refactor(webui): take configuration off the dashboard server

webui.Server declared Cfg *config.Holder with eight read sites, none of
which ran in the UI process: composition leaves it nil there. The field
survived because the daemon kept a webui.Server it never served, using it
to render the published ConfigView snapshot and to hold the readiness
probes (archie-core-ml30).

Split at the producer. LocalConfigView becomes webui.BuildConfigView, a
pure function over a ConfigViewInput the configuration owner assembles;
the DTO and its schema stay where the UI renders them. The daemon builds
that input from its own state (boot.configViewInput) and publishes the
result. Readiness reads the daemon's Holder, channel manager and chat
contract, and the registry it produces is a daemon field, not a field on
a server with no listener. Boot now owns one Holder instead of seeding a
second and replacing it in buildDaemon; operator retry caps read it too,
so they follow a reload rather than a boot-time snapshot.

Server loses Cfg, ConfigProvenance, LastReload, ConfigOverrides and
SetProvenance. The nil-guarded branches they fed went with them, each
checked first against what the UI process actually serves:

- chat.show_tool_calls and the /api/setup checklist were degraded, not
  dead. ConfigView gains a chat section carrying show_tool_calls, the
  operator name and whether a channel is configured, and both surfaces
  read the projection. The end-to-end suite asserts the checklist renders
  from the published snapshot.
- /api/logs takes its path as a process-local option. The history is on
  the daemon's disk, so a dashboard elsewhere cannot read it by learning
  the path; that route still needs a contract.
- handleChannels drops its config-derived fallback, superseded by the
  status manager, which already carries the descriptions and detail.
- trustForwardedHeaders keeps only the process's own setting, which the
  UI process already sets.
- resolveForge keeps the published-projection path it already had.

ConfigView.Editable moves to handleConfig, decided by whether this
process holds UpdateConfig. It describes the writer, not the document, so
the write contract (archie-core-j28m) makes the page editable by wiring
one field. The write handlers and their seams stay for it.

overlay.Store gains Keys: Snapshot nests dotted keys for decoding, so the
overridden-key list was publishing section names ("budgets") where the
dashboard marks and resets rows by stored key ("budgets.max_steps").

Multi-identity forge links move to archie-core-pv6t: forgeConfigForTask
resolved a task's forge from config.Config, had no reachable caller once
the holder was gone, and belongs in the projection rather than the
rendering package.
This commit is contained in:
sam committed 2026-09-11 23:57:38 +10:00
1 parent b7fa45e76d
commit 03afd2e8ad
31 files changed
+809 -502

No files matched your search

