fix(decision): forward an element's selected state to the model

Merged
AS
10d ago
+32-0

Summary

Fixes #884.

checked and expanded already reach the decision model through the element table (actionSpace) and target criteria (targetCriterion), but selected did not, even though the engine already reports it in SemanticNode.states. On a tab bar every tab therefore looked identical to the model, so:

  • the completion check for a tab switch landed around 50/50 (holds/inconclusive), sometimes blocking a step that actually worked
  • a step could be marked done before anything was tapped, because the model couldn't tell the already-active tab from the one it needed to reach

Change

Forward selected the same way checked already is:

  • packages/decision/src/elements.ts: add selected?: boolean to Element, copy row.node.states?.selected into the element table
  • packages/decision/src/questions.ts: include selected in both elementRecords and targetCriterion

No operation logic changes — tab was already tappable; this only forwards state that was already being read by the engine but dropped before it reached the model.

Test plan

  • elements.test.ts: new test asserting a tab's selected state appears in the element table
  • executor.test.ts: new test asserting selected appears in tap_target criteria, covering the same path checked already has a test for in check_target criteria
  • pnpm --filter @e2e-dev/decision test: 75 passed (the 4 pre-existing cli.test.ts skips are unrelated — that suite needs Node ≥22.22.3, and this sandbox has 22.22.0)
  • pnpm --filter @e2e-dev/decision typecheck: clean
  • oxlint on the changed files: clean

Added a patch changeset.