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
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
address review (claude): correct the id-fallback rationale and pin it on the scan path
[._.]/ Adam Eivy28fad1ffcc70
diff --git a/server/services/sprites/walk.js b/server/services/sprites/walk.jsindex 3aaea3ff5c..8d783bb260 100644--- a/server/services/sprites/walk.js+++ b/server/services/sprites/walk.js@@ -120,9 +120,15 @@ function normalizeStripPreview(recordId, run) {// PortOS stamps `id` on every run record it writes; imported source-pipeline// records don't carry one at all (see importer.test.js's fixtures). The run-// DIRECTORY is the run id under both layouts, so fall back to it — the client-// keys the run list by `id`, and an undefined id would collide every idless-// run into one entry. In-memory only, like normalizeStripPreview.+// DIRECTORY is the run id under both layouts, so fall back to it. Two+// consumers break on an undefined id, which is why this isn't cosmetic:+// - WalkWorkflow.jsx's `runs.find((r) => r.id === sel.runId)` — an imported+// entry's `sel.runId` is ALSO undefined, so `undefined === undefined`+// matches the first idless run in the list whatever its direction, and+// that run gets pinned to the wrong direction's card.+// - the `resolvedRunIds` dedup below, where every idless run collapses onto+// the single `undefined` key.+// In-memory only, like normalizeStripPreview — never written back to disk.function normalizeRunRecord(recordId, run, runDirRel) {const withId = run.id ? run : { ...run, id: runDirRel.split('/')[1] };return normalizeStripPreview(recordId, withId);diff --git a/server/services/sprites/walk.test.js b/server/services/sprites/walk.test.jsindex c357452041..cd1daba696 100644--- a/server/services/sprites/walk.test.js+++ b/server/services/sprites/walk.test.js@@ -535,6 +535,22 @@ describe('getWalkState', () => {expect((await getWalkState(id)).runs).toEqual([]);});+ // The scan path needs the same id fallback: without it an idless scanned+ // run keys off `undefined`, which collapses the server-side dedup and makes+ // the client's `runs.find(r => r.id === sel.runId)` match the wrong+ // direction. Reverting the scan to normalizeStripPreview must fail here.+ it('keys an idless scanned grok run by its directory', async () => {+ const id = await characterWithLockedAnchors(newId(), ['east']);+ const runId = 'walk-east-scanidless';+ await mkdir(join(TEST_ROOT, 'sprites', id, 'grok', runId), { recursive: true });+ await writeFile(join(TEST_ROOT, 'sprites', id, 'grok', runId, 'animation-run.json'), JSON.stringify({+ kind: 'grok-walk-animation-run', status: 'candidate', characterId: id, direction: 'east',+ }));+ const { runs } = await getWalkState(id);+ expect(runs).toHaveLength(1);+ expect(runs[0].id).toBe(runId);+ });+// Unapproved candidates and in-flight generations have no selection entry// by definition, so the grok/ scan is still what surfaces them alongside// the entry-resolved approved run.