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

Fold sprite atlas manifests into their atlas card instead of a standalone Manifests group

[._.]/ Adam Eivy7f088be6e51d
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 34177ab060..352ea40528 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -7,6 +7,7 @@
## Sprite Manager
+- **Atlas manifests are folded into the atlas, not a confusing "Manifests" shelf** — a character's asset library used to show a separate **Manifests** group of near-identical JSON cards sitting apart from the sprite-sheet PNGs they describe, so it was never clear that each manifest is just the build metadata for one atlas version. Manifests are no longer their own group: a runtime atlas card gains a **Manifest** button that opens its sidecar (the geometry, chroma key, and source provenance the compiler recorded), and the inspector now says plainly that it's behind-the-scenes metadata removed together with its atlas. The other internal JSON (publish pointers, run records, the reference-set manifest) no longer appears as inert cards at all. Nothing changes on disk — manifests are still written and still deleted as a unit with their atlas version.
- **Every walk direction is trimmable now, whatever produced it** — a direction whose art came from the source pipeline's older video-first "redraw" path (pioneer's *east* being the case in the wild) showed its "approved ✓" card with no **Edit in Loop Trimmer** link, because loop trimming was wired only to grok-generated runs. The Loop Trimmer now resolves any run's geometry from the run's own manifest/strip regardless of where it was authored, so imported and redraw directions are trimmable exactly like native ones — the link appears on every direction that has a packed strip. (Saved trims stay preview-only; there's no run behind them to re-trim.)
- **Sprite runs are stored vendor-neutrally** — under the hood, PortOS used to file its own walk generations under a `grok/` directory, baking one provider into the on-disk layout. Runs now live under a neutral `runs/` tree with the provider recorded as run metadata instead, so future agent services or generation methods slot in without a storage change and nothing downstream (trimming, atlas compile, publish, backups) assumes a vendor. Existing installs are migrated automatically on upgrade: each character's `grok/<run>/` directories are renamed to `runs/<run>/`, every embedded path is rewritten, and the checksums that pin the finalized walk set + compiled atlas are recomputed so a re-compile stays a no-op — your published atlases are unaffected. Imported/redraw characters and the atlas image bytes are left untouched.
- **Delete old atlas and reference images from the asset inspector** — as you iterate a character, its `runtime/` tree fills up with superseded atlas versions (`…-animation-atlas-v10.png`, v9, v8…) and its reference/walk trees fill up with old candidate renders, with no way to prune them short of hand-editing `data/sprites/`. The asset inspector now has a **Delete** action: open any asset, click Delete, confirm in an inline Cancel/Delete row, and it's removed from disk (the library refreshes in place). Deleting an old runtime atlas removes its sidecar manifest in the same step, so a version goes cleanly. The one atlas you can't delete is the current published one — PortOS refuses it (and the pointer/publish-history bookkeeping) so you can't strand a live game or the recompiler; compile or publish a newer version first.
diff --git a/client/src/components/sprites/AssetCollection.jsx b/client/src/components/sprites/AssetCollection.jsx
index 7f0af8f603..84e8864084 100644
--- a/client/src/components/sprites/AssetCollection.jsx
+++ b/client/src/components/sprites/AssetCollection.jsx
@@ -16,7 +16,7 @@
*/
import { useMemo, useState } from 'react';
-import { FolderOpen, RefreshCw, Scissors, Sparkles, Film } from 'lucide-react';
+import { FolderOpen, RefreshCw, Scissors, Sparkles, Film, FileJson } from 'lucide-react';
import AssetInspector from './AssetInspector.jsx';
import SpritePreview from './SpritePreview.jsx';
import { hasSpritePreview } from './spriteAssets.js';
@@ -47,6 +47,10 @@ function AssetCard({ recordId, asset, actions, onInspect }) {
const name = asset.path.split('/').pop();
const regenerate = actions?.regenerateFor(asset);
const trim = actions?.trimFor(asset);
+ // A runtime atlas carries its per-version sidecar manifest. Rather
+ // than a standalone "Manifests" group of lookalike JSON cards, the atlas card
+ // links to its own build metadata — geometry, chroma key, provenance.
+ const manifest = asset.manifest;
return (
<div className="bg-port-bg border border-port-border rounded p-1 space-y-1">
@@ -65,7 +69,7 @@ function AssetCard({ recordId, asset, actions, onInspect }) {
{hasSpritePreview(asset) ? `${asset.width}×${asset.height}` : formatBytes(asset.size)}
</span>
</button>
- {(regenerate || trim) && (
+ {(regenerate || trim || manifest) && (
<div className="flex gap-1">
{regenerate && (
<button
@@ -92,6 +96,17 @@ function AssetCard({ recordId, asset, actions, onInspect }) {
<Scissors className="w-3 h-3" />
</button>
)}
+ {manifest && (
+ <button
+ type="button"
+ onClick={() => onInspect(manifest)}
+ title="View the atlas build manifest — geometry, chroma key, and provenance the compiler recorded"
+ aria-label={`View build manifest for ${name}`}
+ className="flex-1 flex items-center justify-center gap-1 px-1 py-0.5 text-[10px] bg-port-card border border-port-border rounded text-gray-300 hover:border-port-accent"
+ >
+ <FileJson className="w-3 h-3" /> Manifest
+ </button>
+ )}
</div>
)}
</div>
@@ -136,10 +151,13 @@ export default function AssetCollection({ recordId, assets, actions = null, appr
<span className="text-xs text-gray-500 font-normal">({rows.length})</span>
</h4>
<div className="grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 gap-2">
- {/* `actions` is the SINGLE gate on which cards get buttons — its
- two resolvers return null for an asset they can't act on (a
- manifest, an upload, a locked anchor), so there is no second
- role allow-list here to drift out of sync. */}
+ {/* Two kinds of card button, by design: the WORKFLOW actions
+ (Regenerate / Trim) are gated solely by the `actions` resolvers,
+ which return null for an asset they can't act on — no second
+ role allow-list to drift. The atlas "Manifest" button is
+ separate: a pure inspect affordance driven by `asset.manifest`
+ (attached in groupSpriteAssetsByRole), needing none of the live
+ workflow state `actions` carries. */}
{rows.map((asset) => (
<AssetCard
key={asset.path}
diff --git a/client/src/components/sprites/AssetCollection.test.jsx b/client/src/components/sprites/AssetCollection.test.jsx
index f465bf46bb..a25b8af08a 100644
--- a/client/src/components/sprites/AssetCollection.test.jsx
+++ b/client/src/components/sprites/AssetCollection.test.jsx
@@ -44,8 +44,30 @@ describe('AssetCollection grouping', () => {
it('groups by semantic role in the declared order, not by path segment', () => {
render(<AssetCollection recordId="example-walker" assets={ASSETS} />);
// Pre-#2931 this was `reference` / `grok` (raw first path segments) — the
- // strip and its sidecar manifest sat in one undifferentiated bucket.
- expect(groupHeadings()).toEqual(['Reference set(2)', 'Strips(1)', 'Manifests(1)']);
+ // strip and its sidecar manifest sat in one undifferentiated bucket. The
+ // manifest JSON is no longer surfaced as its own "Manifests" group —
+ // behind-the-scenes metadata isn't a browsable asset card.
+ expect(groupHeadings()).toEqual(['Reference set(2)', 'Strips(1)']);
+ expect(screen.queryByRole('heading', { name: /Manifests/ })).toBeNull();
+ });
+
+ it('folds a runtime atlas sidecar manifest onto the atlas card as a View-manifest action', async () => {
+ const user = userEvent.setup();
+ render(
+ <AssetCollection
+ recordId="example-walker"
+ assets={[
+ image('runtime/v3/example-animation-atlas-v3.png'),
+ asset('runtime/v3/example-animation-atlas-v3-manifest.json'),
+ ]}
+ />,
+ );
+ // Exactly one group (Atlases) — the manifest is not its own card.
+ expect(groupHeadings()).toEqual(['Atlases(1)']);
+ // The atlas card exposes a labeled manifest affordance; clicking it opens
+ // the inspector on the sidecar JSON with its explanatory note.
+ await user.click(screen.getByRole('button', { name: /View build manifest/ }));
+ expect(await screen.findByText(/build manifest/i)).toBeTruthy();
});
it('badges each asset with its lifecycle status, including the cross-set supersede', () => {
diff --git a/client/src/components/sprites/AssetInspector.jsx b/client/src/components/sprites/AssetInspector.jsx
index 834db787ec..72cd5aeb9e 100644
--- a/client/src/components/sprites/AssetInspector.jsx
+++ b/client/src/components/sprites/AssetInspector.jsx
@@ -14,6 +14,7 @@ import { Download, ClipboardCopy, ExternalLink, Trash2, X } from 'lucide-react';
import Modal from '../ui/Modal.jsx';
import SpritePreview from './SpritePreview.jsx';
import { spriteAssetUrl, hasSpritePreview, isVideoAsset } from './spriteAssets.js';
+import { isRuntimeVersionPath, isRuntimeSidecarManifest } from '../../lib/spriteFacets.js';
import { formatBytes, timeAgo } from '../../utils/formatters.js';
import { copyToClipboard } from '../../lib/clipboard.js';
import { deleteSpriteAsset } from '../../services/apiSprites.js';
@@ -47,6 +48,12 @@ export default function AssetInspector({ recordId, asset, onClose, onDeleted = n
const url = spriteAssetUrl(recordId, asset.path);
const fileName = asset.path.split('/').pop();
const previewable = hasSpritePreview(asset);
+ // A runtime version lives in `runtime/vN/` as an atlas PNG + its sidecar
+ // manifest, deleted together as a unit by the server. Reuse the classifier's
+ // grammar (spriteFacets) so this stays one definition — the delete copy fires
+ // for either half; the note only for the manifest sidecar.
+ const isRuntimeVersionFile = isRuntimeVersionPath(asset.path);
+ const isRuntimeManifest = isRuntimeSidecarManifest(asset.path);
const runDelete = () => {
setDeleting(true);
@@ -109,6 +116,15 @@ export default function AssetInspector({ recordId, asset, onClose, onDeleted = n
</p>
)}
+ {isRuntimeManifest && (
+ <p className="text-xs text-gray-400 border border-port-border rounded p-2 bg-port-bg">
+ This is the atlas <span className="text-gray-200">build manifest</span> — the geometry,
+ chroma key, and source provenance the compiler recorded for its sprite sheet. It’s
+ behind-the-scenes metadata for the atlas in this same runtime version and is removed
+ together with it, not a separately publishable asset.
+ </p>
+ )}
+
<dl className="grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-xs">
<Row label="Path" value={asset.path} />
<Row label="Dimensions" value={previewable ? `${asset.width} × ${asset.height}` : null} />
@@ -160,7 +176,7 @@ export default function AssetInspector({ recordId, asset, onClose, onDeleted = n
<div className="space-y-2 border border-port-error/40 bg-port-error/10 rounded p-2">
<p className="text-xs text-gray-200">
Delete <span className="font-semibold break-all">{fileName}</span> from disk?
- {/^runtime\/v\d+\//.test(asset.path) && ' Its sidecar manifest is removed too.'}
+ {isRuntimeVersionFile && ' The whole runtime version — atlas sprite sheet and its sidecar manifest — is removed together.'}
{' '}This can’t be undone.
</p>
{deleteError && <p className="text-xs text-port-error break-all">{deleteError}</p>}
diff --git a/client/src/lib/README.md b/client/src/lib/README.md
index 3df14f79fb..f508fc4850 100644
--- a/client/src/lib/README.md
+++ b/client/src/lib/README.md
@@ -137,7 +137,7 @@ grep -i "what you want to do" client/src/lib/README.md
| `songPlayback.js` | `createLayeredPlayer(takes)` — decode N recorded vocal takes and start them together on one shared `AudioContext` so they stack into a layered a cappella performance (sample-aligned, per-layer mute). Used by the Song editor's recording mixer. |
| `songProgress.js` | Pure training-progress core for the song system's memorize/learn/track mode. `deriveTrainingSections(score, lyricSections?)` slices a lead-sheet score into blank-line-separated trainable sections (each a self-contained header+block score, positional stable id, lyric-matched label); `recordAttempt(progress, scope, summary)` appends a graded take to a scope's bounded rolling history (drops zero-note takes); `scopeStats(progress, scope)`/`wholeSongStats` derive `{ attempts, best, average, last, streak, learned }` (learned = streak of ≥`LEARNED_PERCENT` takes ≥`LEARNED_STREAK`); `weakestSections(progress, sections)` ranks weak/un-attempted sections for spaced-repetition; `memorizationPercent` is the learned-section share; `hideLevelFor(average)` maps a rolling average to a progressive lyric/note-hiding level (`show`/`dim`/`hide`/`blind`). No React/audio — `useSongTraining` drives it. |
| `spriteCollectionActions.js` | Gating for the Sprite Manager asset collection's inline actions (#2931). `buildCollectionActions({ detail, walkPending, referencePending, generateWalk, generateAnchor, onRequestTrim })` → `{ regenerateFor(asset), trimFor(asset) }`, each returning `null` for an asset it can't act on. Regenerate mirrors the authoritative workflow surfaces exactly — a walk direction is regenerable only when its anchor is locked, the direction isn't approved, the walk set isn't finalized and no render is in flight; a reference anchor only while it's an unlocked candidate (`south`/main is excluded, since it needs a design prompt or upload). Trim is offered only for a run that actually packed a strip (the trim endpoint 409s otherwise). Pure — takes callbacks, performs no I/O. Consumes the facets from `spriteFacets.js`. |
-| `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. 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. |
+| `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). Pure — no React, no canvas, 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`. |
diff --git a/client/src/lib/spriteFacets.js b/client/src/lib/spriteFacets.js
index 59f3554f99..50604f2e0d 100644
--- a/client/src/lib/spriteFacets.js
+++ b/client/src/lib/spriteFacets.js
@@ -30,10 +30,13 @@ export const SPRITE_DIRECTIONS = [
];
/**
- * Every role, in the order the collection renders its groups. `manifest` is a
- * PortOS addition to the source's role set: sidecar JSON is a real category
- * here (run records, reference sets, atlas manifests, the publish pointer) and
- * folding it into `sprite` would put JSON in the image grid.
+ * Every role. The first seven, in this order, are the groups the collection
+ * renders. `manifest` is a PortOS addition to the source's role set — sidecar
+ * JSON (run records, reference sets, atlas manifests, the publish pointer) is a
+ * real classifier category so it doesn't land in the image grid — but it is NOT
+ * rendered as its own group: `groupSpriteAssetsByRole` folds each
+ * runtime atlas's sidecar manifest onto its atlas row and omits the rest. The
+ * role stays here so the classifier and its label map remain total.
*/
export const SPRITE_ASSET_ROLES = [
'reference', 'strip', 'animation', 'frame', 'atlas', 'evidence', 'sprite', 'manifest',
@@ -71,7 +74,9 @@ const ANIMATION_EXT = /\.(gif|mp4|webm|mov|m4v)$/i;
// strip it of its Regenerate/Trim actions). `stripe.png` stays excluded.
const STRIP_FILE = /(^|[-_])strips?([-_.]|$)/i;
// `runtime/vN/` — the published-atlas version lives in the directory, not the
-// filename, so supersede detection has to read it from there.
+// filename, so supersede detection has to read it from there. This is the one
+// source of truth for the `runtime/vN` grammar; `runtimeVersionDir` /
+// `isRuntimeVersionPath` derive from it rather than re-anchoring the pattern.
const RUNTIME_VERSION_DIR = /^runtime\/v(\d+)\//;
// `-v3.png`, `-v001-strip.png` — a trailing version marker on the filename.
const FILE_VERSION = /-v(\d+)(?=(-[a-z0-9-]+)?\.[a-z0-9]+$)/i;
@@ -166,6 +171,33 @@ export function classifySpriteAsset(path) {
};
}
+/**
+ * The `runtime/vN` directory of a path (no trailing slash), or null. This is
+ * the pairing key that ties an atlas PNG to its per-version sidecar manifest —
+ * and it deliberately does NOT match `runtime/current.json` /
+ * `runtime/publications.json`, which live in the top-level `runtime/` dir, so
+ * the publish pointers are never mistaken for a version sidecar.
+ */
+export function runtimeVersionDir(path) {
+ const m = typeof path === 'string' ? RUNTIME_VERSION_DIR.exec(path) : null;
+ return m ? path.slice(0, m[0].length - 1) : null;
+}
+
+/** True for any file inside a `runtime/vN/` version directory (PNG or sidecar). */
+export function isRuntimeVersionPath(path) {
+ return runtimeVersionDir(path) !== null;
+}
+
+/**
+ * True for the JSON sidecar of a runtime atlas — a `manifest`-role file living
+ * in a `runtime/vN/` dir. Reuses the classifier's role so the "is this a build
+ * manifest" definition lives in exactly one place (`roleFor`), not a second
+ * regex in a component.
+ */
+export function isRuntimeSidecarManifest(path) {
+ return isRuntimeVersionPath(path) && classifySpriteAsset(path).role === 'manifest';
+}
+
/**
* Classify a whole listing, adding the one facet that is only knowable across
* the set: an `approved` asset that is NOT the highest version of its stem is
@@ -201,14 +233,42 @@ export function classifySpriteAssets(assets) {
/**
* Classified assets grouped into render-ready role sections, in
* `SPRITE_ASSET_ROLES` order. Empty roles are omitted.
+ *
+ * The `manifest` role is intentionally NOT rendered as its own group.
+ * A runtime atlas's sidecar manifest is metadata FOR that atlas — same
+ * `runtime/vN/` dir, 1:1, deleted as a unit — so it is folded onto its atlas
+ * row as `row.manifest` (surfaced by the atlas card as a "View manifest"
+ * affordance) rather than shown as a lookalike JSON card that reads as a
+ * separate concern from the PNG it describes. The remaining JSON the classifier
+ * tags `manifest` (publish pointers, run records, the reference-set manifest)
+ * is behind-the-scenes state, not a browsable asset, so it is omitted from the
+ * grid entirely.
*/
export function groupSpriteAssetsByRole(assets) {
const rows = classifySpriteAssets(assets);
+
+ // Index each per-version sidecar manifest by its `runtime/vN` dir so the
+ // atlas PNG sharing that dir can carry it along.
+ const manifestByRuntimeDir = new Map();
+ for (const row of rows) {
+ if (row.facets.role !== 'manifest') continue;
+ const dir = runtimeVersionDir(row.path);
+ if (dir) manifestByRuntimeDir.set(dir, row);
+ }
+
const byRole = new Map();
for (const row of rows) {
- const list = byRole.get(row.facets.role);
- if (list) list.push(row); else byRole.set(row.facets.role, [row]);
+ if (row.facets.role === 'manifest') continue; // folded onto its atlas / hidden
+ let enriched = row;
+ if (row.facets.role === 'atlas') {
+ const manifest = manifestByRuntimeDir.get(runtimeVersionDir(row.path));
+ if (manifest) enriched = { ...row, manifest };
+ }
+ const list = byRole.get(enriched.facets.role);
+ if (list) list.push(enriched); else byRole.set(enriched.facets.role, [enriched]);
}
+ // `manifest` keys are never inserted (folded/skipped above), so filtering on
+ // `byRole.has(role)` alone already excludes the Manifests group.
return SPRITE_ASSET_ROLES
.filter((role) => byRole.has(role))
.map((role) => ({ role, label: SPRITE_ROLE_LABELS[role], assets: byRole.get(role) }));
diff --git a/client/src/lib/spriteFacets.test.js b/client/src/lib/spriteFacets.test.js
index 46610fc2e6..33e510c6ad 100644
--- a/client/src/lib/spriteFacets.test.js
+++ b/client/src/lib/spriteFacets.test.js
@@ -147,17 +147,43 @@ describe('classifySpriteAssets — supersede', () => {
});
describe('groupSpriteAssetsByRole', () => {
- it('returns only non-empty roles, in the declared render order', () => {
+ it('returns only non-empty roles, in the declared render order, and never a Manifests group', () => {
const groups = groupSpriteAssetsByRole([
- { path: 'runtime/current.json' },
+ { path: 'runtime/current.json' }, // a publish-pointer manifest — behind-the-scenes, not shown
{ path: 'grok/walk-east-abc12345/generated/example-walk-east-strip.png' },
{ path: 'reference/example-walk-east-v1.png' },
]);
- expect(groups.map((g) => g.role)).toEqual(['reference', 'strip', 'manifest']);
+ expect(groups.map((g) => g.role)).toEqual(['reference', 'strip']);
+ expect(groups.some((g) => g.role === 'manifest')).toBe(false);
expect(groups[0].label).toBe(SPRITE_ROLE_LABELS.reference);
expect(groups.every((g) => g.assets.length > 0)).toBe(true);
});
+ it('folds a runtime version manifest onto its atlas row instead of a Manifests group', () => {
+ const groups = groupSpriteAssetsByRole([
+ { path: 'runtime/v3/hero-animation-atlas-v3.png' },
+ { path: 'runtime/v3/hero-animation-atlas-v3-manifest.json' },
+ ]);
+ expect(groups.map((g) => g.role)).toEqual(['atlas']);
+ const [atlasRow] = groups[0].assets;
+ expect(atlasRow.manifest?.path).toBe('runtime/v3/hero-animation-atlas-v3-manifest.json');
+ // The manifest row is not double-counted as its own asset.
+ expect(groups[0].assets).toHaveLength(1);
+ });
+
+ it('does not attach the publish pointer to an atlas — only the per-version sidecar', () => {
+ const groups = groupSpriteAssetsByRole([
+ { path: 'runtime/v2/hero-animation-atlas-v2.png' },
+ { path: 'runtime/current.json' },
+ { path: 'atlas/props-sheet.png' }, // imported props atlas — no sidecar
+ ]);
+ const atlas = groups.find((g) => g.role === 'atlas');
+ const runtimeRow = atlas.assets.find((a) => a.path.startsWith('runtime/'));
+ const importedRow = atlas.assets.find((a) => a.path.startsWith('atlas/'));
+ expect(runtimeRow.manifest).toBeUndefined();
+ expect(importedRow.manifest).toBeUndefined();
+ });
+
it('labels every declared role', () => {
expect(SPRITE_ASSET_ROLES.every((r) => typeof SPRITE_ROLE_LABELS[r] === 'string')).toBe(true);
});