Repository navigation
store: exchanges a backfill sends count as turns and keep the session backfilled - #259
connorburgess wants to merge 4 commits into
Conversation
… backfilled Symptom: a session that `sessionpipe backfill` (core 0.19) sent reads on its card with no turns, loses its backfilled mark, and its last time moves to the newest exchange's (or to the moment it arrived, when the exchanges carry no time of their own). nothingHappened() (shared/api.ts) then reads it as a session nothing happened in. Cause: core now sends a backfilled session's exchanges as turn.transcript events (harness.event "backfill") after a session.backfill that carries no `turns` (PROTOCOL.md §4, conformance/delivery/35-backfill-transcript.json). The receiver counted turns only on turn.started and on a backfill's `turns`, and took any other event on a session that was not yet live as its first live one. Fix: a turn.transcript marked "backfill" on a session that so far had only a backfill is history: it keeps the session backfilled with the backfill's span, and the session has as many turns as the highest exchange ordinal read plus one, so a backfill's own `turns`, an exchange sent twice and a later backfill that goes on from the last one count each turn once. Such a later backfill sends no session.backfill again, so an exchange's own time (`data.at`) widens the span; one with no readable time leaves it. A live session, and a session whose first event this receiver reads is such a transcript, read as before. The mock world counts a backfill's exchanges as its turns too. Signed-off-by: Connor Burgess <connorburgesscodes@gmail.com>
|
TL;DR
Core 0.19's No findings sure enough to post from reading the change. Merge confidence 5 of 5 Where to read first
Tests and reachReach: no graph yet, so this review could not trace what the change reaches. Stages: 288 s
|
Signed-off-by: Connor Burgess <connorburgesscodes@gmail.com>
Signed-off-by: Connor Burgess <connorburgesscodes@gmail.com>
|
The backfilled transcript turn-count fix still applies to SessionPipe GUI v0.8.18. Merged current Added the previously deferred Unreleased changelog entry. Validation on this head, macOS / Node 22.23.2:
GitHub CI run 47453783586 for head The terminal desktop failures were A maintainer needs to rerun/investigate the failed jobs and aggregate gate. The upstream job-rerun API rejects this account with HTTP 403 for insufficient repository permissions. Also checked the combined source/test changes from all 19 refreshed PRs on the same main: no source conflicts; typecheck, lint and build passed; all 252 unit-test files passed (3,439 tests, two skipped). This was a local integration check, separate from the individual PR run above. Release-note entries may still need combining as PRs land. |
Signed-off-by: Connor Burgess <connorburgesscodes@gmail.com>
|
Merged current CI run 47497341379 for head The earlier run 47453783586 on Locally on |
Updated against v0.8.19 / main
e8bfe999on 2026-12-05. Current validation and refresh details.What
A session that
sessionpipe backfillsent now reads as core 0.19 sends it. Its card shows how many turns it had, the session keeps its backfilled mark, and its time span is the one the backfill gave. Before this, such a session showed no turns, lost the mark, and its last time moved to its newest exchange, or to the moment it arrived when the exchanges had no time of their own.Why
Core main (sessionpipe 0.19,
packages/cli/src/cli.tsbackfillTurns) sends a backfilled session's exchanges asturn.transcriptevents. Each carriesharness.event: "backfill", its ordinal indata.turn, and its own time. They follow asession.backfillthat then has noturns. spec/PROTOCOL.md §4 says so: "turnsis absent when the sender sends the session's exchanges asturn.transcript(a receiver counts those, and would count them twice)". Core's conformance fixtureconformance/delivery/35-backfill-transcript.jsonsends this shape.server/store/readings.tscounted turns only onturn.startedand on a backfill'sturns. It also treated any other event on a session that was not live yet as the session's first live event. So the first exchange setlive, clearedbackfilled, and movedstartedAt/lastAt, and no exchange was ever counted. With no turns counted,nothingHappened()in shared/api.ts was true for the session.The change, in
applyEvent: aturn.transcriptmarked"backfill"on a session that so far has had only a backfill is history.turns(0.17 senders)sessionpipe backfillrun that continues from its cursor (core numbers fromtranscript_turns)session.backfill, so an exchange's owndata.atwidens the span. An exchange without a readable time leaves the span alone.Two cases read as they do today:
turn.startedcounts them.Boot, rebuild and ingest all go through
applyEvent, so a restart reads the same. The mock world (web/src/mock/world.ts) also counts a backfill's exchanges as turns.An entry is now included under Unreleased in
CHANGELOG.md. Other open PRs also add release notes; those entries may need combining as the PRs land.Original proof (before the v0.8.18 refresh)
New test in
server/store/store.test.ts, "counts a backfill's exchanges as its turns and keeps it backfilled, after a restart too". It starts with asession.backfill(09:00–09:20, noturns) followed by two exchanges stamped 09:00 and 09:15, and checks:backfilled: true, statedone, span 09:00–09:20lastAt10:05turns: 5keeps 5On origin/main (4ab6eae) it fails:
On this branch it passes:
Checks:
npm run typecheck: passes.npm run lint: passes. Its 135 warnings were already on main; the changed lines add none.npm test: 3361 passed, 2 skipped, 1 failed. The one failure is the same timeout on unmodified origin/main (4ab6eae), where the full run gives 3360 passed, 2 skipped, 1 failed. Both runs show:Run alone, that file passes on main (11 passed).
Checklist
git commit -s): the DCO is the only paperwork.npm run typecheck && npm run lint && npm testpass;npm run test:e2efor a UI change. (Not a UI change: e2e not run.)// SPDX-License-Identifier: Apache-2.0. (No new files.)--demo).shared/*names the wire-contract change in the description. (Noshared/*change.)CHANGELOG.md.