fix: navigate before loading page data
This commit is contained in:
@@ -56,19 +56,26 @@ Deno.test("sidebar running status reuses the green symbol spinner", async () =>
|
||||
sidebarCss.includes("--spinner-color: var(--success)"),
|
||||
"sidebar spinner should use the green success token",
|
||||
);
|
||||
const activityModel = await Deno.readTextFile(
|
||||
new URL("../src/lib/workspace/sidebar/workers.ts", import.meta.url),
|
||||
);
|
||||
const running = activityModel.indexOf("if (worker.state === 'running')");
|
||||
const subworker = activityModel.indexOf("if (worker.has_running_internal_workers)");
|
||||
const idle = activityModel.indexOf("if (worker.state === 'idle')");
|
||||
assert(
|
||||
sidebar.indexOf("worker.state === 'running'") <
|
||||
sidebar.indexOf("worker.has_running_internal_workers"),
|
||||
running >= 0 && running < subworker,
|
||||
"parent running state should keep the green Spinner priority",
|
||||
);
|
||||
assert(
|
||||
sidebar.indexOf("worker.has_running_internal_workers") <
|
||||
sidebar.indexOf("worker.state === 'idle'"),
|
||||
subworker >= 0 && subworker < idle,
|
||||
"SubWorker activity should replace the idle dot with the purple Spinner",
|
||||
);
|
||||
assert(
|
||||
sidebar.includes("worker.has_running_internal_workers"),
|
||||
"idle parents should render SubWorker activity from the Workspace projection",
|
||||
sidebar.includes("sidebarWorkerActivity(worker)") &&
|
||||
sidebar.includes("activity === 'worker-running'") &&
|
||||
sidebar.includes("activity === 'subworker-running'") &&
|
||||
sidebar.includes("activity === 'idle'"),
|
||||
"sidebar should render the authoritative parent and SubWorker activity projection",
|
||||
);
|
||||
assert(
|
||||
sidebar.includes('<Spinner label="SubWorker running" />'),
|
||||
@@ -87,7 +94,7 @@ Deno.test("sidebar running status reuses the green symbol spinner", async () =>
|
||||
Deno.test("running status is Composer-side above mini Tasks", async () => {
|
||||
const page = await Deno.readTextFile(
|
||||
new URL(
|
||||
"../src/routes/w/[workspaceId]/workers/[workerRef]/console/+page.svelte",
|
||||
"../src/routes/w/[workspaceId]/workers/[workerRef]/console/PageContent.svelte",
|
||||
import.meta.url,
|
||||
),
|
||||
);
|
||||
@@ -100,15 +107,17 @@ Deno.test("running status is Composer-side above mini Tasks", async () => {
|
||||
const status = page.indexOf("<WorkerRunStatus");
|
||||
const miniMode = page.indexOf('mode="mini"');
|
||||
const tasks = page.lastIndexOf("<ConsoleTasks", miniMode);
|
||||
const composer = page.indexOf('<form class="console-composer card"');
|
||||
const composer = page.indexOf('<form class="console-composer"');
|
||||
|
||||
assert(status >= 0, "WorkerRunStatus should be rendered");
|
||||
assert(composer >= 0, "Composer should be rendered");
|
||||
assert(miniMode >= 0 && tasks >= 0, "mini Tasks should be rendered");
|
||||
assert(status < tasks, "WorkerRunStatus should be above mini Tasks");
|
||||
assert(tasks < composer, "mini Tasks should remain above Composer");
|
||||
assert(
|
||||
runStatus.includes("nowMs - (startedAtMs ?? nowMs)"),
|
||||
"running elapsed should be recomputed from timestamps",
|
||||
runStatus.includes("compactionStatus?.progress.started_at_ms ?? startedAtMs") &&
|
||||
runStatus.includes("nowMs - (clockStartedAtMs ?? nowMs)"),
|
||||
"running elapsed should be recomputed from the active compaction or run timestamp",
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ function assert(condition: unknown, message: string): asserts condition {
|
||||
Deno.test("Worker Console exposes Overview and Normal display modes", async () => {
|
||||
const page = await Deno.readTextFile(
|
||||
new URL(
|
||||
"../src/routes/w/[workspaceId]/workers/[workerRef]/console/+page.svelte",
|
||||
"../src/routes/w/[workspaceId]/workers/[workerRef]/console/PageContent.svelte",
|
||||
import.meta.url,
|
||||
),
|
||||
);
|
||||
@@ -14,15 +14,21 @@ Deno.test("Worker Console exposes Overview and Normal display modes", async () =
|
||||
for (
|
||||
const token of [
|
||||
'consoleViewMode = $state<ConsoleViewMode>("overview")',
|
||||
'aria-label="Console display mode"',
|
||||
'consoleViewMode = "overview"',
|
||||
'consoleViewMode = "normal"',
|
||||
"projectConsoleLines(consoleProjection.lines, consoleViewMode)",
|
||||
"projectConsoleLines(internal.console.lines, consoleViewMode)",
|
||||
'role="switch"',
|
||||
'aria-checked={consoleViewMode === "overview"}',
|
||||
'title="On: Overview · Off: Normal"',
|
||||
'consoleViewMode = consoleViewMode === "overview" ? "normal" : "overview"',
|
||||
"selectedConsoleProjection = $derived(selectedWorkerView.console)",
|
||||
"mergeCommittedHistoryLines(",
|
||||
"selectedConsoleProjection.lines",
|
||||
"resolveWorkerControlShortcut",
|
||||
"handleWorkerControlShortcut",
|
||||
]
|
||||
) {
|
||||
assert(page.includes(token), `missing Console view-mode token: ${token}`);
|
||||
}
|
||||
assert(
|
||||
/projectConsoleLines\(\s*mergeCommittedHistoryLines\(\s*committedHistoryLines,\s*selectedConsoleProjection\.lines,?\s*\),\s*consoleViewMode,?\s*\)/.test(page),
|
||||
"the chosen main or SubWorker view must apply display mode to its merged retained and live lines",
|
||||
);
|
||||
});
|
||||
|
||||
@@ -47,7 +47,7 @@ Deno.test("Runtime Settings routes validate unknown JSON through the shared Runt
|
||||
Deno.test("Runtime registration presents the complete multi-Workspace trust sequence", async () => {
|
||||
const page = await Deno.readTextFile(
|
||||
new URL(
|
||||
"../src/routes/w/[workspaceId]/settings/runtimes/+page.svelte",
|
||||
"../src/routes/w/[workspaceId]/settings/runtimes/PageContent.svelte",
|
||||
import.meta.url,
|
||||
),
|
||||
);
|
||||
@@ -89,7 +89,7 @@ Deno.test("Runtime registration presents the complete multi-Workspace trust sequ
|
||||
Deno.test("Runtime list links to canonical detail and has no inline delete action", async () => {
|
||||
const page = await Deno.readTextFile(
|
||||
new URL(
|
||||
"../src/routes/w/[workspaceId]/settings/runtimes/+page.svelte",
|
||||
"../src/routes/w/[workspaceId]/settings/runtimes/PageContent.svelte",
|
||||
import.meta.url,
|
||||
),
|
||||
);
|
||||
@@ -122,7 +122,7 @@ Deno.test("Runtime list links to canonical detail and has no inline delete actio
|
||||
Deno.test("Runtime detail keeps trust controls owner-only and conflict-safe", async () => {
|
||||
const page = await Deno.readTextFile(
|
||||
new URL(
|
||||
"../src/routes/w/[workspaceId]/settings/runtimes/[runtimeId]/+page.svelte",
|
||||
"../src/routes/w/[workspaceId]/settings/runtimes/[runtimeId]/PageContent.svelte",
|
||||
import.meta.url,
|
||||
),
|
||||
);
|
||||
@@ -224,7 +224,7 @@ Deno.test("Runtime detail uses flat sections instead of nested cards", async ()
|
||||
const [page, css] = await Promise.all([
|
||||
Deno.readTextFile(
|
||||
new URL(
|
||||
"../src/routes/w/[workspaceId]/settings/runtimes/[runtimeId]/+page.svelte",
|
||||
"../src/routes/w/[workspaceId]/settings/runtimes/[runtimeId]/PageContent.svelte",
|
||||
import.meta.url,
|
||||
),
|
||||
),
|
||||
@@ -245,7 +245,7 @@ Deno.test("Runtime detail uses flat sections instead of nested cards", async ()
|
||||
});
|
||||
|
||||
Deno.test("Runtime labels and recovery controls do not depend on persisted authentication approval", async () => {
|
||||
for (const name of ["+page.svelte", "[runtimeId]/+page.svelte"]) {
|
||||
for (const name of ["PageContent.svelte", "[runtimeId]/PageContent.svelte"]) {
|
||||
const page = await Deno.readTextFile(
|
||||
new URL(
|
||||
"../src/routes/w/[workspaceId]/settings/runtimes/" + name,
|
||||
|
||||
@@ -365,7 +365,7 @@ Deno.test("Workspace deletion DTOs fail closed and preserve durable operation st
|
||||
|
||||
Deno.test("Workspace settings exposes owner-gated typed destructive confirmation", async () => {
|
||||
const source = (await Promise.all([
|
||||
"../src/routes/w/[workspaceId]/settings/+page.svelte",
|
||||
"../src/routes/w/[workspaceId]/settings/PageContent.svelte",
|
||||
"../src/lib/workspace/settings/WorkspaceIdentitySettings.svelte",
|
||||
].map((path) => Deno.readTextFile(new URL(path, import.meta.url))))).join(
|
||||
"\n",
|
||||
@@ -399,7 +399,7 @@ Deno.test("Repository settings consume the validated shared wire shape", async (
|
||||
),
|
||||
Deno.readTextFile(
|
||||
new URL(
|
||||
"../src/routes/w/[workspaceId]/settings/repositories/+page.svelte",
|
||||
"../src/routes/w/[workspaceId]/settings/repositories/PageContent.svelte",
|
||||
import.meta.url,
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user