idle-draft: strip :line-range suffixes before citation existence check

First pilot rejected valid citations like SPEC.md:1-80 — the form the
research template itself mandates. 5 new test cases (83 total).

Claude-Session: https://claude.ai/code/session_01YQDoWNM7XPPii28khFWoMc
This commit is contained in:
Paul O'Reilly
2026-08-02 21:27:53 +12:00
parent 6c4bf449aa
commit cd5be1cf92
3 changed files with 37 additions and 2 deletions

View File

@@ -247,7 +247,11 @@ For the selected `(item_or_dossier, work_type, provider)`:
7. Validation (on exit 0, before promotion): the temp output file must be non-empty and
its first non-blank line must be a top-level Markdown heading (`# ...`). For
`research` work type specifically: every absolute path matching `/home/\S+` cited in
the file must exist on disk (`Path.exists()`); any dead path fails validation.
the file must exist on disk (`Path.exists()`); any dead path fails validation. Citations
may carry a trailing line-range suffix in `path:120-145` or `path:120` form (per the
research prompt template's required citation format); this suffix is stripped — via
`re.sub(r":\d+(-\d+)?$", ...)`, only when the remainder still looks like a path — before
the existence check, so a valid ranged citation is not flagged as a dead path.
8. On validation pass: `os.replace()` the temp file to the canonical path
(`<repo>/<dossier>/<NN-slug>.<work_type>.md`, or append to
`<dossier>/TOPIC-PROPOSALS.md` for `topic_ideas`) — atomic, never a partial file