Repository navigation
Stable run numbers across backfills and restarts; Reset clears the whole student tile - #97
Merged
Merged
Conversation
…ar the whole student tile - Backfill only persists prod's newest-first pages; the daemon then rebuilds the worker from the log so runs replay oldest-first (run 0 was the newest run, and edit distances and goal profiles were computed over a reversed history). - goal_profile is keyed by (studentID, session, run_index) and the per-run alert dedupe by session, so a daemon restart no longer overwrites an earlier session's runs or silences alerts on a reused run number. Idempotent migration keeps old rows. - Reset records when it happened; runs, episodes, goal evidence, alerts, trigger history and switches on that board then show only what came after it.
This was referenced Sep 25, 2026
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.
Fixes three bugs found in prod data (goal runs 0-5 of one student were overwritten and numbered newest-first).
1. Backfill fed events newest-first.
backfill_studentrouted each event as prod paged it (newest-first), so run 0 was the newest run, and edit distances, episodes and goal profiles were computed over a reversed history. Backfill now only persists; the daemon evicts and rebuilds the worker from the log, which replays oldest-first.2. Restarts overwrote runs. Run numbers are positions in a daemon session's replay and restart at 0 on every start (e.g. each deploy), but
goal_profilewas keyed by(studentID, run_index)and the alert dedupe by run index alone. So a new session's run 0 overwrote the old run 0, stale runs from the old session stayed mixed in, and alerts for reused run numbers never fired. Both are now keyed by session; the API shows the current session's goal evidence. Idempotent migration widens the key and keeps old rows (session '').3. Reset only cleared notes and picks. The cards blanked, then runs, episodes, goal evidence and trigger history came back on the next fetch. Reset now records when it happened, and every read behind the student tile (states, detail, goal runs, alerts feed, trigger history, switches) shows only activity after it, for that board only. The confirm text now says what actually happens.
Tests: new
tests/test_run_identity.pyreproduces all three (failed before, pass now); full backend suite 256 passed, ruff clean; frontend 49 passed. Migration checked against an old-schema table (twice, idempotent). Docs updated.Note for the
perf/incremental-worker-statebranch: small overlap inworkers.py(session key on trigger detail, goal upsert and fired_indices; newsession_key/start_session/evict).🤖 Generated with Claude Code