test(daemon): make the apps runtimeFacts override reach every cell

Merged
TH
15h ago
+11-1

What

Follow-up to #3948, from the cubic P3 on thread PRRT_kwDORFGHaM6wArUd.

runtimeFacts in the apps runtime fixture takes Partial<RuntimeFacts<PlatformRuntimeOperations>['operations']>,
so it advertises an override for any operation. It delivered that for some cells only. The spread sat at
line 71, before two fixed fact maps:

...overrides,
...unavailableDeploymentSnapshotAndShutdownOperationFacts,
...applicationLifecycleOperationFacts({ … }),

Both maps state cells the parameter accepts, so an override for findText, querySelector, a snapshot
cell, a lifecycle cell, or anything else they carry was overwritten by the fixture's own unavailable
and reported nothing.

No test was wrong because of it, and no behaviour changed: the one caller, added in #3948, overrides
listApps, which is a fixed cell earlier in the object, so it already won. The defect is that the next
caller can override a cell and watch the override do nothing.

How

...overrides moves last, after both maps, where an override beats anything the fixture hardcoded.

Of the two options in the thread, moving the spread is the cleaner one here. Narrowing the parameter
instead encodes in a type which cells those two maps cover. That list is a restatement of their contents
and goes stale the first time the shared map gains a cell, which is the shape this repo already rejects
for the same reason in platform-runtime-unavailable.ts, where the optional-versus-required split is
decided by the input type rather than by a second table.

Nothing else in the file changes and no assertion is loosened.

Test

The fix needs the assertion the bug went unnoticed without, so the fixture now proves its own
contract:

  • a runtimeFacts override reaches a cell the fixed fact maps state overrides findText, a cell
    unavailableDeploymentSnapshotAndShutdownOperationFacts states, and asserts the fact that comes back
    is the override.

Mutation-checked rather than assumed: returning the spread to its old line fails that case with
expected { available: false, …(1) } to be { available: true }, which is the silent drop described in
the thread. Moving it back turns the case green. The five existing cases pass under both positions, so
this is the assertion that holds the fix.

Verification

  • pnpm check:affected --run --head 88ad6aa028 — all runnable checks passed, exactCommit=true.
  • pnpm exec vitest run --project unit-core — 15,983 passed, 1 skipped.
  • pnpm exec vitest run --project provider-integration — 214 passed.
  • npx tsc -b clean.
  • Scope: one test fixture, so no runtime behaviour moves. Not device-facing.

Size

1 file, +11 / −1.


🤖 Generated with Claude Code