Skip to content

fix(distill): address the #332 council review - #341

Merged
jflowers merged 1 commit into
unbound-force:mainfrom
jflowers:opsx/distill-review-followups
Dec 1, 2026
Merged

jflowers merged 1 commit into
unbound-force:mainfrom
jflowers:opsx/distill-review-followups

Conversation

@jflowers

@jflowers jflowers commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

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.

  • Human-edited articles: when the run skips an article a human has edited, the review queue now names the learnings left pending. It reads "human edit preserved, not synthesized; N learnings held for a later run" and lists them under Held for a later run, instead of "0 learnings synthesized". The result counts them as held.
  • Test isolation: the new tools/main_test.go points XDG_CONFIG_HOME at an empty directory for the whole package, so no test reads the machine's global config.
  • Citation assertions: a new citesInBody helper matches a well-formed [id] in the article body, with frontmatter excluded.
  • New tests:
    • a compose over a flow-style sources: [id] base;
    • a configured max_new_per_theme reaching rolling_pr through the handler;
    • refusal when a synthesizer is configured but unavailable;
    • the dewey doctor max_new_per_theme line.
  • Docs:

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

- 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 uf-divisor left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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):

  1. citesInBody reimplements 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 on tools/distill_synthesis_helpers_test.go.
  2. The doctor test pins the valid arm of the max_new_per_theme line but not its invalid-value WARN arm — see the inline comment on cli_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\[\]-])`

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread cli_test.go
"similarity_threshold=0.62 (" + cfgPath + ")",
"tie_margin=0.05 (default)",
"min_theme_size=3 (" + cfgPath + ")",
"max_new_per_theme=7 (" + cfgPath + ")",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@jflowers
jflowers merged commit 279bd93 into unbound-force:main Dec 1, 2026
7 checks passed
@jflowers
jflowers deleted the opsx/distill-review-followups branch December 2, 2026 00:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants