Inline editing for per-repo config fields (allow_concurrent, max_retries, review_enabled) #140

Closed
opened 2026-10-27 13:35:07 +00:00 by sam · 0 comments
Owner

archie-core-b6ew.4 shipped visibility for AllowConcurrent, MaxRetries, and ReviewEnabled on the repositories card (read-only), which was the concrete discoverability gap Sam hit. Actual inline editing was scoped out of that issue because it hits a real backend limitation discovered while implementing it: the dashboard's PATCH /api/config path (installUpdateConfigHandler in internal/app/archied/bootstrap.go) applies dotted-key updates via overlay.Nest + configuration.ApplyOverlayValues, and overlay.Nest (internal/infrastructure/configuration/overlay/overlay.go:162) only builds nested maps by splitting on '.' -- it has no array-index handling, so a key like 'repos.0.allow_concurrent' cannot be expressed, and Repos is a []config.Repo slice, not a map, so ApplyOverlayValues's YAML-merge-onto-struct approach cannot target one element either.

This needs either: (a) a dedicated repo-update seam (e.g. a webui handler keyed by owner/name that reads-modifies-writes the Repos slice directly, bypassing the generic dotted-overlay path), or (b) extending overlay.Nest/ApplyOverlayValues to support array indices generically, which is broader-reaching (touches every list-shaped config field, not just Repos) and needs its own design decision about whether index-based overlay keys are stable across a file edit that reorders repos entries. Option (a) is almost certainly the smaller, safer change -- decide in a short design note before implementing, per this repo's settled-design-first rule, since option (b) has real footguns (index stability) that deserve a deliberate answer, not a guess.

Close reason

Traced the mechanism before implementing: overlay.Nest/ApplyOverlayValues has no array-index support, but Repos is addressed as a WHOLE dotted key ('repos', no dot) whose value is the full slice -- so no changes to overlay/configuration packages were needed at all. Added PATCH /api/config/repos/{owner}/{name} (webui.Server.UpdateRepoField seam + handleConfigRepoUpdate), wired in archied/bootstrap.go's installUpdateRepoFieldHandler: reads the daemon's own live, untrimmed Repos (not webui.RepoView, which omits Preflight/TestGlob and would silently drop them on a naive round-trip), mutates the one matched repo's one field via the pure applyRepoFieldUpdate helper, and republishes through the existing UpdateConfig(ctx, {"repos": repos}) path unchanged -- zero duplicated validate/persist/publish logic.

Frontend: config-row.js's row() gained an opts.save override so a caller can redirect where an edit persists; the repositories table renders an autosaving checkbox (allow_concurrent, review_enabled) and a save-on-blur/Enter text input (max_retries) via api.configRepoUpdate, reverting/erroring inline on failure rather than reloading the whole page mid-edit.

Go tests cover the pure applyRepoFieldUpdate function directly (matched-repo-only mutation, untouched-field preservation including Preflight, type coercion, unknown repo/field rejection) and the webui handler (seam delegation, editable-field allowlist enforced before the seam is called, 503/400 mapping). JS tests cover the structural render (checkbox/input initial state) -- the save round trip itself isn't exercisable through the test shim (addEventListener is a no-op there), consistent with existing config-row.test.js coverage.


Imported from beads archie-core-b6ew.6 · GitHub #689 · type feature · priority P2 · created 2026-09-02 · closed 2026-09-02

archie-core-b6ew.4 shipped visibility for AllowConcurrent, MaxRetries, and ReviewEnabled on the repositories card (read-only), which was the concrete discoverability gap Sam hit. Actual inline editing was scoped out of that issue because it hits a real backend limitation discovered while implementing it: the dashboard's PATCH /api/config path (installUpdateConfigHandler in internal/app/archied/bootstrap.go) applies dotted-key updates via overlay.Nest + configuration.ApplyOverlayValues, and overlay.Nest (internal/infrastructure/configuration/overlay/overlay.go:162) only builds nested maps by splitting on '.' -- it has no array-index handling, so a key like 'repos.0.allow_concurrent' cannot be expressed, and Repos is a []config.Repo slice, not a map, so ApplyOverlayValues's YAML-merge-onto-struct approach cannot target one element either. This needs either: (a) a dedicated repo-update seam (e.g. a webui handler keyed by owner/name that reads-modifies-writes the Repos slice directly, bypassing the generic dotted-overlay path), or (b) extending overlay.Nest/ApplyOverlayValues to support array indices generically, which is broader-reaching (touches every list-shaped config field, not just Repos) and needs its own design decision about whether index-based overlay keys are stable across a file edit that reorders [[repos]] entries. Option (a) is almost certainly the smaller, safer change -- decide in a short design note before implementing, per this repo's settled-design-first rule, since option (b) has real footguns (index stability) that deserve a deliberate answer, not a guess. ### Close reason Traced the mechanism before implementing: overlay.Nest/ApplyOverlayValues has no array-index support, but Repos is addressed as a WHOLE dotted key ('repos', no dot) whose value is the full slice -- so no changes to overlay/configuration packages were needed at all. Added PATCH /api/config/repos/{owner}/{name} (webui.Server.UpdateRepoField seam + handleConfigRepoUpdate), wired in archied/bootstrap.go's installUpdateRepoFieldHandler: reads the daemon's own live, untrimmed Repos (not webui.RepoView, which omits Preflight/TestGlob and would silently drop them on a naive round-trip), mutates the one matched repo's one field via the pure applyRepoFieldUpdate helper, and republishes through the existing UpdateConfig(ctx, {"repos": repos}) path unchanged -- zero duplicated validate/persist/publish logic. Frontend: config-row.js's row() gained an opts.save override so a caller can redirect where an edit persists; the repositories table renders an autosaving checkbox (allow_concurrent, review_enabled) and a save-on-blur/Enter text input (max_retries) via api.configRepoUpdate, reverting/erroring inline on failure rather than reloading the whole page mid-edit. Go tests cover the pure applyRepoFieldUpdate function directly (matched-repo-only mutation, untouched-field preservation including Preflight, type coercion, unknown repo/field rejection) and the webui handler (seam delegation, editable-field allowlist enforced before the seam is called, 503/400 mapping). JS tests cover the structural render (checkbox/input initial state) -- the save round trip itself isn't exercisable through the test shim (addEventListener is a no-op there), consistent with existing config-row.test.js coverage. --- _Imported from beads `archie-core-b6ew.6` · GitHub #689 · type feature · priority P2 · created 2026-09-02 · closed 2026-09-02_
sam added the mediumfeature labels 2026-10-27 13:35:07 +00:00
sam self-assigned this 2026-10-27 13:35:07 +00:00
sam closed this issue 2026-10-27 13:35:07 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sam/archie#140