Skip to content

fix(compile): drop archived pages from taken topics and the collision gate - #708

Merged
plind-junior merged 1 commit into
vouchdev:testfrom
dripsmvcp:fix/compile-archived-pages
Jul 31, 2026
Merged

fix(compile): drop archived pages from taken topics and the collision gate#708
plind-junior merged 1 commit into
vouchdev:testfrom
dripsmvcp:fix/compile-archived-pages

Conversation

@dripsmvcp

Copy link
Copy Markdown
Contributor

closes #700

what

build_prompt listed every on-disk page under TAKEN TOPICS … do NOT redraft any of these, and compile_kb seeded taken_names from the same unfiltered
store.list_pages(). An archived page stayed taken forever.

Both halves matter, and together they make archive one-way:

  1. the LLM is told not to redraft a topic the wiki no longer carries, so the
    subject silently drops out of the compiled wiki
  2. a draft that does reuse the title is dropped as a duplicate of a page
    nobody can read

The only way back was hand-editing storage — which is exactly what archiving a
bad compile page is supposed to avoid.

the fix

One _live_pages(store) helper, used at both call sites, filtering
PageStatus.ARCHIVED. That is the same live set recall, digest,
context, synthesize, triage and vault_sync already apply, and the same
treatment claims already get here through _RETRACTED_CLAIM_STATUSES — the
inconsistency the issue points at is pages having been left out of it.

Pending page proposals stay in the taken set: those are drafts awaiting
review, not retirements, and redrafting over one still produces the
duplicate-proposal crash #439 fixed.

tests

Four in tests/test_compile.py, covering both halves and both directions:

  • an archived page is absent from TAKEN TOPICS (the issue's repro)
  • a live page is still listed — the filter is not a blanket drop
  • a draft reusing an archived title is now proposed rather than dropped
  • a draft reusing a live title is still dropped

Full gate green locally: pytest tests/ --ignore=tests/embeddings, mypy src,
ruff check src tests, plus diff-cover --fail-under 100 on the changed lines.

… gate

`build_prompt` listed every on-disk page under TAKEN TOPICS and
`compile_kb` seeded `taken_names` from the same unfiltered list, so an
archived page stayed "taken" forever.

archiving is how an operator retires a bad compile page, and it was
one-way: the llm was told not to redraft a topic the wiki no longer
carries, and a draft that reused the title was dropped as a duplicate of
a page nobody can read. the only way back was hand-editing storage.

claims already get this treatment through `_RETRACTED_CLAIM_STATUSES`;
pages did not. one `_live_pages` helper at both call sites, filtering the
same live set recall, digest, search and the wiki view already use.

pending page proposals stay in the taken set — those are drafts awaiting
review, not retirements.
@github-actions github-actions Bot added tests tests and fixtures size: S 50-199 changed non-doc lines labels Jul 31, 2026
@plind-junior

Copy link
Copy Markdown
Member

of the five archived-page PRs this is the only one that extracts a helper rather than inlining the check, and _live_pages is the right shape — both call sites needed the same set and would have drifted apart otherwise.

catching both halves is what makes this a real fix rather than a partial one. patching only build_prompt would have left the collision gate still dropping a draft that reuses an archived title, so the topic stays unwritable and the operator gets a "duplicate" report naming a page nobody can read. the archived-title-reusable / live-title-still-dropped pair is the test coverage that matters here.

keeping pending page proposals in taken_names is correct and worth the comment you gave it — redrafting over a pending draft is what produced the crash #439 fixed.

the cross-cutting note for this cluster belongs here more than anywhere, because _live_pages is the natural home. context._page_is_live already exists, and its docstring says outright that keeping this predicate in more than one place is what let kb.context keep serving archived pages after #581 fixed kb.search. #710, #709, #698 and #697 each add another copy — #698's is near-verbatim, same body and same try/except, different parameter name. suggest promoting _live_pages / page_is_live next to _page_is_live and pointing the other four at it, so the sixth surface is an import.

nothing blocking in the diff itself.

@plind-junior
plind-junior enabled auto-merge July 31, 2026 06:47
@plind-junior
plind-junior disabled auto-merge July 31, 2026 06:48
@plind-junior
plind-junior merged commit fc03483 into vouchdev:test Jul 31, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size: S 50-199 changed non-doc lines tests tests and fixtures

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(compile): archived pages block TAKEN TOPICS and title collision

2 participants