feat(config): edit configuration from the dashboard (hybrid file + DB) #859

Closed
opened 2026-10-27 13:38:02 +00:00 by sam · 1 comment
Owner

Goal: change runtime-tunable settings from the web UI without hand-editing TOML.

Decision (Sam, 2026-08-04): HYBRID, file stays primary. config.toml remains authoritative for bootstrap; a DB layer holds only runtime-tunable values as an overlay. Making the DB primary would move the thing that decides whether the daemon can boot into the thing the daemon must boot to read, and would lose the property that config is editable with any editor independent of daemon health.

The file format is NOT the blocker. Three things are, in this order:

  1. Config is passed BY VALUE. daemon.Daemon{Cfg config.Config} and workflow.Cfg config.Config each hold a copy made at construction, so mutating a central config would never reach them. Subsystems must read through an accessor or receive change events instead of holding snapshots. This is the real prerequisite.

  2. There is no reload path. No fsnotify, no SIGHUP, nothing -- Load runs once at startup. Changing the source without this only changes WHERE values come from, not WHEN.

  3. Startup is a hard gate. cmd/archied/main.go:588-598 exits the daemon when an MCP provider fails to start. A UI that writes bad config could brick the next boot, which is worse from a DB than from a file you can open in an editor. Writes need validation before persist, and a documented recovery path.

Already in our favour: internal/infrastructure/configuration/ is a real loader package (discovery, feature files, extras, defaults, validation, provenance, tomlwrite) and is already multi-source across TOML and YAML. A DB source is a new decoder alongside decodeTOML/decodeYAML, not a rewrite. provenance.go already tracks where each value came from, which is what the UI needs to show 'this came from the file, this from the DB'.

Read-only config viewing already ships in the dashboard's Configuration section.

Close reason

Closed


Imported from beads archie-core-1786637498420-327-bacadaae · GitHub #348 · type task · priority P2 · created 2026-08-08 · closed 2026-10-05

Goal: change runtime-tunable settings from the web UI without hand-editing TOML. Decision (Sam, 2026-08-04): HYBRID, file stays primary. config.toml remains authoritative for bootstrap; a DB layer holds only runtime-tunable values as an overlay. Making the DB primary would move the thing that decides whether the daemon can boot into the thing the daemon must boot to read, and would lose the property that config is editable with any editor independent of daemon health. The file format is NOT the blocker. Three things are, in this order: 1. Config is passed BY VALUE. daemon.Daemon{Cfg config.Config} and workflow.Cfg config.Config each hold a copy made at construction, so mutating a central config would never reach them. Subsystems must read through an accessor or receive change events instead of holding snapshots. This is the real prerequisite. 2. There is no reload path. No fsnotify, no SIGHUP, nothing -- Load runs once at startup. Changing the source without this only changes WHERE values come from, not WHEN. 3. Startup is a hard gate. cmd/archied/main.go:588-598 exits the daemon when an MCP provider fails to start. A UI that writes bad config could brick the next boot, which is worse from a DB than from a file you can open in an editor. Writes need validation before persist, and a documented recovery path. Already in our favour: internal/infrastructure/configuration/ is a real loader package (discovery, feature files, extras, defaults, validation, provenance, tomlwrite) and is already multi-source across TOML and YAML. A DB source is a new decoder alongside decodeTOML/decodeYAML, not a rewrite. provenance.go already tracks where each value came from, which is what the UI needs to show 'this came from the file, this from the DB'. Read-only config viewing already ships in the dashboard's Configuration section. ### Close reason Closed --- _Imported from beads `archie-core-1786637498420-327-bacadaae` · GitHub #348 · type task · priority P2 · created 2026-08-08 · closed 2026-10-05_
sam added the mediumtask labels 2026-10-27 13:38:02 +00:00
sam self-assigned this 2026-10-27 13:38:02 +00:00
sam closed this issue 2026-10-27 13:38:03 +00:00
Author
Owner

sam wrote (originally 2026-09-11):

Status refresh 2026-09-11. This description predates both the config reload
work and the UI process cutover; two of its three named blockers are gone, and
a new one arrived.

Blocker 1 (config passed by value): resolved. config.Holder exists and the
daemon reads through it; publishConfig swaps the snapshot atomically.
Blocker 2 (no reload path): resolved. SIGHUP reload, a reload controller with
status, and a runtime overlay store all exist
(internal/app/archied/bootstrap.go wireConfigPublishing).
Blocker 3 (startup is a hard gate): still stands, and is exactly why the
deleted policy validated the materialised config before persisting.

New state: the feature was BUILT and then DELETED, not never-built. Commit
e037b95 (2026-09-10, "cut the dashboard over to the archie-ui process") removed
internal/app/archied/config_update.go, config_update_test.go and the three
bootstrap installers, because the UI moved to its own process and the writes
had no contract to cross on (archie-core-ymut descoped them for Phase 3). The
handlers on webui.Server survive and answer 503 because UpdateConfig,
ResetConfig and UpdateRepoField are nil in production.

So what remains is transport, not policy. The policy is recoverable verbatim
from e037b95^:

  • installUpdateConfigHandler: deny non-runtime-tunable keys, apply the
    dotted overlay to a Clone of the published config, validate the
    materialised result, write overlay rows, rebuild provenance with a single
    "config_overlay (runtime)" origin, publish, clear bootOverlayErr.
  • installUpdateRepoFieldHandler: applyRepoFieldUpdate on a cloned Repos
    slice, then reuse UpdateConfig's path so the wire view's omitted fields
    (Preflight, TestGlob) are never round-tripped away.
  • installConfigHandlers' ResetConfig: delete one overlay row, republish.
  • applyDottedOverlay and applyRepoFieldUpdate as pure, unit-tested functions.

The remaining design question is which process serves that policy and what
carries it. Split out as its own bead.

_sam wrote (originally 2026-09-11):_ Status refresh 2026-09-11. This description predates both the config reload work and the UI process cutover; two of its three named blockers are gone, and a new one arrived. Blocker 1 (config passed by value): resolved. config.Holder exists and the daemon reads through it; publishConfig swaps the snapshot atomically. Blocker 2 (no reload path): resolved. SIGHUP reload, a reload controller with status, and a runtime overlay store all exist (internal/app/archied/bootstrap.go wireConfigPublishing). Blocker 3 (startup is a hard gate): still stands, and is exactly why the deleted policy validated the materialised config before persisting. New state: the feature was BUILT and then DELETED, not never-built. Commit e037b95 (2026-09-10, "cut the dashboard over to the archie-ui process") removed internal/app/archied/config_update.go, config_update_test.go and the three bootstrap installers, because the UI moved to its own process and the writes had no contract to cross on (archie-core-ymut descoped them for Phase 3). The handlers on webui.Server survive and answer 503 because UpdateConfig, ResetConfig and UpdateRepoField are nil in production. So what remains is transport, not policy. The policy is recoverable verbatim from e037b95^: - installUpdateConfigHandler: deny non-runtime-tunable keys, apply the dotted overlay to a Clone of the published config, validate the materialised result, write overlay rows, rebuild provenance with a single "config_overlay (runtime)" origin, publish, clear bootOverlayErr. - installUpdateRepoFieldHandler: applyRepoFieldUpdate on a cloned Repos slice, then reuse UpdateConfig's path so the wire view's omitted fields (Preflight, TestGlob) are never round-tripped away. - installConfigHandlers' ResetConfig: delete one overlay row, republish. - applyDottedOverlay and applyRepoFieldUpdate as pure, unit-tested functions. The remaining design question is which process serves that policy and what carries it. Split out as its own bead.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Reference: sam/archie#859