Skip to content

fix: regenerated compiled article keeps validated tier only on unchanged content - #205

Merged
jflowers merged 10 commits into
unbound-force:mainfrom
jflowers:opsx/demote-validated-on-regeneration
Nov 14, 2026
Merged

jflowers merged 10 commits into
unbound-force:mainfrom
jflowers:opsx/demote-validated-on-regeneration

Conversation

@jflowers

Copy link
Copy Markdown
Contributor

Summary

A validated tier now vouches for specific content, not a page name — the store's UpdatePage tier rule became content-bound (validated preserved only when incoming content hash equals stored hash), compile writes every article draft with a truncated SHA-256 content hash recorded on the compiled page row, curate re-index writes tier curated on content change, and promotion remains exclusively the human gate's conditional update.

  • store/store.go: UpdatePage preserves validated only when content_hash matches; changed content demotes to caller-supplied tier (draft/curated). The PR feat: distill knowledge through the running MCP server with OpenAI-compatible synthesis #145 promote race stays closed for byte-identical writes.
  • tools/compile.go: removed per-topic validated tier lookup; persistCompiledArticle always writes draft and sets content_hash from rendered bytes (both compile and store_compiled paths).
  • tools/curate.go: re-index skips unchanged files without a write; changed knowledge files re-index at curated, honoring "automate demotion, not promotion".
  • README.md: compile paragraph updated to reflect draft-on-regeneration.
  • Spec artifacts under openspec/changes/demote-validated-on-regeneration/ and specs/knowledge-distillation + specs/validated-tier-content-binding reconcile KD-FR-108 scenario 2 observables to the write-tier contract; website docs sync tracked as docs: sync dewey compile tier demotion documentation website#413.

Closes #204
Part of #153 Phase 5. Related: #203, #193.

How to Test

Acceptance scenarios from openspec/changes/demote-validated-on-regeneration/tasks.md, mapped to runnable checks:

  1. Regenerating a validated article with different content yields draft:

    go test -race -count=1 -run 'TestCompile_RecompileTierIsContentBound' ./tools/...
    

    Asserts store tier draft, result tier field draft, frontmatter tier: draft, compiled_by provenance.

  2. Regenerating with identical content keeps validated — same test's byte-identical leg (via the real promote gate).

  3. Promote race stays closed:

    go test -race -count=1 -run 'TestUpdatePage_PreservesValidatedTier' ./store/...
    

    (unmodified race-regression test)

  4. Store rule scenarios:

    go test -race -count=1 -run 'TestUpdatePage_' ./store/...
    

    Five VTB-FR-001 scenarios.

  5. Curate re-index:

    go test -race -count=1 -run 'TestAutoIndex_ValidatedTierIsContentBound' ./tools/...
    
  6. Full CI parity:

    go test -race -v -count=1 -coverprofile=coverage.out ./...
    gaze crap --format=json --coverprofile=coverage.out --max-crapload=48 --max-gaze-crapload=45 ./...
    

How to Demo

Walkthrough (no UI):

  1. Promote a compiled article to validated via dewey promote.
  2. Change one of its source learnings so the next synthesis would produce different bytes.
  3. Run dewey compile (or trigger distill background curation).
  4. Verify the page is now tier: draft (frontmatter and store) and appears in the human promote queue; re-running compile without changing sources keeps validated when bytes are identical.

Trivial to verify via the tests above without a live vault.