+12
View File
@@ -404,6 +404,18 @@ document already anticipates is its natural owner. Until then the UI renders
configuration and does not write it, which is what the boundary always said
about ownership even when it assumed a wider contract.
Amended 2026-09-11. This descope is a deferral, not a decision that the
dashboard should be read-only. Name it that way in review: the daemon-side
policy was built and tested, then deleted by the cutover (`e037b95` removed
`internal/app/archied/config_update.go` and its tests), so reviving it is
recoverable work, not a rewrite. `archie-core-j28m` carries the remaining
question -- which process serves the policy and what transport carries the
write -- and blocks the feature bead. The handlers, their error sentinels and
the `UpdateConfig`/`ResetConfig`/`UpdateRepoField` seams on `webui.Server` are
kept deliberately for it; `ConfigView.Editable` follows whichever process holds
`UpdateConfig`, so wiring that one field makes the page editable
(`archie-core-ml30`).
Implementation belongs to `archie-core-8cda.5.4`, the cutover that removes the
daemon's own dashboard. Nothing here is built yet.
+38 -23
View File
@@ -68,7 +68,7 @@ cutover.
| `/api/logs`, `/api/logs/stream` | daemon diagnostic feed, host-local | unresolved: `logging.Feed` is in-process on the daemon host and has no contract |
| `/api/captures`, `/api/mappings`, `/api/bindings` | State Store contracts, with webhook verification owned by Work Intake/Messaging | RESOLVED (cutover, `archie-core-8cda.5.4`): the UI process composes CaptureStore/MappingStore/BindingStore and mounts the `captureintake.Receiver` from its own State Store client; the daemon's binding-dispatch loop keeps consuming captures from the same store |
| `/api/config` (read) | daemon-published `ConfigView` snapshot, read over the State Store contract | RESOLVED (`archie-core-ymut`): see migration-decisions, "Dashboard configuration page" |
| `/api/config` (write), `/api/config/reset`, `/api/config/repos/*` | none; descoped for Phase 3 | RESOLVED (`archie-core-ymut`): 503 in the UI process, SPA hides the controls, editing is config.toml plus reload |
| `/api/config` (write), `/api/config/reset`, `/api/config/repos/*` | a configuration write contract; the daemon stays the policy owner | DESCOPED for Phase 3 (`archie-core-ymut`), NOT abandoned: 503 in the UI process, SPA hides the controls, editing is config.toml plus reload. Dashboard editing is a tracked feature (`archie-core-1786637498420-327`) and its transport is `archie-core-j28m`; the handlers and their func-field seams on `webui.Server` are kept for it |
| `/api/channels`, reload, curators, memory, skills, version/update | owning capability contract or an explicitly removed route | owner and failure semantics remain to define |
| `/`, `/healthz`, `/health`, `/health/detailed` | UI HTTP process; readiness consumes per-service health contracts | current HTTP behavior is the compatibility baseline |
@@ -97,10 +97,9 @@ continue to perform validate-persist-publish for those updates through a
narrow application contract. The UI process must never implement that policy
by holding or mutating a shared `config.Holder`.
The current daemon's `config.Holder` sharing is migration residue: `buildDaemon`
currently assigns `b.web.Cfg = b.d.Cfg`. It is removed only when the UI has a
configuration read/update contract and tests prove that the daemon and UI no
longer share a mutable holder.
The daemon's `config.Holder` sharing was migration residue: `buildDaemon`
assigned `b.web.Cfg = b.d.Cfg`. Removed by `archie-core-ml30` -- the field no
longer exists, and boot owns the single Holder the daemon reads through.
For Phase 3, configuration ownership is split deliberately. The UI process
owns its listener, browser-auth, asset, dependency-target, and readiness
@@ -109,6 +108,11 @@ the dashboard's `/api/config` read, validation, persistence, overlay, reload,
and audit behavior. The UI does not become the writer merely because it
renders the configuration page.
Amended 2026-09-11 by `archie-core-ml30`: the daemon's `config.Holder` sharing
is gone. `webui.Server` has no holder field, so the sharing this paragraph
describes cannot be reintroduced by wiring; the daemon owns one Holder and
publishes a rendered projection.
Amended 2026-09-09 by `archie-core-ymut`: this section previously assumed one
narrow admin contract carrying both the read and the write. It does not. The
read crosses as a daemon-published `ConfigView` snapshot over the State Store
@@ -212,15 +216,15 @@ Phase 3 is closed. Every gate below is proven by test, not by inspection:
| Gate | Evidence |
| --- | --- |
| Deletion | `cmd/archie-ui/architecture_test.go` re-runs `go list -deps` on every `task check` and fails on any banned package, checked in both directions against its two exceptions |
| Composition | `internal/app/archieui/TestComposeUIServerHoldsNoDaemonState` fails on a non-nil `config.Holder`, a concrete `*store.Store`, or a Gateway that is not the gRPC client |
| Composition | `internal/app/archieui/TestComposeUIServerHoldsNoDaemonState` fails on a concrete `*store.Store` or a Gateway that is not the gRPC client. The holder clause it also carried is now enforced by the type: `webui.Server` has no `config.Holder` field (`archie-core-ml30`) |
| End-to-end | `cmd/archie-ui/main_test.go` builds the binary and drives it over HTTP against a live Gateway and State Store |
| No dual authority | The dashboard HTTP listener is `internal/app/archieui/run.go` only; the daemon's two `http.Server`s are its own health endpoint and the forge webhook receiver |
Acceptance criterion 1 is amended to name the UI process rather than the
`internal/webui` package: the UI process receives no holder, while the daemon
still holds one *inside its own process* to render the published `ConfigView`
snapshot (the residue below, tracked by `archie-core-ml30`). No live struct
crosses the service boundary, which is what the criterion protects.
Acceptance criterion 1 was amended at the close of Phase 3 to name the UI
process rather than the `internal/webui` package, because the daemon still held
a holder inside its own process to render the published `ConfigView` snapshot.
`archie-core-ml30` removed that residue, so the criterion holds in its original
form again: `internal/webui` receives no holder in any process.
### Deletion gate: SATISFIED (archie-core-8cda.5.6, rev. 2)
@@ -257,13 +261,21 @@ prefix. `internal/app/archieui`'s `TestComposeUIServerHoldsNoDaemonState`
covers the composition clauses, failing on a non-nil `config.Holder`, a
concrete `*store.Store`, or a Gateway that is not the gRPC client.
One piece of residue remains visible: `webui.Server` still declares
`Cfg *config.Holder`, because the daemon keeps a `webui.Server` as the renderer
that builds the published `ConfigView` snapshot. The UI process never receives
a holder, and the composition test fails if it ever does, but removing the
field outright means moving that renderer and the readiness probes off
`webui.Server` onto the daemon's own configuration owner. That cleanup is
`archie-core-ml30` (P2); it is daemon-internal and does not gate Phase 3.
One piece of residue remained visible at the close of Phase 3: `webui.Server`
still declared `Cfg *config.Holder`, because the daemon kept a `webui.Server`
as the renderer that built the published `ConfigView` snapshot. That cleanup
landed as `archie-core-ml30`. `webui.Server` no longer has a configuration
holder, provenance store, reload-status callback or override-listing callback:
the projection is built by `webui.BuildConfigView`, a pure function the
configuration owner calls, and the daemon assembles its input from its own
state (`boot.configViewInput`). Readiness reads the daemon's own Holder,
channel manager and chat contract, and the health registry it produces is a
daemon field rather than a field on a server the daemon never serves.
`ConfigView.Editable` moved with it. It describes the rendering process's own
write path, so `handleConfig` sets it from `Server.UpdateConfig` rather than
any process baking it into the document. A future configuration write contract
(`archie-core-j28m`) makes the page editable by wiring that one field.
### Real-process evidence (archie-core-8cda.5.6)
@@ -276,11 +288,14 @@ task action crossing to the Gateway (and refused without the CSRF header),
capture intake accepted unauthenticated, the ratified degradations, readiness
dropping when the State Store dies while liveness holds, and a clean SIGTERM.
Two dashboard values still degrade because the published projection does not
carry them, both daemon configuration the UI cannot see: `chat.show_tool_calls`
(the chat page never expands tool calls) and the `/api/setup` checklist (the
panel is omitted rather than rendered from what the snapshot knows). Neither is
a boundary violation; both are fields the projection could publish.
Two dashboard values degraded here because the published projection did not
carry them: `chat.show_tool_calls` (the chat page never expanded tool calls)
and the `/api/setup` checklist (the panel was omitted rather than rendered).
Both are closed by `archie-core-ml30`: `ConfigView` gained a `chat` section
carrying `show_tool_calls`, the operator name, and whether any chat channel is
configured, and both surfaces now read the projection rather than a live
holder. The end-to-end suite asserts the checklist renders from the published
snapshot.
## Non-goals and open work