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
let a frozen imported walk set be unlocked for regeneration
[._.]/ Adam Eivyf666a019af9a
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 6845b06f90..1ddcaaa44c 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -186,3 +186,4 @@- **[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, with absent-on-both still the genuine refusal. 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.diff --git a/client/src/components/sprites/CycleTarget.jsx b/client/src/components/sprites/CycleTarget.jsxindex 516de73fa7..7d15348b36 100644--- a/client/src/components/sprites/CycleTarget.jsx+++ b/client/src/components/sprites/CycleTarget.jsx@@ -23,6 +23,7 @@ import { WALK_FRAME_COUNT_OPTIONS, walkFpsOptionsFor } from '../../lib/spriteTriexport default function CycleTarget({recordId, target, disabled, onChanged, onSavingChange = () => {},surfaceClass = 'bg-port-bg', appRetargetHint = 'change it in Publish below',+ disabledHint,}) {const [save, saving] = useAsyncAction(async (next) => {onSavingChange(true);@@ -37,6 +38,10 @@ export default function CycleTarget({const cycleSeconds = (target.frameCount / target.fps).toFixed(2);const selectCls = `${surfaceClass} border border-port-border rounded px-2 py-1 text-sm text-white disabled:opacity-60`;+ // A host that disables the control says WHY on the inputs themselves — a greyed+ // <select> with the usual "what this knob does" tooltip explains everything+ // except the one thing the user is asking (#3043).+ const titleFor = (enabledTitle) => (disabled && disabledHint ? disabledHint : enabledTitle);return (<div className="flex flex-wrap items-center gap-x-3 gap-y-1.5">@@ -47,7 +52,7 @@ export default function CycleTarget({value={target.frameCount}disabled={disabled || saving || target.frameCountLocked}onChange={(e) => save({ frameCount: Number(e.target.value), fps: target.fps })}- title="Frames in the walk cycle — shared by all 8 directions, because the atlas is a rectangular grid"+ title={titleFor('Frames in the walk cycle — shared by all 8 directions, because the atlas is a rectangular grid')}className={selectCls}>{WALK_FRAME_COUNT_OPTIONS.map((n) => <option key={n} value={n}>{n} frames</option>)}@@ -64,7 +69,7 @@ export default function CycleTarget({value={target.fps}disabled={disabled || saving || target.fpsLocked}onChange={(e) => save({ frameCount: target.frameCount, fps: Number(e.target.value) })}- title="Preview/authoring speed — the consuming app determines real in-game playback. Pinned per set because the atlas needs every direction to agree."+ title={titleFor('Preview/authoring speed — the consuming app determines real in-game playback. Pinned per set because the atlas needs every direction to agree.')}className={selectCls}>{walkFpsOptionsFor(target.fps).map((n) => <option key={n} value={n}>{n} fps</option>)}diff --git a/client/src/components/sprites/WalkSourceFrames.jsx b/client/src/components/sprites/WalkSourceFrames.jsxindex ce8801d95d..20275fd886 100644--- a/client/src/components/sprites/WalkSourceFrames.jsx+++ b/client/src/components/sprites/WalkSourceFrames.jsx@@ -12,6 +12,7 @@ import {import { useAsyncAction } from '../../hooks/useAsyncAction.js';import ConfirmButtonPair from '../ui/ConfirmButtonPair.jsx';import CycleTarget from './CycleTarget.jsx';+import { walkUnlockCopy, WALK_UNLOCK_TOAST } from '../../lib/spriteWalkUnlock.js';import { spriteAssetUrl, PIXELATED } from './spriteAssets.js';// Source frames + re-derive (#2980), inside the Loop Trimmer.@@ -49,13 +50,24 @@ const unavailableCopy = ({ reason, imported }) => ({// What the user has to do before the loop can be re-derived. Mirrors the server's// own guards (walk.js#reDeriveLockReason) so the panel never offers an action the// API will refuse.-const LOCK_COPY = {- finalized: {+//+// `finalized` is a function of the server's unlock block (#3043) rather than a+// constant: a frozen set imported WITHOUT its source clips refuses a plain+// unlock, and the honest offer there is regeneration instead of re-derivation.+// That wording comes from the shared `walkUnlockCopy`, so this panel and the Walk+// Cycles header can never describe one set two different ways. The icon is added+// here because the shared module stays pure copy (no React/lucide imports).+const finalizedLockCopy = (unlock) => ({+ icon: Unlock,+ ...(walkUnlockCopy(unlock) || {text: 'The walk set is frozen. Unlocking re-opens every direction for revision; the rendered clips are kept, so re-approval is one click each.',action: 'Unlock set',prompt: 'Unlock the whole set?',- icon: Unlock,- },+ acknowledgeNoClips: false,+ }),+});++const LOCK_COPY = {approved: {text: 'This direction is approved, and approved runs are immutable. Reopening un-approves just this direction — the rendered clip is kept, so re-approval is one click.',action: 'Reopen direction',@@ -160,10 +172,26 @@ function WalkSourceFrames({ recordId, runId, onSaved = () => {} }) {toast.success(`Extracted ${next.frames?.length ?? 0} source frames from the clip`);}, { errorMessage: 'Could not extract frames from this clip' });+ // The set-level cycle target is a mutating walk op, so the server refuses it+ // outright while the set is frozen (requireUnfinalized) — offering an enabled+ // <select> there just hands back a 409 on change (#3043). The lock panel below+ // carries the unlock that clears it.+ const finalizedSet = data?.lockReason === 'finalized';+ // Suppressed when the unavailable line above already said the same thing (a+ // clipless run reports both `reason` and `lockReason` as the missing clip) —+ // printing the explanation twice reads like two different problems.+ const lock = data && !data.editable && !(!data.available && data.lockReason === 'no-source-video')+ ? (finalizedSet ? finalizedLockCopy(data.unlock) : LOCK_COPY[data.lockReason])+ : null;++ // `useAsyncAction` re-closes over a fresh fn each render, so this reads the+ // `lock` resolved above rather than rebuilding the copy to fish out one flag.const [unlock, unlocking] = useAsyncAction(async () => {- if (data.lockReason === 'finalized') {- await unlockSpriteWalk(recordId, { silent: true });- toast.success('Walk set unlocked — directions are editable again');+ if (finalizedSet) {+ // Only true on the branch whose text above named the cost, and the server+ // honors it only where it proved regeneration is possible.+ await unlockSpriteWalk(recordId, { acknowledgeNoClips: lock.acknowledgeNoClips }, { silent: true });+ toast.success(lock.toast || WALK_UNLOCK_TOAST);} else {await reopenSpriteWalk(recordId, { direction: data.direction }, { silent: true });toast.success(`Walk ${data.direction} reopened`);@@ -172,12 +200,6 @@ function WalkSourceFrames({ recordId, runId, onSaved = () => {} }) {}, { errorMessage: 'Could not unlock this direction' });const busy = redriving || unlocking || targetSaving || extracting;- // Suppressed when the unavailable line above already said the same thing (a- // clipless run reports both `reason` and `lockReason` as the missing clip) —- // printing the explanation twice reads like two different problems.- const lock = data && !data.editable && !(!data.available && data.lockReason === 'no-source-video')- ? LOCK_COPY[data.lockReason]- : null;const frames = data?.frames || [];const sectionCls = 'bg-port-bg border border-port-border rounded p-3 space-y-3';@@ -292,7 +314,10 @@ function WalkSourceFrames({ recordId, runId, onSaved = () => {} }) {<CycleTargetrecordId={recordId}target={data.target}- disabled={busy}+ disabled={busy || finalizedSet}+ disabledHint={finalizedSet+ ? 'The walk set is frozen — unlock it below before changing the cycle target'+ : undefined}onChanged={refresh}onSavingChange={setTargetSaving}surfaceClass="bg-port-card"diff --git a/client/src/components/sprites/WalkSourceFrames.test.jsx b/client/src/components/sprites/WalkSourceFrames.test.jsxindex b530574f16..0aeeccb229 100644--- a/client/src/components/sprites/WalkSourceFrames.test.jsx+++ b/client/src/components/sprites/WalkSourceFrames.test.jsx@@ -229,13 +229,32 @@ describe('WalkSourceFrames', () => {it('offers the set unlock for a finalized set', async () => {await renderPanel(payload({ editable: false, lockReason: 'finalized' }));+ // A frozen set refuses the target PUT outright, so the knob must not invite+ // a guaranteed 409 (#3043).+ expect(screen.getByLabelText(/Cycle target/).disabled).toBe(true);fireEvent.click(screen.getByRole('button', { name: /Unlock set/ }));fireEvent.click(screen.getByRole('button', { name: /^Unlock set$/ }));await act(async () => {});- expect(unlockSpriteWalk).toHaveBeenCalledWith('example-walker', { silent: true });+ expect(unlockSpriteWalk).toHaveBeenCalledWith('example-walker', { acknowledgeNoClips: false }, { silent: true });expect(reopenSpriteWalk).not.toHaveBeenCalled();});+ // A frozen set the server also reports as un-re-derivable (imported without its+ // clips) gets the different, costlier offer — and only THAT confirm carries the+ // acknowledgement past the server's refusal (#3043).+ it('offers regeneration, with the acknowledgement, for a clipless imported set', async () => {+ await renderPanel(payload({+ editable: false,+ lockReason: 'finalized',+ unlock: { blocked: true, stranded: ['east'], acknowledgeable: true },+ }));+ expect(screen.getByText(/one new grok render per direction/)).toBeTruthy();+ fireEvent.click(screen.getByRole('button', { name: /Unlock anyway/ }));+ fireEvent.click(screen.getByRole('button', { name: /^Unlock anyway$/ }));+ await act(async () => {});+ expect(unlockSpriteWalk).toHaveBeenCalledWith('example-walker', { acknowledgeNoClips: true }, { silent: true });+ });+it('reports a failed read with a retry instead of a silent empty panel', async () => {getSpriteWalkSourceFrames.mockRejectedValueOnce(new Error('boom'));render(<WalkSourceFrames recordId="example-walker" runId={RUN_ID} />);diff --git a/client/src/components/sprites/WalkWorkflow.jsx b/client/src/components/sprites/WalkWorkflow.jsxindex 930704382a..fecc3a85de 100644--- a/client/src/components/sprites/WalkWorkflow.jsx+++ b/client/src/components/sprites/WalkWorkflow.jsx@@ -8,6 +8,7 @@ import {approveSpriteWalk, postprocessSpriteWalk, unlockSpriteWalk, reopenSpriteWalk,} from '../../services/apiSprites.js';import ConfirmButtonPair from '../ui/ConfirmButtonPair.jsx';+import Banner from '../ui/Banner.jsx';import CycleTarget from './CycleTarget.jsx';import SpritePreview from './SpritePreview.jsx';import { useAsyncAction } from '../../hooks/useAsyncAction.js';@@ -16,6 +17,7 @@ import { GROK_VIDEO_DURATIONS } from '../../lib/grokVideoClip.js';import {WALK_PHASES, WALK_DEFAULT_FRAME_COUNT, WALK_DEFAULT_FPS,} from '../../lib/spriteTrimmer.js';+import { walkUnlockCopy, WALK_UNLOCK_TOAST } from '../../lib/spriteWalkUnlock.js';// Walk workflow (issue #2897): one grok image_to_video clip per locked// directional anchor, deterministic server-side packaging into the 8-phase@@ -146,6 +148,44 @@ function StripLoop({ recordId, stripPreview }) {// Unlock and a card's Reopen disagreeing about the same run would be a bug.const hasClip = (run) => Boolean(run?.sourceVideoPath) && !run?.sourceClipMissing;+/**+ * The set-level Unlock, as a trigger that swaps to an inline confirm.+ *+ * Both frozen-set entry points render this: the header's plain Unlock and the+ * blocked panel's "Unlock anyway". They differ only in copy and tone, and they+ * are mutually exclusive on `unlockBlocked` — sharing the shape keeps a change to+ * the confirm UX (busy text, tone, aria convention) from having to be made twice+ * and landing in only one of the two frozen-set paths.+ */+function UnlockAffordance({+ armed, onArm, onCancel, onConfirm, busy, label, prompt, ariaLabel, title, className,+}) {+ if (armed) {+ return (+ <ConfirmButtonPair+ prompt={prompt}+ confirmText={label}+ confirmIcon={Unlock}+ busy={busy}+ busyText="Unlocking…"+ tone="warning"+ ariaLabel={ariaLabel}+ onConfirm={onConfirm}+ onCancel={onCancel}+ />+ );+ }+ return (+ <button+ onClick={onArm}+ title={title}+ className={`flex items-center gap-1 px-1.5 py-0.5 text-xs border rounded ${className}`}+ >+ <Unlock className="w-3 h-3" /> {label}+ </button>+ );+}+// The one remedy for an imported direction with nothing behind it. The clip is// the importer's to bring across, so authoring a new version by hand isn't it.const REIMPORT_REMEDY = 're-import this character to bring its source clip across';@@ -482,19 +522,13 @@ export default function WalkWorkflow({const importedDirections = walk?.walkSet?.importedDirections || null;const isImportedDirection = (direction) => (importedDirections? importedDirections.includes(direction) : importedWalkSet);- // Since #2984 imports each run's clip, such a set is no longer a dead end —- // but unlock drops EVERY approval, so the server refuses it unless EVERY- // still-imported direction has a clip (a stranded one could be neither- // reprocessed nor re-approved). Mirror that scope exactly, per direction, so- // the button and the 409 are computed from the same facts; the server's gate is- // still authoritative, this only decides what to offer.- const clipByDirection = useMemo(() => {- const out = {};- for (const run of runs) if (hasClip(run)) out[run.direction] = true;- return out;- }, [runs]);- const unlockBlocked = importedWalkSet- && !(importedDirections?.length && importedDirections.every((d) => clipByDirection[d]));+ // Whether unlock is refused, and whether that refusal can be acknowledged past,+ // is stamped by the server from the same resolver its own gate uses (#3043) —+ // so the button offered here and the 409 it might hit can never be computed+ // from two different readings of the same set. The copy is shared with the Loop+ // Trimmer's lock block; null means "not blocked, offer the ordinary Unlock".+ const unlockCopy = walkUnlockCopy(walk?.walkSet?.unlock);+ const unlockBlocked = Boolean(unlockCopy);// direction → jobId for in-flight video renders. The hook instance is owned// by the Sprites page and shared with the asset collection (#2931) so both@@ -590,11 +624,19 @@ export default function WalkWorkflow({// Unlock (un-freeze) the finalized walk set. Irreversible-ish (it re-opens// every direction), so it's gated behind an inline confirm per the repo's// confirmation UX — not a hidden two-click arm or a browser dialog.+ // ONE flag for both entry points below (the header's plain Unlock and the+ // blocked panel's "Unlock anyway"): they are mutually exclusive on+ // `unlockBlocked`, so only one is ever mounted. A third entry point would need+ // its own flag, or it would arm silently alongside whichever of these is live.const [unlockConfirm, setUnlockConfirm] = useState(false);- const [unlock, unlocking] = useAsyncAction(async () => {- await unlockSpriteWalk(recordId, { silent: true });+ // `acknowledgeNoClips` is sent ONLY from the blocked-but-regenerable branch,+ // whose panel names what it costs (a fresh render per direction). Every other+ // unlock omits it and keeps the server's refusal — an override the user was+ // never warned about is exactly what the guard exists to prevent.+ const [unlock, unlocking] = useAsyncAction(async (acknowledgeNoClips = false) => {+ await unlockSpriteWalk(recordId, { acknowledgeNoClips }, { silent: true });setUnlockConfirm(false);- toast.success('Walk set unlocked — directions are editable again');+ toast.success((acknowledgeNoClips && unlockCopy?.toast) || WALK_UNLOCK_TOAST);onChanged();}, { errorMessage: 'Unlock failed' });@@ -624,29 +666,23 @@ export default function WalkWorkflow({<Lock className="w-3 h-3" /> walk set frozen · immutable</p>{unlockBlocked ? (- <span className="text-[10px] text-gray-500" title="Unlocking re-opens every direction, and at least one imported direction has no source clip on disk to re-derive from — re-import the character to bring its clips across, or reopen the directions that do have clips one at a time">- imported · no clips to re-derive- </span>- ) : unlockConfirm ? (- <ConfirmButtonPair- prompt="Re-open all directions?"- confirmText="Unlock"- confirmIcon={Unlock}+ // The block itself is explained (and acted on) in the panel below —+ // it needs more room than this dense row, and a consequence this+ // expensive must not live in a tooltip.+ <span className="text-[10px] text-gray-500">imported · no clips to re-derive</span>+ ) : (+ <UnlockAffordance+ armed={unlockConfirm}+ onArm={() => setUnlockConfirm(true)}+ onCancel={() => setUnlockConfirm(false)}+ onConfirm={() => unlock()}busy={unlocking}- busyText="Unlocking…"- tone="warning"+ label="Unlock"+ prompt="Re-open all directions?"ariaLabel="Confirm unlock walk set"- onConfirm={() => unlock()}- onCancel={() => setUnlockConfirm(false)}- />- ) : (- <button- onClick={() => setUnlockConfirm(true)}title="Un-freeze the walk set to regenerate or re-approve directions (rendered clips are kept)"- className="flex items-center gap-1 px-1.5 py-0.5 text-xs bg-port-bg border border-port-border rounded text-gray-400 hover:border-port-accent hover:text-white"- >- <Unlock className="w-3 h-3" /> Unlock- </button>+ className="bg-port-bg border-port-border text-gray-400 hover:border-port-accent hover:text-white"+ />)}</div>) : (@@ -673,6 +709,32 @@ export default function WalkWorkflow({)}</div>+ {/* Why the frozen set refuses a plain Unlock, and the one action that gets+ past it. Before #3043 this was a tooltip on a dead label, which left a+ fully-imported set with no reachable way to revise anything — not the+ cycle target, not one direction. The cost is stated as visible text+ rather than a title, per the repo's "tooltip-only warnings are missed on+ touch" rule; `copy.action` is null when even regeneration is out, and+ then there is genuinely nothing to offer. */}+ {unlockBlocked && (+ <Banner tone="warning" size="sm" icon={Unlock} className="space-y-1.5">+ <p className="leading-relaxed">{unlockCopy.text}</p>+ {unlockCopy.action && (+ <UnlockAffordance+ armed={unlockConfirm}+ onArm={() => setUnlockConfirm(true)}+ onCancel={() => setUnlockConfirm(false)}+ onConfirm={() => unlock(true)}+ busy={unlocking}+ label={unlockCopy.action}+ prompt={unlockCopy.prompt}+ ariaLabel="Confirm unlock walk set without source clips"+ className="bg-port-bg border-port-warning/60 text-port-warning hover:bg-port-warning/10"+ />+ )}+ </Banner>+ )}+{/* Set-level drift summary: visible BEFORE eight renders are spent, ratherthan as an atlas-compile wall afterwards. Legacy mixed sets (generatedback when the count/fps were per-render page state) land here on load. */}diff --git a/client/src/components/sprites/WalkWorkflow.test.jsx b/client/src/components/sprites/WalkWorkflow.test.jsxindex b40e5421de..f181743709 100644--- a/client/src/components/sprites/WalkWorkflow.test.jsx+++ b/client/src/components/sprites/WalkWorkflow.test.jsx@@ -1,6 +1,6 @@import { describe, it, expect, vi } from 'vitest';import {- render, screen, act, fireEvent, cleanup,+ render, screen, act, fireEvent, cleanup, waitFor,} from '@testing-library/react';import { MemoryRouter } from 'react-router-dom';@@ -19,7 +19,9 @@ vi.mock('../../services/apiSprites.js', () => ({}));import WalkWorkflow from './WalkWorkflow';-import { postprocessSpriteWalk, reopenSpriteWalk, setSpriteWalkTarget } from '../../services/apiSprites.js';+import {+ postprocessSpriteWalk, reopenSpriteWalk, setSpriteWalkTarget, unlockSpriteWalk,+} from '../../services/apiSprites.js';const CELL_PX = 96;@@ -572,7 +574,11 @@ describe('WalkWorkflow reprocess + reopen', () => {walk={{runs: [{ id: 'run-east', direction: 'east', status: 'approved', stripPreview: { stripPath: 'runs/run-east/generated/strip.png', frameCount: 12, fps: 10, cellWidth: 384, cellHeight: 384 } }],selection: { directions: { east: { status: 'approved', runId: 'run-east' } } },- walkSet: { imported: true, directions: { east: { status: 'approved' } } },+ walkSet: {+ imported: true,+ directions: { east: { status: 'approved' } },+ unlock: { blocked: true, stranded: ['east'], acknowledgeable: true },+ },walkTarget: {frameCount: 12, fps: 10, source: 'derived', sourceLabel: 'from the first approved direction', drift: [],},@@ -587,6 +593,77 @@ describe('WalkWorkflow reprocess + reopen', () => {);expect(screen.queryByRole('button', { name: /^Reopen$/ })).toBeNull();expect(screen.getByText(/imported · no clips to re-derive/)).toBeTruthy();+ // …but re-deriving being impossible is NOT the same as the set being frozen+ // forever (#3043): the anchor is locked, so regeneration is offered.+ expect(screen.getByRole('button', { name: /Unlock anyway/ })).toBeTruthy();+ });++ // The acknowledged unlock is an override of the CLIP requirement only. When the+ // server reports the set is not regenerable either (an unlocked anchor), there+ // is genuinely nothing to offer and the panel must say so rather than hand back+ // a guaranteed 409.+ it('offers no unlock at all when the server says the set is not even regenerable', async () => {+ 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: 'approved', stripPreview: { stripPath: 'runs/run-east/generated/strip.png', frameCount: 12, fps: 10, cellWidth: 384, cellHeight: 384 } }],+ selection: { directions: { east: { status: 'approved', runId: 'run-east' } } },+ walkSet: {+ imported: true,+ directions: { east: { status: 'approved' } },+ unlock: { blocked: true, stranded: ['east'], acknowledgeable: false },+ },+ walkTarget: {+ frameCount: 12, fps: 10, source: 'derived', sourceLabel: 'from the first approved direction', drift: [],+ },+ }}+ renders={noRenders()}+ duration={6}+ onDurationChange={vi.fn()}+ onGenerate={vi.fn()}+ onChanged={vi.fn()}+ />+ </MemoryRouter>,+ );+ expect(screen.queryByRole('button', { name: /Unlock/ })).toBeNull();+ expect(screen.getByText(/nothing to regenerate from either/)).toBeTruthy();+ });++ it('sends the acknowledgement only from the blocked-but-regenerable confirm', async () => {+ const onChanged = vi.fn();+ 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: 'approved', stripPreview: { stripPath: 'runs/run-east/generated/strip.png', frameCount: 12, fps: 10, cellWidth: 384, cellHeight: 384 } }],+ selection: { directions: { east: { status: 'approved', runId: 'run-east' } } },+ walkSet: {+ imported: true,+ directions: { east: { status: 'approved' } },+ unlock: { blocked: true, stranded: ['east'], acknowledgeable: true },+ },+ walkTarget: {+ frameCount: 12, fps: 10, source: 'derived', sourceLabel: 'from the first approved direction', drift: [],+ },+ }}+ renders={noRenders()}+ duration={6}+ onDurationChange={vi.fn()}+ onGenerate={vi.fn()}+ onChanged={onChanged}+ />+ </MemoryRouter>,+ );+ fireEvent.click(screen.getByRole('button', { name: /Unlock anyway/ }));+ fireEvent.click(screen.getByRole('button', { name: /^Unlock anyway$/ }));+ await waitFor(() => expect(unlockSpriteWalk).toHaveBeenCalledWith(+ 'example-walker', { acknowledgeNoClips: true }, { silent: true },+ ));});// #2993: since the importer brings each run's clip across, an imported@@ -653,6 +730,7 @@ describe('WalkWorkflow reprocess + reopen', () => {imported: true,importedDirections: ['east', 'north'],directions: { east: { status: 'approved' }, north: { status: 'approved' } },+ unlock: { blocked: true, stranded: ['north'], acknowledgeable: true },},walkTarget: {frameCount: 12, fps: 10, source: 'derived', sourceLabel: 'from the first approved direction', drift: [],diff --git a/client/src/lib/README.md b/client/src/lib/README.mdindex c54b736b8a..cc807e1b24 100644--- a/client/src/lib/README.md+++ b/client/src/lib/README.md@@ -141,6 +141,7 @@ grep -i "what you want to do" client/src/lib/README.md| `spriteFacets.js` | Client-side facet classifier for the Sprite Manager's asset collection (#2931), mirroring the source pipeline's `classify_asset()`. `classifySpriteAsset(path)` decodes a record-relative asset path into `{ family, status, role, direction, runId }` — `status ∈ runtime/approved/candidate/superseded/rejected/source`, `role ∈ reference/strip/animation/frame/atlas/evidence/sprite/manifest` — and is total (an unknown path degrades to `sprite`/`source` rather than throwing). `classifySpriteAssets(assets)` adds the one facet only knowable across a listing: an approved asset below the highest `-vN` of its stem becomes `superseded`. `groupSpriteAssetsByRole(assets)` returns render-ready `{ role, label, assets }` sections in `SPRITE_ASSET_ROLES` order — it does NOT render a `manifest` group: each runtime atlas's sidecar manifest is folded onto its atlas row as `row.manifest`, and other behind-the-scenes JSON is omitted. `runtimeVersionDir(path)` / `isRuntimeVersionPath(path)` / `isRuntimeSidecarManifest(path)` expose the `runtime/vN` grammar (the sidecar-pairing key and the "is this a build manifest" predicate) so callers like `AssetInspector` reuse one definition instead of re-regexing. Also exports `SPRITE_DIRECTIONS` (mirror of `server/services/sprites/prompts.js`) — the `direction`/`runId` facets are what drive the collection's Regenerate and Edit-in-Loop-Trimmer actions. Pure — no React, no I/O. || `spriteRecordGroups.js` | Grouping + search for the Sprite Manager sidebar's record picker (#2932). `groupSpriteRecords(records)` → ordered `[{ key, label, records }]` under **Characters / Places / Objects** (`props` folded into Objects alongside `object`, no migration). `filterSpriteRecords(records, query, limit=8)` is the autocomplete filter — multi-term (AND) substring over `name`/`id`/`kind`, capped at `limit`. `groupKeyForKind(kind)` maps a kind to its group key (unknown → `objects`). `SPRITE_RECORD_GROUPS` / `NEW_SPRITE_KINDS` back the browse disclosure and the create-panel kind selector. Pure — no React, no I/O; the page owns the per-group icons. || `spriteTrimmer.js` | Pure geometry + source-list math behind the Sprite Manager's Loop Trimmer workspace (#2933). `buildTrimmerSources(walk, assets)` → the ordered animation sources the trimmer can load (every preview-strip run first, then saved trims read from the asset listing), each `{ id, kind: 'run'\|'trim', runId, direction, label, stripPath, frameCount, fps, trimmable }` — every packed-strip run is `trimmable` (layout-agnostic), while saved trims are preview-only, mirroring `spriteCollectionActions`' gate. `stripFrameGeometry(stripPreview)` → `{ frameCount, fps, cellWidth, cellHeight }` with the native 8-phase / 12fps fallback; `phaseLabelFor(index, frameCount)` names the 8 walk phases (bare `frame N` for any other length); `sanitizeTrimSlug(name)` → the server's `[a-z0-9-]+` output slug; `allColumns(n)` / `invertColumns(n, enabled)` for the frame-toggle set. `WALK_PHASES` is the shared phase-label constant (WalkWorkflow imports it here). Also holds the walk-cycle authoring knobs mirrored from `walkBounds.js` — `WALK_DEFAULT_FRAME_COUNT` / `WALK_DEFAULT_FPS`, the `WALK_FRAME_COUNT_OPTIONS` list and `walkFpsOptionsFor(fps)` (splices a current odd fps into the even-step list so the `<select>` never lies) — feeding the shared `CycleTarget` control used by both the walk workflow and the trimmer's re-derive panel (#2980). Pure — no React, no canvas, no I/O. |+| `spriteWalkUnlock.js` | The user-facing copy for a BLOCKED walk-set unlock (#3043), shared by the Walk Cycles header panel and the Loop Trimmer lock block so one server-stamped `walkSet.unlock` can never be described two different ways. `walkUnlockCopy(unlock)` → `{ text, action, prompt, acknowledgeNoClips, toast }` for a blocked set (null when it is not blocked): a blocked-but-`acknowledgeable` set gets the regeneration offer plus the `acknowledgeNoClips` consent flag the unlock POST carries, a non-acknowledgeable one gets the dead-end explanation and no action. `WALK_UNLOCK_TOAST` is the ordinary unlock success message. Pure — no React, no I/O. || `tribe.js` | Pure Tribe domain helpers shared by the Tribe page and its `TribeCircleMap` visualization: `RINGS` (support→core→tribe→village Dunbar rings + the uncapped `external` "outside the tribe" classification — caps, cadence defaults, Tailwind tones + `hex`), `TRIBE_RINGS` (the four inner rings the care queue/capacity/overdue counts operate over, excluding `external`), `ENERGY` (energy tiers + `hex`), `STATUS_HEX` (cadence-status → SVG stroke color), `contactStatus(contact)` (presentation wrapper over the shared `cadenceStatus` — attaches label/tone to the missing/overdue/soon/steady/`external` state) / `daysBetween(date)` (alias of the shared `daysSinceDate`), `ringFor` / `energyFor` lookups, `tagsToArray` / `tagsToInput`, and `initialsFor(name)` (node glyph). Ring `cadenceDays` mirror `DEFAULT_RING_CADENCE` in `server/services/tribe.js`; the cadence STATE MACHINE lives in `tribeCadence.js`. || `tribeCadence.js` | Mirror of `server/lib/tribeCadence.js` — the single authoritative Tribe care-cadence rules shared by the page, the Care dashboard widget, and the proactive alert: `cadenceStatus(entity)` → `{ state, daysRemaining, daysOverdue }`, `daysSinceDate(dateStr)`, `DEFAULT_CADENCE_DAYS`, `SOON_WINDOW_DAYS`. A cross-boundary contract test asserts it never drifts from the server copy. || `streakGlyph.js` | `streakGlyph(streak)` — the single POST streak emoji (✨ / ⚡ / 🔥 by day count) shared by the POST launcher, Morse trainer, daily widget, and dashboard streak widget. |diff --git a/client/src/lib/index.js b/client/src/lib/index.jsindex bb8b5c4b2b..badf4b992b 100644--- a/client/src/lib/index.js+++ b/client/src/lib/index.js@@ -109,6 +109,7 @@ export * from './spriteCollectionActions.js';export * from './spriteFacets.js';export * from './spriteRecordGroups.js';export * from './spriteTrimmer.js';+export * from './spriteWalkUnlock.js';export * from './streakGlyph.js';export * from './syncCounts.js';export * from './tabNotation.js';diff --git a/client/src/lib/spriteWalkUnlock.js b/client/src/lib/spriteWalkUnlock.jsnew file mode 100644index 0000000000..ee6d6afd66--- /dev/null+++ b/client/src/lib/spriteWalkUnlock.js@@ -0,0 +1,46 @@+// The user-facing explanation of a BLOCKED walk-set unlock (#3043), in one+// place because two surfaces render it: the Walk Cycles header panel and the+// Loop Trimmer's lock block. Both describe the same server-stamped+// `walkSet.unlock` — two hand-written copies drifted within the same change+// ("one new grok render each" vs "…per direction"), which is exactly how a user+// meets two different accounts of one irreversible-ish action depending on which+// panel they happened to open.+//+// Pure: takes the stamped block, returns strings. No React, no I/O.++// The three facts a blocked unlock has to convey, assembled once.+//+// `blocked: false` returns null — the caller renders its ordinary Unlock. A+// blocked-but-`acknowledgeable` set gets the regeneration offer and the+// `acknowledgeNoClips` flag that carries the user's consent to the server; a+// blocked and NON-acknowledgeable set gets the dead-end explanation and no+// action, because there is genuinely nothing to offer.+export function walkUnlockCopy(unlock) {+ if (!unlock?.blocked) return null;+ const stranded = unlock.stranded || [];+ const one = stranded.length === 1;+ const who = stranded.length+ ? `${stranded.join(', ')} ${one ? 'was' : 'were'} imported from the source pipeline without ${one ? 'its source clip' : 'their source clips'}, so ${one ? 'it' : 'they'} cannot be re-derived at a new frame count.`+ : 'This walk set was imported from the source pipeline with no directions that can be re-derived here.';++ if (!unlock.acknowledgeable) {+ return {+ text: `${who} At least one directional anchor is also unlocked, so there is nothing to regenerate from either — re-import this character, or create a new character version to revise it.`,+ action: null,+ prompt: null,+ acknowledgeNoClips: false,+ toast: null,+ };+ }+ 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.`,+ action: 'Unlock anyway',+ prompt: 'Re-open all 8 for regeneration?',+ acknowledgeNoClips: true,+ toast: 'Walk set unlocked — regenerate each direction from its locked anchor',+ };+}++// What an ordinary (unblocked) unlock reports on success. Lives here so the two+// surfaces' success toasts stay in step with the blocked one above.+export const WALK_UNLOCK_TOAST = 'Walk set unlocked — directions are editable again';diff --git a/client/src/lib/spriteWalkUnlock.test.js b/client/src/lib/spriteWalkUnlock.test.jsnew file mode 100644index 0000000000..5230b4e057--- /dev/null+++ b/client/src/lib/spriteWalkUnlock.test.js@@ -0,0 +1,46 @@+import { describe, it, expect } from 'vitest';+import { walkUnlockCopy, WALK_UNLOCK_TOAST } from './spriteWalkUnlock.js';++// The copy is shared by the Walk Cycles header and the Loop Trimmer's lock block+// (#3043) precisely so one server-stamped block can't be described two ways —+// which is why the branches are pinned here rather than only through whichever+// component happens to render them.+describe('walkUnlockCopy', () => {+ it('returns null for an unblocked set so callers offer the ordinary Unlock', () => {+ expect(walkUnlockCopy({ blocked: false, stranded: [], acknowledgeable: false })).toBeNull();+ expect(walkUnlockCopy(null)).toBeNull();+ expect(walkUnlockCopy(undefined)).toBeNull();+ });++ it('offers regeneration, and the consent flag, for a blocked-but-regenerable set', () => {+ const copy = walkUnlockCopy({ blocked: true, stranded: ['east'], acknowledgeable: true });+ expect(copy.acknowledgeNoClips).toBe(true);+ 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(/every approval is dropped/);+ });++ 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();+ expect(copy.acknowledgeNoClips).toBe(false);+ expect(copy.text).toMatch(/nothing to regenerate from either/);+ });++ it('inflects the stranded list, and names the set when there is no per-direction evidence', () => {+ expect(walkUnlockCopy({ blocked: true, stranded: ['east'], acknowledgeable: true }).text)+ .toMatch(/^east was imported .* without its source clip, so it cannot be re-derived/);+ expect(walkUnlockCopy({ blocked: true, stranded: ['east', 'north'], acknowledgeable: true }).text)+ .toMatch(/^east, north were imported .* without their source clips, so they cannot be re-derived/);+ // The evidence-free set-level-import case is blocked with an EMPTY list — it+ // must not render as "" or as a singular direction.+ expect(walkUnlockCopy({ blocked: true, stranded: [], acknowledgeable: true }).text)+ .toMatch(/^This walk set was imported/);+ });++ it('exports the plain-unlock success toast', () => {+ expect(WALK_UNLOCK_TOAST).toMatch(/unlocked/);+ });+});diff --git a/client/src/services/apiSprites.js b/client/src/services/apiSprites.jsindex bc29e50675..0bb2e27926 100644--- a/client/src/services/apiSprites.js+++ b/client/src/services/apiSprites.js@@ -131,8 +131,11 @@ export const setSpriteWalkTarget = (id, body, options = {}) => request(`/sprites});// Un-freeze a finalized walk set so its directions can be regenerated/re-approved.-export const unlockSpriteWalk = (id, options = {}) => request(`/sprites/${encodeURIComponent(id)}/walk/unlock`, {- method: 'POST', ...options,+// Body: `{ acknowledgeNoClips }` — see `spriteWalkUnlockSchema` in+// server/lib/validation.js for what that override means. Omit it to keep the+// server's refusal, which is what any caller that hasn't shown the warning wants.+export const unlockSpriteWalk = (id, body = {}, options = {}) => request(`/sprites/${encodeURIComponent(id)}/walk/unlock`, {+ method: 'POST', body: JSON.stringify(body), ...options,});// Re-open ONE approved direction (finer-grained than unlock) so it can bediff --git a/server/lib/validation.js b/server/lib/validation.jsindex 0115261f82..bc3332ed3f 100644--- a/server/lib/validation.js+++ b/server/lib/validation.js@@ -1209,6 +1209,14 @@ export const spriteWalkReopenSchema = z.object({direction: spriteWalkDirectionSchema,});+// Unlock takes no required input; the one optional flag is the user's informed+// override of the "imported set has no clips to re-derive from" refusal (#3043).+// Defaulted rather than `.optional()` so the service's own default and the wire+// shape agree, and an older client's empty body still means "do not override".+export const spriteWalkUnlockSchema = z.object({+ acknowledgeNoClips: z.boolean().default(false),+});+export const spriteWalkPostprocessSchema = z.object({// Resolvable, not native-only (#2980): since #2993 the reprocess is// layout-aware and re-derives an IMPORTED run in the directory it was importeddiff --git a/server/routes/sprites.js b/server/routes/sprites.jsindex 0559032f83..cefec01c1b 100644--- a/server/routes/sprites.js+++ b/server/routes/sprites.js@@ -25,6 +25,7 @@ import {spriteWalkGenerateSchema,spriteWalkApproveSchema,spriteWalkReopenSchema,+ spriteWalkUnlockSchema,spriteWalkPostprocessSchema,spriteWalkTargetSchema,spriteWalkSourceFramesParamsSchema,@@ -198,9 +199,11 @@ router.post('/:id/walk/approve', asyncHandler(async (req, res) => {// Un-freeze a finalized walk set so it can be revised in place (#2933// follow-up): removes the frozen walk-set file and re-opens every direction,-// preserving the rendered clips. 409s a legacy source-pipeline import. No body.+// preserving the rendered clips. 409s a source-pipeline import that has no clips+// to re-derive from, unless the body's `acknowledgeNoClips` overrides it.router.post('/:id/walk/unlock', asyncHandler(async (req, res) => {- res.json(await unlockWalkSet(req.params.id));+ const body = validateRequest(spriteWalkUnlockSchema, req.body || {});+ res.json(await unlockWalkSet(req.params.id, body));}));// Re-open ONE approved direction (finer-grained than unlock) so it can bediff --git a/server/services/sprites/walk.js b/server/services/sprites/walk.jsindex a36eef9068..d24e925be4 100644--- a/server/services/sprites/walk.js+++ b/server/services/sprites/walk.js@@ -706,10 +706,22 @@ export async function getWalkState(recordId) {// a direction leaves the list the moment it is re-derived here, so the client// can gate each card (and name the blocking directions) on the same evidence// the compiler will apply, not on a set-wide approximation.+ // …and stamp WHY unlock is blocked (and whether it can be acknowledged past)+ // from the same resolver the unlock gate uses, so the client can offer the+ // escape rather than re-deriving the rule — or, as before #3043, render a dead+ // "no clips to re-derive" label with no action behind it.+ // The clip evidence is handed over rather than re-resolved: `allRuns` above+ // already stat'd every approved direction's clip, and re-deriving it here would+ // put ~16-32 redundant file ops on a read the client polls every 4s. What is+ // left is a single manifest read, and only on the blocked path.+ const clipByDirection = Object.fromEntries(allRuns+ .filter((run) => resolvedRunIds.has(run.id))+ .map((run) => [run.direction, Boolean(run.sourceVideoPath) && !run.sourceClipMissing]));const stampedWalkSet = walkSet ? {...walkSet,imported: isImportedWalkSet(walkSet),importedDirections: importedWalkDirections(walkSet),+ unlock: await resolveUnlockBlock(recordId, walkSet, clipByDirection),} : null;const walkTarget = resolveWalkTargetFor({record: await recordPromise,@@ -836,6 +848,63 @@ 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.+ */+const lockedAnchorFor = (manifest, direction) => {+ const anchor = manifest?.anchors?.find((a) => a.direction === direction);+ return anchor?.status === 'locked' && anchor.path ? anchor : null;+};++/**+ * Whether a fresh walk render is possible for ONE direction: its anchor must be+ * locked, and the set must carry the frozen chroma key the i2v input is+ * composited onto.+ *+ * Shared by the render path (which throws `error` and then uses `anchor`/+ * `chromaKey`) and the un-finalize gate's regenerability probe (which only reads+ * whether there IS an error). That sharing is load-bearing, not tidiness: the+ * gate tells the user "every direction can be regenerated" and then drops all+ * eight approvals on the strength of it, so a predicate that checked less than+ * the render actually requires would walk them into exactly the dead end the+ * acknowledgement promises can't happen (#3043). `error` is a factory so the+ * probe never builds a ServerError it discards.+ *+ * The chroma key falls back `manifest → record`, which is the resolution order+ * the rest of the sprite code already uses (reference.js resolves it that way at+ * eight sites). Reading `manifest.chromaKey` alone made every SOURCE-PIPELINE+ * IMPORT unrenderable: the importer stamps the key it used on the record and the+ * imported manifest carries none, so a fully-locked imported set reported "no+ * frozen chroma key" and refused every Generate. Absent on BOTH is still the+ * genuine "main was never locked" refusal.+ *+ * Deliberately I/O-free: the on-disk anchor probe (`ANCHOR_MISSING`) stays in the+ * render path, since this runs per-direction from a read.+ */+function resolveWalkRenderability(manifest, record, direction) {+ const anchor = lockedAnchorFor(manifest, direction);+ if (!anchor) {+ return {+ anchor: null,+ chromaKey: null,+ error: () => new ServerError(`Lock the ${anchorIdForDirection(direction)} anchor before animating it`, { status: 409, code: 'ANCHOR_NOT_LOCKED' }),+ };+ }+ const chromaKey = manifest.chromaKey || record?.chromaKey || null;+ if (!chromaKey) {+ return {+ anchor,+ chromaKey: null,+ error: () => new ServerError('Reference set has no frozen chroma key', { status: 409, code: 'MAIN_NOT_LOCKED' }),+ };+ }+ return { anchor, chromaKey, error: null };+}+/*** Start one observable grok walk-video render for a direction whose anchor is* locked. User-triggered only (route-invoked); exactly one image_to_video call@@ -857,14 +926,8 @@ async function startWalkGenerationImpl(recordId, body) {await requireUnfinalized(recordId);const direction = body.direction;const manifest = await loadManifest(recordId);- const anchor = manifest?.anchors?.find((a) => a.direction === direction);- if (!anchor || anchor.status !== 'locked' || !anchor.path) {- throw new ServerError(`Lock the ${anchorIdForDirection(direction)} anchor before animating it`, { status: 409, code: 'ANCHOR_NOT_LOCKED' });- }- const chromaKey = manifest.chromaKey;- if (!chromaKey) {- throw new ServerError('Reference set has no frozen chroma key', { status: 409, code: 'MAIN_NOT_LOCKED' });- }+ const { anchor, chromaKey, error } = resolveWalkRenderability(manifest, record, direction);+ if (error) throw error();// Refuse a second render for a direction already in flight. A fresh runId per// call is the only reservation, and the client's Generate button can briefly// re-enable between the media-poll eviction of its optimistic key and the next@@ -1292,7 +1355,7 @@ async function manifestCycleProvenance(recordId, rawRel, packaged, names) {* labels the run's current geometry off `current`), and a shape that only two* thirds matched would defeat that quietly.*/-function sourceFrameResponse(runId, run, walkTarget, found) {+function sourceFrameResponse(runId, run, walkTarget, walkSet, found) {return {runId,direction: run?.direction || null,@@ -1316,6 +1379,12 @@ function sourceFrameResponse(runId, run, walkTarget, found) {cycleProvenance: 'none',editable: false,lockReason: null,+ // Only meaningful alongside lockReason 'finalized': whether the set-level+ // Unlock this panel offers is itself blocked, and whether that block can be+ // acknowledged past (#3043). Passed through from the walk state the caller+ // already loaded, so this panel and the walk workflow offer the same action+ // for the same set.+ unlock: walkSet?.unlock || null,...found,};}@@ -1374,7 +1443,7 @@ export async function getWalkSourceFrames(recordId, runId, { extract = false } =// unknown id earns.const known = state.runs.find((r) => r.id === runId);if (!known) throw new ServerError(`Unknown walk run: ${runId}`, { status: 404, code: 'RUN_NOT_FOUND' });- return sourceFrameResponse(runId, known, walkTarget, {+ return sourceFrameResponse(runId, known, walkTarget, walkSet, {reason: 'run-not-packaged',lockReason: 'no-source-video',});@@ -1409,7 +1478,7 @@ export async function getWalkSourceFrames(recordId, runId, { extract = false } =const lockReason = reDeriveLockReason({walkSet, selection, run, runId, clipRel,});- return sourceFrameResponse(runId, run, walkTarget, {+ return sourceFrameResponse(runId, run, walkTarget, walkSet, {available: frames.length > 0,// "No clip at all" and "clip present, frames pruned" are different states// with different remedies — the second is one click from recoverable.@@ -1445,10 +1514,13 @@ export function approveWalkDirection(recordId, args) {* `reference-complete` (all anchors locked, walk in progress).** A source-pipeline import (#2895) is refused only when it genuinely has nothing- * to re-derive from — see `assertReDerivable`.+ * to re-derive from — see `assertReDerivable`. `acknowledgeNoClips` is the+ * caller's informed override of exactly that refusal: re-deriving is not the only+ * way back when the directional anchors are still locked, so a user who means to+ * REGENERATE the set can say so.*/-export function unlockWalkSet(recordId) {- return walkWriteTail(recordId, () => unlockWalkSetImpl(recordId));+export function unlockWalkSet(recordId, { acknowledgeNoClips = false } = {}) {+ return walkWriteTail(recordId, () => unlockWalkSetImpl(recordId, { acknowledgeNoClips }));}/**@@ -1462,8 +1534,23 @@ async function directionsWithoutClip(recordId, walkSet, scope) {return scope.filter((_, i) => !clips[i]);}-const notReDerivable = (detail) => new ServerError(- `${detail} Re-import this character to bring its walk clips across, or create a new character version to revise it.`,+/**+ * One refusal for "this imported set has nothing on disk to re-derive from".+ *+ * `regenerable` only extends the message with the way past it — the CODE stays+ * the same either way, following the `FORK_SYNC_REQUIRED`/`acknowledgeFork`+ * precedent in the self-update path: a code names WHAT was refused, and the+ * message names the acknowledgement that overrides it. Whether a given block is+ * overridable is carried by the stamped `walkSet.unlock.acknowledgeable` that+ * clients already read, so a second code would be an unread parallel channel for+ * a fact they have — while forking a string three call sites match on (#3043).+ */+const notReDerivable = (detail, { regenerable = false } = {}) => new ServerError(+ [+ detail,+ regenerable && 'Re-submit with acknowledgeNoClips to re-open the set and regenerate each direction from its locked anchor instead (one new render each).',+ 'Re-import this character to bring its walk clips across, or create a new character version to revise it.',+ ].filter(Boolean).join(' '),{ status: 409, code: 'LEGACY_IMPORTED_WALK_SET' },);@@ -1490,20 +1577,74 @@ const notReDerivable = (detail) => new ServerError(* direction be re-derivable, and names the ones that aren't — pointing at the* per-direction reopen, which is safe precisely because it leaves the rest frozen.*/-async function assertSetReDerivable(recordId, walkSet) {- if (!isImportedWalkSet(walkSet)) return;+async function assertSetReDerivable(recordId, walkSet, { acknowledgeNoClips = false } = {}) {+ // No `isImportedWalkSet` pre-check: the resolver encodes that same answer as+ // `blocked: false`, and enforcing "native sets are never gated" in two places+ // is how the two would eventually disagree.+ const { blocked, stranded, acknowledgeable } = await resolveUnlockBlock(recordId, walkSet);+ if (!blocked) return;+ // Acknowledged: the caller was shown what they lose (re-derivation) and what it+ // costs them instead (a fresh render per stranded direction), and said yes.+ // Honored ONLY where `resolveUnlockBlock` proved a way back exists, so an+ // acknowledgement can never be the thing that strands a set (#3043).+ if (acknowledgeNoClips && acknowledgeable) {+ console.log(`🔓 sprite walk unlock acknowledged without re-derivable clips for ${recordId} · ${stranded.join(', ') || 'set-level import'}`);+ return;+ }+ // "no directions to examine" is the set-level-marker case: an empty or+ // already-re-anchored `directions` map behind a copied selectionPath, where+ // there is no per-direction evidence either way.+ // The "reopen them one at a time" pointer is offered only when some direction+ // actually HAS a clip — for a wholly clipless set that advice names an empty+ // list, and (since the acknowledgement landed) would be strictly worse than the+ // button beside it.+ const partial = stranded.length && stranded.length < importedWalkDirections(walkSet).length;+ const detail = stranded.length+ ? `Unlocking re-opens every direction, and ${stranded.join(', ')} would be left with no source clip to re-derive from and no packaged frames to re-approve — so ${stranded.length === 1 ? 'it' : 'they'} could not be brought back by re-deriving.${partial ? ' Reopen the directions that do have clips one at a time instead.' : ''}`+ : 'This walk set was imported from the source pipeline and carries no directions that can be re-derived here.';+ throw notReDerivable(detail, { regenerable: acknowledgeable });+}++/**+ * Why unlock is (or is not) blocked for a walk set, and whether the block can be+ * acknowledged past. One resolver for both the gate above and the read the+ * clients render, so the button they offer and the 409 they might hit are+ * computed from the same evidence rather than two copies of the rule.+ *+ * `blocked` is its own field rather than something a reader infers from+ * `stranded`: the evidence-free set-level-marker case IS blocked and strands an+ * EMPTY list, so `stranded.length` would read that as "fine" — the exact+ * empty-vs-absent conflation the repo's sentinel rule exists to prevent.+ * `acknowledgeable` says whether regeneration is a real way back, resolved+ * through the render path's own precondition (`resolveWalkRenderability`).+ *+ * `clipByDirection` lets a caller that has ALREADY resolved every approved+ * direction's clip hand that evidence over instead of paying for it twice —+ * `getWalkState` stamps this field and had just done exactly that work. Omit it+ * and the clips are resolved here, which is what the write path does.+ *+ * Returns a fresh object per call: this value is stamped onto a walk-state+ * response, so a hoisted shared constant would be one downstream mutation away+ * from poisoning every later response process-wide.+ */+async function resolveUnlockBlock(recordId, walkSet, clipByDirection = null) {+ const notBlocked = { blocked: false, stranded: [], acknowledgeable: false };+ if (!isImportedWalkSet(walkSet)) return notBlocked;const stale = importedWalkDirections(walkSet);- // Marked imported at the SET level with no source-packaged direction to- // examine (an empty or already-re-anchored `directions` map behind a copied- // selectionPath): no evidence either way, so keep the blanket refusal.+ const regenerable = async (scope) => {+ const [manifest, record] = await Promise.all([loadManifest(recordId), getRecord(recordId)]);+ return scope.every((direction) => !resolveWalkRenderability(manifest, record, direction).error);+ };+ // No per-direction evidence to examine, and unlock re-opens the whole set — so+ // the whole set has to be regenerable before the escape is honest.if (!stale.length) {- throw notReDerivable('This walk set was imported from the source pipeline and carries no directions that can be re-derived here — unlocking is not supported.');+ return { blocked: true, stranded: [], acknowledgeable: await regenerable(SPRITE_DIRECTIONS) };}- const stranded = await directionsWithoutClip(recordId, walkSet, stale);- if (!stranded.length) return;- throw notReDerivable(- `Unlocking re-opens every direction, and ${stranded.join(', ')} would be left with no source clip to re-derive from and no packaged frames to re-approve — so ${stranded.length === 1 ? 'it' : 'they'} could not be brought back. Reopen the directions that do have clips one at a time instead.`,- );+ const stranded = clipByDirection+ ? stale.filter((direction) => !clipByDirection[direction])+ : await directionsWithoutClip(recordId, walkSet, stale);+ if (!stranded.length) return notBlocked;+ return { blocked: true, stranded, acknowledgeable: await regenerable(stranded) };}/**@@ -1537,13 +1678,13 @@ async function dropFinalizedWalkSet(recordId, recordStatus = 'reference-completeawait updateRecord(recordId, { status: recordStatus });}-async function unlockWalkSetImpl(recordId) {+async function unlockWalkSetImpl(recordId, { acknowledgeNoClips = false } = {}) {await requireCharacter(recordId);const walkSet = await loadWalkSet(recordId);if (!walkSet) {throw new ServerError('No finalized walk set to unlock', { status: 409, code: 'WALK_SET_NOT_FINAL' });}- await assertSetReDerivable(recordId, walkSet);+ await assertSetReDerivable(recordId, walkSet, { acknowledgeNoClips });await dropFinalizedWalkSet(recordId);// Seed a fresh (empty) selection so EVERY direction re-opens: with the walk// set gone each direction would still read `approved` from the old selection@@ -1711,8 +1852,8 @@ async function approveWalkDirectionImpl(recordId, { direction, runId }) {// locked anchor. This backstops the revision flow even if an old candidate// remains addressable outside the normal UI.const referenceManifest = await loadManifest(recordId);- const currentAnchor = referenceManifest?.anchors?.find((anchor) => anchor.direction === direction);- if (currentAnchor?.status !== 'locked' || !currentAnchor.path) {+ const currentAnchor = lockedAnchorFor(referenceManifest, direction);+ if (!currentAnchor) {throw new ServerError(`Lock the ${anchorIdForDirection(direction)} anchor before approving its walk`, { status: 409, code: 'ANCHOR_NOT_LOCKED' });}if (run.anchorSha256) {diff --git a/server/services/sprites/walk.test.js b/server/services/sprites/walk.test.jsindex 806924fa11..e0327ce243 100644--- a/server/services/sprites/walk.test.js+++ b/server/services/sprites/walk.test.js@@ -1045,14 +1045,101 @@ describe('imported walk sets — evidence-based re-derive', () => {expect(run.sourceClipMissing).toBeUndefined();});- it('still refuses to unlock an imported set with no clip behind any direction', async () => {+ it('still refuses an unacknowledged unlock of an imported set with no clip behind any direction', async () => {const id = await characterWithLockedAnchors(newId(), ['east']);await importedCharacter(id, { east: { clip: false } });+ // Regenerable (east's anchor is locked), so the refusal NAMES the way past it+ // — but a caller who did not ask for that still gets refused, under the same+ // code as any other un-re-derivable import (the override rides in the message,+ // per the FORK_SYNC_REQUIRED precedent).await expect(unlockWalkSet(id)).rejects.toMatchObject({status: 409,code: 'LEGACY_IMPORTED_WALK_SET',- message: expect.stringContaining('east'),+ message: expect.stringContaining('acknowledgeNoClips'),});+ // …and it does NOT advise reopening "the directions that do have clips", of+ // which there are none.+ await expect(unlockWalkSet(id)).rejects.toMatchObject({+ message: expect.not.stringContaining('one at a time'),+ });+ expect((await getWalkState(id)).walkSet).not.toBeNull();+ });++ /**+ * #3043 — re-deriving is not the only way back. A walk render is conditioned on+ * the direction's LOCKED anchor, so a clipless imported set whose anchors are+ * all locked can still be rebuilt from scratch; before this, such a set (the+ * whole phase-1 import population) had no reachable way to revise anything —+ * not one direction, and not the set's cycle target, which `requireUnfinalized`+ * refuses while the set is frozen.+ */+ it('unlocks a clipless imported set when the caller acknowledges regeneration', async () => {+ const id = await characterWithLockedAnchors(newId(), ['east']);+ await importedCharacter(id, { east: { clip: false } });++ const state = await unlockWalkSet(id, { acknowledgeNoClips: true });+ expect(state.walkSet).toBeNull();+ expect((await records.getRecord(id)).status).toBe('reference-complete');+ // …and the retarget the whole exercise exists for now succeeds.+ const retargeted = await setWalkTarget(id, { frameCount: 12, fps: 12 });+ expect(retargeted.walkTarget).toMatchObject({ frameCount: 12, fps: 12, source: 'set' });+ });++ /**+ * The importer stamps the chroma key it used on the RECORD and copies a+ * manifest that carries none, so a renderability probe reading only+ * `manifest.chromaKey` reports every fully-locked import as un-regenerable —+ * which made both the acknowledged unlock and Generate itself dead for exactly+ * the population they exist for. The fallback mirrors reference.js's own+ * manifest → record resolution order.+ */+ it('resolves the chroma key off the record when the imported manifest carries none', async () => {+ const id = await characterWithLockedAnchors(newId(), ['east']);+ await importedCharacter(id, { east: { clip: false } });+ // Drop the manifest key the native lock flow would have frozen, leaving only+ // the record-level key the importer stamps.+ const manifestPath = join(TEST_ROOT, 'sprites', id, 'reference', `${id}-reference-set-v1.json`);+ const manifest = JSON.parse(await readFile(manifestPath, 'utf8'));+ delete manifest.chromaKey;+ await writeFile(manifestPath, JSON.stringify(manifest));+ await records.updateRecord(id, { chromaKey: '#FF00FF' });++ expect((await getWalkState(id)).walkSet.unlock).toMatchObject({ acknowledgeable: true });++ // …and with NEITHER key the refusal stands: that is the real "main was never+ // locked" state, where regeneration genuinely can't be promised.+ await records.updateRecord(id, { chromaKey: null });+ expect((await getWalkState(id)).walkSet.unlock).toMatchObject({ acknowledgeable: false });+ });++ // 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 () => {+ // Only east's anchor is locked, so north can be neither re-derived (no clip)+ // nor regenerated (no anchor to condition a render on).+ const id = await characterWithLockedAnchors(newId(), ['east']);+ await importedCharacter(id, { east: { clip: false }, north: { clip: false } });++ await expect(unlockWalkSet(id, { acknowledgeNoClips: true })).rejects.toMatchObject({+ status: 409,+ code: 'LEGACY_IMPORTED_WALK_SET',+ });+ expect((await getWalkState(id)).walkSet).not.toBeNull();+ });++ // What the two clients render their Unlock affordance from (#3043) — stamped by+ // the same resolver the gate uses, so the button offered and the 409 it might+ // hit cannot be computed from two different readings of the set.+ it('stamps the unlock block on the walk state', async () => {+ const clipless = await characterWithLockedAnchors(newId(), ['east']);+ await importedCharacter(clipless, { east: { clip: false } });+ expect((await getWalkState(clipless)).walkSet.unlock).toEqual({+ blocked: true, stranded: ['east'], acknowledgeable: true,+ });++ const withClip = await characterWithLockedAnchors(newId(), ['east']);+ await importedCharacter(withClip, { east: {} });+ expect((await getWalkState(withClip)).walkSet.unlock).toMatchObject({ blocked: false });});// Unlock drops EVERY approval, and a source-packaged direction with no clip can