fix(compile): drop same-batch duplicate page titles in compile_kb#440
Open
nickmopen wants to merge 1 commit into
Open
fix(compile): drop same-batch duplicate page titles in compile_kb#440nickmopen wants to merge 1 commit into
nickmopen wants to merge 1 commit into
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
taken_names was computed once before the phase-1 validation loop and never grew as survivors were accepted, unlike phase-2 wikilink resolution just below it. two same-titled drafts in one compile_kb() LLM response both passed the collision guard and got filed as separate PAGE proposals with the same id; approving the first created the page and approving the second silently overwrote it via the update_page vault-edit path, with no error or diff shown to the reviewer. fold each survivor's title/slug into taken_names as soon as it's accepted, so a same-batch duplicate is dropped the same way a collision with an existing page or pending proposal already is. Fixes vouchdev#439
818f084 to
9c21ac0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
compile_kb()now folds each accepted draft's title/slug intotaken_namesas soon as it survives phase-1 validation, so a second same-titled draft later in the same batch is dropped by the existing collision guard instead of also passing.Why
taken_nameswas computed once before the phase-1 validation loop and never grew as survivors were accepted — unlike phase-2 wikilink resolution just below it, which does fold survivors back in. Two same-titled (or same-slugifying) drafts returned in onecompile_kb()LLM response both passed_draft_problem()and got filed as separate PAGE proposals sharing the sameid.proposals.approve()deliberately routes an existing page id throughupdate_page()(the vault-edit path), so approving the first proposal created the page and approving the second silently overwrote it — no error, no diff, no "already exists" signal to the reviewer. Fixes #439.What might break
page for '<title>' already exists or is pending review, same message already used for cross-call collisions. No prior behaviour relied on both surviving — that was the bug.VEP
Not a surface change (no object-model,
kb.*method, on-disk-layout, or audit-log-shape change) — internal validation-ordering fix incompile.py.Tests
make check(lint + mypy + pytest) — clean on the touched files. Full local suite: 1012/1020 passed (excludingtests/embeddings); the 8 pre-existing failures and 2 excluded modules (test_http_server.py,test_http_server_mcp.py, which bind real sockets) are Windows-local environment artifacts unrelated to this change (os.getuidabsence,\vs/path separators, symlink privilege requirements, acat-based LLM stub) — none touchcompile.py,proposals.py, or the new test. CI runs on Ubuntu where these don't occur.test_same_batch_duplicate_titles_second_droppedreproduces the issue's repro exactly: two same-titled drafts in one batch, second is dropped, and approving the first leaves the page with the first draft's body untouched.CHANGELOG.mdupdated under## [Unreleased].Fixes #439