Repository navigation
Let shipped logs leave event ids to admission, and give the diff gallery's replies ids - #6737
Conversation
`examples/developer/diff-thread-gallery.jsonl`, added in #6682, seeds two agent replies without an `id`. Every other seeded log in the corpus gives each event one. `tests/journeys/test_render_pages.py::test_a_shipped_log_replays_its_example_state` checks that each shipped event's id survives replay, so it fails on main with `KeyError: 'id'`. #6682 never ran it, because a pull request runs only the journeys tests it edits. The two replies now carry `dfg-line-cap-answer` and `dfg-line-backoff-answer`. No state, test or page reads a reply's id, so the gallery draws the same threads. The test failed on main at 850e0bf and passes with this change (`uv run pytest tests/journeys/test_render_pages.py::test_a_shipped_log_replays_its_example_state -n0`).
leaf-agent
left a comment
There was a problem hiding this comment.
The reply events were valid without ids. The test is what failed. Admission gives an event an id when it has none (append_admitted in src/leaf/event_contracts.py: if "id" not in event: event = {**event, "id": new_event_id(events)}), and examples/AGENTS.md says a seed line is "an event as its writer would send it", so leaving id out is allowed. The KeyError comes from the test's own assert {event["id"] for event in events} <= previous in test_a_shipped_log_replays_its_example_state. That line requires every shipped event to carry an id, which no contract requires. As it stands, the next seed that leaves an id to admission fails the same way, and only the nightly journeys run notices. I'll push a change so the line checks only the ids a seed names. The ids this PR adds stay, matching the rest of the corpus.
Admission assigns an id to an event that has none, and examples/AGENTS.md says a seed line is an event as its writer would send it, so an id-less seed is valid. test_a_shipped_log_replays_its_example_state still raised KeyError on one: it now checks only that each id a seed names survives replay.
test_a_shipped_log_replays_its_example_stateintests/journeys/test_render_pages.pyfails on main withKeyError: 'id'. Two seeded agent replies inexamples/developer/diff-thread-gallery.jsonl, added in #6682, have noid. #6682 never ran this test, because a pull request runs only the journeys tests it edits.The seed was valid. Admission gives an event an id when it has none (
append_admitted), andexamples/AGENTS.mdsays a seed line is an event as its writer would send it. The test's{event["id"] for event in events}was what required every shipped event to carry an id. It now checks only that each id a seed names survives replay, so the next seed that leaves an id to admission passes.The two replies also get ids now,
dfg-line-cap-answeranddfg-line-backoff-answer, like every other seeded event in the corpus. Nothing reads a reply's id, so the gallery draws the same threads.The test failed on main at 850e0bf and passed after the seed edit (
uv run pytest tests/journeys/test_render_pages.py::test_a_shipped_log_replays_its_example_state -n0). This PR edits the test file, so its CI runs the test against the change to the test.