Repository navigation
fix(distill): address the #332 council review - #341
Conversation
- Human-edit skip path: the review queue names the learnings left
pending behind a human's edit ("human edit preserved, not
synthesized; N learnings held") instead of "0 learnings synthesized",
and the result counts them as held.
- Tests in tools never read the machine's global config: TestMain
points XDG_CONFIG_HOME at an empty directory for the package.
- Citation assertions match a well-formed bracketed citation in the
article body, not a substring anywhere in the file.
- New tests: a compose over a flow-style sources base; a configured
max_new_per_theme reaching rolling_pr through the handler; refusal
when a synthesizer is configured but unavailable; the doctor line.
- sanitizeMembers documents why a scanner error is run-fatal.
- AGENTS.md and README document max_new_per_theme beside the other
calibration knobs; the proposal records the max_completion_tokens
transport fix and content coverage (website sync: website#499).
Closes unbound-force#338
Closes unbound-force#339
Co-Authored-By: Claude Opus 5.5 <[email protected]>
uf-divisor
left a comment
There was a problem hiding this comment.
Council Review: APPROVE WITH ADVISORIES
Six reviewer personas ran against be518314...b2246044 (11 files, +177/−10). Five returned APPROVE (adversary, architect, curator, gaze-testing, guard); divisor-testing returned APPROVE WITH ADVISORIES with two LOW findings, posted inline.
What this PR does: cherry-picks the #332 council-review follow-ups onto current main — the human-edit skip path now names the learnings held behind a human edit, tools tests isolate XDG_CONFIG_HOME via a new TestMain, citation assertions use a citesInBody helper, and the three test gaps from #338/#339 are closed, with max_new_per_theme documented in AGENTS.md and the README.
Verification: CI is green on the head commit (build-and-test, MegaLinter, changes/Scope). Gates ran at b224604 (worktree; config from be51831); every detected tool is covered by passing CI, so no local execution was needed. Pre-flight verdict: PASS.
Advisories (both LOW, non-blocking):
citesInBodyreimplements the citation grammar as a bespoke regex narrower than the production verifier (scanBrackets/citationIdentities), so the tested and enforced contracts can drift — see the inline comment ontools/distill_synthesis_helpers_test.go.- The doctor test pins the valid arm of the
max_new_per_themeline but not its invalid-value WARN arm — see the inline comment oncli_test.go.
Two lessons were stored from this review (a test-isolation pattern and a parser-drift gotcha).
This review was generated by /uf.review-pr (AI-assisted).
| // glued to a neighbouring word or bracket, so an id in the sources list, | ||
| // in a longer identity, or in a run of brackets does not count. | ||
| func citesInBody(article, id string) bool { | ||
| pattern := `(^|[^\w\[\]-])\[` + regexp.QuoteMeta(id) + `\]($|[^\w\[\]-])` |
There was a problem hiding this comment.
LOW (assertion-parity) — citesInBody enforces a narrower citation grammar than the production verifier, so the tested contract and the enforced one can drift independently. The helper matches only a single-identity bracketed citation bounded by non-word characters ((^|[^\w\[\]-])\[<id>\]($|[^\w\[\]-]), frontmatter excluded), while verifySynthesizedBody (scanBrackets + citationIdentities in tools/citations.go) accepts any same-line depth-zero bracket group whose comma-separated content matches the identity grammar — including the [a, b] multi-source form that buildDistillSynthesisPrompt instruction 4 tells models to produce. The doc comment claims FR-012 equivalence the helper does not have.
Current uses are safe: echoSynthesis emits single - text [id] lines, so the positive assertions get stricter rather than weaker, and the one negative use in the cap test is redundant with the Held == 1 count. A future fixture or echo change emitting the documented comma-separated form would produce false test failures, and absence assertions would silently weaken.
Consider composing the production primitives — membership in citationIdentities(scanBrackets(body)) — so the two grammars cannot diverge. If the regex stays for clarity, its comment should state the divergence and a parity test should pin the relationship.
| "similarity_threshold=0.62 (" + cfgPath + ")", | ||
| "tie_margin=0.05 (default)", | ||
| "min_theme_size=3 (" + cfgPath + ")", | ||
| "max_new_per_theme=7 (" + cfgPath + ")", |
There was a problem hiding this comment.
LOW (coverage-gap) — the test pins the valid arm of the max_new_per_theme doctor line (max_new_per_theme=7 (<path>)) but not its invalid-value WARN arm, even though the same test pins that arm for the sibling field (distill.tie_margin 0.5 is outside [0,0.5)).
Config-level validation of the field is covered in tools (TestResolveDistillGroupingConfig_MaxNewPerTheme: fractional, zero, negative, over-cap, and both boundaries), so only the doctor's WARN rendering for this one field is unguarded: a regression that stops rendering the max_new_per_theme warning while tie_margin's still renders would pass unnoticed.
Mirroring the sibling's WARN assertion — a fixture with an out-of-range max_new_per_theme expecting the outside-range line — closes the gap.
Summary
Follow-up to #332. It was rebase-merged at fff8b4c, before these fixes from its council review were pushed, so they never reached main. This is the same commit, cherry-picked onto current main.
tools/main_test.gopointsXDG_CONFIG_HOMEat an empty directory for the whole package, so no test reads the machine's global config.citesInBodyhelper matches a well-formed[id]in the article body, with frontmatter excluded.sources: [id]base;max_new_per_themereachingrolling_prthrough the handler;dewey doctormax_new_per_themeline.sanitizeMembersexplains why a scanner error stops the run;max_new_per_theme;max_completion_tokensfix and content coverage. The website sync issue is docs: sync dewey distill synthesis documentation website#499.Closes #338
Closes #339
Closes #334
Closes #335
Closes #336
Closes #337
Test plan
go vet ./...and gofmt are clean.go test -race -count=1 ./...passes on current main with this commit.🤖 Generated with Claude Code