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: absent-from-map read as clipless, and atlas chroma key

[._.]/ Adam Eivy2ab39784b54c
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index d16681de49..aa33298209 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -186,7 +186,7 @@
- **[claude-default-opus-5] Default Claude CLI/TUI and Bedrock providers now use `claude-opus-5`.** The seeded `claude-code`, `claude-code-tui`, `claude-code-bedrock`, and `claude-code-tui-bedrock` providers ship the new opus tier as their default/heavy model (`claude-opus-5`; Bedrock: `global.anthropic.claude-opus-5[1m]`), and `claude-opus-5` leads the Anthropic API model-refresh list. The Bedrock `[1m]` long-context variant is carried forward and mapped like-for-like — a box pinned to `…opus-4-8[1m]` lands on `…opus-5[1m]`, one pinned to the plain id lands on the plain id — so the bump never silently changes which context tier a Bedrock request asks for. `data.reference/providers.json`, the aiToolkit sample defaults, and the PortOS scaffolder are updated together, and migration `206-claude-default-opus-5.js` rewrites existing installs' `data/providers.json` on the next `update.sh` — conservatively, matching migration 058/153: only an exact match on the prior seeded model list is rewritten (a curated list is left alone), a tier pointer still parked on a now-absent opus-4-8 id is repaired on its own, and still-current haiku/sonnet pins are preserved. `claude-opus-5` is added to the usage cost table at Opus-tier rates ($5/$25 per MTok), and the `/opus/i` family rule now reports it as the tier's rate anchor.
- **[issue-2991] Support portless desktop managed processes and an app→sprite reverse lookup** — a managed app can now describe a GUI/desktop process (`type: 'desktop'`, e.g. a Godot game binary) with no HTTP port, and the port-dependent surfaces degrade gracefully instead of faking a port. Start now launches a desktop app from its own `startCommands` with PM2 `autorestart` OFF (a window closing is a normal exit, not a crash to loop on — `startWithCommand` gained an `{ autorestart }` option), skips the web-server ecosystem path, and refuses to spawn a second instance when the process is already online. Status reports from the supervisor alone (a clean quit renders as *stopped*, never "unreachable"), and the null-tolerant reserved-port collection already excludes absent ports. The "Open UI" launcher stays hidden for a portless app (`getLaunchUrls` returns all-null) rather than linking to `undefined`. New `GET /api/apps/:id/sprite-bindings` reverse-lookup lists the sprite records whose `publishBinding.appId` targets an app, surfaced on the app Overview tab as "Published Sprite Assets" with their destination paths — making "PortOS is the creative source for this app" legible from the app side. Publishing itself still resolves purely from `repoPath`, with no dependency on registered processes.
- **[issue-2953] Finish the image-to-3D workspace: file-upload picker, a per-record detail route, and a records library** — the `/media/3d` page now doubles as a library, listing every `image_to_3d_models` record (newest-first) as a deep-link card into a new `/media/3d/:id` detail view. The detail page mounts the reusable `GlbViewer` (with **Download .glb**) once a render lands `ready`, polls while `generating`, surfaces the runner's actionable error on `failed`, and offers re-render + delete (inline-confirm) — the URL is the source of truth for what's open, per the ID-based deep-linking convention. `GalleryImagePicker` gains an optional `allowUpload` prop: an "Upload" control saves a file off disk into the gallery via the existing peer-syncable `POST /api/image-gen/upload`, then selects it exactly like a gallery image, so an uploaded photo feeds `createImageTo3dModel` the same way a render-history pick does. No new backend surface — everything runs against the endpoints that landed in #2973.
-- **[issue-3043] Let a frozen imported walk set be unlocked for regeneration** — a character imported from the source pipeline whose walk set was finalized without its per-run source clips (the phase-1 import shape) had *no reachable action at all*: unlock and reopen both 409'd `LEGACY_IMPORTED_WALK_SET` (nothing to re-derive from), the cycle-target PUT 409'd `WALK_SET_FINAL` (set is frozen), and the workflow header rendered a dead `imported · no clips to re-derive` label with no button behind it — while the drift banner told the user to re-derive. The guard's premise was too narrow: it reasoned only about *re-derivation*, but a walk render is conditioned on the direction's **locked anchor**, so such a set can always be rebuilt from scratch — it just costs a new render per direction instead of a free local repack. `POST /walk/unlock` now accepts `{ acknowledgeNoClips }`, honored only where the server has proven every stranded direction has a locked anchor to regenerate from (an acknowledgement can never be the thing that strands a set — a stranded direction with an unlocked anchor still refuses, with the original error code). `getWalkState` stamps `walkSet.unlock = { blocked, stranded, acknowledgeable }` from the same resolver the gate itself uses, so the button a client offers and the 409 it might hit are computed from one reading of the set; the refusal that *can* be acknowledged past gets its own code (`LEGACY_IMPORTED_WALK_SET_REGENERABLE`) and names that path. The Walk Cycles header replaces the dead label with an **Unlock anyway** panel stating the cost as visible text rather than a tooltip (one new grok render per direction, every approval dropped, nothing deleted on disk), and the Loop Trimmer disables its `CycleTarget` while the set is frozen — it was enabled and 409'd on change — with the same two unlock offers below it. Two adjacent bugs surfaced while proving the escape is real and are fixed with it: `startWalkGenerationImpl` read `manifest.chromaKey` alone, but the importer stamps the key it used on the RECORD and copies a manifest carrying none — so every fully-locked source-pipeline import reported `MAIN_NOT_LOCKED` ("no frozen chroma key") and refused every Generate; the lookup now falls back manifest → record, the order reference.js already resolves it in at eight sites, The postprocess path carried the SAME missing rung (`run.chromaKey || manifest.chromaKey`) and died inside sharp with `Invalid hex color: undefined` on any reprocess of an imported run — a parser complaining about its argument, naming neither the field nor the record behind it. All three sites now share one `resolveChromaKey({ manifest, record, run })` (run → manifest → record), and a genuinely keyless record is refused by name before reaching the color parser. And the render path's anchor/chroma preconditions are now one shared `resolveWalkRenderability()`, so the gate that promises "every direction can be regenerated" and the render path that has to deliver it cannot drift — a predicate checking less than the render requires is exactly how an acknowledgement walks a user into the dead end it promises cannot happen.
+- **[issue-3043] Let a frozen imported walk set be unlocked for regeneration** — a character imported from the source pipeline whose walk set was finalized without its per-run source clips (the phase-1 import shape) had *no reachable action at all*: unlock and reopen both 409'd `LEGACY_IMPORTED_WALK_SET` (nothing to re-derive from), the cycle-target PUT 409'd `WALK_SET_FINAL` (set is frozen), and the workflow header rendered a dead `imported · no clips to re-derive` label with no button behind it — while the drift banner told the user to re-derive. The guard's premise was too narrow: it reasoned only about *re-derivation*, but a walk render is conditioned on the direction's **locked anchor**, so such a set can always be rebuilt from scratch — it just costs a new render per direction instead of a free local repack. `POST /walk/unlock` now accepts `{ acknowledgeNoClips }`, honored only where the server has proven every stranded direction has a locked anchor to regenerate from (an acknowledgement can never be the thing that strands a set — a stranded direction with an unlocked anchor still refuses, with the original error code). `getWalkState` stamps `walkSet.unlock = { blocked, stranded, acknowledgeable }` from the same resolver the gate itself uses, so the button a client offers and the 409 it might hit are computed from one reading of the set, and the read hands the gate the clip evidence it already resolved rather than re-probing disk. The refusal keeps the single `LEGACY_IMPORTED_WALK_SET` code and names the override in its message, following the `FORK_SYNC_REQUIRED`/`acknowledgeFork` precedent — whether a block is overridable rides on the stamped `unlock.acknowledgeable` clients already read, not on a second code string. The Walk Cycles header replaces the dead label with an **Unlock anyway** panel stating the cost as visible text rather than a tooltip (one new grok render per direction, every approval dropped, nothing deleted on disk), and the Loop Trimmer disables its `CycleTarget` while the set is frozen — it was enabled and 409'd on change — with the same two unlock offers below it. Two adjacent bugs surfaced while proving the escape is real and are fixed with it: `startWalkGenerationImpl` read `manifest.chromaKey` alone, but the importer stamps the key it used on the RECORD and copies a manifest carrying none — so every fully-locked source-pipeline import reported `MAIN_NOT_LOCKED` ("no frozen chroma key") and refused every Generate; the lookup now falls back manifest → record, the order reference.js already resolves it in at eight sites. The postprocess path carried the SAME missing rung (`run.chromaKey || manifest.chromaKey`) and died inside sharp with `Invalid hex color: undefined` on any reprocess of an imported run — a parser complaining about its argument, naming neither the field nor the record behind it. The atlas compile read it manifest-only too, so the recovery path this issue opens (unlock → regenerate all 8 → approve → freeze) would have dead-ended there at a 409 *after* eight paid renders. All four sites now share one `resolveChromaKey({ manifest, record, run })` (run → manifest → record), and a genuinely keyless record is refused by name before reaching the color parser. And the render path's anchor/chroma preconditions are now one shared `resolveWalkRenderability()`, so the gate that promises "every direction can be regenerated" and the render path that has to deliver it cannot drift — a predicate checking less than the render requires is exactly how an acknowledgement walks a user into the dead end it promises cannot happen.
- **[issue-3049] Pin the walk aligner to the character's torso, not its bounding box** — a re-derived walk cycle slid visibly left and right as the legs scissored instead of walking in place; measured on a real packed 12-frame strip the torso travelled **29px** in a 384px cell. `alignFrames` crops each frame to its own alpha bbox and composites the crop at `dx`, and since #3021 `dx` was a single shared value — but `sourceRootXs[i]` is measured *relative to that frame's own crop*, so a constant `dx` pins `bbox.left` (the leading arm/leg extremity) and lets the body swing by the full spread of those offsets. The emitted manifest showed it exactly: `hipOffsets` spanning 26.2px against `translations` whose x was `122` for all twelve frames, and the strip itself had `bbox.left` at exactly 122 in every cell while the hip swung 179→205. #3021's premise was right (the old 42%–76% hip/leg band did migrate as the legs scissored) but freezing `dx` swapped it for a *worse* landmark: measured in absolute source coordinates over one 6s clip, the candidates rank torso 14px · hip 17px · head 24px · **bbox.left 44px** · legs 52px. So `rootX` now measures the **torso** band (30%–58%, above the knees — the visual mass a viewer tracks and the part genuinely stationary in a walk-in-place) and `dx` is per-frame again, computed from each frame's own crop offset so the shared landmark lands on the pivot every time; that cancels the crop variation *and* the residual drift grok leaves in a "walk in place" clip (~14px). `rootX` is shared with `atlas.js` for idle-frame registration, so both moved together. The #3021 guard had asserted the mechanism (`new Set(translations.map(([dx]) => dx)).size === 1`) rather than the behaviour, and its own fixed-torso/swinging-arm fixture passed while the body slid 30px — it now measures where the torso *lands* in the output frames and requires ≤1px spread, which pinning the crop cannot satisfy. Re-deriving a real direction: torso spread **29px → 1.0px**, with the hip band still swinging 8px and `bbox.left` varying 9px (limbs moving, body still).
- **[issue-3050] Spread walk-cycle phases evenly when the gait period doesn't divide the frame count** — a re-derived walk could read as a limp rather than a smooth loop: the *timing* was uneven, not the seam (which is why `validation` never flagged it — the loop closed fine). `selectCycleIndices` resamples the detected window with `pyRound(i * cycleLength / frameCount)`, and `pyRound` is Python's round-half-to-even, so a `.5` tie breaks toward the even integer — meaning the tie's *direction* depends on the parity of the integer part and consecutive ties resolve opposite ways. A 15-frame gait over 12 phases landed its ties at 2.5→2 (down), 7.5→8 (up), 12.5→12 (down), putting double-steps at positions 2, 5 and 10 — spacings of 3 and 5, an arrhythmic hitch. The run manifest corroborated it: those three transitions carried ~28% more motion than the single-step median. Phase indices are now distributed with integer half-up (`floor((i * cycleLength + frameCount/2) / frameCount)`), which resolves every tie the same way, so the unavoidable stretch is spread evenly — 15→12 moves its double-steps to 1, 5 and 9 (gaps of 4 and 4). This is the one place that deliberately does not use `pyRound`: the pixel math keeps it for byte-compatibility with the source pipeline, while phase selection is a perceptual-quality question and only it has a tie problem. The legacy 12→8 default was affected too (strides `2,1,1,2,2,1,1` → `2,1,2,1,2,1,2`), as were 18→12 and any other ratio landing ties at regular intervals; 16→12, 13→12 and 12→12 were already even and are unchanged. The old golden-array test asserted the banker's-rounding output directly; it is replaced by a property assertion — at most two distinct stride lengths, differing by 1, with the longer ones evenly spaced — checked across five ratios so a future change to the resample has to preserve it for all of them.
- **[issue-3052] Stop the requested phase count from hiding a shorter gait period** — a walk read as janky leg movement (the legs visibly jump mid-loop) even though the endpoint seam scored well and validation passed. `selectCycleIndices` searched only windows of at least `frameCount`, on the grounds that a shorter one cannot yield that many *distinct* source frames — but that floor also made any gait whose real period is shorter **invisible to the detector**. On a real clip the gait ran 11 frames against 12 requested phases, so the search could only offer a 15-frame window: **1.36 gait cycles**, which replays a third of a stride. It scored well because a front-facing walk is near-symmetric, so 15 frames lands on the *mirrored* pose and an image-distance metric reads that as the same one — `endpointSeamScore` 0.53 while the legs were plainly wrong. The detector now probes for the true period without the output-count floor and prefers it when it is only mildly shorter (`MIN_PERIOD_RATIO = 0.8`), holding one frame to reach the requested count: a far smaller artifact than replaying part of a stride, and bounded so a much shorter period still falls back to the longer window. `cycleSelection.heldFrames` records how many phases repeat, and `validateFrames` takes it so an intentional hold is not confused with the "packer picked the same frame twice" failure that guard exists for. Across one character's seven directions the probe found better (lower-seam) windows on five — south 15→11 (0.531→0.476), south-east 12→11 (1.082→**0.438**), north-east 12→11 (0.985→**0.600**). **Rejected on evidence:** re-extracting at `WALK_FPS * frameCount / period` so the period lands exactly on the count was built and measured, and is wrong twice over — ffmpeg's `fps` filter picks the nearest source frame, so any rate that is not `sourceFps / k` samples unevenly (13.09fps from a 24fps source gives source-frame steps `[2,2,2,1,2,2,2,2,2,1,2,2]`, widening the adjacent-motion range from 2.2× to 11×), and extracting denser gains nothing because the clip is 12fps content encoded at 24fps with every frame duplicated (adjacent scores at 24fps alternate `1.29, 0.21, 2.65, 0.10…`). `WALK_FPS = 12` is already the native content rate, so an 11-frame period genuinely cannot yield 12 distinct phases.
diff --git a/client/src/components/sprites/WalkSourceFrames.test.jsx b/client/src/components/sprites/WalkSourceFrames.test.jsx
index 0aeeccb229..26f04f2f63 100644
--- a/client/src/components/sprites/WalkSourceFrames.test.jsx
+++ b/client/src/components/sprites/WalkSourceFrames.test.jsx
@@ -248,7 +248,7 @@ describe('WalkSourceFrames', () => {
lockReason: 'finalized',
unlock: { blocked: true, stranded: ['east'], acknowledgeable: true },
}));
- expect(screen.getByText(/one new grok render per direction/)).toBeTruthy();
+ expect(screen.getByText(/one new grok render/)).toBeTruthy();
fireEvent.click(screen.getByRole('button', { name: /Unlock anyway/ }));
fireEvent.click(screen.getByRole('button', { name: /^Unlock anyway$/ }));
await act(async () => {});
diff --git a/client/src/lib/spriteWalkUnlock.js b/client/src/lib/spriteWalkUnlock.js
index ee6d6afd66..3385324044 100644
--- a/client/src/lib/spriteWalkUnlock.js
+++ b/client/src/lib/spriteWalkUnlock.js
@@ -32,8 +32,17 @@ export function walkUnlockCopy(unlock) {
toast: null,
};
}
+ // Scoped to the stranded list on purpose: the server verifies locked anchors
+ // for THOSE directions only (`resolveUnlockBlock` probes `stranded`), so a
+ // blanket "each of the 8 can be regenerated" would claim more than it checked
+ // — a non-stranded direction whose anchor happens to be unlocked is not
+ // covered by the gate, and telling the user otherwise is the same
+ // promise-more-than-you-proved mistake the gate itself avoids.
+ const regenerated = stranded.length
+ ? `${stranded.join(', ')} can be regenerated from ${one ? 'its' : 'their'} locked anchor — one new grok render ${one ? 'for it' : 'each'}`
+ : 'each direction can be regenerated from its locked anchor — one new grok render per direction';
return {
- text: `${who} Unlocking anyway re-opens all 8 directions so each can be regenerated from its locked anchor — one new grok render per direction. Nothing on disk is deleted, but every approval is dropped and the set stops compiling until all 8 are approved again.`,
+ text: `${who} Unlocking anyway re-opens all 8 directions and ${regenerated}. Nothing on disk is deleted, but every approval is dropped and the set stops compiling until all 8 are approved again.`,
action: 'Unlock anyway',
prompt: 'Re-open all 8 for regeneration?',
acknowledgeNoClips: true,
diff --git a/client/src/lib/spriteWalkUnlock.test.js b/client/src/lib/spriteWalkUnlock.test.js
index 5230b4e057..f696530c91 100644
--- a/client/src/lib/spriteWalkUnlock.test.js
+++ b/client/src/lib/spriteWalkUnlock.test.js
@@ -18,10 +18,28 @@ describe('walkUnlockCopy', () => {
expect(copy.action).toBe('Unlock anyway');
expect(copy.toast).toBeTruthy();
// The cost has to be in the TEXT, not a tooltip — a touch user never sees a title.
- expect(copy.text).toMatch(/one new grok render per direction/);
+ expect(copy.text).toMatch(/one new grok render/);
expect(copy.text).toMatch(/every approval is dropped/);
});
+ // The server only verifies locked anchors for the STRANDED directions, so the
+ // copy must not claim regeneration for all eight. Pinned as a property: the
+ // regeneration clause names the stranded list, and never asserts a blanket
+ // "each of the 8" when a specific subset is what was checked.
+ it('scopes the regeneration claim to the directions the server actually verified', () => {
+ const one = walkUnlockCopy({ blocked: true, stranded: ['east'], acknowledgeable: true });
+ expect(one.text).toMatch(/east can be regenerated from its locked anchor/);
+ expect(one.text).not.toMatch(/each can be regenerated/);
+
+ const many = walkUnlockCopy({ blocked: true, stranded: ['east', 'north'], acknowledgeable: true });
+ expect(many.text).toMatch(/east, north can be regenerated from their locked anchor/);
+
+ // The evidence-free case has no stranded list — there the server DID verify
+ // all eight, so the blanket wording is the accurate one.
+ const setLevel = walkUnlockCopy({ blocked: true, stranded: [], acknowledgeable: true });
+ expect(setLevel.text).toMatch(/each direction can be regenerated/);
+ });
+
it('offers no action, and never the consent flag, when regeneration is out too', () => {
const copy = walkUnlockCopy({ blocked: true, stranded: ['east'], acknowledgeable: false });
expect(copy.action).toBeNull();
diff --git a/server/services/sprites/atlas.js b/server/services/sprites/atlas.js
index e38878e3a6..9792add8bb 100644
--- a/server/services/sprites/atlas.js
+++ b/server/services/sprites/atlas.js
@@ -55,9 +55,10 @@ import {
buildAtlasGrid, resolveTrackUniformity, compiledGridUpToDate, trackDirections,
} from './atlasGrid.js';
import {
- withWalkWriteTail, walkSetRelPath, importedWalkDirections,
+ withWalkWriteTail, walkSetRelPath, importedWalkDirections, resolveChromaKey,
} from './walk.js';
import { verifyPackagedFrames } from './walkFrames.js';
+import { getRecord } from './records.js';
// Player atlas contract (source pipeline runtime_publish.py): 96px cells,
// pivot (48,88) — silhouette centered on x=48, feet on the y=88 ground line —
@@ -320,11 +321,17 @@ export async function validateForCompile(recordId) {
}
await readVerified(walkSet.selectionPath, walkSet.selectionSha256, 'Walk selection file');
- const referenceManifest = await loadManifest(recordId);
+ const [referenceManifest, record] = await Promise.all([loadManifest(recordId), getRecord(recordId)]);
if (!referenceManifest || referenceManifest.status !== 'complete') {
throw compileError('Reference set is not complete — all 8 anchors must be locked', 'REFERENCE_INCOMPLETE');
}
- const chromaKey = referenceManifest.chromaKey;
+ // manifest → record, the same rung order the generate and postprocess paths
+ // use. Reading the manifest alone made the atlas uncompilable for every
+ // source-pipeline import — the importer stamps the key on the RECORD and
+ // copies a manifest carrying none — so the recovery path #3043 opens (unlock →
+ // regenerate all 8 → approve → freeze) would have dead-ended here, at a 409,
+ // AFTER the user paid for eight renders.
+ const chromaKey = resolveChromaKey({ manifest: referenceManifest, record });
if (!chromaKey) throw compileError('Reference manifest has no frozen chroma key');
const anchors = {};
diff --git a/server/services/sprites/walk.js b/server/services/sprites/walk.js
index 8aef5452e7..9d0b35ecda 100644
--- a/server/services/sprites/walk.js
+++ b/server/services/sprites/walk.js
@@ -848,13 +848,6 @@ async function setWalkTargetImpl(recordId, { frameCount, fps }) {
return getWalkState(recordId);
}
-/**
- * The locked directional anchor for a direction, or null. Third copy of this
- * `.find` + locked/path pair when it was extracted (generate, approve, and the
- * regenerability probe below all ask the same question), and the definition of
- * "usable anchor" drifting between them is how a gate ends up promising a render
- * the render path then refuses.
- */
/**
* The chroma key a walk operation should key against, most specific first: the
* run's own frozen key, then the reference manifest's, then the record's.
@@ -870,10 +863,17 @@ async function setWalkTargetImpl(recordId, { frameCount, fps }) {
* Returns null when no rung has one, so callers refuse explicitly rather than
* handing `undefined` to a color parser.
*/
-const resolveChromaKey = ({ manifest, record, run } = {}) => (
+export const resolveChromaKey = ({ manifest, record, run } = {}) => (
run?.chromaKey || manifest?.chromaKey || record?.chromaKey || null
);
+/**
+ * The locked directional anchor for a direction, or null. Third copy of this
+ * `.find` + locked/path pair when it was extracted (generate, approve, and the
+ * regenerability probe below all ask the same question), and the definition of
+ * "usable anchor" drifting between them is how a gate ends up promising a render
+ * the render path then refuses.
+ */
const lockedAnchorFor = (manifest, direction) => {
const anchor = manifest?.anchors?.find((a) => a.direction === direction);
return anchor?.status === 'locked' && anchor.path ? anchor : null;
@@ -1654,6 +1654,34 @@ async function assertSetReDerivable(recordId, walkSet, { acknowledgeNoClips = fa
* response, so a hoisted shared constant would be one downstream mutation away
* from poisoning every later response process-wide.
*/
+/**
+ * Which of `scope` has no clip to re-derive from, using a caller's pre-resolved
+ * clip map where it covers a direction and probing disk where it doesn't.
+ *
+ * The partition is the whole point. `getWalkState` builds its map from the runs
+ * it resolved, and it only resolves entries whose status is `approved` — while
+ * `importedWalkDirections` filters on provenance alone and so includes entries
+ * in any state. So a direction can be legitimately absent from the map, and
+ * reading absent as "proven to have no clip" is the repo's own absent-vs-empty
+ * conflation: a `pending` source-anchored entry whose clip is sitting on disk
+ * would be reported stranded, and the client would either quote the user eight
+ * needless renders or (with an unlocked anchor anywhere) hide the unlock
+ * entirely — re-creating, through a different door, the dead end #3043 removes.
+ * `in` distinguishes resolved-false from unresolved; the probe answers the rest.
+ */
+async function strandedDirections(recordId, walkSet, scope, clipByDirection) {
+ if (!clipByDirection) return directionsWithoutClip(recordId, walkSet, scope);
+ const unresolved = scope.filter((direction) => !(direction in clipByDirection));
+ const probed = new Set(unresolved.length
+ ? await directionsWithoutClip(recordId, walkSet, unresolved)
+ : []);
+ // Filtered over `scope` rather than concatenated, so the reported order stays
+ // the walk set's own — it is read aloud in the refusal message.
+ return scope.filter((direction) => (direction in clipByDirection
+ ? !clipByDirection[direction]
+ : probed.has(direction)));
+}
+
async function resolveUnlockBlock(recordId, walkSet, clipByDirection = null) {
const notBlocked = { blocked: false, stranded: [], acknowledgeable: false };
if (!isImportedWalkSet(walkSet)) return notBlocked;
@@ -1667,9 +1695,7 @@ async function resolveUnlockBlock(recordId, walkSet, clipByDirection = null) {
if (!stale.length) {
return { blocked: true, stranded: [], acknowledgeable: await regenerable(SPRITE_DIRECTIONS) };
}
- const stranded = clipByDirection
- ? stale.filter((direction) => !clipByDirection[direction])
- : await directionsWithoutClip(recordId, walkSet, stale);
+ const stranded = await strandedDirections(recordId, walkSet, stale, clipByDirection);
if (!stranded.length) return notBlocked;
return { blocked: true, stranded, acknowledgeable: await regenerable(stranded) };
}
diff --git a/server/services/sprites/walk.test.js b/server/services/sprites/walk.test.js
index 183a3532b8..bbce70d0e1 100644
--- a/server/services/sprites/walk.test.js
+++ b/server/services/sprites/walk.test.js
@@ -200,6 +200,7 @@ async function makeCandidateRun(recordId, direction, {
*/
async function makeImportedDirection(recordId, direction, {
base = 'grok', declaredBase = base, clip = true, frameCount = 8, fps = 12,
+ status = 'approved',
} = {}) {
const runId = `run-${(seq++).toString(16)}`;
const spriteRoot = join(TEST_ROOT, 'sprites', recordId);
@@ -235,7 +236,7 @@ async function makeImportedDirection(recordId, direction, {
}));
return {
runId,
- entry: { status: 'approved', runPath: anchor(declaredRun), runManifest: anchor(manifestRel) },
+ entry: { status, runPath: anchor(declaredRun), runManifest: anchor(manifestRel) },
};
}
@@ -1153,6 +1154,27 @@ describe('imported walk sets — evidence-based re-derive', () => {
expect(runWalkPostprocess).not.toHaveBeenCalled();
});
+ /**
+ * The stamped read and the unlock gate must agree. `getWalkState` resolves runs
+ * only for entries whose status is `approved`, while `importedWalkDirections`
+ * filters on provenance alone and so includes entries in any state — so a
+ * source-anchored `pending` entry is absent from the clip map the read hands
+ * over. Reading absent as "proven clipless" made the read report `blocked` for
+ * a set the write path unlocks plainly and for free: the client would quote
+ * eight needless renders, or (with any anchor unlocked) render no unlock
+ * control at all — the dead end #3043 exists to remove, through another door.
+ */
+ it('agrees with the unlock gate when an imported entry is not approved', async () => {
+ const id = await characterWithLockedAnchors(newId(), ['east']);
+ await importedCharacter(id, { east: {}, north: { status: 'pending' } });
+
+ // north is source-anchored (so `stale` includes it) and HAS its clip on disk,
+ // but is not approved — so the read never resolved a run for it.
+ expect((await getWalkState(id)).walkSet.unlock).toMatchObject({ blocked: false });
+ // …and the gate, which probes disk, agrees: a plain unlock succeeds.
+ await expect(unlockWalkSet(id)).resolves.toMatchObject({ walkSet: null });
+ });
+
// The acknowledgement is an override of the CLIP requirement only — it must
// never become a way to strand a direction that cannot be rebuilt at all.
it('refuses an acknowledged unlock when a stranded direction has no locked anchor', async () => {