fix: scene clear race, path editor anchors, avatar cover, team color crash

Clear scene now patches traps/tokens/npcTokens atomically and updateScene merges against a fresh scene snapshot. Align NPC path-editor previews on token center, default new paths to fixed facing, size avatars by natural aspect for cover, and read team color synchronously from the picker.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Ivan Fontosh
2026-08-29 15:30:28 +08:00
parent 028c1be059
commit 0a9168b320
10 changed files with 189 additions and 95 deletions
@@ -85,6 +85,18 @@ void test('zipStore: NPC parse defaults externalUrl', () => {
assert.match(src, /externalUrl: normalizeNpcExternalUrl/);
});
void test('zipStore: updateScene merges patch inside updateProject mutator (no stale base race)', () => {
const src = fs.readFileSync(path.join(here, 'zipStore.ts'), 'utf8');
const i = src.indexOf('async updateScene(sceneId: SceneId, patch: ScenePatch)');
assert.ok(i >= 0);
const j = src.indexOf('async updateConnections(', i);
assert.ok(j > i);
const block = src.slice(i, j);
assert.match(block, /await this\.updateProject\(\(p\) => \{/);
assert.match(block, /const existing = p\.scenes\[sceneId\]/);
assert.doesNotMatch(block, /const existing = open\.project\.scenes\[sceneId\]/);
});
void test('zipStore: listProjects skips unreadable archives', () => {
const src = fs.readFileSync(path.join(here, 'zipStore.ts'), 'utf8');
assert.match(