test(fixtures): restore sessions-a-few fixture with assertions - #8676
Conversation
Seed pinned, plain open, closed-in-History, and archived transcript states. The consumer test drives the production session catalog, restore filter, transcript reader, and archive backfill reader to prove each record reaches its expected bucket with deterministic mtimes.
GPT 5.6 Review — ✅ no blocking findingsGPT 5.6 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
Design Review (Fable 5) — ✅ PASSDesign-level review of Design-Verdict: PASS Test-only fixture restoration whose assertions ride the real readers (list, prefetch filter, transcript, backfill), each state verified against actual production filter semantics. [DESIGN-REVIEWED] 87c2fba |
Opus 4.8 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
First Principles Review (Fable 5) — 🟡 CONCERNSPremise-level review of I have what I need: the contract, the intent, the patch, the existing fixture inventory ( First-Principles-Verdict: CONCERNS All four session states this fixture seeds already ship in What this change shipsIntent: give the dashboard's four session states a seeded fixture whose classification is asserted through the production readers — an ADDITION (+125/-0; "restore" names prior existence, not a defect).
Watch
Subtractions
[FIRST-PRINCIPLES-REVIEWED] 87c2fba |
dwu96
left a comment
There was a problem hiding this comment.
Tier 1 auto-approve: test (7 files). Criteria: no conflict, no requested changes, security path denylist clean, design-doc gate clean, SAST annotations clean, security checklist all-NO, AI reviewers green. Category: purely additive test fixture — new tests_fixtures/sessions-a-few data tree plus one new test/ consumer test; no existing file modified and no runtime code path changed.
Summary
Restores the
sessions-a-fewseed fixture and gives it a consumer test. The fixture seeds four chat sessions covering every session record state the dashboard distinguishes — pinned, ordinary open, closed-in-History, and archived — so each state is asserted to land in the correct view with the correct ordering rather than merely existing on disk.Transcript JSONL is the seedable half of session state; the SQLite event log is not (per the SQLite deferral in
rich/README.md), so nothing here depends on it — the test asserts nomemory.dbis created.Backend-only: a test fixture directory plus its consumer test. No user-facing surface changes, so no screenshots.
Consumer test
test/test_fixture_sessions_a_few.pydrives the production readers, not reimplementations of them:ConversationLog.list_sessions()— the session catalog, asserted to return exactly the three non-archived keys._prefetch_recent_session()fromkiro_crew.dashboard.chat_persistence— asserted to hydrate messages for the pinned and open records and to return(None, None)for the closed one, which is what keeps a closed thread in History instead of restoring it into a slot.ConversationLog.read_messages()— the transcript reader, asserted to yield the closed thread'suser/assistantturns.backfill_transcripts()fromkiro_crew.events.backfill— the archive backfill reader, asserted to emit the archived slice's twoSessionMessageevents with the expected roles and content lengths.Deterministic
os.utimemtimes (1_000.0 for pinned, 2_000_000_000.0 and +1 for open/closed) pin the ordering and the recency cutoff so the bucket assignment cannot drift with wall-clock time.Schema repairs
The fixture was written against the current on-disk schema rather than the shape it originally carried:
_type: archivewithreason,archived_at, andcount.closed_atas an epoch float (1768467600.0), which is what the current readers parse; an ISO string in that field is not accepted by the closed-session path.Verification
.venv/bin/python -m pytest test/test_fixture_sessions_a_few.py test/test_pod_scenarios_command.py test/test_pod_seed_scenarios.py test/test_seed.py -q→ 125 passed. The three sibling suites are the fixture registry's own coverage (test_pod_seed_scenarios.pywalks every shipped fixture's manifest), so they confirm the new fixture registers cleanly alongside the registry-tolerant scenarios test from fix: return complete pod scenario descriptions #8222.isort --check-only,flake8, andblack --check --target-version py310all clean.src/kiro_crew/tests_fixtures/sessions-a-few/plustest/test_fixture_sessions_a_few.py.Pattern harvest
Not generalizable: fixture restoration validated against current production readers; no new rule.