856e2eef7148472d1683c4d4e36edf1d6dfdd3bd
42
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
34c436fa99 |
build(tools): lint the tools module in the gate
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. |
||
|
|
7499e5559e |
build(docs): gate docs/prds against session-bound writing
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. |
||
|
|
7f1da81d52 |
feat(tools): a capture-intake sender for exercising the Events surfaces
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.
|
||
|
|
fffa6bc528 | feat(webui): refine system navigation and appearance | ||
|
|
d933d36449 |
feat(webui): bootstrap Vue 3 + shadcn-vue, replacing the Preact dashboard
Sam owns this codebase and reads Vue fluently, not Preact; a UI its maintainer
cannot read is the liability that outweighs the port. shadcn-vue is Vue-only,
so adopting it means the framework moves with it.
Scaffolded per the official Vite guide: `npm create vite --template vue-ts`,
Tailwind v4 via @tailwindcss/vite, `shadcn-vue init` (Reka UI, Lucide, neutral
base, CSS variables). Button and DropdownMenu are added, the latter being what
the pending navigation restructure needs.
Two deviations from the guide, both forced:
- The guide sets `baseUrl` alongside `paths`. TypeScript 6 deprecates
`baseUrl` and errors on it, and this project is heading for TS 7 native, so
`paths` stands alone and resolves relative to the config file. Not a
downgrade: the scaffold's typescript ~6.0.2 is untouched.
- vite.config.ts keeps `base: "./"` and unhashed asset names. ui/embed.go
embeds a committed dist/, served from a path the build does not know;
hashed names would also orphan a file in git on every rebuild.
The Preact app and its 43 test files are deleted rather than ported, on Sam's
instruction: tests return when there is behaviour worth pinning rather than a
port to re-assert. `task test:ui` is now a vue-tsc typecheck, which is what
would actually catch a broken component; an empty `npm test` would pass
vacuously.
ui/src/router/index.ts carries the route table and is the new source of truth
for TestDashboardPagesRegistryCoversEveryRoute, which parsed main.jsx before.
Keeping that contract alive matters: it is what caught the stale /chat entry
earlier today. Every route resolves to a named placeholder view, so an unported
page is visibly unported rather than blank.
golangci-lint now excludes ui/node_modules. The dashboard toolchain pulls in
`flatted`, which ships a Go implementation beside its JavaScript, and the gate
was failing on complexity in a vendored third-party file.
The shadcn MCP server is registered in the root .mcp.json. `shadcn-vue mcp init`
writes it to the directory it runs in, which for a nested ui/ is a path Claude
Code never reads.
|
||
|
|
f45ebd288d |
fix: address the Greptile findings on the merged PRs (#902)
* fix: address the Greptile findings on the merged PRs Four valid review findings from PRs #892, #893, #898 and #899, which were merged without the comments being read. - Config.Clone left the new diff-cap pointers aliased (#899, mine). Clone deep-copies every reference field, including the *bool beside it, so a clone could write the cap through to the published snapshot. Both the top-level field and the identity overrides are copied, with the clone test extended to cover them. - providerOutcomeRecorder.record could report an older call as the latest (#892). The completion time is taken before the lock, so two concurrent calls can reach the lock in the opposite order to their completion and the unconditional store overwrote the newer outcome. It now keeps the newer, via a recordAt seam that makes the reordering testable. - Curator model calls bypassed the recorder (#892). curatorLLMRunner calls the runtime directly, so a daemon whose only recent model traffic was curator work reported "no calls attempted yet" while the provider was demonstrably reachable. It records at its own adapter, and sendChatTurn's "single choke point" comment is corrected to say there are two. - A provider error reached /status raw (#892), unlike channel details, so a multiline or oversized error broke the one-line-per-fact layout. Both now share one bounded formatter. Found while fixing the curator path: agentexec.NewRuntime returns nil when no provider is configured, and a nil *runtime.Runtime panics on its first method call, so a curator asking for a completion took the daemon down. It now returns an error, and records nothing -- a local misconfiguration is not a provider call. Not fixed, filed instead: the shared lastPollAt masking a stuck identity, the container max-uptime callback resurrecting teardown bookkeeping, the dashboard dropping a served-only status filter on cold load, and the route registry test's line-by-line parser. * fix(build): drop goimports from the gate's formatter set `task check` spent 136 of its 167 seconds in `task fmt`, and 134 of those 136 in one formatter: goimports alone over the tree. golangci-lint's goimports formatter calls imports.Process once per file, which builds a fresh x/tools ProcessEnv each time, so internal/imports.getFixesWithSource re-reads modindex.Read($GOMODCACHE) per file. On this machine that index is 62.7 MiB / 2,081,070 lines (an 11 GiB module cache), and modindex's in-process memo does not take effect: 3 files read 187.9 MiB back, 15 files open the payload 15 times. That is ~53 GiB of I/O and CSV parsing per run, and it is linear at ~155 ms per file (122 files -> 18.8s, 864 -> 133.8s). Pointing the index cache elsewhere drops the same command to 3.9s. The same analyzer runs under `golangci-lint run`, so a cold cache pays it again: 169s cold with goimports, 31s without -- which is what CI and archied's own PR gate see, since only `fmt` never caches locally. Removing it costs no enforcement. gofumpt and gci remain, `task lint` still reports formatter drift as an issue, and the whole-tree fmt is now 2.2s with the tree byte-identical. What is given up is goimports' convenience of adding and removing import lines, which compile errors already cover. The examples/secret-engines exclusion stays: gofumpt and gci leave those Yaegi programs alone today, but the exclusion is the stated invariant that a formatter must not rewrite the imports of files it cannot type-check, and TestFormattersExcludeInterpretedSecretEngines holds it. Its comment no longer pins the reason to the formatter that was dropped. * fix(gateway): stop /status promising and mis-reporting health it cannot see Two findings from the cloud review of #892. Title generation no longer records chat-model health. It runs detached after a first turn under its own 30s bound and its error is swallowed by the caller, but it shared the process-wide outcome recorder, so a title that merely timed out overwrote the health line with "failed" -- reporting a broken provider on the strength of a call no user was waiting for. The /status command description no longer claims "workers" and "channels". Neither can render: newStatusHealth reads the container pool and the poll loop from boot, but the only production router.Health assignment is in setupGatewayChat, which runs solely in the archie-gateway process, where neither exists; channels is nil since the Messaging Service took the front-ends. Only the broker and chat-model lines actually appear, so that is what the help text now says. The underlying split -- daemon owns the facts, Gateway owns the Router -- is filed rather than patched here: it needs either a cross-process health contract or a ratified two-section /status, not a quick wire-up. |
||
|
|
2935010504 | fix(build): make formatting and CI converge (#901) | ||
|
|
2d3e4e59ad |
fix(ui,gateway): load the served lifecycle vocabulary, and make the page registry match the routes (#890)
* 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:
|
||
|
|
c29cdf6f79 |
feat(workflow): post line-anchored review comments with suggested fixes (#891)
* feat(workflow): post line-anchored review comments with suggested fixes Bead archie-core-q9au (docs/prds/inline-review.md). A review's findings reached the operator only as a flat list in the PR body, so the author had to map every finding back to its line by hand and apply mechanical fixes by hand. Now the line-anchored findings are also posted as inline review comments, carrying a one-click suggestion when the reviewer could state the fix. Domain (internal/domain/workflow): - ReviewFinding gains Suggestion; Validate rejects one on anything but a confirmed finding, so the agent's record_finding call is refused with something it can act on. Validate splits into validateAnchor / validateClassification / validateDisposition, which also brings it back under the cyclop limit the gate enforces. - StagePostReviewComments runs after StageOpenPR in the implement workflow. It posts only line-anchored findings (Line > 0); a whole-file finding has no line to attach to and stays in the body list, which remains the complete record. It is best-effort: the PR is open and the body already lists every finding, so a failed comment is logged, never a park -- the same reasoning as OpenPR's existing best-effort LinkBranch call. - The suggestion fence is gated on Verdict == confirmed where the fence is written, because it is a one-click apply: a wrong suggestion breaks the code and the author has to notice. Forge (internal/forge): ReviewCommentWriter + GitHub/Gitea implementations, type-asserted like PullRequestReader so a forge that cannot is skipped rather than faked (NoopForge is pinned as not satisfying it). GitHub loops one CreateComment per comment and joins the failures, so one refused anchor cannot drop the rest; Gitea carries them on a single COMMENT-state review. Two deliberate departures from the PRD's sketch, both recorded in it: - The interface is batch (CreateReviewComments), not one call per comment: Gitea's only inline shape is one submitted review, and the set then crosses NATS once instead of once per finding. - The head SHA is resolved inside each forge implementation rather than by the caller. The stage runs in archie-agent, which holds no forge credentials and has no PullRequestReader; the daemon-side forgerpc handler is the only place that does. Transport (internal/forgerpc): workflow.Forger gains the method, so the agent reaches the daemon over the new create_review_comments subject; the server type-asserts the writer and answers an incapable forge with an error the stage logs. This is the one proxied method whose absence on an image skew does not park a task. The reviewer prompt and record_finding schema ask for a suggestion on a confirmed, mechanically fixable defect only. Regenerating the wfextract symbol table -- the documented way a new exported workflow symbol reaches interpreted stage plugins -- also picked up symbols that were missing from the committed table (the Status* and Source* constants, ReviewCheck, Store, Task, and the _Store wrapper). Nil-guards were re-applied to every wrapper afterwards, as that file's header requires. Evidence: task check exit 0 (incl. 229 UI tests). Three mutations of the new stage logic each fail a test that names the behaviour -- dropping the confirmed-only gate, dropping the Line > 0 filter, and letting a posting failure escape -- so the tests discriminate rather than passing vacuously. * fix(build): drop the Dockerfile pin assertion The guard fetched golangci-lint's go.mod at image build time to fail the build when GOLANGCI_LINT_VERSION and GOFUMPT_VERSION disagreed. It only ever tripped on self-inflicted pin drift, but it added a network fetch and a new failure mode to the release build, which is not where that belongs. The pins stay correct (golangci-lint 2.13.2, whose vendored gofumpt v0.11.0 equals GOFUMPT_VERSION) and the comment above them still states the invariant, so the reasoning survives without the build-time machinery. The pin change itself reaches the agent image through the normal release path: CI rebuilds and pushes archie-agent on an archie/vX.Y.Z release, and a gateway-only release deliberately does not. * feat(workflow): add the remediate workflow for PR review remediation Implements step 5 of docs/prds/pr-review-remediation.md: a remediate workflow that resumes the task's existing worktree onto its PR branch (worktree.Manager.Resume, not Prepare's refresh), runs a builder agent against the review's actionable comments, commits and pushes to the same branch, and replies via the forge's ReplyToReview. Task.RetryCount doubles as the remediation round counter, capped by the repo's max_retries; the round-cap stage parks the task and posts one comment when it's hit. Task gains a ReviewPayload field (JSON-encoded review unit) with full store/proto/staterpc plumbing. workflow.Forger gains Comment and ReplyToReview, proxied to archie-agent via a new forgerpc RPC. Resume and its Dir lookup are added as an unexported optional Trees capability rather than widening the exported interface, which is already at golangci-lint's interfacebloat cap and is projected into wfextract's Yaegi symbol table for repository-authored stage plugins. The daemon-side reaction consumer that dispatches into this workflow (subscribing ARCHIE_REACTIONS, grouping comments by review, enforcing per-task serialization) is tracked separately in archie-core-8li9.4. * feat(messaging): extract standalone messaging service binary and process composition * feat(messaging): adapt channel frontends to consume Gateway ChatContract * feat(messaging): remove in-process channels and Router from daemon bootstrap Telegram, email and webhook now run only in the Messaging Service, which reaches this process through the Gateway's ChatContract. The daemon builds no channel and no gateway.Router, so the wiring that existed only to serve them goes with it: setupGateways, setupEmailGateway, setupWebhookGateway, setupTelegramGateway, buildTelegramRouter, makeTelegramReload and the release-announcement path helper. The seams those paths owned move to where they can still be honoured: - Channel ValidateConfig runs in archiemessaging.compose, which now returns an error, so a configured-but-invalid front-end fails the service rather than being dropped silently. - The inbound rate limiter moves to the Gateway process, which owns the only Router and therefore the only place a per-sender budget applies to every channel's turns. - The daemon's gateway readiness probe becomes a ContractProbe against the Gateway. It cannot observe a channel lifecycle it no longer runs, and a channel-count probe would have reported every daemon degraded. - telegramSetup is now chatSetup (in chat_setup.go), trimmed to the fields a chat turn runner actually reads. Telegram operator features that were wired only in the daemon (/update, release announcements, version reporting, SIGHUP reload) are not yet wired in the Messaging Service: archie-core-8cda.6.6. Channel lifecycle reporting: archie-core-8cda.6.8. The Gateway process builds no worktree manager, so review_pr is unadvertised on every channel: archie-core-8cda.6.7. * feat(messaging): re-wire the Telegram operator surface in the Messaging Service setupTelegramGateway satisfied eight telegram.Gateway seams from the daemon's own process. Each is resolved by where the fact it needs is owned, not by where it used to be built; the decision table is in docs/architecture/migration-decisions.md. Wired here: /update (built from this service's own [chat.telegram] check and install commands), the update-report relay (same sha256(bot_user)[:8] path the daemon wrote, so a pending report is found rather than written afresh), show_tool_calls, and /restart's config reload, which re-resolves the token and allowlist from this service's own file and refuses a reload that resolves to an empty token. /version is sourced from the Gateway: ChatSnapshot gains a Version field carrying the Gateway's rendered build block, read per call and bounded by the dependency timeout. cmd/archie-messaging deliberately takes no version ldflags, so it cannot report a partial upgrade as a matched one. RunningVersions and ReleaseAnnouncements stay nil. Both need a component's real running version, and the only versions this process can obtain are a different binary's stamps -- reporting them would manufacture exactly the false success the update check exists to catch, and the announcer without parseable versions is a no-op that reads as configured. archie-core-8cda.6.9 carries the contract that unblocks them. Dangerous stays nil: no composition has ever supplied a command authority. Enrich is dropped from the update service: componentInstallTypeEnricher read [nats], which this service must not decode, so the check command's own reported install type stands. * fix(workflow): guard inline review comments against head drift Two findings from the review of q9au. A comment's line numbers describe exactly one revision of the branch, but the forge resolved the pull request's head at posting time -- after the review had already read the worktree. A push in that window (a collaborator, a retry) meant the findings were anchored to whatever now occupied those lines, mislabelling instead of failing. The revision the review measured now travels with the comment set: OpenPR records it from the same worktree read it already performs (TaskContext.ReviewedHeadSHA), StagePostReviewComments threads it through Forger to forgerpc, and the forge refuses the whole set once the head it reads has moved off it -- which the best-effort stage logs, the PR body remaining the record. An unmeasured revision posts unverified rather than dropping every finding, so a worktree that cannot report one degrades instead of regressing. Suggestion was documented single-line only, because GitHub applies a suggestion fence up to its first line and a multi-line replacement would silently corrupt the file. Only the verdict was validated, so a multi-line suggestion reached the renderer and posted as that truncated fence. Validate now rejects an embedded newline, which makes record_finding refuse it with feedback the model can act on instead of the reviewer discovering the corruption later. |
||
|
|
c1f5977a39 |
fix(build): make task fmt apply the gofumpt rules task lint checks
`task lint` enables gofumpt's `extra-rules`, so it demands `func f(a, b int)` where `task fmt`'s bare `gofumpt -w .` left `func f(a int, b int)` alone -- and `task fmt` is the documented repair for a failing gate, so a contributor had no command that could satisfy `task check`. That is the same failure shape as the version drift fixed alongside it, one layer up: fmt and lint are not the same formatter, so only the rules they happen to share are safe. `-extra` matches `extra-rules`, and nothing reformats as a result: the tree is already clean under it (`gofumpt -extra -l .` is empty). Still open, filed as archie-core-q288: gci's custom-order places archie-core imports last where gofumpt sorts them alphabetically, so `task fmt` can still produce formatting it will never fix. That needs a decision about which formatter owns formatting rather than another flag, and it is a decision CI cannot currently surface at all -- the deploy gate never runs golangci-lint. |
||
|
|
0c9d61eed3 |
feat(tools): surface half-wired symbols inside shipped packages in reachaudit
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.
|
||
|
|
b09be5515d |
feat(config): let the State Store and Gateway listen addresses be configured
Both gRPC listeners took their bind address from a -listen flag default alone, with no config key. The port a service binds and the port its clients dial were therefore two separate facts -- the flag default, and [services.<name>].target -- with nothing keeping them in step. On a host that already owned the default the effect read as a code fault rather than a port collision: the store died with "bind: address already in use" while every client reported "state store: connection error ... error reading server preface: EOF". Cockpit binds 9090 by default, so this is not hypothetical. Verifying the dashboard on such a host needed a hand-written overlay plus a matching -listen, two things to keep in step by hand. - [services.state].listen and [services.gateway].listen now name the bind address. Precedence is -listen, then config, then a default applied by the loader. An empty result is a startup ERROR, never a fallback: net.Listen reads "" as "any free port", so defaulting there would bind the service somewhere no client looks and still report success. - Both flag defaults become "" so configuration can win, mirroring how archie-ui already prefers [web].listen over its flag. - Gateway listen defaults to the same constant as the gateway target, so a default deployment's client and server cannot drift onto different ports. [services.state].target still has no default: an empty target stays a startup error in the daemon and gateway, which no longer serve a local store. - ServiceConnection gains the field. Its doc now says clients read only Target and TargetToken, and Listen belongs to the process that owns the service -- the previous wording claimed the struct starts no listeners while carrying one. - deployments/dev.toml states each port once, beside the target it must match, so `task dev` is retargetable on a host that owns 9090 by editing one overlay. Tests. Unit: config defaults, explicit values, and precedence. Process: the existing real-process smoke test now takes its listen from configuration instead of -listen, so the end-to-end wiring is proven by the test that already starts the binary, with no extra process. Both were verified load-bearing by mutation -- inverting the precedence fails the unit test, and making the app layer ignore config fails the process test with "state: no listen address". Verified: task check exit 0. Also documented in config.example.toml, the configuration architecture table, and the `task dev` summary. |
||
|
|
dcaa98cc44 |
docs(site): make docs/ buildable as a documentation site
Adds an mkdocs.yml, a landing page, and `task docs:site` / `task docs:serve`. Deliberately hosting-agnostic: MkDocs is the same input Backstage TechDocs consumes, so choosing where this lands later costs nothing. exclude_docs holds back four subtrees, since everything under docs/ would otherwise be published. archive/ is superseded design and would compete with the current architecture for a reader's attention; inspiration/ discusses other products by name; prds/ are open decisions rather than settled design; github-token.md is credential setup. One PRD is let back through because architecture/migration-decisions.md links to it three times, and a page excluded out from under a live link is just a 404 with extra steps. No nav block. MkDocs derives it from the directory layout, so a new page under docs/architecture/ publishes without a second edit, and there is no hand-maintained tree to drift against the repository. Builds --strict, so a dead internal link fails rather than ships. |
||
|
|
38c0e485bc |
chore(tools): make unreachable-code analysis runnable from the Taskfile
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. |
||
|
|
641c80f7d9 |
feat(build): gate generated contract data in task check
Closes #855 (archie-core-5gzx). The check mode added in the preceding commit had no caller, so it prevented nothing: a stale contracts.json still passed every gate. This wires it in and makes drift fail the build. - `task docs:generate` writes the committed artifact. - `task docs:check` verifies it, non-destructively. - `task check` runs `docs:check`, right after `proto:check`, so both generated-artifact surfaces are judged the same way in the same place. The check cannot be satisfied by rewriting: it generates into a temporary directory, so a failing gate leaves the artifact exactly as it found it and the author applies the regenerated bytes. That keeps the regenerated diff reviewable in the same commit as the code change that caused it, which is what Step 9 of the architecture document requires and what a CI auto-update would quietly bypass. Documents that called this gap open are updated rather than left to contradict the code: - `generated-documentation.md` Step 8 (no `docs:*` task exists -> both exist), Step 9 (drift is gated locally, not in CI), and the hook/CI policy (rule 3 is now enforced by the gate; rules 1, 2, and 4 still rely on the author, since nothing observes a commit). - `contract-conformance-audit.md` gap 1, now closed. - `config-example-drift.md` item 3, which asked for exactly this wiring. - `CLAUDE.md`, whose `task check` description listed neither `docs:check` nor `test:tools`. - The build, docs, and diagnostics skills, plus a re-baselined diagnostics snapshot: the `task_docs` delivery surface went 0 -> 6 and the `tools` module 4 -> 7 now that the tasks exist. Verified with `task check` (green), including the new `docs:check` step. |
||
|
|
6fd76ae550 |
fix(tools): stop testing on the text of other files, and ungate contractaudit
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. |
||
|
|
fe48ffdd97 |
fix(dev): give dev:gateway the dev overlay so it reaches the dev state store
dev:daemon, dev:dashboard and dev:state-store all pass `-config-overlay deployments/dev.toml`, which is what sets [services.state].target = 127.0.0.1:9090. dev:gateway did not, so under `task dev` the gateway dialled whatever the developer's installed ~/.config/archie/config.toml named, or failed to start in a fresh checkout, while the other three processes used the dev store the task summary itself describes. No automated test accompanies this: asserting it would mean reading Taskfile.yml's text, which is the source-coupling class the tracker already files as test-coupling-6/-7. The change is a config value, verified by inspection of the four dev processes. |
||
|
|
1957d0ab39 |
feat(tools): add contractaudit for standing contract-conformance reporting
Reachability (tools/reachaudit, epic archie-core-06ag) answers "is this code in a shipped binary?". It cannot answer the complementary question: "does every declared contract surface have a consumer, or a declaration that it has none?". ratelimit was in the binary closure and called by nothing, which reachability could not see. tools/contractaudit classifies each subject of each declared surface as CONSUMED, DECLARED-UNCONSUMED, UNDECLARED-UNCONSUMED, or STALE-DECLARATION, and only the last two are findings. The declaration allowlist must match reality exactly: a missing entry fails and so does an entry that outlived its subject, because a stale allowlist is how a gate quietly stops checking anything. Surfaces: the two gRPC services, whose consumption is derived by scanning adapter bodies for calls through the generated client, and the dashboard HTTP API, matched between the registerXRoutes call sites and the path literals the bundled client calls. Findings on the current tree, all deliberate and now declared: ListCaptures and ListUndispatchedCaptures are superseded by their streaming variants -- staterpc's client calls StreamCaptures -- so no production client reaches the unary RPCs. Three bugs this tool found in itself, each recorded because each is the class of error that makes a conformance check worse than none: - Joining RPCs to adapter methods by name silently reported live RPCs as unconsumed, because adapters do not map one-to-one: StoreClient.Get calls GetSession, List calls ListSessions. - Reflecting over the client value rather than the pointer reported zero methods, hence the whole surface unconsumed. - Treating the asset mount and the health probes as dashboard API routes reported four healthy routes as undeclared; they have different consumers and are out of scope for this surface. The consumer extractor fails loudly on a call shape it cannot parse rather than under-reporting, and every check is negative-tested: a route, an RPC, and a removed consumer are each injected, confirmed to fail for the right reason, and reverted. The declaration staleness rule is tested too. Advisory when run directly; task check runs it -strict. See docs/prds/contract-conformance-audit.md. |
||
|
|
27203c6523 |
fix(build): gate the tools module read-only in task check
Nothing in the delivery gate entered tools/, so its dependency drift was only ever discovered by a command that silently repaired it, dirtying the tree with an unrelated diff. task check now runs test:tools. -mod=readonly is passed explicitly on every documented tools command: a developer's global GOFLAGS=-mod=mod in go env overrides the toolchain default and re-enables the rewrite. Also corrects the archie-build-and-env coverage table, which claimed task check omits task lint. |
||
|
|
851c46d8ed |
docs(deploy): UI Service deployment, auth, and operations profiles
Bead archie-core-8cda.5.5: - task dev now runs archie-ui (dev:dashboard) on :8484 -- after the cutover archied binds no dashboard listener, and Vite's /api,/events proxy needs a live receiver there. dev:mobile starts archie-ui with a LAN bind and -token-file (reusing the pre-cutover token path) instead of a mobile archied overlay; dev:ui's summary points at archie-ui. - deployments/dev.toml documents itself as the archie-ui overlay and states the [services.gateway] target explicitly. - systemd-user-service.md: the auth gap is now the documented posture -- archie-ui has no secret registry, resolves GATEWAY_TOKEN/ STATE_STORE_TOKEN from its process environment only, so the starter (EnvironmentFile) exports them; worked env-file example added, plus /healthz as the token-free liveness probe. - INSTRUCTIONS.md ships five binaries with archie-ui in the quickstart and the token story; README.md carries the auth note; the docker-nats-stack profile notes archie-ui binds [web] and dials the same [services.*] targets. - release tooling: archied's component closure extends with cmd/archie-ui and internal/app/archieui, so a UI-process-only commit can no longer fall between the two changelogs; RELEASING.md documents that the UI Service ships inside the archied release. |
||
|
|
a3e8718d19 |
feat(archieui): standalone UI process over remote Gateway and State Store
Add cmd/archie-ui and internal/app/archieui: a second composition root that
serves the dashboard and the compiled SPA against the two contracts the daemon
already dials, so the UI stops needing the daemon's in-process objects.
The composition root lives outside internal/app/archied deliberately. That
package pulls 88 internal packages (daemon, forge, containers, NATS, secrets,
workflow); reusing its boot the way RunGateway and RunStateStore do would make
the PRD's deletion gate unreachable. archieui links 41, and cmd/archie-ui 42.
Configuration ownership follows docs/prds/ui-service-boundary.md: the process
reads the shared file, but only [services.gateway].{target,target_token},
[services.state].{target,target_token} and [web].{listen,
trust_forwarded_headers}, with flags taking precedence. Options has no field
for anything else in that file to land in, and no config.Holder.
compose() sets only the contract-backed and process-local fields. Every daemon
runtime handle stays nil on purpose and its route degrades through the
existing 501/503/empty paths. Captures, CaptureLimiter and BindingDispatcher
are withheld for the duration of the seam: the daemon's dashboard still serves
POST /webhooks/capture/{source}, and two intakes are not permitted.
Readiness is the UI's own registry over its two dependencies via a new bounded
readiness.ContractProbe. The existing GatewayProbe was unusable here: with no
channel manager to inject it reports "no gateway channels configured", i.e.
permanently degraded.
The State Store's fail-closed non-loopback rule and the two dial paths move to
staterpc.Dial/TargetIsLoopback and gatewayrpc.Dial, so the server side and
every client share one implementation instead of three copies.
The Gateway remains loopback-only with no auth interceptor, so this process is
scoped to being colocated with it; filed as archie-core-juqx.
Refs: archie-core-8cda.5.2
|
||
|
|
f5414a82a1 |
fix(state-store): task-scope container credentials, stream large capture lists, validate Update, wire dev's state-store (archie-core-8cda.4.7)
Closes six review findings against .4.6 (PR #775): - daemon.StateStoreGrantIssuer + staterpc.TaskGrants: containers get a per-task credential authorized only for their own Update/Transition/ InsertEvent, never the daemon's administrative token. Issued before Acquire, revoked on Release; fails closed if no issuer is wired. - StreamCaptures/StreamUndispatchedCaptures: new streaming RPCs so a batch of large capture bodies can't exceed gRPC's 4MiB unary cap. The original unary RPCs are kept, unmodified (deprecated) rather than reshaped, so buf breaking stays green for an in-flight rolling deploy. - Update rejects a nil Task with InvalidArgument instead of panicking in the store layer. - RequireHostGateway only forces on for embedded NATS, so an externally reachable NATS/State Store no longer requires a local Docker bridge. - Client-side token resolution now matches the server's (target_token, then STATE_STORE_TOKEN secret/env). - task dev now runs archie-state-store (dev:state-store) alongside archied/archie-gateway/vite; deployments/dev.toml points them at it. |
||
|
|
a59505816a | feat(state-store): stand up archie-state-store binary and own archie.db (archie-core-8cda.4.3) (#771) | ||
|
|
3175526732 | fix(archied): initialize conversation persistence on daemon startup | ||
|
|
b319d77c56 |
feat(gateway): delete in-process ChatContract path, make remote the only mode
archie-gateway is now the sole owner of ChatContract; the daemon always dials it over gRPC for webui chat, no in-process fallback left. Telegram and email keep their own in-process routers unchanged (their streaming responder is a callback that can't cross the wire-safe contract). - composeChatContract only accepts mode="remote"; config defaults Services.Gateway to remote + 127.0.0.1:8585 when unset - deleted taskActionsActor (dead code once the local branch is gone) - task dev now launches archie-gateway alongside archied + Vite Verified end-to-end: archie-gateway + archied booted against a shared NATS/store, webui's /api/chat/sessions round-tripped through the gRPC hop. |
||
|
|
0a6496d2cd | feat(gateway): extract ChatContract service | ||
|
|
c0a91c011c | feat(contracts): add gateway service seams and protobuf toolchain | ||
|
|
4ae6de7dfd |
fix(build): clear pre-existing task check gate blockers (#719)
Baseline `task check` failed on a clean main checkout, blocking unrelated in-flight work. Fixes only those pre-existing failures: - bootstrap.go: extract wireWebStoreSurfaces from setupObservability (cyclop 16 > 15) and startEmbeddedNATS from connectNATS (nestif). - telegram_setup_test.go: os.Setenv -> t.Setenv (usetesting). - install_script_test.go: exec.Command -> exec.CommandContext with t.Context() (noctx). - Taskfile: add a ui:deps install step shared by `ui` and `test:ui`. ui/node_modules is gitignored and nothing in the gate installed it, so `task test:ui` died on a missing jsdom rather than a real test failure. - shutdown_watchdog_test.go: `go fix` output adopted verbatim. Refs bead archie-core-14cs. |
||
|
|
53b31de028 |
chore(taskfile): make task check include golangci-lint
Sam's explicit requirement: the definitive gate should catch lint regressions, not just fmt/vet/build/test. Immediately surfaced real debt on the first run -- see follow-up beads issues. |
||
|
|
c39d7b8040 |
feat(playbooks): standalone lint tool for playbook binding dirs
Fourth slice of docs/prds/eda-playbook-engine.md (t2db.12): the design doc's pre-merge collision layer, as a gopls-shaped standalone binary (cmd/archie-playbooks) rather than a Taskfile wrapper -- one binary, one schema source, mode-based entrypoints. - cmd/archie-playbooks: subcommand dispatch table from day one (lint now; an lsp/serve mode later slots in without restructuring), flag parsing only per organisation.md's cmd/ rule. - internal/app/archieplaybooks: the lint mode's composition -- collects directories, calls workflow.LoadPlaybookDirs (the daemon's own loader), reports findings. No second validation path: the linter agrees with runtime startup validation by construction. - Reuses LoadKindWorkflowsYAML/LoadLabelWorkflowsYAML/LoadPlaybookDirs directly; collision/malformed/invalid bindings exit non-zero. - Known limitation recorded: findings are file-granular, not line-granular (yaml.Unmarshal into map discards line numbers; a file:line diagnostic needs a yaml.Node upgrade, out of scope here). - Taskfile lint:playbooks target; PRD records the shipped shape and the file-granular caveat. |
||
|
|
deac0cc130 |
fix(build): stamp gatewayVersion/runtimeVersion in the right package
-X main.gatewayVersion/main.runtimeVersion targeted package main, but those vars live in internal/app/archied (cmd/archied is a thin wrapper). An -X target that doesn't exist is silently ignored by the linker, so every archied binary this shipped -- task build, install.sh, Dockerfile.archied, and the carina self-update script -- reported "dev" instead of its real version. Point every one of those ldflags at the actual package. Also, while chasing the carina incident this surfaced: - restart.go: /restart didn't check for an in-flight /update install. The install runs as archied's own child process, so a restart killed it mid-build (observed: "signal: terminated") instead of letting it finish or fail cleanly. Refuse the restart while updateInProgress. - update.go / update_report.go: the "no version could be confirmed running" branch still opened with "Update complete", contradicting its own next clause. Reworded so an unverified outcome isn't reported as completion. |
||
|
|
d96f403d93 |
chore(ci): pin Go version from go.mod and add a govulncheck step
CI's go-version was a floating "1.26" independent of go.mod, so it could silently drift from the toolchain the project actually builds with. Switched to go-version-file: go.mod as the single source of truth, and added `task vuln` (govulncheck) plus a CI scan step -- kept out of `task check` since it needs network access to the vuln DB. |
||
|
|
972fb5b8e1 |
feat(deployment): default to managed NATS workers
Autonomous workflows now always hand a complete task to a scoped archie-agent container. Embedded NATS is the default and external NATS changes only broker placement; legacy agent and containers.enabled inputs decode for migration but cannot select an execution path. The daemon flushes task-event subscriptions before a worker can publish, and runtime updates snapshot and restore the configured worker image. |
||
|
|
ed33ab5380 |
feat(agent): stamp archie-agent's build and report it back to the daemon
archied's own build has carried a compiled-in gatewayVersion and an internal/installtype stamp since archie-core-522/b5d08d0, but archie-agent's build had neither -- its Taskfile.yml and Dockerfile build steps passed no -ldflags at all, so even a daemon that wanted to verify what agent build is actually in service had nothing to check against. daemonRunningVersions said as much explicitly: the agent was left out of every verification on purpose, because nothing self-reported a real value. Every archie-agent process is task-scoped and ephemeral (spawned per task, dies after), not a long-lived process the daemon can poll on demand the way it polls Telegram's gateway. So there's no "ask the agent its version" request -- the only channel back is whatever a worker includes in the taskrun.Response it already sends on every completed task. Stamp archie-agent's build the same way archied's is (installtype, plus a new agentworker.Version()), have executeTaskRequest report both in its Response, and have the daemon record the latest observation in a new mutex-guarded AgentStatus, fed from runViaAgent on every successful response only -- never off a request that never reached an agent, or one describing a failed/parked task. daemonRunningVersions now includes the agent component once (and only once) something has actually been observed, so Report.Verify gets a real value to check future update claims against instead of omitting the component entirely. Part 1/3 of archie-core-1786751948782-3-837a8fd0 point 4. Closes archie-core-1786751948782-3-837a8fd0.1. |
||
|
|
369b13b688 |
feat(releaseupdate): stamp install type at build time, fail closed on unknown
/update could report success at the correct target version while the archie-agent container running it never actually changed: the update mechanism trusted the configured installer's exit code and reported whatever version number the release claimed, with nothing verifying the two agreed. The first piece of the fix: a new internal/installtype package reports how a binary was built for distribution (Type(), defaulting to "unknown"), stamped once per release artifact via "-ldflags -X .../installtype.buildType=<value>" rather than guessed at runtime by probing the environment -- restic and Tailscale both treat "which install shape is this" as a build-time decision for the same reason: a probed signal is guessable, a compiled-in one is not. releaseupdate.Service.Install now refuses to run the configured Installer at all when InstallType is unset or installtype.Unknown, so an unstamped or misconfigured build can no longer silently attempt an update it has no way to know is even the right kind for how this instance was deployed. Wired through every real archied build path so the gate doesn't just exist in principle: Taskfile.yml's build task (binary), Dockerfile.archied (container), and install.sh (binary) all now stamp it; cmd/archied/telegram_setup.go wires Service.InstallType from installtype.Type(). Configuration-page display of install type/version and post-update verification against the actually-running reference (not just the installer's reported version) remain open -- this lands the correctness gate, not the full observability surface. Refs #522 |
||
|
|
94adedc2d7 |
fix(build): stamp versions in task build, not only in the Docker image
Version stamping lived solely in Dockerfile.archied's -ldflags, so any build from source reported gatewayVersion/runtimeVersion as "dev". That covers every host deployment: carina builds the binaries with go build and runs them under systemd, never touching the image, so /version there answered "Archie Gateway: dev Runtime: dev" for a tagged release. Derive the same -X values from the release tags. git describe without --abbrev=0 gives 1.7.0-2-gbb54786 when HEAD has moved past the tag, which is the honest answer for a mid-cycle build rather than claiming the release itself. archie-agent has no version variable, so only archied is stamped. |
||
|
|
61b4b7b0cf |
refactor(store): replace legacy persistence with SQLite
Task and event persistence now uses a dedicated SQLite sidecar derived from the configured state prefix, matching the independently persisted conversation store. The configured path now means a state-path prefix rather than a database file so fresh SQLite state never attempts to interpret the previous storage format. Remove the retired implementation and dependency completely, strengthen SQLite migrations and concurrency behavior, restore backend-neutral coverage, and align configuration, operational guidance, UI labels, and deployment documentation with the new storage and host-daemon topology. |
||
|
|
170fe0250b |
fix: close the duplicate-work loop and the dead paths around it
Applies the four-reviewer pass over the forge/dashboard-actions work. The through-line is that several capabilities were wired but inert, and one of them could cost real work. DUPLICATE WORK. "Closes #N" was dropped from PR bodies in favour of LinkBranch, which is sidebar linkage on Gitea and a no-op stub on GitHub -- neither closes anything, and nothing else did either. So a merged task left its issue open, labelled and assigned; the next poll re-enqueued it, and once the dashboard's Clear removed the task row that became a second implementation and a second PR for work already merged. reconcilePRs now closes the issue on merge, and a rejected task closes its issue too. A PR closed without merging deliberately leaves the issue open: that usually means "try again". MAX RETRIES. Configured, defaulted and reported by /api/config, and enforced nowhere -- markDead was unreachable and EffectiveMaxRetries had no callers, so the dashboard's retry incremented retry_count forever. The retry action now retires a task to dead at the cap. DEAD ON ARRIVAL. Tasks() never selected plan or source, so the "Decision required" panel could not render and chat tasks -- whose issue number is synthetic -- linked to forge issues that do not exist. COSMETIC FAILURE, FATAL RESULT. OpenPR failed the whole stage when LinkBranch errored, so the pull request was never opened and the task parked; a retry re-links the same branch, which Gitea answers with a conflict, so every retry parked again. It is best-effort now. INVISIBLE ACTIONS. Approve/retry/reject wrote store rows and nothing else, so the timeline and activity stream never showed that a human had intervened. They emit events now. Also: store write failures answer 500 rather than 409; the dashboard surfaces the server's actual reason instead of "409 Conflict"; action buttons stop propagation (acting on a task no longer also expands it), disable in flight, keep per-task errors instead of one shared string, and confirm before rejecting. Removed: the maybeRetryParked shim and markDead with their now-vacuous tests, WaitingTasks (no consumers; its tests were rewritten to assert the same routing through TaskByID), write-only Daemon.Runtime, and dir/dirs response bloat from /api/skills. skillSource checked workDir before sharedDir, mislabelling every shared skill when the two are equal. DefaultRoots now dedupes roots differing only by a trailing separator. The air build rule claiming to keep ui/dist current never ran -- it required one file to satisfy include_dir and include_file together, and ui/ is excluded from the walk. Deleted with the comment that promised it. task test:ui joins task check and CI; it ran nowhere before, so the dashboard suite could rot silently. Docs corrected where they described behaviour that no longer exists: parks no longer comment on the issue, state labels no longer drive retries, and forgerpc's doc claimed four proxied methods while listing three of five. |
||
|
|
4d44ef76f5 |
feat(webui): rebuild the dashboard
The old UI was a single 200-line Go file serving one hand-written HTML page of task rows. It showed that archied was running and almost nothing about what it was doing -- skills, workflows, memory, channels, logs and configuration were all invisible unless you read the source or the config file. The dashboard now covers each of those as its own section, built as a Vite app under ui/ at the repo root: it is a separate artefact from the Go daemon, not an internal package of it. dist/ is committed so building archied never needs a Node toolchain, and the !no_ui build tag keeps an embed-free build available. Both sides are split by concern rather than by layer -- one Go file per API area, one folder per UI section with its own CSS -- so a change to logs cannot disturb tasks. Pages report consequences, not just state: an empty memory page says Archie starts every conversation with no recollection of earlier ones, and the setup checklist names what is missing in plain language instead of showing a grid of zeroes. Nothing greets by a hardcoded name; the operator comes from [chat], which is deployment data. Auth is exposure control, not capability control -- the agent already holds this user's authority through its own tools. So a loopback bind needs no token, and only a reachable bind mints one and logs a URL, which means an instance cannot be exposed merely by omitting config. Container startup now degrades instead of aborting, for the reason resolveForge already does: a missing agent image should not deny the operator chat and the dashboard, and under Restart=on-failure it turns a recoverable problem into a crash loop with the real error scrolling past. `task dev` runs the daemon under air and the Vite server together in one terminal. |
||
|
|
c91f373879 |
chore: add task release for changelog generation and tagging
The changelogs said 1.1.0 while 116 commits sat untagged on main, and the deploy workflow stamps images 'dev' when no tag points at HEAD. Two steps, so generated notes can be edited before a tag freezes them: release:prepare writes them, release commits and tags. Which commits land in which changelog is decided by each binary's package closure (go list -deps), so a change to a package archied does not import cannot show up in archied's changelog. |
||
|
|
146acf5466 |
feat: secret engine registry foundation (archie-core-xec)
internal/secret package: - Engine interface (Name, Version, Resolve) for pluggable secret backends - SecretRef type replacing TokenEnv/APIKeyEnv string fields - ResolveOrEnv for backward-compatible env-var fallback - Built-in env engine registered by default - Registry with Register/Get/Resolve/LoadDir (yaegi-based) - DefaultRegistry() singleton for one-off resolution - 12 tests, race-clean Scoped to foundation only. Provider/NATS/Telegram migration deferred to xec.4 (separate bead — those call sites forward env var names to subprocesses/runtimes and need eager-resolve-then-inject, not a simple field rename). 40/40 packages pass with -race. |
||
|
|
6ebbd3b2cf |
fix: add missing LinkBranch stubs to test doubles
Fix go vet/test failures by adding LinkBranch methods to stubForge, prCapturingForge, testForge, and fakeForge. Update test data from 'sam/archie' to 'acme/widget' and state label defaults from 'archie:*' to 'agent:*'. Add Taskfile.yml for project build automation. Implement container self-network detection so spawned agents join the daemon's Docker network. |