Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: refresh stale atlas manifests (#3223)

[._.]/ Adam Eivyeceaac1d7c06
diff --git a/server/services/sprites/atlas.js b/server/services/sprites/atlas.js
index e35dc71c81..07f17e052d 100644
--- a/server/services/sprites/atlas.js
+++ b/server/services/sprites/atlas.js
@@ -808,7 +808,10 @@ export async function compileAtlasInTail(recordId, {
// (the re-materialize case).
for (;;) {
const survivor = await readJSONFile(join(runtimeAbs, `v${version}`, `${stem}-v${version}-manifest.json`), null);
- if (!survivor || survivor.atlasSha256 === atlasSha256) break;
+ if (!survivor || (
+ survivor.atlasSha256 === atlasSha256
+ && trackFrameCountsUpToDate(survivor.geometry, frameCountFields)
+ )) break;
version += 1;
}
const versionRel = `${RUNTIME_DIR}/v${version}`;
@@ -823,7 +826,10 @@ export async function compileAtlasInTail(recordId, {
// createdAt and trip the immutable-write refusal.
const manifestAbs = join(dir, manifestRel);
const survivingManifest = await readJSONFile(manifestAbs, null);
- if (survivingManifest?.atlasSha256 === atlasSha256) {
+ if (
+ survivingManifest?.atlasSha256 === atlasSha256
+ && trackFrameCountsUpToDate(survivingManifest.geometry, frameCountFields)
+ ) {
const survivingBuffer = await readFile(manifestAbs);
const pointer = {
schemaVersion: 1,
diff --git a/server/services/sprites/atlas.test.js b/server/services/sprites/atlas.test.js
index 36ffae56bd..3256037805 100644
--- a/server/services/sprites/atlas.test.js
+++ b/server/services/sprites/atlas.test.js
@@ -444,8 +444,15 @@ describe('compileAtlas', () => {
// its atlas pixels and finalized track sets are unchanged.
const pointerAbs = join(TEST_ROOT, 'sprites', id, 'runtime/current.json');
const legacyPointer = JSON.parse(await readFile(pointerAbs, 'utf8'));
+ const legacyManifestAbs = join(TEST_ROOT, 'sprites', id, first.manifestPath);
+ const legacyManifest = JSON.parse(await readFile(legacyManifestAbs, 'utf8'));
+ delete legacyManifest.geometry.jetpackFrameCount;
+ const legacyManifestBytes = Buffer.from(`${JSON.stringify(legacyManifest, null, 2)}\n`);
+ await writeFile(legacyManifestAbs, legacyManifestBytes);
delete legacyPointer.geometry.jetpackFrameCount;
+ legacyPointer.manifestSha256 = sha256(legacyManifestBytes);
await writeFile(pointerAbs, JSON.stringify(legacyPointer));
+ await rm(join(TEST_ROOT, 'sprites', id, first.atlasPath));
const backfilled = await compileAtlas(id, { tracks: customTracks });
expect(backfilled.created).toBe(true);
expect(backfilled.version).toBe(first.version + 1);