ContainerRuntimePage still bound the Go field names the document carried before archie-core-qna6 gave container-runtime-policies its own snake_case shape. Every control read a key the document does not hold, so the fields rendered empty and DurationInput warned on each mount; the page's Profiles section wrote to a key the decoder drops. Bind image, max_concurrency, max_uptime, volume_ttl, pull_policy and network, drop the dead Profiles section (named profiles live in the agent-profiles resource, filed as archie-core-x0wk), and pin the key list in a test the migration lacked. Settings -> Advanced rendered nothing in any deployment: its only card needs the sandbox dangerous-command authority, which has no implementation (archie-core-sod1). Drop it from the sidebar, the router and the gateway's dashboard page index; the page and its components stay in the tree for sod1. Register CardAction in SetupPanel and EmptyDescription in TaskLogs, which Vue was resolving to nothing, so the setup percentage and the log empty-state descriptions render again.
55 lines
1.7 KiB
TypeScript
55 lines
1.7 KiB
TypeScript
import assert from "node:assert/strict";
|
|
import { readFile } from "node:fs/promises";
|
|
import test from "node:test";
|
|
|
|
/**
|
|
* The keys of the container-runtime-policies document.
|
|
*
|
|
* internal/app/controlplane/containerRuntimePolicies owns this shape and
|
|
* normalises every stored document to it (archie-core-qna6). These are the keys
|
|
* the control plane serves, so they are the keys the page must bind.
|
|
*/
|
|
const documentKeys = [
|
|
"image",
|
|
"max_concurrency",
|
|
"max_uptime",
|
|
"volume_ttl",
|
|
"pull_policy",
|
|
"network",
|
|
];
|
|
|
|
/** The Go-cased spellings the wire carried before archie-core-qna6. */
|
|
const retiredKeys = ["Image", "MaxConcurrency", "MaxUptime", "VolumeTTL", "PullPolicy", "Network"];
|
|
|
|
test("the container runtime page binds the document's own keys", async () => {
|
|
const page = await readFile(
|
|
new URL("../src/settings/ContainerRuntimePage.vue", import.meta.url),
|
|
"utf8",
|
|
);
|
|
// Only the template binds fields; the script's own reads go through the
|
|
// `runtime` ref, whose `.value` is not a document key.
|
|
const template = page.slice(page.indexOf("<template>"));
|
|
const bound = [...template.matchAll(/runtime\.([A-Za-z_]+)/g)].map((m) => m[1]);
|
|
assert.ok(bound.length > 0, "the page binds no fields at all");
|
|
for (const key of new Set(bound)) {
|
|
assert.ok(
|
|
documentKeys.includes(key),
|
|
`runtime.${key} is not a container-runtime-policies key`,
|
|
);
|
|
}
|
|
});
|
|
|
|
test("the container runtime page does not bind a retired Go-cased key", async () => {
|
|
const page = await readFile(
|
|
new URL("../src/settings/ContainerRuntimePage.vue", import.meta.url),
|
|
"utf8",
|
|
);
|
|
for (const key of retiredKeys) {
|
|
assert.doesNotMatch(
|
|
page,
|
|
new RegExp(`\\.${key}\\b`),
|
|
`the document no longer carries ${key}`,
|
|
);
|
|
}
|
|
});
|