Skip to content

test(fixtures): restore memory-populated fixture with assertions - #8674

Merged
dwu96 merged 1 commit into
mainfrom
fx/fixture-memory-populated
Sep 5, 2026
Merged

test(fixtures): restore memory-populated fixture with assertions#8674
dwu96 merged 1 commit into
mainfrom
fx/fixture-memory-populated

Conversation

@pepmach

@pepmach pepmach commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Caveat, up front: semantic.md in this fixture is validated through MemoryStore's hardened
file reader (_guarded_entry), not through the path the Memory tab actually uses. Semantic
memory is vector-backed now — MemoryStore.build_context reads it via
self._vector_store.get_semantic_context(...), and markdown_snapshot() does not carry a semantic
layer at all. This fixture deliberately excludes SQLite, so the vector retrieval path is not
covered here. What the seeded semantic.md proves is that the file layer parses and survives the
guarded reader — not that semantic recall works end to end.

Summary

Restores the memory-populated seed fixture so every text-backed memory layer is non-empty at once,
and adds the consumer test that was missing. The fixture seeds preferences.md, projects.md,
semantic.md, two dated history days (2026-01-14, 2026-01-15), and a lessons.jsonl carrying
three learned corrections.

Vector stores (memory.db, memory_index.db) stay out, per the SQLite deferral already recorded in
rich/README.md: reproducible binary fixtures need a dedicated builder. The fixture asserts their
absence rather than leaving it implicit.

Consumer test

test/test_fixture_memory_populated.py drives the real production readers instead of re-parsing the
fixture files itself:

  • LessonStore.load_all() — asserts all three lessons round-trip with every field exact
    (rule, negative, ts, category, repo_scope), so a schema drift in the store fails here.
  • MemoryStore.markdown_snapshot() — asserts the history set is exactly the two seeded dates, and
    that preferences / projects / semantic / both history days are each non-empty and mutually
    distinct (len(set(layers)) == len(layers)), which catches a reader that silently returns the same
    content for two layers.
  • assert not list(home.rglob("*.db")) — pins the deliberate SQLite exclusion.
  • assert not Path(home).exists() after the context exits — proves seeded_home cleanup is hermetic.

Schema repairs

The restored fixture data had to be brought back onto the current Lesson schema before the
production reader would accept it:

  • Lesson timestamps numeric → string. ts values were numeric epoch floats; they are now
    ISO-8601 strings (2026-01-16T00:00:00+00:00), matching what LessonStore reads and returns.
  • category field added. Two lessons are tool, one is preference.
  • repo_scope field added. Explicitly null on two lessons and "src/kiro_crew" on the third,
    so both the scoped and unscoped branches are represented rather than only the default.

Verification

Run in the worktree venv, on the rebased head:

  • test/test_fixture_memory_populated.py + test/test_pod_scenarios_command.py +
    test/test_pod_seed_scenarios.py + test/test_seed.py125 passed. The registry-tolerant
    scenarios test from fix: return complete pod scenario descriptions #8222 is in main and passes with this fixture registered.
  • Gates on the one touched test file: isort --check-only, flake8, and
    black --check --target-version py310 all clean.
  • Diff boundary confirmed: 8 files under src/kiro_crew/tests_fixtures/memory-populated/ plus
    test/test_fixture_memory_populated.py. Nothing else, 138 insertions, no deletions.

Backend-only; no user-visible surface changes, so no screenshots.

Pattern harvest

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

Seed preferences, projects, semantic memory, two history days, and three learned corrections in one deterministic fixture.

Exercise the production lesson and markdown readers to prove every text layer is non-empty and distinct, all lesson fields parse, and seeded-home cleanup is hermetic.

SQLite vector stores are deliberately excluded because reproducible binary fixtures require a dedicated builder.
@pepmach
pepmach requested a review from a team as a code owner September 5, 2026 06:25
@pepmach
pepmach requested a review from smeyffret 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

Design Review (Fable 5) — ✅ PASS

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

Design-Verdict: PASS

Additive fixture matching every existing convention (schema-version, config shape, production lessons.jsonl path, packaging globs), proven by a consumer test through real readers; no design-level concerns.

[DESIGN-REVIEWED] 00d1309

@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 00d13091fe82d2b46f60b61cb29d3f4593c64ba2 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 00d1309

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

@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Opus 4.8 Review — ✅ no blocking findings

Reviewed 00d13091fe82d2b46f60b61cb29d3f4593c64ba2 — this comment is updated in place on each push.

Review details

All APIs the test uses exist and behave as asserted. This PR adds only inert test-fixture data and one consumer test under test/; no production code path changes, no security boundary is touched, and the discovery pass's assessment holds under my own falsification. Nothing meets the grounding bar.

No findings.

[OPUS-REVIEWED] 00d1309

Verdict parsed from the review's SHA-scoped output markers for commit 00d13091fe82d2b46f60b61cb29d3f4593c64ba2.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 00d13091fe82d2b46f60b61cb29d3f4593c64ba2: <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 00d13091fe82d2b46f60b61cb29d3f4593c64ba2 — 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.

All evidence gathered — contract read, patch and intent read, consumers and siblings counted in the repo. Final review:

First-Principles-Verdict: CONCERNS

Restoring the fixture earns its place, but it re-ships semantic.md, a layer with zero production readers, plus a config.json nobody consumes.

What this change ships

Intent: give the shipped seed-scenario set a home where every text memory layer is populated, pinned by the consumer test whose absence got the fixture removed — an ADDITION.

  1. kirocrew seed / pod scenarios regains a fourth scenario, auto-registered — justified
  2. Seeded preferences and projects markdown — justified (drives markdown_snapshot)
  3. Two dated history days — justified (exact-set assertion)
  4. lessons.jsonl on the current schema — justified (only fixture carrying lessons; counted 0 elsewhere)
  5. Seeded semantic.md — zero consumers
  6. Fixture config.json (theme, onboarding, timezone) — undeclared, zero consumers
  7. Consumer test driving LessonStore and MemoryStore — justified (it is the point)
  8. .db-absence assertion — justified (pins the recorded SQLite deferral)
  9. Post-exit cleanup assertion — duplicate of test/test_fixtures_helper.py:95

Watch

  • semantic.md has zero production readers — grepped semantic\.md across src/: markdown_snapshot reads preferences/projects/history only (memory.py:682-734), build_context is vector-backed (memory.py:910), and even migrate_from_markdown reads lessons/preferences/projects/history but never semantic.md (vector_memory.py:3944-4072). The test's _guarded_entry poke proves nothing new: the same reader already runs three times via the public snapshot. The caveat discloses this; disclosure doesn't keep the surface.
  • The genuinely new content over rich is lessons.jsonl plus one history day (rich already ships all four markdown layers); the description never weighs extending rich against a permanent fourth scenario name.

Subtractions

  • Drop semantic.md and the _guarded_entry block from test_fixture_memory_populated.py — 0 production consumers (count above); the fixture then claims only layers something reads.
  • Delete memory-populated/config.json — 0 consumers (the test never reads it; seed doesn't require it, the empty fixture ships none); it is symmetry with minimal/rich, not a requirement.
  • Drop the trailing assert not Path(home).exists() and the Path import — test_seeded_home_cleans_up_tempdir (test/test_fixtures_helper.py:95) already pins that contract.

[FIRST-PRINCIPLES-REVIEWED] 00d1309

@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 (9 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/memory-populated data tree plus one new test/ consumer test; no existing file modified and no runtime code path changed.

@dwu96
dwu96 merged commit 9d4e170 into main Sep 5, 2026
64 checks passed
@dwu96
dwu96 deleted the fx/fixture-memory-populated branch September 5, 2026 07:09
@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