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

fix: preserve legacy walk contract counts (#3154)

[._.]/ Adam Eivyffdc903b4986
diff --git a/server/routes/sprites.js b/server/routes/sprites.js
index 211ac5fc3a..e575e609e1 100644
--- a/server/routes/sprites.js
+++ b/server/routes/sprites.js
@@ -62,6 +62,7 @@ import {
import { getTrackState, startTrackGeneration, approveTrackRun } from '../services/sprites/animationTrackWorkflow.js';
import { saveLoopTrim } from '../services/sprites/walkTrims.js';
import { compileAtlas, getAtlasState } from '../services/sprites/atlas.js';
+import { resolveWalkFrameCount } from '../services/sprites/atlasGrid.js';
import { setPublishBinding, publishAtlas } from '../services/sprites/publish.js';
import { deleteSpriteAsset } from '../services/sprites/assets.js';
@@ -184,6 +185,12 @@ router.get('/:id', asyncHandler(async (req, res) => {
kindTracks.length ? getAtlasState(req.params.id) : null,
...genericTracks.map((row) => getTrackState(row.id, req.params.id)),
]);
+ // Imported/pre-#3016 walk pointers may carry only their legacy column list.
+ // Normalize that compatibility shape at the API boundary so every client
+ // track reader can stay on the generic field/span contract.
+ if (runsWalk && atlas?.current?.geometry) {
+ atlas.current.geometry.walkFrameCount = resolveWalkFrameCount(atlas.current.geometry);
+ }
const tracks = Object.fromEntries(genericTracks.map((row, index) => [row.id, trackStates[index]]));
// PublishWorkflow needs the COMPLETE applicable registry slice, including
// walk (whose bespoke state does not carry `definition`). Keep it separate
diff --git a/server/routes/sprites.test.js b/server/routes/sprites.test.js
index 49214b8c3f..d42472cf8d 100644
--- a/server/routes/sprites.test.js
+++ b/server/routes/sprites.test.js
@@ -454,6 +454,14 @@ describe('sprites routes', () => {
records.getRecordWithAssets.mockResolvedValueOnce({
record: { id: 'pioneer', kind: 'character' }, assets: [],
});
+ atlas.getAtlasState.mockResolvedValueOnce({
+ current: {
+ geometry: {
+ columns: ['idle', 'walk-00', 'walk-01', 'walk-02', 'scanner'],
+ },
+ },
+ publications: [],
+ });
const r = await request(app).get('/api/sprites/pioneer');
expect(r.body.walk).toEqual({ runs: [], selection: null, walkSet: null });
expect(walk.getWalkState).toHaveBeenCalledWith('pioneer');
@@ -463,6 +471,7 @@ describe('sprites routes', () => {
contractFrameCountField: 'walkFrameCount',
standaloneContract: true,
});
+ expect(r.body.atlas.current.geometry.walkFrameCount).toBe(3);
// A character carries scanner but NOT ambient, so only scanner is keyed —
// and each state passes through with the `definition` (registry row) the
// service resolved, so the client renders the track's label/bounds from data