Skip to content

fix(convo_miner): stop sweeper drawers being purged (#2089) - #2125

Merged
igorls merged 3 commits into
developfrom
fix/2089-onto-develop
Aug 2, 2026
Merged

fix(convo_miner): stop sweeper drawers being purged (#2089)#2125
igorls merged 3 commits into
developfrom
fix/2089-onto-develop

Conversation

@igorls

@igorls igorls commented Aug 2, 2026

Copy link
Copy Markdown
Member

Summary

Conflict-resolved merge of #2089 onto current develop.

  • Prevents sweeper drawers from matching convo_miner extract_mode purge/idempotency scope
  • Aborts when purge fails instead of continuing into a half-state
  • Resolves tests/test_palace.py import conflict with single-writer tests from fix(storage): enforce local single-writer ownership #2079 (keeps both test suites)

Closes #2089.

Test plan

  • uv run pytest tests/test_palace.py tests/test_convo_miner_unit.py

KeilerHirsch and others added 3 commits July 28, 2026 16:24
…purge

#104 (CRITICAL, data-loss): the sweeper writes drawers with no
extract_mode at all (ingest_mode="sweep"). _metadata_matches_extract_mode's
legacy-compat rule -- "no extract_mode means treat as a legacy exchange
row" -- couldn't tell that apart from a genuine pre-schema convo_miner
row, so mempalace mine --mode convos (default extract=exchange) swept
every sweeper drawer for a shared transcript into its purge scope and
deleted them on the very next re-mine. The legacy-compat fallback now
only applies when the drawer is otherwise convo_miner's own (no
ingest_mode at all, or convo_miner's own "convos" tag) -- a drawer
positively identified as another producer's (sweep, or any other
foreign ingest_mode) never matches, using the same ingest_mode
discriminator sync.py already relies on for its own registry-row check.

#105 (MEDIUM, silent-failure): convo_miner's own instance of the
purge-failure swallow already fixed for miner.py at #23 -- a failed
purge in _file_chunks_locked was logged at debug level and mining
proceeded anyway, silently producing duplicate/stale drawers under
mixed schema versions. Now aborts (returns skipped=True, leaving the
old drawers' stored mtime untouched so the next mine retries) and
prints a visible warning.

428 tests pass across test_palace.py/test_convo_miner*.py/test_miner.py/
test_sweeper.py/test_hallways.py/test_format_miner.py/test_repair.py, no
regressions.
Copilot AI review requested due to automatic review settings August 2, 2026 08:25
@igorls
igorls requested a review from milla-jovovich as a code owner August 2, 2026 08:25
@igorls
igorls merged commit 2accb56 into develop Aug 2, 2026
8 of 9 checks passed

Copilot AI 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.

Pull request overview

This PR merges and finalizes the fix from #2089 onto develop, tightening convo_miner’s purge/idempotency behavior so it no longer deletes sweeper-created drawers and so it fails safely (skips) when a purge operation errors, avoiding mixed stale/new drawer states.

Changes:

  • Refines _metadata_matches_extract_mode to treat missing extract_mode as “legacy exchange” only for convo-miner-owned drawers (ingest_mode None / "convos"), excluding other producers like the sweeper ("sweep").
  • Updates convo_miner._file_chunks_locked to abort the mine attempt when stale-drawer purge fails, emitting a visible warning and returning skipped=True.
  • Adds targeted unit tests covering the new extract-mode scoping logic and the purge-failure abort behavior.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
mempalace/palace.py Narrows legacy exchange-mode matching so missing extract_mode no longer sweeps up non-convo producers (e.g., sweeper).
mempalace/convo_miner.py Aborts/returns skipped when stale-drawer purge fails instead of proceeding to upsert into a half-purged state.
tests/test_palace.py Adds direct unit coverage for _metadata_matches_extract_mode including the sweeper metadata case.
tests/test_convo_miner_unit.py Adds coverage for purge-failure abort behavior and for excluding sweeper rows from exchange-mode delete-id selection.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

3 participants