refactor(config): delete the runtime config overlay
The control plane replaces this, rather than extending it (docs/prds/runtime-control-plane.md, "First implementation"). Until now both paths existed: overlay kept dashboard edits in its own SQLite file beside archie.db and layered them over the file config at boot and on every reload, which is the duplicate configuration authority the PRD set out to remove. Gone with it: the --no-config-overlay flag and ARCHIE_SKIP_CONFIG_OVERLAY recovery hatch, which existed because a bad overlay row could brick the boot; ReloadStatus.OverlayUnavailable; and the reload controller's overlay source. The -config-overlay file overlay is a different thing and stays. The dashboard's three write seams went too. UpdateConfig, ResetConfig and UpdateRepoField were assigned only in internal/webui's own tests, so in production they answered 503 and ConfigView.Editable was permanently false (archie-core-j28m). Removing Editable would otherwise have flipped the SPA's controls on, since configEditable read a missing field as true, so the config pages become what they already were in practice: a read of what each process is running with. Configuration is written through the control plane. apply.go survives this deliberately; archie-core-xrux carries the question of whether its map merge is still guarding the file overlay path.
This commit is contained in:
1 parent
d8dd9ac6d6
commit
2311529def
35 files changed
+58
-1519
No files matched your search
@@ -140,13 +140,6 @@ export const api = {
|
||||
channelReload: <T = unknown>(id: string) =>
|
||||
request<T>(`/api/channels/${encodeURIComponent(id)}/reload`, { method: "POST", body: {} }),
|
||||
config: <T = unknown>() => request<T>("/api/config"),
|
||||
configUpdate: <T = unknown>(updates: Payload) => request<T>("/api/config", { method: "PATCH", body: { updates } }),
|
||||
configRepoUpdate: <T = unknown>(owner: string, name: string, field: string, value: unknown) =>
|
||||
request<T>(`/api/config/repos/${encodeURIComponent(owner)}/${encodeURIComponent(name)}`, {
|
||||
method: "PATCH",
|
||||
body: { field, value },
|
||||
}),
|
||||
configReset: <T = unknown>(key: string) => request<T>("/api/config/reset", { method: "POST", body: { key } }),
|
||||
logs: <T = unknown>(params?: QueryParams) => request<T>("/api/logs" + qs(params)),
|
||||
taskLogs: <T = unknown>(id: string, params?: QueryParams) =>
|
||||
request<T>(`/api/tasks/${encodeURIComponent(id)}/logs` + qs(params)),
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Select, SelectContent, SelectGroup, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
|
||||
import type { ConfigFieldType } from "./types";
|
||||
|
||||
/**
|
||||
* The editor for one config field: a text input, or a select for the two types
|
||||
* whose value is a closed set.
|
||||
*
|
||||
* It owns focus -- the row mounts it the moment the row enters edit mode, so
|
||||
* the first keystroke lands in the control -- and reports Enter and Escape.
|
||||
* Saving and cancelling belong to the row, which is what knows whether what
|
||||
* was typed can be sent.
|
||||
*
|
||||
* Enter commits for the text input only. reka's select opens its listbox on
|
||||
* Enter, so a select commits through its own listbox and the row's Save.
|
||||
*/
|
||||
const props = defineProps<{
|
||||
modelValue: string;
|
||||
type: ConfigFieldType;
|
||||
options?: string[];
|
||||
disabled?: boolean;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
"update:modelValue": [string];
|
||||
save: [];
|
||||
cancel: [];
|
||||
}>();
|
||||
|
||||
const BOOL_OPTIONS = ["true", "false"];
|
||||
|
||||
function update(value: unknown): void {
|
||||
emit("update:modelValue", String(value ?? ""));
|
||||
}
|
||||
|
||||
const vFocus = {
|
||||
mounted: (el: HTMLElement) => {
|
||||
el.focus();
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Select
|
||||
v-if="props.type === 'bool' || props.type === 'enum'"
|
||||
:model-value="props.modelValue"
|
||||
:disabled="props.disabled"
|
||||
@update:model-value="update"
|
||||
>
|
||||
<SelectTrigger v-focus class="w-full" :aria-label="props.type === 'bool' ? 'Value' : 'Option'">
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectGroup>
|
||||
<SelectItem v-for="option in props.type === 'bool' ? BOOL_OPTIONS : props.options || []" :key="option" :value="option">
|
||||
{{ option }}
|
||||
</SelectItem>
|
||||
</SelectGroup>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<Input
|
||||
v-else
|
||||
v-focus
|
||||
:model-value="props.modelValue"
|
||||
:disabled="props.disabled"
|
||||
autocomplete="off"
|
||||
@update:model-value="update"
|
||||
@keydown.enter.prevent="emit('save')"
|
||||
@keydown.esc="emit('cancel')"
|
||||
/>
|
||||
</template>
|
||||
+19
-110
@@ -1,26 +1,19 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from "vue";
|
||||
import { computed } from "vue";
|
||||
|
||||
import { api } from "@/lib/api";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { parseEdit, valueText } from "./config-field";
|
||||
import ConfigControl from "./ConfigControl.vue";
|
||||
import { errorText, loadConfig } from "./state";
|
||||
import { valueText } from "./config-field";
|
||||
import type { ConfigField } from "./types";
|
||||
|
||||
/**
|
||||
* One row of a key/value list: the label, the value the process is running
|
||||
* with, and -- when the field is editable and this process holds the write
|
||||
* path -- the edit and reset controls.
|
||||
* One row of a key/value list: the label and the value the process is running
|
||||
* with. Configuration is written through the control plane, so this list
|
||||
* reports what is in effect and never offers a control of its own.
|
||||
*
|
||||
* A locked field shows its value and the reason instead of a control: those
|
||||
* keys are the daemon's own bootstrap inputs, and changing one from here could
|
||||
* break the next boot. A process serving a published snapshot has no write
|
||||
* path at all, so it renders every editable field as a value rather than a
|
||||
* control that would answer 503 (archie-core-ymut).
|
||||
* A locked field shows the reason it stays bootstrap-owned: those keys are the
|
||||
* daemon's own startup inputs and the control plane deliberately does not
|
||||
* manage them.
|
||||
*
|
||||
* Every row is a subgrid of the list's three tracks, so the columns line up
|
||||
* across rows; see ConfigList.
|
||||
@@ -28,67 +21,12 @@ import type { ConfigField } from "./types";
|
||||
const props = defineProps<{
|
||||
label: string;
|
||||
value?: unknown;
|
||||
/** The descriptor that makes the row editable. Absent for a value-only row,
|
||||
* which is what the provenance list uses. */
|
||||
/** The descriptor carrying the row's description and locked reason. */
|
||||
field?: ConfigField;
|
||||
/** Whether the serving process can apply changes at all. */
|
||||
editable?: boolean;
|
||||
}>();
|
||||
|
||||
const text = computed(() => valueText(props.value));
|
||||
|
||||
const editing = ref(false);
|
||||
const draft = ref("");
|
||||
const error = ref<string | null>(null);
|
||||
const saving = ref(false);
|
||||
const resetting = ref(false);
|
||||
|
||||
const lockedReason = computed(() => props.field?.locked_reason ?? "");
|
||||
const overridden = computed(() => Boolean(props.field?.overridden));
|
||||
const canEdit = computed(() => Boolean(props.field?.editable) && props.editable !== false && !lockedReason.value);
|
||||
|
||||
function startEdit(): void {
|
||||
if (!props.field) return;
|
||||
draft.value = String(props.field.value ?? "");
|
||||
error.value = null;
|
||||
editing.value = true;
|
||||
}
|
||||
|
||||
async function save(): Promise<void> {
|
||||
const target = props.field;
|
||||
if (!target) return;
|
||||
const parsed = parseEdit(target.type, draft.value);
|
||||
if (parsed.error) {
|
||||
error.value = parsed.error;
|
||||
return;
|
||||
}
|
||||
saving.value = true;
|
||||
error.value = null;
|
||||
try {
|
||||
await api.configUpdate({ [target.key]: parsed.value });
|
||||
editing.value = false;
|
||||
await loadConfig();
|
||||
} catch (err) {
|
||||
error.value = errorText(err);
|
||||
} finally {
|
||||
saving.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function reset(): Promise<void> {
|
||||
const target = props.field;
|
||||
if (!target) return;
|
||||
resetting.value = true;
|
||||
error.value = null;
|
||||
try {
|
||||
await api.configReset(target.key);
|
||||
await loadConfig();
|
||||
} catch (err) {
|
||||
error.value = errorText(err);
|
||||
} finally {
|
||||
resetting.value = false;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -106,9 +44,7 @@ async function reset(): Promise<void> {
|
||||
label and holding focus keeps the description on screen. The
|
||||
aria-label carries the label and the description together, because
|
||||
the tooltip content itself is out of the accessibility tree when the
|
||||
trigger is not hovered or focused. No visual change -- the focus
|
||||
floor in style.css draws the only new affordance, and only on
|
||||
keyboard focus.
|
||||
trigger is not hovered or focused.
|
||||
-->
|
||||
<span tabindex="0" :aria-label="`${label}: ${field.description}`" class="text-sm text-fg-muted">{{ label }}</span>
|
||||
</TooltipTrigger>
|
||||
@@ -116,43 +52,16 @@ async function reset(): Promise<void> {
|
||||
</Tooltip>
|
||||
<span v-else class="text-sm text-fg-muted">{{ label }}</span>
|
||||
|
||||
<template v-if="editing && field">
|
||||
<ConfigControl v-model="draft" :type="field.type" :options="field.options" :disabled="saving" @save="save" @cancel="editing = false" />
|
||||
<div class="flex items-center gap-2 justify-self-end">
|
||||
<Button size="sm" :disabled="saving" @click="save">Save</Button>
|
||||
<Button variant="outline" size="sm" :disabled="saving" @click="editing = false">Cancel</Button>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<!-- min-w-0 is load-bearing: a grid item refuses to shrink below its
|
||||
content by default, which is what pushed long paths into the action
|
||||
column and truncated them against the buttons. -->
|
||||
<slot name="value">
|
||||
<span
|
||||
:class="cn('min-w-0 break-words font-mono text-sm min-[701px]:truncate', text === '—' ? 'text-fg-subtle' : 'text-foreground', lockedReason && 'text-fg-muted')"
|
||||
:title="text"
|
||||
>{{ text }}</span>
|
||||
</slot>
|
||||
<!-- The controls sit in the row rather than appearing on hover: one that
|
||||
only exists on hover is invisible to touch and to anyone scanning
|
||||
for what is editable. -->
|
||||
<div v-if="canEdit" class="flex items-center gap-2 justify-self-end">
|
||||
<Badge v-if="overridden" variant="warn" title="Set from the dashboard; this shadows the value in the config file">overridden</Badge>
|
||||
<Button variant="ghost" size="sm" :title="`Edit ${label}`" @click="startEdit">Edit</Button>
|
||||
<Button
|
||||
v-if="overridden"
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
title="Discard the dashboard value and fall back to the config file"
|
||||
:disabled="resetting"
|
||||
@click="reset"
|
||||
>
|
||||
Reset
|
||||
</Button>
|
||||
</div>
|
||||
</template>
|
||||
<!-- min-w-0 is load-bearing: a grid item refuses to shrink below its
|
||||
content by default, which is what pushed long paths into the action
|
||||
column and truncated them against the buttons. -->
|
||||
<slot name="value">
|
||||
<span
|
||||
:class="cn('min-w-0 break-words font-mono text-sm min-[701px]:truncate', text === '—' ? 'text-fg-subtle' : 'text-foreground', lockedReason && 'text-fg-muted')"
|
||||
:title="text"
|
||||
>{{ text }}</span>
|
||||
</slot>
|
||||
|
||||
<span v-if="lockedReason" class="col-span-full text-xs text-fg-subtle min-[701px]:col-span-2 min-[701px]:col-start-2">{{ lockedReason }}</span>
|
||||
<span v-if="error" class="col-span-full text-xs text-danger min-[701px]:col-span-2 min-[701px]:col-start-2" role="alert">{{ error }}</span>
|
||||
</div>
|
||||
</template>
|
||||
@@ -5,7 +5,7 @@ import ConfigCard from "./ConfigCard.vue";
|
||||
import ConfigList from "./ConfigList.vue";
|
||||
import ConfigRow from "./ConfigRow.vue";
|
||||
import { sectionRows, sectionsFor } from "./sections";
|
||||
import { config, configEditable } from "./state";
|
||||
import { config } from "./state";
|
||||
|
||||
/**
|
||||
* The generic schema rows for one page. The daemon serves one catalog of
|
||||
@@ -27,7 +27,6 @@ const sections = computed(() => sectionsFor(config.value?.schema, props.ids));
|
||||
:label="field.label"
|
||||
:value="field.value"
|
||||
:field="field"
|
||||
:editable="configEditable"
|
||||
/>
|
||||
</ConfigList>
|
||||
</ConfigCard>
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, watch } from "vue";
|
||||
|
||||
import { Checkbox } from "@/components/ui/checkbox";
|
||||
import { TableCell } from "@/components/ui/table";
|
||||
import { api } from "@/lib/api";
|
||||
import { errorText, loadConfig } from "./state";
|
||||
import type { RepoView } from "./types";
|
||||
|
||||
/**
|
||||
* One boolean override on a repository row.
|
||||
*
|
||||
* The box moves before the write and moves back if the write is refused: a
|
||||
* checkbox that waits on a round trip reads as a dropped click. It follows the
|
||||
* repository's own value afterwards, so a reload that changed it elsewhere is
|
||||
* not hidden behind a stale local copy.
|
||||
*/
|
||||
const props = defineProps<{ repo: RepoView; field: "allow_concurrent" | "review_enabled"; editable: boolean }>();
|
||||
|
||||
const checked = ref(Boolean(props.repo[props.field]));
|
||||
const loading = ref(false);
|
||||
const error = ref<string | null>(null);
|
||||
|
||||
watch(
|
||||
() => props.repo[props.field],
|
||||
(next) => {
|
||||
checked.value = Boolean(next);
|
||||
},
|
||||
);
|
||||
|
||||
async function change(next: boolean | "indeterminate"): Promise<void> {
|
||||
const value = next === true;
|
||||
checked.value = value;
|
||||
loading.value = true;
|
||||
error.value = null;
|
||||
try {
|
||||
await api.configRepoUpdate(props.repo.owner, props.repo.name, props.field, value);
|
||||
await loadConfig();
|
||||
} catch (err) {
|
||||
checked.value = !value;
|
||||
error.value = errorText(err);
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<TableCell>
|
||||
<template v-if="editable">
|
||||
<Checkbox :model-value="checked" :disabled="loading" :aria-label="field" @update:model-value="change" />
|
||||
<span v-if="error" class="ml-2 text-xs text-danger" role="alert">{{ error }}</span>
|
||||
</template>
|
||||
<template v-else>{{ checked ? "yes" : "no" }}</template>
|
||||
</TableCell>
|
||||
</template>
|
||||
@@ -1,68 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, watch } from "vue";
|
||||
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { TableCell } from "@/components/ui/table";
|
||||
import { api } from "@/lib/api";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { errorText, loadConfig } from "./state";
|
||||
import type { RepoView } from "./types";
|
||||
|
||||
/**
|
||||
* One integer override on a repository row. The value commits on blur or on
|
||||
* Enter, not on every keystroke: half-typed numbers are not configuration.
|
||||
*/
|
||||
const props = defineProps<{ repo: RepoView; field: "max_retries"; editable: boolean }>();
|
||||
|
||||
const draft = ref(String(props.repo[props.field] ?? 0));
|
||||
const loading = ref(false);
|
||||
const error = ref<string | null>(null);
|
||||
|
||||
watch(
|
||||
() => props.repo[props.field],
|
||||
(next) => {
|
||||
draft.value = String(next ?? 0);
|
||||
},
|
||||
);
|
||||
|
||||
function update(value: unknown): void {
|
||||
draft.value = String(value ?? "");
|
||||
}
|
||||
|
||||
async function commit(): Promise<void> {
|
||||
const parsed = parseInt(draft.value, 10);
|
||||
if (Number.isNaN(parsed)) {
|
||||
error.value = "Enter a whole number";
|
||||
return;
|
||||
}
|
||||
loading.value = true;
|
||||
error.value = null;
|
||||
try {
|
||||
await api.configRepoUpdate(props.repo.owner, props.repo.name, props.field, parsed);
|
||||
await loadConfig();
|
||||
} catch (err) {
|
||||
error.value = errorText(err);
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<TableCell :class="cn({ 'font-mono': !editable })">
|
||||
<template v-if="editable">
|
||||
<Input
|
||||
:model-value="draft"
|
||||
:disabled="loading"
|
||||
:aria-label="field"
|
||||
class="w-24"
|
||||
autocomplete="off"
|
||||
@update:model-value="update"
|
||||
@blur="commit"
|
||||
@keydown.enter.prevent="($event.target as HTMLElement).blur()"
|
||||
/>
|
||||
<span v-if="error" class="ml-2 text-xs text-danger" role="alert">{{ error }}</span>
|
||||
</template>
|
||||
<template v-else>{{ draft }}</template>
|
||||
</TableCell>
|
||||
</template>
|
||||
@@ -4,19 +4,15 @@ import { computed } from "vue";
|
||||
import { Empty, EmptyDescription, EmptyHeader, EmptyTitle } from "@/components/ui/empty";
|
||||
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table";
|
||||
import ConfigCard from "./ConfigCard.vue";
|
||||
import RepoBoolCell from "./RepoBoolCell.vue";
|
||||
import RepoIntCell from "./RepoIntCell.vue";
|
||||
import { config, configEditable } from "./state";
|
||||
import { config } from "./state";
|
||||
|
||||
/**
|
||||
* Each repository Archie polls, and the quality gate a change must pass before
|
||||
* it opens a pull request.
|
||||
*
|
||||
* Concurrent tasks, retries and self-review are per-repository overrides,
|
||||
* written through PATCH /api/config/repos/{owner}/{name} rather than into
|
||||
* config.toml directly, so a change here takes effect without editing a file
|
||||
* on the host. A process with no write path renders those three as values: its
|
||||
* PATCH route answers 503 (archie-core-ymut).
|
||||
* Concurrent tasks, retries and self-review are per-repository policy. They
|
||||
* are edited as the repository-policies control-plane resource, so this table
|
||||
* reports what each repository is running with.
|
||||
*/
|
||||
const repos = computed(() => config.value?.repositories ?? []);
|
||||
|
||||
@@ -58,9 +54,9 @@ function gateSummary(gate?: string[][]): string {
|
||||
<TableCell>{{ repo.ecosystem || "go" }}</TableCell>
|
||||
<TableCell class="font-mono">{{ gateSummary(repo.gate) }}</TableCell>
|
||||
<TableCell class="font-mono">{{ repo.protect?.length ? repo.protect.join(", ") : "—" }}</TableCell>
|
||||
<RepoBoolCell :repo="repo" field="allow_concurrent" :editable="configEditable" />
|
||||
<RepoIntCell :repo="repo" field="max_retries" :editable="configEditable" />
|
||||
<RepoBoolCell :repo="repo" field="review_enabled" :editable="configEditable" />
|
||||
<TableCell>{{ repo.allow_concurrent ? "yes" : "no" }}</TableCell>
|
||||
<TableCell class="font-mono">{{ repo.max_retries ?? 0 }}</TableCell>
|
||||
<TableCell>{{ repo.review_enabled ? "yes" : "no" }}</TableCell>
|
||||
</TableRow>
|
||||
</TableBody>
|
||||
</Table>
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import type { ConfigFieldType } from "./types";
|
||||
|
||||
/** The empty marker. A value the server did not send is shown as an em dash,
|
||||
* which is a fact about the running config, not a missing render. */
|
||||
export function valueText(value: unknown): string {
|
||||
@@ -7,19 +5,3 @@ export function valueText(value: unknown): string {
|
||||
return String(value);
|
||||
}
|
||||
|
||||
/** parseEdit turns the editor's text back into the value the wire expects, or
|
||||
* says why it cannot. Types without a numeric or boolean form are sent as the
|
||||
* text as typed, which is what the daemon's own parser then validates. */
|
||||
export function parseEdit(type: ConfigFieldType, text: string): { value?: unknown; error?: string } {
|
||||
switch (type) {
|
||||
case "int": {
|
||||
const n = parseInt(text, 10);
|
||||
if (Number.isNaN(n)) return { error: "Enter a whole number" };
|
||||
return { value: n };
|
||||
}
|
||||
case "bool":
|
||||
return { value: text === "true" };
|
||||
default:
|
||||
return { value: text };
|
||||
}
|
||||
}
|
||||
@@ -32,11 +32,6 @@ function isMissing(err: unknown): boolean {
|
||||
export const config = ref<ConfigView | null>(null);
|
||||
export const configError = ref<string | null>(null);
|
||||
|
||||
/** Whether this process can apply configuration changes. False means every row
|
||||
* renders as a value: the write routes answer 503, so a control would only
|
||||
* invite a failure. An unknown config (still loading, or unreadable) is not
|
||||
* read-only, so only an explicit false is treated as one. */
|
||||
export const configEditable = computed(() => config.value?.editable !== false);
|
||||
|
||||
/** Nothing to render: either the read failed, or archied is running without a
|
||||
* config file wired into the dashboard. */
|
||||
|
||||
@@ -14,17 +14,13 @@
|
||||
export type ConfigFieldType = "string" | "int" | "bool" | "duration" | "enum" | "structured";
|
||||
|
||||
export interface ConfigField {
|
||||
/** The dotted path PATCH /api/config accepts this value under. */
|
||||
/** The dotted path this value lives at in the running config. */
|
||||
key: string;
|
||||
label: string;
|
||||
description?: string;
|
||||
type: ConfigFieldType;
|
||||
value?: unknown;
|
||||
/** The dashboard may change it. Distinct from locked_reason, which is a
|
||||
* runtime property of the running config rather than of the field. */
|
||||
editable: boolean;
|
||||
locked_reason?: string;
|
||||
overridden?: boolean;
|
||||
options?: string[];
|
||||
/** Changing it will not take effect until archied restarts. */
|
||||
restart_required?: boolean;
|
||||
@@ -78,11 +74,6 @@ export interface ConfigView {
|
||||
providers?: Record<string, ProviderView>;
|
||||
provenance?: ConfigOrigin[];
|
||||
reload?: ReloadStatus;
|
||||
/** Whether this process can apply configuration changes at all. False makes
|
||||
* the pages render values rather than controls, which is the honest offer
|
||||
* from a process serving a published snapshot: its write routes answer 503
|
||||
* (archie-core-ymut). */
|
||||
editable: boolean;
|
||||
schema?: ConfigSection[];
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user