Replace CLAUDE.md with a short decision-rule constitution; move PRDs,
architecture, development and design docs and repo skills out of the tree;
delete the docs tooling (docsgen, prdlint, docdrift, docsite, contractaudit,
reachaudit) and its gate steps; stop install.sh copying repo skills into
runtime skills.
The gate resolved a citation with a filesystem stat, so a directory left behind
by a checkout that removed its files -- internal/gate and internal/gate/gateeval
among them -- resolved on the developer's machine and did not exist in CI. The
baseline was generated that way, so it passed locally and failed CI on the same
commit, which is the state a gate must never be in.
Read the tracked tree from git ls-files and resolve against that: a tracked
file, a directory containing tracked files, or a file-shape template matched
against tracked siblings. Failing to read git is fatal rather than a fallback to
the filesystem, because the fallback is the bug being fixed.
Regenerate the baseline, which now records the citations the filesystem check
was masking. Verified by running the tool in a clean worktree at HEAD: identical
counts to the working tree, exit 0.
docs/architecture is declared authoritative for settled design, so a page that
cites code which has moved actively misleads every session and every subagent
brief that reads it. Nothing in the gate compared a prose citation against the
tree: docsgen checks the contract schema against Go types, docsite checks
generated artifacts against their Markdown sources, prdlint checks PRD writing
style. All three verify internal consistency, so a page can describe a package
deleted months ago and every check stays green -- which is how a page describing
a removed system survives behind a hand-written "removed" banner.
Add tools/docdrift. It resolves every internal/... citation under docs/ against
the tree and fails on one that dangles, handling the shapes prose actually uses:
a package with a symbol (internal/config.Config), a test with its package
(internal/app/archieui/TestFoo), a file-shape template
(internal/webui/api_<concern>.go), and a Go package pattern (internal/...).
Generated artifacts are skipped so embedded page bodies are not double-counted.
The baseline is a burn-down list of the 48 citations already broken -- packages
that moved (internal/store, internal/memory, internal/nats) and ones never built
(internal/policy, the image and research capability docs). It is not a licence:
the check also fails when an allowlisted citation starts resolving again, so an
exemption cannot outlive its reason. Regenerate with `docdrift list`.
Wire it into `task check` as docs:drift.
Also correct AGENTS.md, which listed `policy` among the cross-cutting packages
sitting under internal/. No such package has ever existed in this tree; the
design is approved and unbuilt (docs/architecture/policy.md). That is exactly
the class of stale claim this check now catches.
archie-agent mcp is a stdio MCP server, on the official go-sdk, serving a
stage's capture tools and appending accepted calls to a captures file.
The harness runner writes the tool spec and a standard mcpServers config,
registers it through HarnessSpec.MCPConfig, and reads the captures back
into the stage result. The captures file is writable by the harness user,
so the worker validates every record again with the same acceptCapture
the built-in loop now shares, and forged, undeclared or over-cap records
are dropped. A stage with capture tools on a harness without MCP is
refused before it runs.
The harness runner made internal/agentexec import go-git, which the tools
module reaches through docsgen, so tools/go.sum needed its entries; tidy
also dropped the stale modernc sqlite requirements. Request gained the
Harness field, so contracts.json is regenerated with the HarnessSpec
schema.
Add a self-contained design handoff under docs/design/ui-redesign/ (README,
build prompt, HTML mockups, design-canvas sources, CSS and JSON theme
tokens). docs/design/ is held back from the published docs sets like
docs/inspiration/: it is input to building the UI, not a page to read.
Remove the superseded service-decomposition research from docs/inspiration/.
docs/development/ holds one page per kind of change (settings, State Store
and persistence, task lifecycle, workflows and steps, event automation,
dashboard, agent execution and containers, processes and wiring, merging
work), each naming every layer the change must reach and pointing at the
document that owns the design. The docs build puts them in the development
set; docs/index.md and CLAUDE.md link them.
Also adds the container-profile case to the validator agreement test, the
check the profiles work skipped.
The State Store, event capture and Gateway conversations already serve from
PostgreSQL. This deletes internal/store and internal/infrastructure/edastore,
the SQLite gateway session store and openProductionTaskStore, and the -db
recovery path on a legacy task file; backup, restore, validate and rollback
work on the database database_url names.
- The binding-secret cipher moves to internal/infrastructure/bindingcipher and
ToolCall to internal/infrastructure/postgres.
- NewSessionStoreMemory is now a pure in-memory store that passes the shared
SessionStore conformance suite.
- Tests run against PostgreSQL through internal/infrastructure/postgres/pgstore;
legacyimport/legacyfixture writes the legacy files the import and the boot
gate read.
- The cron dialect is owned in internal/domain/scheduling, so
github.com/pocketbase/pocketbase and pocketbase/dbx leave go.mod.
modernc.org/sqlite stays for the one-time import (legacyread).
- The UI and Messaging architecture gates ban the Postgres and legacy readers
in place of internal/store.
goose migration 0001 lands the twelve State Store tables on Postgres, and sqlc generates the task queries from it. Two behaviours that genuinely differ from SQLite are pinned by tests against a real PG 18: claiming takes the oldest queued row with FOR UPDATE SKIP LOCKED (without the clause a second claimer blocks, which the test shows by timing out), and every column behind a Go int is bigint -- SQLite's INTEGER is 64-bit, and the chat issue-number allocator seeds at 10^15, which does not fit an int4.
task db:generate writes the committed postgresdb package; task db:check regenerates it in the gate, as proto:check and ui:check do.
The remaining store methods (events, resources, identities, the status tables) still run on SQLite: porting them is the rest of archie-core-7r0x.2.
docs:artifact:check regenerated the artifact from a directory walk of
docs/, which also sees an UNTRACKED page. The committed artifact then
looked stale and the gate demanded a regeneration that was already
correct -- one that would have committed a page belonging to no commit.
It cost two sessions in one day: a migration branch, and an unrelated
writer adding a PRD.
Enumerate through `git ls-files --cached` instead, so a page the commit
carries is required in the artifact and a working-tree scratch file is
not. The index counts as well as HEAD, deliberately: a page staged for
this commit is about to be carried by it. Outside a git work tree there
is no commit to disagree with, so the walk is kept and says so on stderr
rather than passing as the stronger guarantee.
Test fails against the walk with the gate's own message ("is stale;
regenerate it by running ...") and passes against the enumeration.
Beads sync to a Dolt remote, so anything written into one is published.
Two beads filed earlier today named an operator host, its internal
address and its filesystem paths -- the tracker was treated as a private
store, which it is not.
The rule is stated where the tracker is described, next to the existing
one about .beads/ never reaching a commit, because it is the same class:
the tracker is not a private store. Host-specific facts belong in the
operator's memos instance, which a bead may point at.
release.sh decided which commits a release carries from two package closures,
cmd/archied and cmd/archie-agent, plus a short explicit list. The Messaging
Service, the State Store, the playbook runner and the UI ship in the host
bundle but were not named, so a change to a package only one of them links
closed over no component and the release omitted it silently: the telegram
fence fix in 1.37.1's range was dropped this way, and releases since the
Messaging Service was severed from archied in 1.35.0 have been incomplete.
The gap is pre-existing, not introduced by the one-stream change: the old
two-file closures named the same two component directories. What changed is
that the omission is now visible, because a release is one tag with one set of
notes rather than two independent ones.
Each shipped binary's closure is now part of the release, so a change only the
messaging service, state store, playbook runner or UI links lands in the
changelog instead of nowhere.
A tool call rendered as a label line plus a ```text fence. Telegram draws a
fenced block as a full code widget (language header bar, copy button, panel),
and the block parser inserts a spacer paragraph before every block, so one
call cost four rendered elements. Three calls filled the screen to show three
word counts.
Every toolPreview path already summarises to a single line, so the fence was
never wrapping more than one. Drop it and put the preview on the header line.
Tool lines now join with a hard break rather than a bare newline: a soft
break would space-join them into one run-on paragraph, and a blank line would
put the spacer back. Three calls are now three consecutive blocks.
Two hardcoded values go with it. The status word is printed only when the
outcome is not success, since every line otherwise read "done" and
distinguished nothing. The icon is no longer a literal in the renderer: each
builtin declares its own on tools.Tool (not on Schema, which is the model's
contract), the provider carries it into ToolEntry, and the turn snapshots the
registry's icons alongside its tool set. A tool that declares none renders
without one rather than borrowing a generic wrench.
Carries a dependency upgrade (go.mod, go.sum, tools/go.mod, tools/go.sum).
CHANGELOG.archied.md and CHANGELOG.archie.md were two version streams that
drifted: a release that moved both components had two numbers, two pages and
two tags, and a reader had to visit two files to learn what shipped.
The merged history holds 65 versions from 64 archied and 34 archie sections --
33 that both components released, 31 only archied, one only archie -- so 98
published pages become 65. A version's date is the newest of its sections'
dates, and a component whose own date differs carries it on its label, because
the history has two dates and the merge must not invent one. `## [Unreleased]`
is not a release: it gets no page, and it stays at the top of the file.
A level-two heading is where the merge could silently drop a section, so the
merge is verified by content rather than by the generator: section counts per
source, the merged version set against the exact union, and every source `###`
title present both as a substring and, after stripping the component prefix, as
an identical heading. Counting `##` headings rather than releases overcounts by
one here, which is how the empty `[Unreleased]` block was caught.
- newsgen reads one file and writes `docs/news/<version>.md`, the index, the
canonical `releases.json`, and `docs/news/redirects.json`. The redirect table
is what keeps the retired `/news/<component>/<version>/` URLs alive; it is
generated beside the pages so it cannot drift from them.
- release.sh takes one `--version`, keeps commit and tag (the Woodpecker
pipeline that will own them does not exist yet), and exits 3 when the commit
set justifies no release, so a pipeline can finish green without tagging.
- The consumers of the two files follow: the deploy workflow's tag gate and
release-notes extraction, the zip contents, the update check's changelog
links, the packaged-path note, the docs skill, and newsgen's tests.
The per-component detail survives as labelled sections inside each release, so
a reader still learns whether archied or the agent changed; what goes away is
the separate numbers and the separate pages.
The site's sidebar held the landing page and one guide next to seventeen
architecture records, the migration register, the review procedure and five
PRDs. Nothing there is secret -- every development page may be read by anyone --
but a reader who wants to know what Archie is and how to point an event at it
was meeting contributor material with no signal that it was not for them.
One source tree now yields two sets: public (index, guides/) under /docs/, and
development (architecture/, prds/) under /dev/, each with its own artifact and
its own derived sidebar. archive/, inspiration/, news/ and the credential notes
stay out of both, unchanged.
Selective PRD publication is gone rather than carried over. It existed only
because settled architecture cites PRDs and a link to a held-back target fails
the generator, so five PRDs published to keep those citations alive; with both
halves of every such citation in the development set, the exception has no work
left to do. Both sets are generated in one pass over one url map, so a citation
that crosses between them resolves to the base its target is served under, and
the refusal now fires only for a target genuinely in neither set.
Widening the set exposed a scanner bug worth its own note: the link regex
matched `Resolve[T](i, src, exportPath)` inside a code span and refused the page
for a link to `i,`. Code spans and fenced blocks are now skipped, because what a
renderer draws as a link is the only thing this tool may rewrite or refuse a
page for.
docs/prds/public-and-dev-docs.md records the decision. Draft: the three choices
in it are the maintainer's, the write-up is not yet reviewed.
MkDocs retires and the Astro app becomes the only public site, so the artifact is
the product and the Markdown stays the source -- the split tools/newsgen already
states for releases. tools/docsite walks the published set and writes
docs/data/generated/docs.json: every page's directory-style url, title, section and
raw Markdown body, plus the sidebar tree derived from the layout.
Three things the artifact has to get right, each of which was wrong in a draft:
- LINKS. The published pages carry relative .md links that MkDocs rewrote at build
time and nothing else will. Each is rewritten to the target page's url using the
same function that builds urls, so a link and its target cannot disagree; anchors
and scheme-qualified links pass through; assets resolve by the same rule and none
are referenced.
- FRAGMENTS. A link can resolve to a page and still be broken, because a fragment
matching no heading lands the reader at the top of a long document. Each is
checked against the target's headings, by the slug rule a table of contents uses.
- REFUSAL. A link whose target the set holds back, or whose fragment matches no
heading, fails the generator naming the file, the line and the target. This found
three citations from settled architecture pointing at two PRDs the blanket prds/*
exclusion withheld -- links that were already 404s on the published site, so the
exclusion broke citations rather than withholding drafts. Both targets are now
published, for a reason distinct from the three ratified PRDs already published.
The published set moves out of mkdocs.yml into the generator with its reasons: a
renderer reading the artifact cannot see why a page is absent. docs/data/generated
is accounted for by docsgen's generatedArtifacts, which now names this file beside
contracts.json -- one ownership registry for the directory rather than one per
writer, so neither tool reports the other's artifact as unaccounted.
docs:artifact regenerates; docs:artifact:check reproduces into memory and fails on
drift without touching the tree, wired into task check beside news:check. The
existing docs:site target is MkDocs and was left alone -- a first attempt at that
name silently ran MkDocs and produced nothing.
Verified: task check exit 0, docs:artifact:check reporting 23 pages. The artifact
carries 23 pages, no archive/ inspiration/ or news/ entry, and the five PRDs the
set declares. Coverage: the published set and its count, url derivation, the nav
tree, both refusal paths, and check's no-write guarantee.
Derive a public news page and one release-notes page per component version
from CHANGELOG.archied.md and CHANGELOG.archie.md, the notes the release
process already freezes.
- tools/newsgen writes docs/news/releases.json, the canonical artifact a host
renders from, plus the MkDocs pages. Check mode fails when the committed
files lag a changelog edit, and runs in task check; tools/release.sh --tag
regenerates and stages them in the release commit, skipping files already
current.
- mkdocs.yml keeps the version pages out of the derived navigation without
excluding them from the site.
The sender drove only the capture intake, which is the one inbound path a
config change cannot break. It now also signs a GitHub issue delivery for
[forge].webhook_addr: X-Hub-Signature-256 over the exact bytes, the event
header, and optional --assignee/--label so the payload can satisfy a
bot-user or label trigger. The signature is the same digest
webhookguard.VerifyHMAC computes, so a refusal here is the receiver's
policy rather than a mismatch in the tool.
--url now names the intake a send goes to (dashboard for capture, receiver
for --forge) and --api names the dashboard for the read-back, which is a
different host once the receiver has one of its own.
The playbook engine PRD passed the guard while carrying a whole second PRD
inside a list item. Three separate blind spots, each with a test:
A second **Status:** field was invisible twice over. lintStatus returned on
the first status it found, and its pattern was anchored at ^, so an indented
one inside a list item was never read. It now checks every status line and
reports a second one as what it is: a nested document that belongs in its
own file.
dated-status matched verb-then-date only, so "(2026-08-22, decided)" and
"surveyed 2026-09-03" read as clean. It matches either order now, plus the
words that turn a date into provenance for a finding rather than a fact.
Rules were line-scoped, so a citation broken across a line wrap was two
innocent lines: "...Dedup section, lines" then "155-159, the rule". Each rule
now also tests the line joined to its successor, reporting the line the match
starts on.
Three defects the first sweep left behind, each caught by a rule the guard
did not yet have.
Statuses. RULES.md gives three; the tree had 25 values, and the free-text ones
were carrying progress. "Implemented (wiring landed)" and "Ratified (rev. 2e).
Rev. 2e adds the OpenTaskByPR lookup. Rev. 2d revised section 10..." were both
changelogs living in the one field the other rules exempt. Every PRD now
declares Draft, Approved or Finalised and nothing else; five that declared
nothing now declare one. A revision number moves to **Revision:**, a pointer
to the authoritative document to **Authority:**, and what a past revision
changed to git. CLAUDE.md's citation of state-store-contract rev. 2e still
resolves.
Stale cross-references. "Supersedes the 2026-09-03 open question", "this
bullet previously said", "an earlier draft of this document claimed" all point
at text the reader cannot see, because it was replaced. A supersede marker
survives only when it names a file, a section or a symbol that can be found.
Temporal hedges. 100 uses of today, currently and right now across 31 files.
Each dates its sentence to the day it was written: "[notify] today is one
webhook URL, read in one place" stops being true the moment this design lands,
while still reading as the premise it rests on.
The header-field exemption was also too wide. "**Date:** 2026-09-03, Channel
resolved 2026-09-22" smuggled a dated status into the one line the rules did
not read; the exemption is now a Date holding only a date and a Status holding
only one of the three.
golangci-lint ran ./... from the repository root, which stops at the root
module, so the tools module was never linted and had drifted unseen. task
check already closes this hole for tests with test:tools; lint now has the
same shape in lint:tools, which runs in the tools directory rather than
passing a path prefix that only rewrites output paths.
Fixes the six issues that had accumulated behind it:
stripJSComments was 21 cyclomatic complexity against a cap of 15, with the
comment-skipping and literal-copying loops inlined into one scanner. It is
four named functions now, and the De Morgan warning went with the rewrite. It
had no test despite deciding whether a commented-out call reads as a live
consumer, so it has one: literals that look like comments, comment markers
inside strings, escapes, and unterminated literals and block comments.
docsgen's missing-artifact error ended in punctuation, and three test type
assertions were unchecked, which panic rather than fail when the generated
artifact does not have the shape the case assumes.
A PRD states a decision, a requirement, a constraint or evidence. Those
survive the code moving underneath them. A line number, a progress report or
a dated status claim does not: it is true on the day it is written and
silently wrong a month later, while still reading as authoritative.
prdlint rejects five shapes: file:line citations (including a document citing
its own line numbers), dated status claims, progress reports on the work
being designed, phase-completion narration, and records of how a finding was
produced. Each finding names the file, line, rule and fix.
The rules target decay, not subject matter. A PRD may describe a phased plan,
name a dependency that exists, and carry its own Status and Date header
fields; what it may not do is assert the state of the tree on the day it was
written. Fenced blocks are skipped, since a listing may specify a line
reference as its literal content.
Wired into task check next to docs:check. A sweep alone would not stop the
class recurring.
Posts to /webhooks/capture/{source} with a realistic GitHub, Sentry, form or
large payload (or an exact body), reads the capture back so a silent drop is
visible immediately, and names the intake's rate and size limits when it
hits them. Wired as task webhook:send.
* fix(ui): make the served lifecycle vocabulary actually load
base/task-meta.jsx documents the backend as the source of truth: /api/task-meta
returns the statuses (label, pill severity, "needs you") and the operator
actions, and loadTaskMeta() replaces the freeze-dried defaults with that
catalog. Nothing called it. Every pill, status filter and action control read
the snapshot, so a catalogue change on the server never reached the browser --
the module's first paragraph was simply not true.
main.jsx now asks for the catalog once at boot, alongside the capabilities read
it already does for the same reason: the shell paints immediately and upgrades a
moment later.
The two vocabularies the dashboard mirrors rather than serves -- FILE_STATUS
(ids owned by internal/domain/workflow/task/changes.go) and CONFIG_SCHEMA
(events.ConfigCapturedSchema) -- are now documented as the deliberate second
tier, with their two-sided pins named, so the tree stops telling two stories
about where a vocabulary comes from. Both degrade to a raw id or the verbatim
payload rather than rendering something wrong, which is why mirroring is
tolerable there and not for a presentation catalog.
RED before (loader never called):
x booting the dashboard replaces the freeze-dried vocabulary with the served catalog
actual: 'custom_status', expected: 'Custom status'
Also repairs a drifted LAW asset. A fresh build of pristine main dirties both
ui/dist/assets/index.css and index.js: 04d4d8f1 (#889, memory unification slice
5) changed ui/src without rebuilding ui/dist, and task check runs task ui --
which repairs dist instead of verifying it -- so a stale dist is invisible to
the gate. Rebuilding here restores the invariant; a dist-freshness gate is filed
as follow-up.
* fix(ui,gateway): restore the search focus the port dropped, and the page registry truth
An adversarial review of the port (278b7fc6) found three things worth acting on.
1. Topbar search -- a regression the port introduced. The el() version focused
the input when the narrow-layout toggle opened it, and blurred it after a
successful jump; the port kept neither. That layout hides the field with
width:0/pointer-events:none until .is-open or :focus-within, so without
focus() the caret was not in the field the operator had just opened, and
without blur() :focus-within left it expanded across the topbar after the
jump. Both calls are back, with the ref they need.
2. dashboard_tools.go advertised a page that does not exist and omitted two that
do. The registry calls itself "the single source of truth for what the
dashboard exposes", but it is a hand-copy of the route table in
ui/src/main.jsx: /memory stayed after the page was deleted (that deletion
also left ui/dist stale -- archie-core-1vhh), and /bindings and /curators
were never added. So the agent could hand the operator a chip to a route that
now falls back to the dashboard, and could not answer "where do I go for
playbook bindings?".
3. TestDashboardPagesRegistryCoversEveryRoute did not test that. It asserted
three hardcoded paths and passed while the registry listed a deleted page. It
now reads the route table back out of ui/src/main.jsx and compares in both
directions, which is what makes the registry's claim holdable. RED before:
route "/bindings" is a dashboard page the registry does not list, so the agent cannot point at it
route "/curators" is a dashboard page the registry does not list, so the agent cannot point at it
registry lists "/memory" (Memory), which is not a dashboard route: the agent would send the operator somewhere that does not exist
Also deletes the dead .chat-page rules the deleted chatPage() bridge left
behind: nothing renders .chat-page any more (chat.jsx renders
.chat-page-content, and the drawer sizes it from layout.css).
Not changed: the unreachable `soon` path, which predates the port and was
reported rather than acted on.
* fix(build): verify ui/dist is fresh instead of never looking at it
ui/dist is committed because the Go build embeds it, so it is a generated
source file. Nothing in the gate read it: task check does not run task ui, and
nothing else compares the bundle with ui/src. So when 04d4d8f1 (#889) changed
ui/src without rebuilding, the committed bundle went on serving the Memory page
whose source had been deleted -- with the gate green throughout.
task ui:check (tools/uidist.sh) rebuilds into a temporary directory and compares,
never rewriting the committed artifact. That is the rule docs:check already
states for the contract reference -- a gate that silently rewrote the artifact
would bless an unintended change with no reviewer ever seeing it -- and it
matters more now that several agents work in their own worktrees, where each
could otherwise pass while producing a different bundle.
Evidence:
fresh tree exit 0, matches
hand-staled bundle exit 1, names the differing file
the #889 drift replayed exit 1, names BOTH index.css and index.js
(pre-#889 bundle, post-#889 sources)
git status after a run unchanged: the check never writes ui/dist
Cost: ui:check declares ui:deps like ui and test:ui do, so the gate runs npm
install once per dependent. Task's sources/generates up-to-date check does not
apply to a node_modules directory (measured: it ran on every invocation), so the
target does not claim otherwise; guarding that is follow-up work.
Gate: task check exit 0, UI suite 230/230, all Go packages ok.
* fix(ui): make the served vocabulary reach an already-painted page
Greptile's finding on the first cut of this fix, and it was right: loadTaskMeta()
resolves after a page has painted and only mutated module state. The route tree
renders into its own root, so App re-rendering cannot reach it, and a painted
page kept the freeze-dried labels it read on the way up.
show() is split so the page render can be repeated on its own: renderRoute()
mounts the current route into the outlet without the teardown/chrome side
effects, and the catalog effect calls it once the catalog lands. The key is
unchanged, so Preact re-renders the mounted page in place and keeps its state.
Deeper instance of the same defect, found while fixing that one:
task-filters.jsx captured the vocabulary in module-level constants at import
(ATTENTION_STATUSES/TASK_STATUSES), so the task filter could never see a served
status, no matter when or how correctly the catalog landed. Both are read at
call time now.
Tests, and what they actually cover:
- the task-filter test has teeth: with the source fix stashed it fails, with
the fix it passes.
- task-meta-late-catalog.test.js guards the boot fetch end to end (it fails
when loadTaskMeta is never called), but it does NOT isolate the re-render:
a page also re-renders for its own reasons, so the assertion holds without
renderRoute too. Said plainly here rather than implied as coverage -- the
fix makes the re-render deterministic instead of incidental, and this
harness cannot tell those apart.
- it lives in its own file because main.jsx boots once per process; a second
test in the same file would assert against a detached tree.
UI suite 232/232, task check exit 0.
The whole-package section hard-truncated tracker hit text to 56 chars
with no ellipsis, so long issue titles cut off mid-word (e.g. "...neither
re"). Switch to the same indented-list format already used for the
in-package section instead of a fixed-width single line.
reachaudit classified whole unreachable packages but explicitly skipped
findings inside packages already in the cmd closure ("reported separately
as live-package findings" -- never implemented). That's the more common
half-built-feature shape: the package ships, one symbol at its call site
doesn't (crondelivery.ChatCourier, eda/playbook.Store.Dispatch,
gatewayrpc.StoreClient). Add a second in-package-* report section using
the same tracked/untracked/dynamic classification. Also wires the --md
flag, which was accepted but never written.
Direct bumps:
- github.com/nats-io/nats-server/v2 v2.14.6 -> v2.15.0
- github.com/nats-io/nats.go v1.53.1 -> v1.54.0
- github.com/samcharles93/ai-sdk v0.1.32 -> v0.1.39
- google.golang.org/grpc v1.83.2 -> v1.84.0
- modernc.org/sqlite v1.58.0 -> v1.59.0
- golang.org/x/net v0.58.0 -> v0.59.0
- golang.org/x/term v0.45.0 -> v0.46.0
Indirect: go-humanize, x/crypto, x/exp, x/sync, x/sys, x/text, x/time,
genproto/googleapis{,/api,/rpc}, modernc.org/libc.
tools/ is a separate module and needs its own tidy to match the root's
ai-sdk and sqlite bumps. docs:check runs it with -mod=readonly, so a
stale tools/go.mod fails loudly there rather than being rewritten.
Add `task deadcode` (whole-program RTA from ./cmd/...) and `task reachaudit`
(the existing classifier on top of it). Neither joins `task check`: both
report a standing backlog, so gating on them fails every run until that
backlog is zero, same as `task vuln`.
`task deadcode` shells to `go run ...@latest` rather than a local binary on
purpose. A deadcode built against an older Go than this module exits non-zero
and prints nothing, which reads as "no dead code" instead of "analysis
failed" -- the locally installed copy was built against 1.26 against a 1.27
module and had been silently reporting an empty tree.
reachaudit had two traps that made it answer confidently from nothing:
its --repo default pointed at a path that does not exist on either machine,
and it reused /tmp/reachaudit-deadcode.txt with no staleness check, so it
would serve a previous tree's analysis indefinitely. Key the cache on HEAD
and refuse it outright when the tree is dirty.
Also lands the design for tools/symbolrefs, the type-resolved reference
index that covers what reachability cannot: RTA treats every address-taken
function as live, so every reflect.ValueOf entry in the *extract tables
launders a dead symbol into a reachable-looking one, and deadcode reports
functions only, leaving dead package vars unrepresentable.
All three Greptile findings were valid against the code; each is fixed at its
cause rather than at the symptom, and each fix is covered by a test that
fails when the fix is reverted.
**Check could silently write.** `check` was matched only as the first
argument, and leftover positional arguments were never inspected. So
`docsgen --repo-root .. check` — and any misspelled subcommand — fell
through to the write path and overwrote the artifact the check promises not
to touch. That is the exact guarantee the mode exists to provide, so the
failure was silent and in the wrong direction.
Extracted argument handling into a testable `parseOptions` and made a leftover
positional argument an error with usage text. Switched the flag set from
`ExitOnError` to `ContinueOnError` so the error surfaces as a value rather
than a process exit, which is what makes it testable.
**Obsolete detection claimed files it does not own.** It treated every
sibling `.json` as docsgen's and reported it obsolete, so checking an
artifact in a mixed-use directory produced a false stale result, and the
documented target layout — which anticipates further named artifacts in
`docs/data/generated/` (catalog.json, AsyncAPI output) — would have been
reported stale as soon as a second artifact legitimately existed.
Ownership is now declared rather than inferred: `generatedArtifacts` maps each
directory docsgen owns end-to-end to the names it produces there, and a
directory docsgen does not own is never judged. A new unit test pins both
halves — the orphan inside an owned directory is still caught, and a foreign
`.json` in an arbitrary `--out` directory is not.
**Provenance traversal stopped at one level.** Refs were walked only inside
the top-level contract schemas, so a definition reachable solely through
another definition resolved to "no authoritative definition found" — the
diagnostic lying about the code it points at. Replaced the single pass with a
breadth-first walk that follows discovered definitions transitively, seeded
with every published contract first so a definition reachable from several
contracts is attributed to the alphabetically first rather than to whichever
the walk happened to reach. `walkSchemaRefs` now iterates map keys in sorted
order for the same reason.
`schemaProvenance` takes its roots as a parameter, which is what makes the
transitive case testable without real types.
Verified by mutation: with each fix reverted in turn, its test fails —
`parseOptions(["--repo-root" ".." "check"]) returned nil error`,
`obsoleteArtifacts() = [...someone-elses.json is obsolete...]`, and
`provenance[Leaf] = ""`. Control run passes unmutated, and the file is
byte-identical after restoration.
Also confirmed end to end that the previously silent invocation now exits
non-zero with usage instead of writing, and that the committed artifact is
untouched by it.
`task check`: exit 0, 0 failures.
`docs/data/generated/contracts.json` sat stale since 4b340d2b with nothing
to notice: no task, no test, and no CI step regenerates or compares it, so
the committed contract reference quietly drifted from the Go types it
claims to describe. It was only found by hand-running the generator.
Implements Step 6 of docs/architecture/generated-documentation.md, which
already specified this command and closed the gap filed in
docs/prds/contract-conformance-audit.md ("`docsgen check` is documented and
does not exist"):
1. generates into a temporary directory;
2. normalizes line endings;
3. compares the schema trees with the committed output;
4. reports missing, changed, and obsolete files;
5. names the authoritative definition behind each mismatch;
6. exits non-zero without modifying the working tree.
The check never writes to the working tree, so the author applies the
regenerated bytes rather than the gate silently doing it. That is why this
is a `check` and not a CI auto-update: the code change that shifted the
contract surface should be reviewed with its regenerated artifact in one
commit, and a bot commit would bless an unintended contract change with no
reviewer ever seeing it. Step 9 states the same prohibition directly.
Diagnostics name the Go type, so a failure says where to look:
docs/data/generated/contracts.json is stale; regenerate it with:
go -C tools run ./docsgen --repo-root ..
schema "AgentExecutionResult" changed (authoritative definition:
github.com/samcharles93/archie-core/internal/agentexec.Result)
schema "MediaAttachment" changed (authoritative definition:
reached from .../internal/gateway.MessageEvent)
Nested definitions are attributed through the published contract that
references them, iterated in sorted order so the diagnostic is
deterministic when several contracts share a definition.
Usage: `go -C tools run ./docsgen check --repo-root ..`, plus the existing
`--out` to compare an arbitrary artifact.
Reuses the write path rather than reimplementing encoding, so check and
generate cannot disagree about the expected bytes.
Tests cover: the committed artifact is current (the regression guard that
would have caught this), changed/removed/missing/obsolete detection, and
that a failing check leaves the artifact's bytes, mode, and directory
contents untouched.
`task docs:check` wiring into `task check` is deliberately not in this
commit: Taskfile.yml is being edited concurrently in this working tree.
Verified with `task check` (green).
task fmt reformatted this file's fmt.Fprintf call; committing it rather than
letting it ride in the release commit, so the release diff stays the changelogs
alone. AGENTS.md: formatter changes are adopted verbatim.
Six tests asserted on the wording and formatting of source and config files
rather than on behaviour: four injected text into fixtures and checked that a
regex noticed, and two asserted on api.jsx's contents. They break on an extra
space, a newline, a rename, or a comment that merely mentions the token -- the
single-fetch check had already false-positived on a comment, and I patched it
with a comment-stripper instead of deleting it. A test that cannot tell "the
code is wrong" from "the file is formatted differently" tests the wrong thing,
and the maintenance cost is permanent.
Deleted: tools/contractaudit/negative_test.go in full, and the source-scanning
"api.jsx holds exactly one fetch call" check with its stripComments helper. The
dashboard suite still asserts the browser mutation contract behaviourally, per
method, by inspecting the request each one makes -- which is where the real
defect was found. 142 UI tests pass; the 45 methods remain fully covered by the
two inventories and the completeness check.
The tool's own decoding is now testable without a file: parseDeclarations takes
an io.Reader, so its rules are exercised with in-memory input, and only the
absent-file branch still touches a path (which is never created).
contractaudit is no longer part of task check. Its surfaces are discovered by
scanning source text, so a rename or reformat elsewhere can change its output
with nothing actually wrong -- it reported 16 live routes as unconsumed once,
when the dashboard's request helper was renamed. A check that can fail for
reasons unrelated to what it measures must not be able to break a build. It now
matches tools/reachaudit: advisory, run by hand, --strict available on request.
Also removes five unused indirect requires from tools/go.mod (go mod tidy).
They were residue from the reflection-based first implementation of the RPC
scan, which was replaced by text scanning without tidying. -mod=readonly cannot
catch a superfluous require, so nothing would ever have found them.
Rewrites docs/prds/contract-conformance-audit.md, which claimed RPC coverage was
derived by reflection over the exported client type -- it never was -- listed
surface sizes of 43/12/52 against real counts of 45/21/49, described three
classification classes where the code has four, invented a five-surface Shape
with files that were never written, and blamed raw fetch calls for a 401 defect
that did not exist. Each false claim is now recorded in an errata section rather
than quietly dropped, and the document states plainly that the audit has found
nothing actionable: the 415 refusals and the duplicated client plumbing were
both found by reading the handler and reproducing the request.
Testing rule added to the document, since this is the second time: assert on the
observable effect, never on the content or formatting of generated or
hand-authored text and config files.
Renaming the dashboard's request helper from req( to request( broke the
consumer extractor: it matched the call by name, so 16 live routes were
reported unconsumed. The extractor now keys on the call argument instead,
which survives a rename.
The first attempt at that fix was worse than the bug, and is recorded here
because the direction of the error is the whole point. Crediting any quoted
/api/... literal meant a comment, a retired-route array, or a display label
counted as proof a route was reachable -- so deleting every real request
still reported the surface as healthy. A false "unconsumed" is a loud,
fixable failure; a false "consumed" is a silent hole in the gate, which is
worse than having no gate at all.
A path now counts as a consumer only when it is the first argument of a call
in code. That excludes bare constants, dead arrays, object properties, and
commented-out calls, while still accepting any function name. Both halves are
pinned by tests: TestScanFileCreditsAnyCallSignature and
TestScanFileIgnoresNonCallLiterals, plus a surface-level
TestNegativeCommentedOutCallIsStillReported that the vacuous version fails.
Re-injecting either half of the bug fails the suite.
Requiring a call lost no real consumer: internal/webui still reads 49/49.
The remaining limits (path must be the first argument; template
interpolations unseen; routes credited per path rather than per verb) are
declared in docs/contract-declarations.json and the PRD rather than left
implicit.
Also corrects a measurement I had quoted inconsistently: proto/state/v1
declares 45 RPCs, not 43 or 46.