Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

test([nav-route-manifest-coverage-guard]): self-enforce the scanner's single-line assumption

[._.]/ Adam Eivyccec8cf0340a
diff --git a/PLAN.md b/PLAN.md
index 8ef0c48ac8..20c8b99678 100644
--- a/PLAN.md
+++ b/PLAN.md
@@ -6,6 +6,7 @@ For project goals, see [GOALS.md](./GOALS.md). For completed work, see [.changel
Claimable, well-specified, no decision needed — `/claim`-able. Unordered.
+- [ ] [nav-tabbed-page-coverage-guard] **Extend nav coverage to tabbed (`:tab` param) pages.** The `nav-route-manifest-coverage-guard` test in `server/lib/navManifest.test.js` deliberately skips every `:param` route, so a missing `NAV_COMMANDS` entry for a *tab* of a tabbed page can still slip through. The existing `TABBED_PAGES` contract in the same file covers only 4 sections (`/brain`, `/cos`, `/digital-twin`, `/meatspace`) because those export a clean `TABS` constant. The remaining tabbed pages have NO uniform tab list to assert against: `Calendar.jsx` uses a *local* (non-exported) `const TABS = [{id,…}]`, `Settings.jsx` has no list at all (a bare `switch (tab)` over `case 'general'`/`'backup'`/…), and `/goals/:tab`, `/insights/:tab`, `/messages/:tab`, `/wiki/:tab`, `/sharing/:section` are each their own shape. Add a per-page tab-source adapter (export a `TABS` constant from each page, or a small switch-arm/local-array extractor) and feed those into the `TABBED_PAGES`-style contract so every tab id round-trips to a `NAV_COMMANDS` path. Deferred from `nav-route-manifest-coverage-guard` review (codex, 2026-06-02): a separate guard with its own per-page parsing + false-positive surface, outside that item's "non-param route" scope.
- [ ] [story-builder-import-partial-commit] **Import flow doesn't handle a partial commit.** `ImportPanel.importAndBuild` calls `commitImport` once; if it fails after the universe/arc/canon persist but the issue-create rolls back, it just toasts a generic error. Re-clicking re-sends the full payload — a retry could duplicate issues. The standalone `Importer.jsx` guards this with the `arcAlreadyPersisted` retry (sends `arc:null, seasons:[]`). Either reuse that path or surface a "open in the Importer to recover" link.
- [ ] [arccanvas-sync-shared-hook] **Cleanup: extract the ArcCanvas host-wiring into a shared hook.** `client/src/pages/PipelineSeries.jsx` and `client/src/pages/StoryBuilder.jsx` (the `StoryBuilderDetail` wiring added by `story-builder-embed-arccanvas`) both hand-roll the same `lastSavedRef` + `updateSeriesFromServer` + `handleIssuesUpdate` + `flushPending` contract ArcCanvas expects. The two `flushPending` field-sets diverge (PipelineSeries flushes 10 bible fields + cover/style overrides; StoryBuilder only 6 and treats it as a near-no-op), and PipelineSeries also carries `patchSeries`/`handleSave`. Extract `useArcCanvasSync({ series, setSeries, setIssues, flushFields })` → `{ updateSeriesFromServer, handleIssuesUpdate, flushPending }` in `client/src/hooks/` and migrate both callers. Deferred from the embed PR because it's a 2-file refactor (touches PipelineSeries) with its own review surface.
- [ ] [story-builder-extract-image-render-hook] **Cleanup: the image-render lifecycle is duplicated 5×.** `StepCharacters` (StoryBuilder.jsx) + `StyleProbeImage.jsx` each re-implement `getSettings → readPipelineImageSettings → imageCfg` + a single-render jobId lifecycle, and `StepCharacters` near-verbatim copies `UniverseCanonSection`'s styled-render-and-persist routine. Extract a `useImageRenderSettings()` + `useSingleImageRender({ buildPrompt, onComplete })` hook and a shared canon styled-render helper. Also: `ProviderModelPicker` (StoryBuilder.jsx) duplicates the Importer's `LlmPicker` + `SeriesLlmPicker`/`FeatureProviderPicker`/`StagePromptModelPicker` — promote one shared provider/model picker.
diff --git a/server/lib/navManifest.test.js b/server/lib/navManifest.test.js
index fc09253608..a7c5bcc381 100644
--- a/server/lib/navManifest.test.js
+++ b/server/lib/navManifest.test.js
@@ -187,6 +187,9 @@ const NAV_COVERAGE_OPT_OUT = new Map([
['/universes/new', 'create-mode sentinel for the Universe Builder editor'],
]);
+// Element wrappers that forward to another route rather than render a page. A
+// NEW redirect wrapper must be added here, or the scanner will treat it as a
+// real page and (loudly, not silently) demand a nav entry for its route.
const REDIRECT_ELEMENT = /element=\{<\s*(Navigate|RedirectWithSearch|CanonRedirect|UniverseRouteRedirect)\b/;
// Flatten a stack of (possibly multi-segment, possibly "/") route path pieces
@@ -196,24 +199,37 @@ function joinRoutePath(segments) {
}
// Walk App.jsx line-by-line, tracking the stack of currently-open <Route>
-// containers, and return the absolute paths of every concrete, non-redirect,
-// non-param leaf route — the set that must each have a NAV_COMMANDS entry (or an
-// opt-out). Each <Route> is a single line in App.jsx, so a line scanner suffices.
-function extractNavigableRoutePaths(appSrc) {
+// containers. Returns:
+// - required: absolute paths of every concrete, non-redirect, non-param leaf
+// route — the set that must each have a NAV_COMMANDS entry (or an opt-out)
+// - malformed: <Route>-opening lines whose tag doesn't close on the same line
+// - stackDepth: open containers left unclosed at EOF
+// The scanner assumes each <Route> is a single line (true in App.jsx today). A
+// multi-line route would otherwise slip through silently — a multi-line *leaf*
+// reads as a pathless index route (resolves to an already-covered parent, never
+// flagged) and a multi-line *container* never gets pushed yet still pops on its
+// </Route>, corrupting the stack. `malformed`/`stackDepth` make that assumption
+// self-enforcing so it fails loudly instead. Returned (not thrown) so a bad
+// App.jsx surfaces as a focused test failure rather than aborting collection.
+function scanRoutes(appSrc) {
const stack = []; // parent path segments of currently-open <Route> containers
const required = [];
+ const malformed = [];
for (const rawLine of appSrc.split('\n')) {
const line = rawLine.trim();
if (line === '</Route>') { stack.pop(); continue; }
if (!/^<Route\b/.test(line)) continue; // skips <Routes>, comments, JSX text
+ // A single-line <Route> always closes its tag with `>` (container) or `/>`
+ // (leaf). Anything else is a multi-line opener the scanner can't handle.
+ if (!line.endsWith('>')) { malformed.push(line); continue; }
+
const pathMatch = line.match(/\bpath="([^"]*)"/);
const routePath = pathMatch ? pathMatch[1] : null; // null = index route
- const isContainer = line.endsWith('>') && !line.endsWith('/>');
// A container is a layout wrapper: push its segment so children resolve to
// absolute paths, but don't require a manifest entry for the wrapper itself.
- if (isContainer) {
+ if (!line.endsWith('/>')) {
stack.push(routePath ?? '');
continue;
}
@@ -227,14 +243,23 @@ function extractNavigableRoutePaths(appSrc) {
if (absolute.split('/').some((s) => s.startsWith(':'))) continue; // param route
required.push(absolute);
}
- return [...new Set(required)];
+ return { required: [...new Set(required)], malformed, stackDepth: stack.length };
}
describe('nav coverage — every navigable App.jsx route has a manifest entry', () => {
// Query string / hash on a manifest path (e.g. /media/image?settings=1) is a
// deep-link variant of a real route; compare on the bare path.
const navPaths = new Set(NAV_COMMANDS.map((c) => c.path.split(/[?#]/)[0]));
- const routePaths = new Set(extractNavigableRoutePaths(fs.readFileSync(APP_JSX, 'utf8')));
+ const scan = scanRoutes(fs.readFileSync(APP_JSX, 'utf8'));
+ const routePaths = new Set(scan.required);
+
+ it('the line scanner saw every <Route> (single-line assumption holds)', () => {
+ // A non-empty malformed list or unbalanced stack means a multi-line route
+ // exists and would slip past the coverage check below — re-fold it to one
+ // line, or upgrade the scanner before trusting the guard.
+ expect(scan.malformed).toEqual([]);
+ expect(scan.stackDepth).toBe(0);
+ });
it('each concrete leaf <Route> resolves to a NAV_COMMANDS path (or an opt-out)', () => {
const uncovered = [...routePaths]