mirror of
https://github.com/nomadkaraoke/karaoke-gen.git
synced 2026-12-02 01:48:08 +09:00
## Summary Turns the **P8 phantom-parenthetical** class from a review *gate* into a deterministic *auto-fix*, widening the fully-auto class without loosening the quality bar. Part of the full-auto-review initiative (measurement re-assessment phase). The 2026-08-30 reconstruction re-measure of the corpus (see below) showed that deleting phantom parentheticals — `(Instrumental break)`, `(I'm sorry)`, and unanchored `(Angel baby)` duplicate copies — is a recurring, cleanly-deterministic human edit. Previously these only *gated* the job to human review; now they're auto-deleted so the affected jobs auto-ship with correct output. ## Changes - **`deterministic.phantom_parenthetical_suggestions`** — emits a `delete` for a parenthetical run whose **every word is a gap word** (the decisive signal: this correctly deletes an unanchored duplicate even when its tokens appear elsewhere in the references, e.g. `(Angel baby)`). Guards: skips pure-vocalization parentheticals (left to the vocalization gate) and long runs (> 5 words). Wired into `deterministic_suggestions`, so it flows through the same cache / apply / score paths as P4/P5. - **`scorer._extract_gating_signals`** — now excludes words that a **winning** delete suggestion removes (winner-aware via `pick_accept_all_winners`) before scanning for the phantom/vocalization gates. A phantom that will be auto-deleted no longer trips the phantom gate, while genuine absurd-duration phantoms stay gated. ## Validation - **Corpus + battery (25 jobs):** 6/6 correct-direction deletes, **zero false positives**. The two known-human cases reproduce exactly (`(I'm sorry)`×3, `(Instrumental break)`); two initially-unverified deletes (`(only to my)`, `(Dreaming)`) confirmed correct — neither appears in the human's final. - **Private `validate_scorer.py` green:** safety preserved (33453fa0 still not-auto via its genuine gap/anchor signals; raw phantom safety-net gate intact); P8 fires 33453fa0 ×3, 8e465dc7 ×1, 5f90b799 ×1. - **Tests:** new unit tests for the fixer (8) + scorer delete-awareness incl. winner-vs-loser conflict handling (2). `backend/tests/services` 380 passed; auto_approval + auto_correct 230 passed; review routes + instrumental summary 91 passed. - **CodeRabbit** local review: no findings. ## Measurement note Human-edit measurement now uses **reconstruction** (diff post-AI vs final), not the `edit_log` — which was proven unreliable (never logs timing edits; null path is ambiguous). Documented in `docs/LESSONS-LEARNED.md`. @coderabbitai ignore Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>