Repository navigation
test: judge a device round's correctness before it measures anything (#234 D1) - #237
Merged
Merged
Conversation
…234 D1) Rounds 1 and 2 of #194 both spent a device lease measuring milliseconds without establishing, on the device, that the tree being measured painted the right rows, routed a real tap to the right handler, or released what it claimed to release. A cost measured on a quietly wrong tree is worse than no cost: it reads as evidence. This is the judgement half of #234 Part D — the oracle table, the evaluator, and the command that writes one verdict record and exits non-zero when a step fails. Six steps, in the order that lets each one end the round: first-screen, adoption, native-tap, slot-update, clear-retention, dispose. Three properties make it a gate rather than a report: - A missing observation FAILS its step. A gate that goes green because its oracle could not be read converts a collection bug into a correctness claim. - Evaluation stops at the first failure; later steps record as `skipped`, never as passes, because a wrongly painted tree makes them meaningless. - An absence needs a provocation. `dispose` requires that at least one ack was provoked after the dispose and still did not arrive; `clear-retention` requires the residual to be identical across all N cycles, not merely small once. Keeping the judgement pure and apart from the collection is what lets it run in CI with no device attached, and lets a window whose collection went wrong be re-judged from the observations it did produce without re-taking the lease. The device half (app probe + adb runner) is not in this slice: it depends on the unmerged round-2 build wiring (BENCH_DISABLE_DEVTOOL, BENCH_DEVICE_MESSAGECHANNEL_FALLBACK; SDK 4.0 has no MessageChannel), and duplicating that here would create a second home for the same workaround. 47 tests across the two files. Nine command guards and four evaluator rules were red-verified by breaking each in turn; every one failed exactly one test. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_019RsC3U39kUuLKajZANeTVy
# Conflicts: # benchmarks/lynx-table/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
#234 Part D, judgement half. A device round now opens with a gate that answers six correctness questions before any measurement window runs, and exits non-zero when one fails.
Rounds 1 and 2 of #194 both spent a device lease measuring milliseconds without establishing, on the device, that the tree being measured painted the right rows, routed a real tap to the right handler, or released what it claimed to release. A cost measured on a quietly wrong tree is worse than no cost — it reads as evidence. The web container cannot stand in for this: different renderer, different event path, no reference table.
Six steps, ordered so each one can end the round:
first-screenadoptionnative-tapslot-updateclear-retentiondisposeThree properties are what make this a gate rather than a report:
skipped— never as passes. A wrongly painted tree makes every later answer meaningless, and scoring them anyway would read as five-of-six rather than as stopped.disposedoes not pass because no ack arrived; it requires that at least one was provoked after the dispose and still did not arrive. Same reasonclear-retentionrequires the residual to be identical across all N cycles rather than merely small once.The judgement is pure and separate from the collection, so it runs in CI with no device attached, and a window whose collection went wrong can be re-judged from the observations it did produce without re-taking the lease.
Changes
stages/issue234-gate-oracles.mjs— the oracle table andevaluateDeviceGate. No I/O, no device.stages/issue234-device-gate.mjs— the command: reads observations, writes one record viawriteEvidenceJson, prints per-steppass|FAIL|skip, returns 0/1.benchmarks/lynx-table/README.md— new §10 documenting the gate and stating what is not here yet.Validation
pnpm format:check— not run repo-wide;pnpm format:files:checkclean on all five changed files.pnpm typecheck— not applicable,.mjsbenchmark tooling with no TS surface.pnpm test— not run; these files arenode --test, outside the Vitest projects.node --test stages/issue234-gate-oracles.test.mjs stages/issue234-device-gate.test.mjs→ 47 pass, 0 fail.node --test stages/*.test.mjs→ 158 pass, 1 fail —stages/results/issue57-clear-teardown.json is not byte-identical to what writeEvidenceJson produces for it. Pre-existing and unrelated: that record is untouched by this branch (git diff HEAD -- stages/results/is empty) and all four new files are additions.Red-verified. A test that has never failed is not protecting anything, so nine command guards and four evaluator rules were each broken in turn and confirmed to go red — every one failed exactly one test, so the coverage is specific rather than overlapping:
--scaleacceptedOne test wrote its record to
os.tmpdir()and failed againstwriteEvidenceJson's own guardrail (no Prettier configuration resolved … the record would not be gate-clean). The guardrail is right — records are checked in — and the test was wrong, since the real command only ever writes understages/results/. Fixed by staging the scratch under the existing gitignored.test-scratch/, which gives the test the same config resolution the command gets in earnest.No changeset:
octane-lynx-table-benchisprivate: true, so this is internal tooling.Risk / follow-ups
The device half is not in this slice, and this is the one place the "branch off
8938c1260" instruction cannot hold. The app probe that produces the observations and the adb runner that drives it depend on the round-2 device branch's build wiring —BENCH_DISABLE_DEVTOOL=1andBENCH_DEVICE_MESSAGECHANNEL_FALLBACK=1(SDK 4.0 has noMessageChannel) — which is a 63-linescripts/build-app.mjsdiff on the unmergedhuxcx/perf-lynx-device-round2@609f7b284. Both are prerequisites for any bundle to boot on the device, so a gate bundle built off8938c1260would have neither, and duplicating the wiring here would create a second home for the same workaround and conflict on merge.So D1 lands off
8938c1260as instructed and D2 needs your call: stack it onhuxcx/perf-lynx-device-round2, or hold it until that branch merges. Until then the gate is exercised against observation fixtures, which is what these tests do.Also unresolved from earlier slices: the harness assigned branch
claude/octane-issue-66-phase-a-7wz97z, butcreate-a-prmandates afeat/|fix/|docs/|test/|perf/topic branch for the label bot. I read "照惯例" as endorsing the repo convention and used a topic branch; say if you want the assigned name instead.Provenance
agent-authored)Generated by Claude Code