Key Files Changed

  • store/store.go — content-bound validated preservation (content_hash gate, 5 new tier-hash scenarios)
  • store/store_test.go — cover VTB-FR-001
  • tools/compile.go — draft-only writes + content_hash on compiled rows (VTB-FR-002/003), removed validated carry-over lookup
  • tools/compile_test.go — assert content-bound recompile tier contract (VTB-FR-002/003, KD-FR-108)
  • tools/curate.go / tools/curate_test.go — tier is content-bound on re-index (VTB-FR-004)
  • README.md, AGENTS.md — compile/distill tier wording
  • openspec/changes/demote-validated-on-regeneration/** — proposal/design/tasks/specs (epic Epistemic integrity for Dewey knowledge: temporal validity, drift detection, guarded curation #153 Phase 5)
  • specs/knowledge-distillation/spec.md, specs/validated-tier-content-binding/spec.md — reconciled write-tier contract

Full diff: 10 commits ahead of upstream/main (211017b..142dfda), 17/17 packages, 1881 tests passing.

Known Issues

None — review council returned APPROVE (spec review APPROVE WITH ADVISORIES, code review APPROVE 5/5). Two LOW spec advisories were honored before push. CI parity verified locally (build, vet, race tests, gaze thresholds green).

This PR was generated by /uf.finale (AI-assisted).

- VTB-FR-001..005 content-bound validated preservation
- KD-FR-108 demote-on-regeneration contract
- design.md with hash-equality store rule and compile/curate wiring
- tasks.md phased implementation plan
…FR-002)

Add the unexported contentHash helper (SHA-256, first 8 bytes hex — the
curation re-index / learning re-ingestion convention) and wire it into
persistCompiledArticle and StoreCompiled page construction, hashing
exactly the article bytes persisted to the store and written to disk.
The hash is a change-detection fingerprint, not cryptographic integrity
(collision risk accepted at 2^-64), and is scoped to the compiled write
paths only. With the store's content-bound UpdatePage rule (VTB-FR-001)
this makes changed-vs-unchanged compiled content distinguishable, so
regeneration of a validated compiled page now demotes to draft unless
the bytes are identical.

The two compile tests task 2.3 repurposes remain red by plan:
TestCompile_PreservesValidatedTierAndRecordsProvenance now fails on the
demotion it must be rewritten to assert; the lookup-failure test lost
its target branch in 2.1.
@jflowers
jflowers enabled auto-merge (rebase) November 14, 2026 17:56

@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: REQUEST CHANGES

5 reviewers dispatched (divisor-adversary, divisor-architect, divisor-curator, divisor-guard, divisor-testing; 4 content/scope personas skipped by plan). Native verdicts: 2 APPROVE, 2 APPROVE WITH ADVISORIES, 1 REQUEST CHANGES. All 5 runs completed successfully.

Findings

  1. HIGH — Documentation Completeness (divisor-curator, README.md:768) — posted inline.
  2. LOW — Documentation Completeness (divisor-curator, README.md:789) — line not in diff, recorded here: the Trust Tiers table row validated | promote | Agent content promoted by human review does not mention content-bound preservation (validated vouches for specific bytes and demotes on hash change). The website docs for trust tiers will need the same clarification when the sync issue is handled.
  3. LOW — Documentation Completeness (divisor-guard, README.md:771) — posted inline.
  4. LOW — Test Isolation (divisor-testing, tools/curate_test.go:495) — posted inline.
  5. LOW — Test Isolation (divisor-testing, tools/compile_test.go:2100) — posted inline.

Verdict justification

The REQUEST CHANGES verdict rests on the single HIGH documentation finding. Verification note from the review operator: unbound-force/website#413 exists, is OPEN, and carries the docs label ("docs: sync dewey compile tier demotion documentation"), matching the PR body's reference and task 4.1; the finding's check queried the unbound-force/dewey repository, while the AGENTS.md Website Documentation Sync gate targets the unbound-force/website repository. The council's computed verdict is reported unchanged.

CI & Pre-flight

  • build-and-test: PASS · MegaLinter: PASS
  • Pre-flight (ci-aware): PASS — local tools covered by passing CI checks

This review was generated by /uf.review-pr (AI-assisted).

Comment thread README.md
@@ -768,7 +768,7 @@ Environment variables override config file values for embedding. For synthesis,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The proposal's Impact section requires a website docs sync issue for this user-visible tier change, and the verification query (gh issue list --repo unbound-force/dewey --label docs --state open, plus --search validated) returns empty — no tracking issue found in the repository checked. AGENTS.md's Website Documentation Sync gate requires the issue in unbound-force/website with the docs label. Reference the tracking issue so the docs sync obligation is traceable from the PR. [divisor-curator · HIGH]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The finding's premise doesn't hold: the tracking issue exists where the project's gate requires it. AGENTS.md's Website Documentation Sync rule requires the docs-sync issue in the unbound-force/website repository, labeled docs, titled docs: sync dewey <feature> documentation. That issue is unbound-force/website#413 — "docs: sync dewey compile tier demotion documentation", open, carrying the docs label. The verification behind this finding queried unbound-force/dewey (gh issue list --repo unbound-force/dewey --label docs), which is not the repository this gate targets, and the review's own verification section records website#413 as existing.

The obligation is traceable from three anchors already in the PR: the body ("website docs sync tracked as unbound-force/website#413", which GitHub renders as a link), tasks.md task 4.1 (checked — "File website docs sync issue (unbound-force/website, docs label)"), and README.md:771, which documents the tier-preservation behavior the sync issue describes.

No change follows from this finding. The thread stays open for the reviewer's response.

Comment thread README.md Resolved
Comment thread tools/curate_test.go Resolved
Comment thread tools/compile_test.go Resolved
@jflowers

Copy link
Copy Markdown
Contributor Author

Filed as #206: Tracks a README clarification: the Trust Tiers table's validated row (README.md:789) reads "Agent content promoted by human review." and omits the content-bound preservation this PR introduces — a validated article keeps its tier only when the regenerated bytes are identical to the stored article, and changed content demotes to draft for re-review (README.md:771 documents this in the Knowledge Compilation section). The website-side trust-tier docs clarification rides the existing sync issue, unbound-force/website#413. Not changed in this PR (LOW).

jflowers added a commit to jflowers/gh-hud that referenced this pull request Nov 14, 2026
A feedback run that answers a review leaves its threads unresolved (the
reviewer resolves them), and its replies bump the PR's update time. The
unresolved count still said "4 threads" and the fingerprint changed, so
auto-dispatch started a second run to answer the first run's own replies
(seen on unbound-force/dewey#205).

Fetch each thread's last comment too, and count ThreadOpen: unresolved
human threads whose last comment isn't mine. Feedback dispatch keys on
ThreadOpen (or a reviewer acting after me); Thread still counts every
unresolved human thread for merge readiness and the dashboard.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
jflowers added a commit to jflowers/gh-hud that referenced this pull request Nov 14, 2026
When a run ended on lap1 while lap1's .local name was gone, the hub's
ssh export of the transcript timed out and the record was finished with
"ssh lap1: signal: killed": status unknown, no summary, for good, though
the transcript was still on lap1 (unbound-force/dewey#205's feedback run).

- runScript tells an unreachable machine (ssh exit 255, or the context
  ran out) from a command that failed there: unreachableError, matching
  errUnreachable.
- finishRecord marks such a record Unread.
- On each agent pass where the machine answers herdr, the owner reads an
  unread outcome again, backing off 2m, 4m … 30m, for 24h after the run
  ended. A reread fills in status, summary and failure detail, and the
  inspection when that failed too and nothing has run in the checkout
  since. Records from before Unread are recognised by ssh's timeout.
- An epic piece's review waits up to an hour for an unread outcome.

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 Re-review: APPROVE WITH ADVISORIES

This re-review supersedes the earlier CHANGES_REQUESTED review from this account (same head commit 142dfdad), taking the author's thread replies into account.

Reviewer Verdicts

Reviewer Verdict Findings
divisor-adversary APPROVE 0
divisor-architect APPROVE 0
divisor-curator APPROVE WITH ADVISORIES 1 LOW
divisor-guard APPROVE 0
divisor-testing APPROVE 0

CI: build-and-test PASS, MegaLinter PASS.

Prior Findings — Resolution

  • HIGH (README.md:768, website docs sync traceability) — Resolved. The sync issue exists as unbound-force/website#413 (open, docs label), traceable from the PR body, tasks.md task 4.1, and README.md:771. The prior check queried the wrong repository (unbound-force/dewey instead of unbound-force/website).
  • LOW (README.md:771 CHANGELOG) — Declined by author with rationale (release notes are generated by GoReleaser at tag time); accepted.
  • LOW (README.md:789 Trust Tiers row) — Declined by author with rationale; accepted.
  • LOW (curate_test.go:495 2ms sleep) — Declined with rationale (the sleep is documented and load-bearing for the updated_at no-write assertion); accepted.
  • LOW (compile_test.go:2100 retry loop) — Declined with rationale (the loop covers the compiled_at second boundary; failure is loud, not a silent flake); accepted.

Advisory

One LOW documentation advisory remains (inline comment on tasks.md): the website#413 body should enumerate the affected docs pages and the specific updates. Issue-body edit only — nothing blocking in this PR.

Verdict

APPROVE WITH ADVISORIES — one LOW, informational advisory; no CRITICAL or HIGH findings. The content-bound validated tier design (store-owned hash equality, compile draft-on-regeneration, curate curated-on-change) is sound and well tested (VTB-FR-001..005; issue #204 acceptance criteria 3/3 covered).

This review was generated by /uf.review-pr (AI-assisted).


## 4. Docs and constitution alignment verification

- [x] 4.1 [P] File website docs sync issue (unbound-force/website, `docs` label) for user-visible `compile` tier/frontmatter change and retain `verified` site state until re-promoted

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 — documentation (advisory, non-blocking) · divisor-curator

unbound-force/website#413 is filed and open for the compile tier change, but its body does not yet enumerate the affected docs pages or the specific updates. The AGENTS.md Website Documentation Sync gate asks sync issues to name which website pages need updating and what changes.

Follow-up (issue-body edit only — no change to this PR): list the affected pages (e.g. trust tiers, compile/curate tool docs) and the specific updates — tier demotion on regeneration, the content_hash preservation witness, re-review queue re-entry, and curate re-index behavior.

@jflowers
jflowers merged commit 6a12069 into unbound-force:main Nov 14, 2026
2 checks passed
jflowers added a commit to jflowers/gh-hud that referenced this pull request Nov 14, 2026
On my own unbound-force PRs the bot's review was due only while it
hadn't reviewed the head commit. A feedback run that answers a
changes-requested review with replies (no code change) leaves the head
reviewed, so the PR waited on a re-review nothing asked for
(unbound-force/dewey#205).

BotReviewDue is now also true when the bot's latest review of the head
commit requested changes and I've reviewed (thread replies) or commented
since. A re-review resets it; review's round limit still caps it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@jflowers
jflowers deleted the opsx/demote-validated-on-regeneration branch November 15, 2026 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: regenerated compiled article keeps the validated tier of the content it replaced

2 participants