Skip to content

fix(graph): exclude archived pages from kb.neighbors - #698

Merged
plind-junior merged 3 commits into
vouchdev:testfrom
kurosawareiji7007-hub:fix/neighbors-exclude-archived-pages
Jul 31, 2026
Merged

fix(graph): exclude archived pages from kb.neighbors#698
plind-junior merged 3 commits into
vouchdev:testfrom
kurosawareiji7007-hub:fix/neighbors-exclude-archived-pages

Conversation

@kurosawareiji7007-hub

Copy link
Copy Markdown
Contributor

Summary

  • kb.neighbors / vouch neighbors no longer return archived pages.
  • Matches context-pack graph expansion (_page_is_live); claims were already filtered.

Fixes #696

Test plan

  • pytest tests/test_graph.py
  • ruff check on touched files
  • CI green + 100% diff coverage

Made with Cursor

@github-actions github-actions Bot added docs documentation, specs, examples, and repo guidance retrieval context, search, synthesis, and evaluation tests tests and fixtures size: XS less than 50 changed non-doc lines labels Jul 31, 2026
@plind-junior

Copy link
Copy Markdown
Member

the behaviour is right — neighbors was the one graph surface still serving archived pages while context expansion dropped them, and matching the two is correct.

but the new _neighbor_ok page branch is context._page_is_live copied out, not called. side by side:

# graph.py, this PR
try:
    return store.get_page(node_id).status is not PageStatus.ARCHIVED
except ArtifactNotFoundError:
    return False

# context.py:601-604, already on test
try:
    return store.get_page(page_id).status is not PageStatus.ARCHIVED
except ArtifactNotFoundError:
    return False

identical apart from the parameter name, and the comment you wrote — "match context._page_is_live" — says you knew where it lived. from .context import _page_is_live gets the same behaviour with nothing to drift.

that matters more than usual here, because _page_is_live's own docstring is about this exact failure: "keeping it in three places is what let kb.context keep serving archived pages after #581 fixed kb.search." this PR is one of five open right now adding a copy (#710, #709, #708, #697 are the others), so the predicate is about to exist in six places, which is how #581 got a sequel in the first place.

if the import direction is awkward (graph → context), the cleaner move is the one suggested on #708: promote a page_is_live(page) next to _page_is_live and have both call sites use it. either way, not a fresh copy.

one smaller thing: assert graph._neighbor_ok(store, "missing-page", "page") is False is a second, unrelated assertion riding inside test_find_neighbors_excludes_archived_pages. it covers a real branch (the ArtifactNotFoundError path), so it should be its own test rather than a tail assertion on a test named for something else — otherwise a failure there reports as "archived pages leak", which it is not.

Fixes vouchdev#696: _neighbor_ok filtered retracted claims but accepted any
on-disk page, so archived titles still appeared in neighbors while
context expansion already dropped them. pages now use a live-status check.
@kurosawareiji7007-hub
kurosawareiji7007-hub force-pushed the fix/neighbors-exclude-archived-pages branch from d57ea0c to c4326ad Compare July 31, 2026 07:24
Upstream imported coerce_numeric but still used bare int()/float(),
which left an unused-import ruff F401 that failed CI on vouchdev#713.
@github-actions github-actions Bot added size: S 50-199 changed non-doc lines and removed size: XS less than 50 changed non-doc lines labels Jul 31, 2026
resolve the changelog union; both the vouchdev#696 archived-page filter and the
vouchdev#716 edge-leak fix belong in the same section.
@github-actions github-actions Bot added size: XS less than 50 changed non-doc lines and removed size: S 50-199 changed non-doc lines labels Jul 31, 2026
@plind-junior
plind-junior merged commit 5a93be0 into vouchdev:test Jul 31, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs documentation, specs, examples, and repo guidance retrieval context, search, synthesis, and evaluation size: XS less than 50 changed non-doc lines tests tests and fixtures

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(graph): kb.neighbors still returns archived pages

2 participants