Skip to content

Read overflow, runtime modules, stored drafts and the event log through the product in tests - #1276

Merged
max-sixty merged 4 commits into
mainfrom
tests-consume-product-readings
Sep 27, 2026
Merged

max-sixty merged 4 commits into
mainfrom
tests-consume-product-readings

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Tests stop restating four rules the product owns, and read the product's answer instead.

Sideways overflow. About 40 assertions computed "does the page scroll sideways" themselves: eleven from document.body, which stopped being the scroller in 7336a14, and the rest from document.documentElement. They now call root_overflow(page), a new harness helper over the render gate's rootOverflow probe. The body reading reports overflow on a page that narrows body while the window scrolls nothing (test_the_render_gate_measures_sideways_room_at_the_root_scrollport already plants that case). Under the root reading, every assertion still passes, so none was green only because of the body reading. test_a_comment_inside_a_scrolling_table_leaves_the_page_its_own_width collected a sideways reading and never asserted it. It now asserts the page stays its own width at both scroll positions, which is what its docstring promises.

Runtime modules. Eleven tests imported /runtime/… by bare path, or spelled out the entry-relative lookup inline. A served page runs its runtime from its revision path, so a bare import loads a second module instance, and import('/runtime/widget-api.js') === <the page's module> is false. Every page-side import now goes through the harness's window.__lfRuntimeImport. This moves one test's subject: the live-specimen tests in test_render_controls.py now mount through the page's own specimen.js rather than a copy. test_site.py keeps its own resolution only where the page's address is the subject.

Stored drafts. STORED_DRAFT_TEXT, STORED_DRAFT_SETTLED and about a dozen inline sites spelled the storage key as 'lf-draft:' + ctx, without the page scope that storage.js prefixes on a page served under a path. drafts.js now exports whereDraft(ctx), the draft store's where() for that key, and its own storage listener derives its prefix from it instead of rebuilding PAGE_SCOPE + DRAFT. The harness reads the key through draft_key(page, ctx) and offers stored_draft_text, stored_draft_settled and until_draft_settled. The storage faults in test_render_drafts.py have to run ahead of the runtime's listener, which at the window means being added first. They stay init scripts and compare against a window.lfDraftKey that the test sets from draft_key once the page loads.

Event log. render_cases_interaction.sent_events and eight inline parsers split events.jsonl with splitlines(), which also splits at a U+2028 inside a comment. The product reader, event_log.read_events, stopped doing that for exactly this reason. Its callers now use it, and sent_events is gone.

tests/AGENTS.md names the four doors next to the rule that already asked tests to consume the product's answer.

Left for a follow-up PR, because #1265 edits the same files: scripts/record-demo.py and scripts/eval_claude_delivery.py still parse the log with splitlines().

Checked with npm run test:runtime and each touched test: the 35 overflow tests, the whole test_render_drafts.py, and the import and log sites (134 passed; the one xfail is the strict, pre-existing test_a_specimen_holds_a_wide_exhibit_inside_the_column). The storage-fault tests failed while their fault ran after the runtime's listener, which shows that ordering carries the test.

This was written by Claude Code on behalf of max-sixty

🤖 Generated with Claude Code

