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

address review (claude): flag missing strip via stripMissing, not error status

[._.]/ Adam Eivyfaebbe7ac6e5
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index b9b1b03d39..d485d69bc1 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -131,4 +131,4 @@
- **Fix two cross-schema breaks in the sprite detail endpoint that were hiding imported walk data** — `GET /api/sprites/:id` 500'd for every imported character because `getWalkState()`'s run-sort called `.localeCompare()` on `createdAt`, which the ElsewhereAcres source pipeline stamps as a Python epoch-seconds number rather than PortOS's own ISO string; the comparator now normalizes both shapes to milliseconds. Separately, each run's `stripPreview` field is now normalized through the existing `toRecordRelativeAssetPath()` helper (`server/services/sprites/paths.js`, mirroring the same rebase-on-read convention `reference.js` already uses for anchor paths): the source pipeline names the field `stripPreview.path` and anchors it at its own repo root, so PortOS's `stripPreview.stripPath`-reading client 404'd on every animated walk-loop thumbnail even once the 500 was fixed. Neither fix rewrites the imported files on disk — normalization happens in memory at read time, so the importer's hash-verified provenance is untouched. New regression coverage in `walk.test.js`. Filed #2924 to cover the one remaining gap: `pioneer`'s `east` direction was approved from an imagegen-redraw pipeline the grok-video-only walk viewer doesn't model, so it shows "approved" but no animated thumbnail.
- **Accessibility audit pass: switches, icon-only buttons, focus rings, and the media lightbox** — four hand-rolled toggle switches (CoS Dynamic Avatar, Digital Twin ingestion, scheduled backups, Sharing import mode) were announced as plain unlabeled buttons with no on/off state; they now carry `role="switch"` + `aria-checked` + a name. A dozen icon-only buttons gained accessible names (cron cancel, folder "go up", rapid-reader chunk size, JIRA project clear, writing-sample remove, memory-practice mark correct/incorrect, calendar icon picker) and the process/agent expand carets gained `aria-expanded`. Six inputs that set `focus:outline-none` inside an unstyled wrapper were invisible when focused — their containers now carry `focus-within:border-port-accent`, and four standalone selects/buttons gained a `focus-visible` ring. The Sprites asset preview moved from a click-to-dismiss overlay to the shared `<Modal>` (Esc, focus trap, focus restore), and `MediaLightbox` — which deliberately opts out of `<Modal>` — now supplies its own `role="dialog"`/`aria-modal` and focus trap instead of letting Tab walk out into the page behind it. ~20 unlabeled toolbar controls on the highest-traffic pages (Runner, Review, Wiki, Tribe, Loras, Media History, Media Collections, Prompt Manager) gained labels. A new `client/src/a11yConventions.test.js` guard fails the suite if a new hand-rolled full-screen backdrop or an unlabeled toggle-switch button is introduced; the remaining unlabeled-control backlog is tracked in `PLAN.md`.
- **Heal the `grok/` run-path residue that blanked imported sprite walk cycles (migration 203)** — imported characters whose source pipeline anchored run paths at `art-source/sprites/<id>/grok/…` rendered every walk direction's "approved" badge over an empty cell (observed on `pioneer`: 7 of 8 directions blank, only the imagegen-redraw `east` — which never carried a `grok/` segment — animated). Migration 202 physically relocated those runs `grok/` → `runs/` but its `startsWith('grok/')` neutralizer only matched record-relative paths, so it left every repo-anchored `…/sprites/<id>/grok/…` string pointing at the now-nonexistent directory — the read layer stripped the `art-source/…` prefix to `grok/…`, which no longer resolved, so `getWalkState` couldn't find the run behind each direction and the strip-loop preview URL 404'd. New migration `203-heal-imported-grok-run-paths.js` rewrites the leftover `sprites/<id>/grok/` segment to `runs/` (preserving the `art-source/…` provenance prefix and image-byte shas, exactly as 202 preserved its anchoring) across the selection, walk-set, run records, and postprocess manifests, then recomputes the same `runManifestSha256`/`selectionSha256`/`walkSetSha256` cascade so the healed state is internally consistent. Gated to records 202 already moved (`runs/` present, `grok/` gone) that still carry the residue — a self-consistent `grok/`-layout record is left untouched. Non-path strings that merely contain "grok" (`grok-game-animation-frames-run`, `local-postprocess-of-existing-grok-session-video`) are unaffected.
-- **Surface a missing walk strip as an error instead of a silent blank card** — a finalized sprite direction whose packed `…-strip.png` had gone missing on disk (how `pioneer`'s `north`/`west` strips vanished — dropped during a `grok/`→`runs/` relocation while the record still advertised the path) rendered its "approved" badge over an empty cell: `getWalkState`'s native run path handed the client a `stripPreview.stripPath` that 404'd into a blank CSS-`background-image` `StripLoop`, unlike `loadRedrawRun` which already returns null on a missing strip. `getWalkState` now checks the strip on disk (`normalizeMissingStrip`, mirroring the existing `normalizeStaleRendering` read-time normalization — never persisted) and, when absent, surfaces the run as an `error` with `stripMissing: true` + a "regenerate this direction to repack it" message and drops the dangling `stripPath` so `StripLoop`/the trim button don't render it. As defense-in-depth (a background-image fires no `onError`), `StripLoop` also preloads the strip via an `Image` probe and shows an explicit "strip missing" placeholder if it fails to load.
+- **Flag a missing walk strip instead of rendering a silent blank card** — a sprite direction whose packed `…-strip.png` had gone missing on disk (how `pioneer`'s `north`/`west` strips vanished — dropped during a `grok/`→`runs/` relocation while the record still advertised the path) rendered its "approved" badge over an empty cell: `getWalkState`'s native run path handed the client a `stripPreview.stripPath` that 404'd into a blank CSS-`background-image` `StripLoop`, unlike `loadRedrawRun` which already returns null on a missing strip. `getWalkState` now checks the strip on disk (`normalizeMissingStrip`, mirroring the existing `normalizeStaleRendering` read-time normalization — never persisted) and, when absent, flags the run `stripMissing: true` and drops the dangling `stripPath` so `StripLoop`/the trim button don't render it. The walk card shows an explicit "strip missing" indicator pointing at the recovery that actually works for that direction's state — **regenerate** an unapproved/unfinalized direction, **unlock** a finalized set — rather than overloading the run's `error` status (which would offer a "Retry postprocess" that 409s on a finalized/approved direction and pair a red error with the green "approved" ✓). As defense-in-depth (a background-image fires no `onError`), `StripLoop` also preloads the strip via an `Image` probe and shows a placeholder if it fails to load for any other reason.
diff --git a/client/src/components/sprites/WalkWorkflow.jsx b/client/src/components/sprites/WalkWorkflow.jsx
index 1579dd6802..44e95df763 100644
--- a/client/src/components/sprites/WalkWorkflow.jsx
+++ b/client/src/components/sprites/WalkWorkflow.jsx
@@ -139,6 +139,19 @@ function DirectionCard({
<StripLoop recordId={recordId} stripPreview={run.stripPreview} />
)}
+ {/* The server dropped this run's stripPath because its packed strip is
+ gone on disk (stripMissing) — render an explicit indicator in place of
+ the blank loop, pointing at the recovery that actually works for this
+ direction's state: a finalized set must be unlocked first, an
+ unapproved candidate can just be regenerated (the Generate button
+ below). Deliberately not the status==='error' path, which offers a
+ "Retry postprocess" that 409s for a finalized/approved run. */}
+ {(approved || candidate) && run?.stripMissing && (
+ <p className="text-[10px] text-port-error border border-port-error/60 rounded px-1.5 py-1 leading-tight">
+ Walk strip missing on disk — {finalized ? 'unlock the set to regenerate this direction' : 'regenerate to repack it'}.
+ </p>
+ )}
+
{/* grok animates in an observable TUI session — link into the Shell page
to watch it, and (if needed) type to course-correct or Stop it. The
session exists only while the render is live ('rendering'). */}
diff --git a/client/src/components/sprites/WalkWorkflow.test.jsx b/client/src/components/sprites/WalkWorkflow.test.jsx
index bb10f3ae5c..d9db49f569 100644
--- a/client/src/components/sprites/WalkWorkflow.test.jsx
+++ b/client/src/components/sprites/WalkWorkflow.test.jsx
@@ -124,6 +124,43 @@ describe('WalkWorkflow loop preview', () => {
}
});
+ // When the server flags a run stripMissing (its packed strip is gone on disk)
+ // it drops the stripPath, so the loop can't render. The card must show an
+ // explicit indicator pointing at the recovery that works for the direction's
+ // state — regenerate an unapproved/unfinalized direction, unlock a finalized
+ // set — never the status==='error' "Retry postprocess" that would 409.
+ const renderMissing = ({ finalized }) => render(
+ <MemoryRouter>
+ <WalkWorkflow
+ record={{ id: 'example-walker' }}
+ reference={{ manifest: { mainReference: { locked: true }, anchors: [{ direction: 'east', status: 'locked' }] } }}
+ walk={{
+ runs: [{ id: 'run-east', direction: 'east', status: 'candidate', stripMissing: true, stripPreview: { frameCount: 8, fps: 12, cellWidth: 384, cellHeight: 384 } }],
+ selection: { directions: { east: { status: 'approved', runId: 'run-east' } } },
+ walkSet: finalized ? { directions: { east: { status: 'approved' } } } : null,
+ }}
+ renders={noRenders()}
+ duration={6}
+ onDurationChange={vi.fn()}
+ onGenerate={vi.fn()}
+ onChanged={vi.fn()}
+ />
+ </MemoryRouter>,
+ );
+
+ it('shows a regenerate-oriented strip-missing indicator on an unfinalized direction', () => {
+ renderMissing({ finalized: false });
+ expect(screen.getByText(/Walk strip missing on disk — regenerate to repack it\./)).toBeInTheDocument();
+ // No dead "Retry postprocess" button (that path is gated on status==='error').
+ expect(screen.queryByRole('button', { name: /Retry postprocess|Re-run postprocess/ })).toBeNull();
+ expect(screen.queryByRole('img', { name: 'walk loop preview' })).toBeNull();
+ });
+
+ it('points a finalized direction at unlock instead of regenerate', () => {
+ renderMissing({ finalized: true });
+ expect(screen.getByText(/Walk strip missing on disk — unlock the set to regenerate this direction\./)).toBeInTheDocument();
+ });
+
it('scales the preview box to a non-square cell', () => {
const loop = renderWalk({
stripPath: 'grok/walk-east-abc/generated/strip.png',
diff --git a/server/services/sprites/walk.js b/server/services/sprites/walk.js
index 796bf002d1..71fbbd205b 100644
--- a/server/services/sprites/walk.js
+++ b/server/services/sprites/walk.js
@@ -185,23 +185,26 @@ function normalizeStripPreview(recordId, run) {
// render path (unlike loadRedrawRun, which returns null on a missing strip)
// hands the client a healthy-looking run and StripLoop paints a blank
// background-image with no signal that anything is wrong. That's exactly how the
-// pioneer north/west strips vanished silently. Surface it as an error at read
-// time — never persisted — so the card shows the missing-strip message + a
-// regenerate affordance instead of a mystery blank, and drop the dangling
-// stripPath so StripLoop and the trim button don't try to render it. A run with
-// no stripPreview (rendering/postprocessing/pre-package) is untouched.
+// pioneer north/west strips vanished silently. Flag it at read time — never
+// persisted — so the card renders an explicit "strip missing" indicator instead
+// of a mystery blank, and drop the dangling stripPath so StripLoop and the trim
+// button don't try to render it. A run with no stripPreview
+// (rendering/postprocessing/pre-package) is untouched.
+//
+// Deliberately does NOT flip status to 'error': the run's status is orthogonal
+// to whether its strip survived on disk. Overloading 'error' here mis-drives the
+// UI — DirectionCard's error block offers "Retry postprocess", which 409s
+// (WALK_SET_FINAL / RUN_APPROVED) for exactly the finalized/approved directions
+// this guard most often fires on (the pioneer north/west population), and pairs a
+// red error with the green "approved" badge. Keeping the status lets the client
+// route recovery correctly off `stripMissing` + the direction's approved/finalized
+// state (regenerate an unapproved candidate; unlock the set for a finalized one).
async function normalizeMissingStrip(recordId, run) {
const stripPath = run?.stripPreview?.stripPath;
if (!stripPath) return run;
if (await pathExists(join(spriteDir(recordId), stripPath))) return run;
const { stripPath: _dropped, ...stripPreviewRest } = run.stripPreview;
- return {
- ...run,
- status: 'error',
- stripMissing: true,
- postprocessError: 'Packed walk strip is missing on disk — regenerate this direction to repack it.',
- stripPreview: stripPreviewRest,
- };
+ return { ...run, stripMissing: true, stripPreview: stripPreviewRest };
}
// PortOS stamps `id` on every run record it writes; imported source-pipeline
diff --git a/server/services/sprites/walk.test.js b/server/services/sprites/walk.test.js
index 4fb71f6e8b..bfbe59a317 100644
--- a/server/services/sprites/walk.test.js
+++ b/server/services/sprites/walk.test.js
@@ -484,9 +484,10 @@ describe('getWalkState', () => {
// (a botched migration or manual cleanup dropped it — how pioneer's north/west
// strips silently vanished) must NOT surface as a healthy run: the native
// render path otherwise hands the client a stripPath that 404s into a blank
- // StripLoop. getWalkState surfaces it as an error with stripMissing, drops the
- // dangling stripPath, and never rewrites the record on disk.
- it('surfaces a candidate run whose strip is missing on disk as an error', async () => {
+ // StripLoop. getWalkState flags it with stripMissing and drops the dangling
+ // stripPath, WITHOUT flipping status to 'error' (which would mis-drive the
+ // client's postprocess-retry UI), and never rewrites the record on disk.
+ it('flags a candidate run whose strip is missing on disk with stripMissing', async () => {
const id = await characterWithLockedAnchors(newId(), ['east']);
const { runId } = await makeCandidateRun(id, 'east');
const runRecordPath = join(TEST_ROOT, 'sprites', id, 'runs', runId, 'animation-run.json');
@@ -496,15 +497,39 @@ describe('getWalkState', () => {
const { runs } = await getWalkState(id);
const run = runs.find((r) => r.id === runId);
- expect(run.status).toBe('error');
expect(run.stripMissing).toBe(true);
- expect(run.postprocessError).toMatch(/strip is missing/i);
+ // Status is preserved — a missing strip is orthogonal to postprocess status,
+ // and flipping to 'error' would offer a Retry that 409s on finalized/approved.
+ expect(run.status).toBe('candidate');
// Dangling stripPath is dropped so StripLoop / the trim button don't render it.
expect(run.stripPreview.stripPath).toBeUndefined();
// Read-time only — the record on disk is untouched.
expect(await readFile(runRecordPath)).toEqual(bytesBefore);
});
+ // The population this guard exists for is an APPROVED direction whose strip
+ // vanished (pioneer's north/west — approved, then their strips dropped during a
+ // grok/->runs/ relocation). The approved entry resolves through loadRunForEntry,
+ // and the flag must ride through that path too — the run stays approved in the
+ // selection (recovery there is unlock-then-regenerate, driven client-side off
+ // stripMissing + finalized), never mutated to a broken 'error' run.
+ it('flags an approved direction whose strip is missing without disturbing its approval', async () => {
+ const id = await characterWithLockedAnchors(newId(), ['east']);
+ const { runId } = await makeCandidateRun(id, 'east');
+ await approveWalkDirection(id, { direction: 'east', runId });
+ // Approval froze the strip on disk; now it vanishes.
+ await rm(join(TEST_ROOT, 'sprites', id, 'runs', runId, 'generated', `${id}-walk-east-strip.png`));
+
+ const { runs, selection } = await getWalkState(id);
+ const run = runs.find((r) => r.id === runId);
+ expect(run.stripMissing).toBe(true);
+ expect(run.stripPreview.stripPath).toBeUndefined();
+ expect(run.status).not.toBe('error');
+ // The selection still records the direction as approved — the guard never
+ // touches approval state, only the strip preview.
+ expect(selection.directions.east.status).toBe('approved');
+ });
+
// A run whose strip IS on disk stays a healthy candidate — the guard only
// fires on an actually-missing file, not on every read.
it('leaves a candidate run with its strip present untouched', async () => {