Repository navigation
feat: gather the whole record — qualified labels and mid-comment records - #126
Conversation
There was a problem hiding this comment.
Approving. I formed my view from the diff before the description, then checked the plan on #113, the M6-R3 text on #109, and the doc-synthesizer contract. The headline claims hold up under execution, not just reading.
What I verified by running it
The "3 -> 7" measurement reproduces exactly. I ran the real gatherer against live GitHub — gatherRecords with tracker.GitHub{} over M5's 22 tasks and their closing PRs, plus the pre-#113 matcher re-implemented verbatim over the same walk. Old: 3. New: 7, and they are the seven the plan names (#68's gate resolution, #73's four Decisions, #76's Deviation, PR #95's mid-comment Deviation). Not a fixture, same tracker, same walk. Temporary test deleted; tree clean.
The corpus is genuinely M5's comments, and I checked all of them rather than two. The 22 sources refs are exactly the live sub-issues of #67, in order. Every one of the 51 stored comments (43 issue + 8 PR, across 22 issues and 18 PRs) is byte-identical to the live API response on author, html_url and body. No drift, no editing.
The seven records are all the records the corpus contains. Scanning every occurrence of **Decision, **Deviation, **Gate resolved in the corpus gives 8 hits. Seven are gathered. The eighth is #68's gate-raised instruction text ("Resolve by replying with a comment starting **Gate resolved:**") — mid-line, inside backticks, correctly excluded. Nothing unaccounted for.
The "no record lives in a PR body or review body" claim holds. I swept all 18 M5 PR bodies, review bodies and inline review comments for the three labels. One hit: a mid-line mention in #107's review prose. No labelled record. Plan step 3 and the Decision comment's parenthetical are both true, so SPEC §4 standing is a sound premise, not an assumption.
UnresolvedGates semantics are unchanged for bare labels. Ten probed cases — bare resolved, bare Decision, Deviation only, resolution before the raise, two gates one resolution, unresolved — all behave identically to the pre-change prefix check. Qualified **Gate resolved (...):** and **Decision (...):** now resolve; a qualified Deviation still does not.
The slice aliasing is safe. open = &records[len(records)-1] points into a slice that later grows, but no append happens while open is live — the only append immediately reassigns it. Probed with 12 records in one comment: no corruption. open also resets per comment, so a record never spans comments. Fine as written, just load-bearing on that ordering.
Consequences outside the diff: ExtractRecords, Record, gatherRecords and writeRecords have no consumers beyond milestoneClose and the tests. No doc carries a literal transcript of the close output, so the label-instead-of-kind change breaks no documented example. go test ./..., go vet ./..., gofmt -l . all clean locally; both CI checks green.
M6-R3 and the contract. "Gathered output covers what the doc-synthesizer contract says it may rely on" is satisfied: item 2 ("every Decision and Deviation comment across the milestone's task issues and PRs") is now true where it demonstrably was not — that is the 3-of-7 gap. Item 3 (merged PR descriptions) stays the seat's own read, and the gather now hands it the pointers, with SPEC §4 stating the boundary explicitly. That is a legitimate resolution of the task's "either the gatherer reaches PR bodies or the contract stops implying it" fork.
Plan adherence. All six steps landed. Three ask-the-human points struck through with operator attribution and dates. One Decision comment records the paragraph model, its trade-off, and three rejected alternatives with the baseline measurement. I found no undeclared deviation.
Notes — none blocking, all for the record
-
CRLF bodies never split.
paragraphBreakis\n[ \t]*\n, so\r\n\r\ndoes not match: a CRLF comment collapses to one paragraph, and a mid-comment record in one is silently missed (probed: 0 records). Theoretical for this tracker — zero of the 146 issue/PR comments in this repo carry a CR, including every comment the human operator wrote, because the REST API returns LF. Adding\rto the character class would close it for nothing, if you touch this again. -
A fenced code block with a blank line in it can produce a false record. A paragraph boundary inside a fence lets an example label match, and the record then swallows the rest of the fence. Old code could not hit this (it only looked at how a comment starts), so this is new surface — and this project quotes the record convention constantly. Contrived enough to accept; blockquoted labels are correctly ignored.
-
SPEC §4's "a label mentioned mid-line is not a record" under-describes the rule. A label at the start of a line that is not a paragraph start is also dropped:
Prose intro.\n**Decision:** Xyields nothing. Same as the old behaviour, so not a regression, but §4 now reads as though mid-line is the only exclusion. "not at the start of a paragraph" would be exact. -
§4 does not state the closing rule. That any other bold
**Label:**paragraph ends the open record is real, author-visible behaviour — write**Note:** ...under a Decision and the rest is truncated. It is in the Decision comment and the Go doc, but not in the protocol document the record author reads. -
The summaries header overclaims. It prints "merged PR descriptions", but
ClosingPRs(ref, true)returns open and closed PRs —gatherRecords' own doc comment says so. All 18 M5 PRs are merged, so it is true today; an abandoned PR on a closed task would be listed as merged. "task PRs" would be honest. -
writeRecordsheader repeats the label immediately above a body that opens with the same label, and a long qualifier makes for a very long header line. Plan-adherent (step 5), purely a readability note. -
One asymmetry worth naming:
ExtractRecordsnow finds mid-comment records, butUnresolvedGatesstill only recognises a resolution that opens a comment. A round-up ending**Gate resolved:** ...is gathered as a record yet does not clear the gate. Probably the right conservative call, since the label removal is the hard block — but it is not recorded anywhere as a choice. -
tracker.go:343 has an orphaned short line ("A single trailing") left by the comment reflow.
The gap M5's synthesis exposed is closed, and the fix is proved on the evidence that exposed it rather than on invented fixtures. Good work.
…graph rule precisely (#113)
|
Post-approval, from checky's non-blocking notes, one commit: CRLF comment bodies are normalised before the paragraph split (a web-UI comment is CRLF; |
There was a problem hiding this comment.
Re-reviewed at ea303d8. Approval stands, and this supersedes my review of ffb0f6c. All three changes do what the commit message says — checked by execution, not by reading.
1. CRLF normalisation — fixed, and more completely than the note asked. strings.ReplaceAll(c.Body, "\r\n", "\n") before the split. I re-ran the probes that failed at ffb0f6c: a CRLF comment with a mid-comment Deviation now yields the record (was 0); a CRLF **Decision:** followed by a **Finding:** paragraph now closes correctly instead of swallowing it; a qualified label after intro text, two records separated by another bold label, a blank line containing spaces, and a mixed LF/CRLF body all behave exactly as their LF equivalents. Worth noting a bonus the tests do not assert: because normalisation happens before the split, Record.Body carries no stray CR either, so the gathered raw material comes out clean rather than merely being found. TestExtractRecordsCRLF covers the load-bearing case.
2. The close-output header — accurate now. "task PRs (open and merged — their descriptions are the task summaries, read directly, never gathered; SPEC §4)". It no longer asserts every listed PR is merged, which was the actual defect. Strictly, closedByPullRequestsReferences(includeClosedPrs: true) returns open, closed and merged, so a closed-unmerged PR still sits outside the parenthetical, and gatherRecords' own doc comment says "open and closed". Not worth another round — flagging only so the exact set is on the record.
3. SPEC §4 — both rules now stated, and both match the code. "A label that does not open a paragraph — mid-line, or at the start of a line inside a paragraph — is not a record": verified, We agreed **Decision:** inline. and Prose intro.\n**Decision:** ... both yield zero records. "Any other bold label opening a later paragraph (**Finding 3:**) ends the record before it": verified, the record closes at the **Finding 3:** paragraph. One loose edge — **Why:**, **Trade-off:** and **Rejected:** are not treated as "other" and still attach to an open record, which §4's own example blocks imply but the new sentence does not carve out. Read together it is unambiguous enough; mentioning it only because a pedantic reader of that one sentence would predict the opposite.
The fenced-code deferral is the right call. A label at the start of a paragraph inside a code fence is not a shape any record has taken here, and fixing it properly means tracking fence state through the split — disproportionate to a hazard that requires a blank line inside a fence. The reasoning is recorded on the PR, which is what I wanted from it. Captured for #109's close observations is the right home.
Re-verified at ea303d8: go test ./..., go vet ./..., gofmt -l . all clean. Both CI checks green on the head commit (Go build and test, Lint commit messages). PR head matches the local checkout; tree clean. Everything I proved at ffb0f6c still holds — the corpus is untouched, the seven records and the 3-to-7 measurement are unaffected by these changes, and no new caller or output consumer appears.
Approved.
Closes #113 — M6-R3.
What
internal/tracker/tracker.go):ExtractRecordsnow yields one record per labelled paragraph. Labels may carry a parenthetical qualifier (**Decision (superseding …):**), kept verbatim in a newRecord.Label;Gate resolvedstill maps to a Decision.UnresolvedGatesaccepts a qualified resolution and — as before — never a Deviation.internal/cli/milestone.go): records print under their full label; after the records, a "task summaries" list names each task's PRs so the doc-synthesizer has the pointers — bodies are read directly, never gathered.internal/tracker/testdata/m5-corpus.json— every sub-issue of M5: Crew expansion #67 and its closing PRs (22 issues, 43 + 8 comments, snapshot 2026-08-26).TestExtractRecordsM5Corpusasserts all seven records by source, kind and label, including the four the M5 close missed (three**Decision (…):**on Staff the reviewer role with a dedicated App identity #73, PR feat: require the reviewer-role holder's review at task finish #95's mid-comment Deviation).Measured
Real gatherer over M5's 22 tasks, before this change: 3 records. After: 7 (+22 summary lines). Same run, same tracker, no fixture.
Tests
TestExtractRecords(unchanged shape, now also pins label and body of a one-record comment),TestExtractRecordsVariants(qualified Decision, qualified gate resolution, Deviation after a round-up with its Why and trailing prose and without the round-up, two records in one comment separated by another bold label, mid-line mention ignored),TestUnresolvedGatesAcceptsQualifiedResolution,TestExtractRecordsM5Corpus.go test ./...green.Not done, by the plan and the operator's answers on #113
PR bodies as a source (SPEC §4 stands); supersession semantics; review bodies (no M5 record lives in one — checked).
🤖 Generated with Claude Code