feat(enrich): thin-page enrichment proposes expansions for stub pages#403
feat(enrich): thin-page enrichment proposes expansions for stub pages#403claytonlin1110 wants to merge 2 commits 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 |
|
@plind-junior Hi, would you review plz? |
adds kb.enrich_page plus vouch enrich-page / enrich-pages: scores a page against enrichment.min_body_chars / enrichment.min_citations in config.yaml and, for a qualifying thin page, drafts an addition synthesized strictly from approved, non-retracted claims already in the kb (reusing kb.synthesize's rendering so every added sentence carries a resolvable [claim_id] citation). the addition is appended to the page's existing body and filed via propose_page with slug_hint set to the existing page id -- nothing is ever written durably, only proposed. enrich-pages batches this over all thin pages with --dry-run / --limit, mirroring compile.py's propose-never-approve shape. closes vouchdev#309
e0b98f7 to
f0d3e64
Compare
the reduced test tip's storage.py dropped KBStore.update_page (still called by proposals.approve()'s vault-edit path -- the mechanism kb.enrich_page relies on to revise an existing page rather than duplicate it) and health.py / kb_list_pages called .value on Page.type, which is a plain open string (issue vouchdev#234), not an enum -- AttributeError on any KB with pages. both block kb.enrich_page outright on this branch; restoring them is unrelated to the enrichment feature itself.
summary
implements #309: a maintenance pass that finds thin pages (stub title + one-line body, few or no
claims/sources) and drafts an enriched revision synthesized strictly from related approved material already in the kb.kb.enrich_page(+ mcp/jsonl/cli registration across all four surfaces,src/vouch/enrich.py) scores one page againstenrichment.min_body_chars/enrichment.min_citations(config.yaml, sane defaults, overridable per-invocation). a page is thin whenlen(page.body)is under the char threshold orlen(page.claims) + len(page.sources)is under the citation threshold.synthesize.synthesize(feat:kb.synthesize— answer-mode retrieval over the review-gated KB #222) against the page's title+body as query, rather than re-deriving clauses fromcontext.build_context_packdirectly — this keeps the "every sentence traces to an approved claim" invariant identical between the two features and only pulls approved, non-retracted claims.claims/sources.propose_pagewithslug_hintset to the existing page id, landing as a pending proposal — nothing is written durably without a humankb.approve. mirrorscompile.py's propose-never-approve shape, including a distinctpage-enricheractor so self-approval stays blocked by the default gate.vouch enrich-pagesbatches this overkb.list_pages(), with--dry-run,--min-body-chars,--min-citations,--limit,--json; one page's rejection (e.g. a page kind's required fields tightened since last approval) is recorded as a skip rather than sinking the batch.docs/enrich.md+ CHANGELOG entry.test plan
tests/test_enrich_page.py— thin-page selection (both thresholds), above-threshold / no-related-claim skips, the propose-not-write invariant (proposal then approve revises the existing page, not a duplicate), dry-run, every-sentence-has-a-resolvable-citation, config load (present/default/bad-value fallback), batch dry-run +--limit, audit event, capabilities/HANDLERS parity, jsonl wire (success + clean missing-page error)ruff check src testscleanmypy srcclean (no new errors beyond the pre-existingsandbox.pywin32 / missing-jinja2gaps on this machine)pytest(enrich, synthesize, compile, storage, capabilities) green aside from two pre-existing, unrelated failures confirmed present on a pristineupstream/testcheckout too (thehost_compat/openclaw-manifest tests, andtest_jsonl_kb_compile_files_proposals's use of acatstub llm_cmd, which doesn't exist as a Windows shell built-in)🤖 Generated with Claude Code