@max-sixty
max-sixty merged commit 931d431 into main Sep 27, 2026
5 checks passed
@max-sixty
max-sixty deleted the tests-consume-product-readings branch September 27, 2026 05:24
max-sixty added a commit that referenced this pull request Sep 27, 2026
…event_log in scripts (#1289)

Which environment variables make a process a host session is now stated
once, in `host.py`, and the three places that kept their own list read
it instead.

`host.py` already listed each harness's `session_variables`. Each
harness now also declares `identity_variables`: its session variables
plus the ones its `lifetime` reads, which for Claude Code are
`CLAUDE_PID` and `CLAUDE_JOB_DIR`. `IDENTITY_VARIABLES` collects every
harness's set and `LEAF_AGENT`, now named `AGENT_VARIABLE`, the display
name any harness takes. It replaces `SESSION_VARIABLES`, whose only
readers were the scrubbers below.

- `tests/conftest.py` builds `sessionless` and `isolated_session` from
`IDENTITY_VARIABLES`, and `CLAUDE_IDENTITY` from
`ClaudeCodeHarness.identity_variables`. `CODEX_IDENTITY` is gone, since
its two remaining uses meant the whole set. A new host variable now
reaches the suite's isolation without a second edit.
- `scripts/site.py` also scrubs `CLAUDE_PID`, `CLAUDE_JOB_DIR` and
`LEAF_AGENT` from the build's environment, so the builder's display name
can no longer sign a published version note.
- `scripts/eval_harness.py` also scrubs `LEAF_AGENT`, so an eval child
no longer speaks as its launcher's named worker. Its `CLAUDE*` prefix
rule stays: it covers settings, such as the effort level, that no host
reads.

This also finishes the event-log half of #1276, which waited on #1265
because both touch the same scripts. `scripts/record-demo.py` and
`scripts/eval_claude_delivery.py` now read `events.jsonl` through
`event_log.read_events` rather than `splitlines()`, which splits a
comment at U+2028, and so does one more test that read the file raw
(`test_each_carrier_hands_the_agent_what_the_snapshot_shows`). Two raw
reads stay where the file's bytes are the subject: a snapshot of the
stored line, and a check that `seq` is never stored.

`TODO.md` gains one entry for what #1285 left: prefix selectors in
`test_render_controls.py` and `test_render_threads.py` still spell a
suggestion's contribution key.

Checked with
`test_interact_{session,contract,anchors,product,server}.py` (781
passed), and by importing all four scripts and confirming
`eval_harness.environment()` drops every identity variable.

> _This was written by Claude Code on behalf of max-sixty_

🤖 Generated with [Claude Code](https://claude.com/claude-code)
max-sixty added a commit that referenced this pull request Sep 27, 2026
…he remaining tests, and locate margin controls by kind (#1295)

#1276, #1285 and #1289 moved the suite onto the product's own readings;
#1288's
parallel thread work re-introduced two of the copies they had removed,
and
`test_render_controls.py`, `test_render_threads.py` and
`test_render_application_boundary.py` still carried a few more.

**Runtime modules.** Two sites in `test_render_threads.py` still
resolved
`/runtime/…` from the page's `<script data-lf-entry>` inline, instead of
the
harness's `window.__lfRuntimeImport`. Both now go through it, the way
#1276
moved every other page-side import.

**Interaction log.** Four sites in `test_render_application_boundary.py`
still split `interactions.jsonl` with `read_text().splitlines()`, which
also
splits on a U+2028 inside a recorded value. They now read it through
`interaction_log.lines`, the product's own reader, already used the same
way
for `events.jsonl` via `event_log.read_events`.

**Margin controls by kind.** `render_harness.py` had `margin_control`,
`draft_control` and `suggestion_control` for one exact id, but four
sites in
`test_render_controls.py` and one in `test_render_threads.py` still
spelled
`[data-lf-margin-entry-owner^="suggestion:"]` or `^="draft:"` inline, to
find
any instance of a kind rather than a particular one. `any_owner_entry`,
`any_draft_control` and `any_suggestion_control` cover that case, and
every
site now uses them. A sixth site read a suggestion's id back out of its
margin entry by slicing the `"suggestion:"` prefix off the owner
attribute in
browser JS; it now asks `marginEntrySource`, the runtime's own link from
a
margin control to the widget that registered it, for the widget's
element
directly. The `tests-readings` TODO item is done.

Checked by running each touched test and the whole

`test_every_ring_the_layer_draws_is_shown_whole_somewhere_in_the_corpus`,
which exercises the `any_owner_entry` table entry, the draft locator,
and the
`marginEntrySource` lookup together, plus `npm run test:runtime`.

> _This was written by Claude Code on behalf of max-sixty_

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Sonnet 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants