Skip to content

Move frontend assertions out of the PHP test suite - #287

Merged
roncodes merged 1 commit into
dev-v0.6.59from
claude/move-frontend-assertions-to-ember
Aug 4, 2026
Merged

Move frontend assertions out of the PHP test suite#287
roncodes merged 1 commit into
dev-v0.6.59from
claude/move-frontend-assertions-to-ember

Conversation

@roncodes

@roncodes roncodes commented Aug 4, 2026

Copy link
Copy Markdown
Member

Why

server/tests/TelematicsHardeningTest.php and server/tests/CustomerContactIdentitySafetyTest.php reached across into the Ember addon with file_get_contents(__DIR__ . '/../../addon/...') and asserted on template/component source text.

That had three costs:

  • UI edits sat on the backend CI critical path. A deleted panel in addon/components/customer/form.hbs broke the PHP suite, which skipped the coverage gate and therefore skipped the Codecov upload entirely.
  • The assertions tested strings, not behavior. They passed on a match inside a comment and failed on a harmless rename.
  • They contributed zero coverage — no server/src code executes in them.

What changed

All 15 addon/ reads are gone from the two PHP files. Every assertion is re-expressed in the Ember suite against behavior. Backend assertions in both files are untouched.

Was asserted as source text Now asserted as
case 'active': return 'Connected'; in the status cell + details controller cell/telematic-status and connectivity/telematics/details both map active/connectedConnected/success
this.args.resource?.public_id present, ?.uuid absent webhookUrl builds from public_id, returns null when only the Ember uuid exists
'this.hasWebhookUrl', 'Provider polling' in the template rendering <Telematic::Details> shows the URL, the unavailable message, or the polling copy per provider
'advancedCredentialFields', 'field.default_value' endpoint fields land in the <details> section and fall back to the provider default_value
'format-date-fns this.lastSeenLabel ...' Device::Details renders 18 Jun 2026, 15:28, - when never seen
'this.showWelcomeEmailOption', 'this.toggleWelcomeEmail' welcome email is opt-in, gated on isNew + portal extension, writes meta.customer_portal.send_welcome_email without dropping sibling meta
'is_customer=true' the user selector's query is { doesnt_have_contact: true, is_customer: true }

New: 8 test files. Extended: 6.

Two build fixes came along

The Ember suite could not load this addon's modules at all before this — every existing test file failed identically with Could not find module '@fleetbase/fleetops-engine/...'.

  1. @ember/legacy-built-in-components added to devDependencies. It's an optional peer of ember-engines, so pnpm skips it and vendor.js dies on a missing module. Lockfile updated with pnpm install --lockfile-only; the diff is only this package.
  2. index.jslazyLoading is disabled only for ember test run from this package (process.argv.includes('test') && process.cwd() === __dirname). A lazy engine keeps its modules out of the dummy app. Host apps and ember build stay on the lazy path — verified: the production build still emits dist/engines-dist/@fleetbase/fleetops-engine/assets/engine-*.js.

Verification

PHP — both files green:

  • TelematicsHardeningTest: 25 passed, 12 skipped (550 assertions)
  • CustomerContactIdentitySafetyTest: 5 passed (43 assertions)
  • php-cs-fixer --dry-run: clean

Ember.js CI steps, run locally:

  • pnpm run lint — exit 0 (js, hbs, css, intl)
  • pnpm run build — exit 0

Ember tests — the 27 new pure-logic unit assertions pass. The container-based tests (1 controller unit file, 6 rendering files) could not be executed: setupTest/setupRenderingTest fail for every test in this checkout, pre-existing ones included, on Failed to create an instance of 'service:universe/registry-service'. Treat those as unverified.

Known follow-ups (not in this PR)

  • .github/workflows/ember.yml never runs ember test — only lint and build. These assertions gate nothing in CI yet. Wiring that up first needs the universe/registry-service container failure fixed and the generated it renders boilerplate tests cleaned up.
  • Two more PHP files still read addon/, using dirname(__DIR__, 2) instead of __DIR__ . '/../../', which is why the original sweep missed them: server/tests/OrderFileAttachmentTest.php:6-7 and server/tests/OrderActivityFlowRegressionTest.php:108.
  • scripts/pest-runner.php exits 0 with zero output in this environment — reproduces on untouched files, caused by the auto_prepend_file bootstrap it injects.
  • Unit | Component | telematic/form: editing server uri updates resource credentials (pre-existing) calls prototype.setCredential.call({...}), but @action returns a pre-bound function so this.args is undefined.

🤖 Generated with Claude Code

TelematicsHardeningTest and CustomerContactIdentitySafetyTest read Ember
templates and components through file_get_contents(__DIR__ . '/../../addon/...')
and asserted on their source text. That put UI edits on the backend CI critical
path — a deleted panel in customer/form.hbs broke the PHP suite, which skipped
the coverage gate and therefore the Codecov upload. The assertions also matched
source strings rather than behavior, so they passed on a match inside a comment
and failed on a harmless rename, while executing no server/src code.

All 15 addon/ reads are gone. Each assertion is re-expressed in the Ember suite
against behavior:

- cell/telematic-status, connectivity/telematics/details: active and connected
  both surface as "Connected"
- telematic/details: webhook URL is derived from public_id and is null when only
  the Ember uuid exists; last_sync_job_id and last_sync_error reach the UI
- telematic/form, telematic/settings: endpoint fields are partitioned into the
  advanced section and fall back to provider default_value
- device/details, device/panel-header: last-seen timestamp formatting and
  connection state taking precedence over the raw online flag
- customer/form: welcome email is opt-in, gated on isNew plus the customer
  portal extension, and writes meta.customer_portal.send_welcome_email without
  dropping sibling meta; the user selector queries is_customer

The backend assertions in both PHP files are untouched.

Two build fixes were needed for the Ember suite to load this addon at all:
@ember/legacy-built-in-components is an optional peer of ember-engines, so pnpm
skips it and vendor.js dies on a missing module; and a lazy engine keeps its
modules out of the dummy app, so every dummy/components/* import failed to
resolve. Eager loading is scoped to `ember test` run from this package, leaving
host apps — and `ember build` — on the lazy path.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@roncodes
roncodes changed the base branch from main to dev-v0.6.59 August 4, 2026 17:31
@roncodes
roncodes merged commit a55402f into dev-v0.6.59 Aug 4, 2026
6 of 8 checks passed
@roncodes
roncodes deleted the claude/move-frontend-assertions-to-ember branch August 4, 2026 17:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant