Skip to content

Phase 4: Repairer (repair + validate + routing + repair eval) - #4

Merged
YoniRaviv merged 15 commits into
mainfrom
feat/phase-4-repairer
Jun 11, 2026
Merged

YoniRaviv merged 15 commits into
mainfrom
feat/phase-4-repairer

Conversation

@YoniRaviv

@YoniRaviv YoniRaviv commented Jun 11, 2026 •

Copy link
Copy Markdown
Owner

Summary

Phase 4 of DocPulse v1 — the repairer: given a confirmed-stale doc section + verdict + code change, produce a style-preserving corrected section, validate it, route it by confidence, and measure repair quality in the eval harness.

  • repair_model config — optional override (Config.resolve_repair_model()), falls back to model.
  • src/docpulse/repair/
    • repairer.py — single-shot structured-output repair() (submit_repair tool schema), one retry on malformed output, fail-safe to unchanged content on any LLM/parse failure.
    • validator.py — deterministic preservation_ratio() (fraction of original paragraph blocks surviving byte-identical) + validate() = preservation gate (≥0.5) × LLM accuracy-vs-new-code × style-vs-original.
    • routing.py — pure route(verdict, repair, config) -> auto_fix | draft | skip.
    • prompts.py — repairer + validator prompts.
  • src/docpulse/eval/repair_harness.py — eval-only: synthesizes a stale verdict from each label.yml (isolates repair quality from verifier noise), runs repair→validate→route, LLM rubric judge scoring vs reference_correction (accuracy/completeness/style 1–5 + human-review flag), aggregates mean preservation, % of stale cases ≥0.95 preserved (exit-gate metric), rubric means, flagged count.
  • docpulse eval --repair — runs the repair eval after the verify table; prints per-case preservation/tier/rubric + aggregates + unified diffs.

Deferred to Phase 5 (consistent with Phase 3 keeping CLI orchestration out): the standalone git-diff-driven docpulse repair --base pipeline. The validator is product-ready; only its CLI entrypoint waits.

Not in this PR — keyed measurement: the exit-gate run (docpulse eval --repair --model anthropic/claude-haiku-4-5) needs ANTHROPIC_API_KEY, like Phase 3's baseline. Running it yields the ≥95%-preservation number + rubric scores; STATUS.md / 03-plan.md get updated after.

Built subagent-driven (TDD, per-task spec + quality review, plus a final integrated review that caught and fixed a real bug: the validator's style check wasn't being shown the original section).

Test Plan

  • uv run pytest -q — 132 passed
  • uv run ruff check — clean (repo-wide)
  • Keyed exit-gate eval run (--repair against the 6 seed stale cases) — requires ANTHROPIC_API_KEY

🤖 Generated with Claude Code

YoniRaviv and others added 15 commits June 11, 2026 14:20
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…hten prompt test

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…/style

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…report

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… test case

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… test

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…rden rubric flag

Pass original_content into build_validation_user_message so the LLM
has both ORIGINAL and REWRITTEN sections when judging style_consistent.
OR the model's needs_human_review flag with a deterministic min-score<=3
check in judge_repair so low scores are always flagged regardless of
what the model returns.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…e block preservation

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@YoniRaviv
YoniRaviv merged commit 490fe79 into main Jun 11, 2026
2 checks passed
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.

1 participant