Commit Graph
7 Commits
Author SHA1 Message Date
sam 66b07a4b46 fix(build): rebuild when the embedded dashboard changes
The build task's only sources were **/*.go, go.mod and go.sum, while
ui/embed.go embeds the committed bundle with //go:embed all:dist. Task's
up-to-date check is a content checksum over files, so a change to ui/dist
-- including the one `task ui` writes in place -- left the task "up to
date" and the previously embedded dashboard in every binary.

Measured on this worktree, appending a byte to ui/dist/index.html:

  git status                 M ui/dist/index.html
  task build                 task: Task "build" is up to date
  grep <marker> bin/archied  0        <- stale asset shipped

With ui/dist/** listed, the same probe rebuilds all six binaries and the
marker is present; a nested asset (ui/dist/assets/index.css) does too.
Reverting the probe rebuilds again, and a second build with nothing
changed still reports "up to date", so the content cache is intact.
touch-only changes do not retrigger, confirming the check is on content
rather than mtime.

deployment_contract_test.go gains a bounded test over the build task's
sources block, the shape the neighbouring fmt assertion already uses.

The version stamps in the same task stay out of reach of a file checksum:
git describe moves with HEAD while no file content does, and the git
metadata is not addressable from a worktree, where .git is a file. That
needs a status/stamp design decision, so it is split to archie-core-pdq2.
2026-09-22 01:58:02 +10:00
sam bd9fa15c57 fix(build): run go fix to a fixpoint in task fmt
One go fix pass applies each fixer once, to the parse it started with, so a
rewrite made by one fixer is only fixed up by the next pass: stditerators
turns `for i := range t.NumField()` into a field iterator that copies its
loop variable, and forvar deletes that copy on the following pass. A single
pass therefore left the copy behind for copyloopvar to reject, and no
fmt-then-lint sequence healed it. task fmt now applies passes until a dry run
reports nothing left to fix, and fails loudly instead of handing the lint
step a tree it must reject.

deployment_contract_test.go pins the fixpoint proof rather than the old
single-invocation literal.
2026-09-22 01:57:53 +10:00
sam 2935010504 fix(build): make formatting and CI converge (#901) 2026-09-20 00:38:51 +10:00
sam 164886308b refactor(install): install.sh delegates config generation, and tests stop reading hand-written configs
Two things fall out of one principle: a test that asserts against a
hand-written file is testing an artifact a human or an agent may legitimately
rewrite at any moment, so only generated output is a valid target.

install.sh generated config.toml two ways -- a full heredoc for the self-host
path and an awk splice of the [forge] block into config.example.toml -- with a
forge_block shell helper feeding both. That is the arrangement
docs/architecture/configuration.md decided against: it "must stop generating
config.toml; archied setup owns it", because the installer hand-rolling TOML
already drifted once (choosing Gitea produced a config naming a token the
installer never wrote). Both generators and forge_block are gone; install.sh
collects its answers as before and passes them to archied setup as parameters,
with secrets passed as REFERENCES to the env keys it just wrote rather than as
values, which would put them on a command line. The installer also now asks for
a cloud model, which archied setup requires and the old path never emitted.

deployment_contract_test.go tested the removed generators by parsing install.sh's
shell text, reconstructing the heredoc and asserting on its content. It broke the
instant install.sh stopped generating config -- "install.sh has no heredoc
declaring the daemon config's [nats] table" -- which is the failure mode in
miniature: the test was coupled to an artifact, not to behaviour. Deleted.

What it actually protected is kept, asserted on the GENERATED config instead:
TestRunSetup_GeneratedConfigSatisfiesDaemonRequirements runs archied setup and
loads what it wrote, requiring services.state.target and bot_user. A test against
generated output fails when generation breaks and passes when a human merely
tidies the template.

Found by an adversarial package sweep (temp tracker: config-1,
repo-root-deployment-1, repo-root-deployment-2).
2026-09-15 03:35:45 +10:00
sam 1f3f54bedd test(archied): pin the wiring these fixes depend on and drop text coupling
Two fresh-context reviews of the preceding five fixes found that the tests were
mostly sound but that three things were not: one harness was coupled to shell
source text, one assertion was coupled to a tool count, and -- worse -- the two
changes carrying the most weight were pinned by nothing at all.

Composition order. review_pr worked only because Run builds the worktree manager
before the gateways; no test observed it. Reverting the order left every test
green while the daemon silently stopped offering review_pr, because the producer
guard then returns nil instead of advertising a broken tool. Pin the order by
source position, matching the existing
TestSetupBackendsRegistersContainerCleanupAfterNATS, since no runtime seam can
see it. methodBody now resolves package-level funcs as well as methods.

Composition wiring. The daemon fix's whole point is that resolved routing
bindings reach the worker, yet nothing verified that buildDaemon puts them on the
daemon: with b.kindWorkflows replaced by nil, only the new test fails and both
the daemon and worker packages stay green. That is the "tested in isolation,
never verified wired" shape this work exists to remove, so pin the hop.

The wire contract itself. taskrun.Request's json tags are the interface between
two binaries, and a same-type round trip cannot see a tag rename. Assert the
emitted keys literally; renaming one now fails with the key list.

Brittleness. selfHostConfig no longer string-matches install.sh's heredoc opener
or assumes the delimiter is EOF, and no longer hand-substitutes a copy of
forge_block's output -- it discovers heredocs by shape and selects the one
declaring [nats], a table the assertions never touch. Verified against four
behaviour-preserving refactors that previously failed: renaming the delimiter,
reordering the redirect, factoring the path into a variable, and <<-. The two
[services.gateway] source greps are gone: defaults.go already supplies that
target, so there was no behaviour to pin. review_pr is asserted present by name
rather than by entry count, so a sibling review tool cannot turn it red.

Also carry the published request's decode error instead of discarding it, so a
payload-shape break reports as itself rather than as an empty routing binding.

Every new test was verified non-vacuous by reintroducing the defect.
2026-09-15 02:18:30 +10:00
sam f54f130065 fix(install): emit an active State Store target so a fresh install can boot
install.sh produces config.toml two ways, and neither emitted an active
[services.state].target. The self-host branch writes a hand-rolled heredoc with
no [services] section at all, and the non-self-host branch rewrites only the
[forge] block of config.example.toml -- where [services.state] sat commented
out. openStateStoreAdapter requires a target, so a freshly installed archied
aborted at startup with no way to boot from the config the installer had just
written.

Activate [services.state] with a loopback target in both sources, which is the
producer fix: the config the installer emits is the invalid state, so it is
corrected where it is generated rather than defended against at the daemon.
[services.gateway] is activated alongside it for the same reason it is safe to
-- internal/infrastructure/configuration/defaults.go already defaults that
target to 127.0.0.1:8585, so declaring it changes no resolved value and only
makes the emitted config explicit.

Add TestInstallerGeneratedConfigHasServiceTargets, which parses what each
branch actually produces: config.example.toml through the real config loader,
and the install.sh heredoc reconstructed with its shell expansions resolved.
Both assertions are red-first -- with the sources reverted the test fails on
both branches with the boot-fatal message.

Found by an adversarial package sweep (temp tracker: repo-root-deployment-1,
.local/issue-tracker/).
2026-09-15 02:10:31 +10:00
sam 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.
2026-08-24 14:56:57 +10:00