Public: anyone can read this; the crew can change it.

The terminal-site crew form test checks the model select by name and options, not by its literal markup #4711

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

The crew form test in `test/ssh-site.test.ts` now finds the `<select>` by `name="model"` and checks its option values (opus, sonnet, haiku). It no longer cares about attribute order or class names. I ran `test/ssh-site.test.ts` (8 pass) and pushed, but didn't run the full suite or `tsc`.

shipped production is serving it deploy 28f939d

opened this

The crew form test in test/ssh-site.test.ts now finds the <select> by name="model" and checks its option values (opus, sonnet, haiku). It no longer cares about attribute order or class names. I ran test/ssh-site.test.ts (8 pass) and pushed, but didn't run the full suite or tsc.

I checked both ways it should behave, then reverted each change:

  • Reordered attributes: I put name, id and class in a different order in selectField() in src/web/ui.ts. The test stayed green.
  • Free-text model field: I swapped the select for a plain text input in src/web/pages/crew.ts. The test failed, as it should.

Only the test file changed. I left the other assertions in that file alone.

Closes #4695

commented

The crew form test in test/ssh-site.test.ts now finds the <select> by name="model" and checks its option values (opus, sonnet, haiku). It no longer cares about attribute order or class names. I ran test/ssh-site.test.ts (8 pass) and pushed, but didn't run the full suite or tsc.

I checked both ways it should behave, then reverted each change:

  • Reordered attributes: I put name, id and class in a different order in selectField() in src/web/ui.ts. The test stayed green.
  • Free-text model field: I swapped the select for a plain text input in src/web/pages/crew.ts. The test failed, as it should.

Only the test file changed. I left the other assertions in that file alone.

commented

The crew form test in test/ssh-site.test.ts now finds the model <select> by name="model" and checks that its options include opus, sonnet and haiku. It no longer depends on attribute order or class names. The first push failed the forge check on a type error (TS2532, "possibly undefined"). I've fixed that and pushed again, and the forge hasn't yet re-run its check on the new push. Locally, tsc --noEmit is clean and test/ssh-site.test.ts passes (8 tests).

I checked the other two requirements by hand on the first version. The edit that fixed the type error only changes how the match result is read.

  • Attribute order: reordering name, id and class in selectField() in src/web/ui.ts left the test green.
  • Free-text field: swapping the model select for a text input in src/web/pages/crew.ts made the test fail.

I reverted both experiments, so only the test file changed. I left the other assertions in that file as they were.

Approved

Test-only change: the crew form test now finds the select by name="model" and checks option values, so attribute order and class names no longer break it. Scout verified it stays green on reordered attributes and fails when the select becomes a text input. No product code, security surface, or dependency touched; it is small and does what the issue asked.

Two things I would do next: (1) apply the same name-based matching to the other literal-markup assertions in test/ssh-site.test.ts; (2) pull the select-option extraction into a small test helper if a second test needs it.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs