Skip to content

fix: dry_run check order in auto_extract + corpus seeding for TestCrossModeConsistency - #40

Merged
davidgut1982 merged 2 commits into
mainfrom
fix/dry-run-and-corpus-seed
Jun 2, 2026
Merged

fix: dry_run check order in auto_extract + corpus seeding for TestCrossModeConsistency#40
davidgut1982 merged 2 commits into
mainfrom
fix/dry-run-and-corpus-seed

Conversation

@davidgut1982

Copy link
Copy Markdown
Owner

Summary

Two small, independent fixes bundled on one branch.

Fix 1 — auto_extract dry_run check order (t_020a062b)

src/lore/extraction/__init__.py

The dry_run guard is now evaluated strictly between the dedup step (should_merge) and any kb_add/kb_update call, so the documented contract holds exactly:

  • dry_run=True — the full pipeline runs (LLM extraction + dedup + candidate generation), but no KB write of any kind is issued. Each accepted candidate's would-be decision (insert/merge, type, content, confidence, existing_id) is collected and returned under summary["candidates"] so operators can inspect what would have been written — results for inspection only.
  • dry_run=False (default) — the full pipeline including writes, unchanged.

Precedence is preserved: dry_run wins over review_mode (nothing is written, not even to the pending queue). All existing control-surface and orchestrator test expectations (counts, dry_run flag, skipped accounting) remain satisfied; the change is additive (candidates only appears in dry-run summaries).

Fix 2 — TestCrossModeConsistency corpus seeding (t_c9f48936)

tests/e2e/test_search_modes.py

TestCrossModeConsistency previously depended on pre-seeded corpus entries that do not exist on a clean staging instance, so it failed there. Added a class-scoped crossmode_corpus fixture that:

  1. Seeds the minimum entry it needs — one sentinel entry under a unique e2e-crossmode-<hex> topic — using the existing e2e LoreClient pattern, then waits 2 s for the FTS index to settle (matching the existing seeded_client / test_regression.py pattern).
  2. Yields (client, sentinel) to the tests.
  3. Tears down on completion — deletes the seeded entry plus any topic stragglers, best-effort so teardown never masks a test failure.

Both tests in the class now consume this fixture, making them self-contained and green on any clean staging environment. Class scope means the seed + FTS-settle cost is paid once per class rather than per test.

Testing

  • Both files validated for syntax.
  • Fix 1 traced against tests/test_extraction_control_surface.py and tests/test_extraction_orchestrator.py: all existing assertions still hold (dry-run writes nothing, dry_run flag set, exact 4-key summary preserved when dry-run is off).
  • Fix 2 is gated behind LORE_E2E_URL and exercises a live Lore instance on staging.

🤖 Generated with Claude Code

davidgut1982 and others added 2 commits June 2, 2026 05:54
dry_run is now evaluated strictly between dedup (should_merge) and any
kb_add/kb_update: the full pipeline (LLM extraction + dedup) still runs so
candidate decisions are real, but no KB write of any kind is issued in
dry-run mode. The would-be action for each accepted candidate is collected
under summary["candidates"] so operators can inspect exactly what would have
been written before enabling live writes — matching the documented
"results returned for inspection only" contract.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…f48936)

The cross-mode consistency tests previously assumed pre-seeded corpus entries
that do not exist on a clean staging instance, so they failed there. Add a
class-scoped `crossmode_corpus` fixture that seeds one sentinel entry under a
unique topic, waits for the FTS index to settle, yields (client, sentinel),
and deletes the entry (plus any topic stragglers) on teardown — best-effort so
teardown never masks a test failure. Both tests now consume this fixture and
pass on any clean staging environment.

Reuses the existing e2e LoreClient pattern; class-scoped so the seed + FTS
settle cost is paid once per class rather than per test.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
davidgut1982 added a commit that referenced this pull request Jun 2, 2026
@davidgut1982
davidgut1982 merged commit 2bcbb4e into main Jun 2, 2026
3 checks passed
davidgut1982 added a commit that referenced this pull request Jun 2, 2026
* chore: bump version to 0.8.7

* docs: add 0.8.7 changelog entry

* chore: bump version to 0.9.0

* docs: replace partial 0.8.7 changelog with comprehensive 0.9.0 entry

* docs: add PR #40 fixes to 0.9.0 changelog
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.

1 participant