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

Migrated from github.com/Trevato/SO-ARM100

A test proves the served page has exactly one STOP, no layout rule hides it, and it stops on pointerdown #135

Merged opened this

Check · Review · Land done · Live — Landed; nothing deploys from this branch, so this is the end of its path.

Merged

I added Software/so101/src/stop-layout.test.ts, a test-only change that proves the three STOP properties from the served page without a browser. Its three tests pass, but I couldn't run tsc --noEmit or the full bun --cwd Software/so101 test here.

Notes

shipped merged

opened this

I added Software/so101/src/stop-layout.test.ts, a test-only change that proves the three STOP properties from the served page without a browser. Its three tests pass, but I couldn't run tsc --noEmit or the full bun --cwd Software/so101 test here. Bun hit a read-only temp dir in the sandbox, so the forge check is the first run of the type check and the full suite.

The test starts a server on a fake bus, fetches /, and reads the page rather than rendering it:

  • One STOP: it walks the markup (ignoring comments, scripts and styles) and asserts exactly one [data-stop] element.
  • Never hidden: it flattens every rule from the page's <style>, including everything inside @media blocks, and finds any display:none or visibility:hidden rule whose selector matches the button or one of its ancestors. It asserts there are none, and that neither the button nor an ancestor carries the hidden attribute. Selector matching looks at the last compound only and ignores pseudo-classes, which can over-flag but never under-flag. Two sanity checks make sure the parser reached the @media rules and can see a hiding rule at all.
  • Pointerdown: it asserts the button has no onclick attribute and that $("stop").addEventListener("pointerdown", …stop()) exists. It also requires that any click handler is guarded by e.detail === 0, which is the keyboard path (Enter or Space on the focused button).

On the current page the test finds no offending rules.

🤖 Generated with Claude Code

Closes #129

2 earlier comments
commented

I added Software/so101/src/stop-layout.test.ts, a test-only change that proves the three STOP properties from the served page without a browser. Its three tests pass, but I couldn't run tsc --noEmit or the full bun --cwd Software/so101 test here. Bun hit a read-only temp dir in the sandbox, so the forge check is the first run of the type check and the full suite.

The test starts a server on a fake bus, fetches /, and reads the page rather than rendering it:

  • One STOP: it walks the markup (ignoring comments, scripts and styles) and asserts exactly one [data-stop] element.
  • Never hidden: it flattens every rule from the page's <style>, including everything inside @media blocks, and finds any display:none or visibility:hidden rule whose selector matches the button or one of its ancestors. It asserts there are none, and that neither the button nor an ancestor carries the hidden attribute. Selector matching looks at the last compound only and ignores pseudo-classes, which can over-flag but never under-flag. Two sanity checks make sure the parser reached the @media rules and can see a hiding rule at all.
  • Pointerdown: it asserts the button has no onclick attribute and that $("stop").addEventListener("pointerdown", …stop()) exists. It also requires that any click handler is guarded by e.detail === 0, which is the keyboard path (Enter or Space on the focused button).

On the current page the test finds no offending rules.

🤖 Generated with Claude Code

commented

I added a new test, Software/so101/src/stop-layout.test.ts, and a check.run command to forge.json. I haven't seen the forge's verdict on the new push yet.

Test: it fetches / from a test server and asserts three things:

  • There is exactly one [data-stop].
  • No CSS rule in any @media block sets display:none or visibility:hidden on it or on an element containing it.
  • Its handler is bound to pointerdown. Any click handler is only the keyboard fallback, guarded by e.detail === 0.

The three tests pass here.

Check failure: the check failed with check.run is required because forge.json on main has a check block with only limits. The issue said "no change outside the new file", but the check cannot pass without this, so I added check.run to forge.json. It installs, runs bun x tsc --noEmit, then bun test, all with --cwd Software/so101. Reviewers should confirm that command is what the forge wants for the check. If main should get the fix on its own, this commit can be split out.

Not run here: I couldn't run tsc --noEmit or bun install in this sandbox, because Bun can't write to its temp dir. The forge's check will be the first run of the type check and the full test suite.

🤖 Generated with Claude Code

commented

This pull now adds only Software/so101/src/stop-layout.test.ts. I haven't seen the forge's verdict on the new push yet.

main fixed the broken check block in forge.json itself (1142ee6), which conflicted with my earlier check.run fix. I reverted my forge.json change and merged main, so the diff against main is the one new file.

The test fetches / from a test server and asserts three things:

  • One STOP: exactly one [data-stop] element.
  • Never hidden: no CSS rule in any @media block sets display:none or visibility:hidden on it or on an element that contains it.
  • Pointerdown: the handler is bound to pointerdown. Any click handler is only the keyboard fallback, guarded by e.detail === 0.

The three tests pass here. I haven't run tsc --noEmit or the full suite, because Bun can't write to its temp dir in this sandbox. The forge's check will be the first run of both.

🤖 Generated with Claude Code

Approved

Test-only, one new file, no dependency, within the safety roadmap (#66). It reads the served page: exactly one [data-stop], no display:none or visibility:hidden rule (@media flattened) matching the button or an ancestor, and a pointerdown binding with the click handler limited to keyboard (e.detail===0). That matches src/viewer.html:883-884 and the preview serves one data-stop. The sanity checks (rules>20, a hiding rule is visible) guard against a parser that silently finds nothing. I could not run the new file in my checkout, so I am relying on the green forge check.

Two things I would do next: 1) the last-compound-only selector match plus dropped pseudo-classes is deliberately over-strict, so if a legitimate rule such as .panel:not(.open) .x ever trips it, narrow the matcher rather than loosen the assertion. 2) the pointerdown regex needs stop() on the same line as the listener, so a reformat will fail it; the failure message should say that.

Note server.test.ts:208 already asserts one STOP button; this test is stronger and the overlap is harmless.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs