Skip to content

test(fixtures): restore sessions-a-few fixture with assertions - #8676

Merged
dwu96 merged 1 commit into
mainfrom
fx/fixture-sessions-a-few
Sep 5, 2026
Merged

test(fixtures): restore sessions-a-few fixture with assertions#8676
dwu96 merged 1 commit into
mainfrom
fx/fixture-sessions-a-few

Conversation

@pepmach

@pepmach pepmach commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Restores the sessions-a-few seed 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 no memory.db is 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.py drives the production readers, not reimplementations of them:

  • ConversationLog.list_sessions() — the session catalog, asserted to return exactly the three non-archived keys.
  • The restore filter, _prefetch_recent_session() from kiro_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's user/assistant turns.
  • backfill_transcripts() from kiro_crew.events.backfill — the archive backfill reader, asserted to emit the archived slice's two SessionMessage events with the expected roles and content lengths.

Deterministic os.utime mtimes (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:

  • Archive header records use the current archive schema — _type: archive with reason, archived_at, and count.
  • Session metadata records carry closed_at as 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 -q125 passed. The three sibling suites are the fixture registry's own coverage (test_pod_seed_scenarios.py walks 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.
  • Gates on the touched test file: isort --check-only, flake8, and black --check --target-version py310 all clean.
  • Diff boundary: 7 files, +125/-0, confined to src/kiro_crew/tests_fixtures/sessions-a-few/ plus test/test_fixture_sessions_a_few.py.

Pattern harvest

Not generalizable: fixture restoration validated against current production readers; no new rule.

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.
@pepmach
pepmach requested a review from a team as a code owner September 5, 2026 06:25
@pepmach
pepmach requested a review from dwu96 September 5, 2026 06:25
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Sep 5, 2026
@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ✅ no blocking findings

GPT 5.6 completed its review of 87c2fba5c2449dcf0682bda5530d9b950fba18bb and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 87c2fba

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 87c2fba5c2449dcf0682bda5530d9b950fba18bb: <one-sentence reason>

@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Design Review (Fable 5) — ✅ PASS

Design-level review of 87c2fba5c2449dcf0682bda5530d9b950fba18bb — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

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

@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Opus 4.8 Review — ✅ no blocking findings

Reviewed 87c2fba5c2449dcf0682bda5530d9b950fba18bb — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 87c2fba

Verdict parsed from the review's SHA-scoped output markers for commit 87c2fba5c2449dcf0682bda5530d9b950fba18bb.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 87c2fba5c2449dcf0682bda5530d9b950fba18bb: <one-sentence reason>

@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5) — 🟡 CONCERNS

Premise-level review of 87c2fba5c2449dcf0682bda5530d9b950fba18bb — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

I have what I need: the contract, the intent, the patch, the existing fixture inventory (empty/minimal/rich), the auto-discovery mechanism in seed.py, and the existing test coverage of the same readers. Emitting the review.

First-Principles-Verdict: CONCERNS

All four session states this fixture seeds already ship in rich, and the "backend-only" fixture auto-registers as a user-visible seed scenario.

What this change ships

Intent: 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).

  1. A new seedable home sessions-a-few with one session per dashboard state — duplicate of rich's state coverage
  2. The scenario appears in kirocrew pod scenarios and as a valid gateway --seed value — undeclared
  3. A test asserting each seeded state lands in its dashboard bucket via the real readers — justified
  4. Six fixture files ship in the runtime wheel to every install — rides along with 1

Watch

  • Description claims "Backend-only … No user-facing surface changes", but available_fixtures() (src/kiro_crew/seed.py:103) discovers fixtures by directory listing, so this name joins the kirocrew pod scenarios output and the accepted --seed values — shipped surface that must be honored once released.
  • Duplication, counted: grep pinned|closed over rich/sessions/ shows 4/4 states already present — 2 pinned, 1 open (triage-demo), 1 closed (research-notes), plus an archive/ slice. The new test sets its own os.utime mtimes, so nothing about it requires a fresh fixture.

Subtractions

  • Delete src/kiro_crew/tests_fixtures/sessions-a-few/ (6 files) and point test/test_fixture_sessions_a_few.py at seeded_home("rich"), asserting rich's keys; rich's session set is already pinned by test/test_fixtures_helper.py::test_seeded_home_rich_has_multi_session_coverage, so the two tests would hold one contract instead of two fixtures diverging.

[FIRST-PRINCIPLES-REVIEWED] 87c2fba

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Sep 5, 2026
@dwu96
dwu96 enabled auto-merge (squash) September 5, 2026 07:08

@dwu96 dwu96 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@dwu96
dwu96 merged commit 5335421 into main Sep 5, 2026
64 checks passed
@dwu96
dwu96 deleted the fx/fixture-sessions-a-few branch September 5, 2026 07:08
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Sep 5, 2026
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