feat: auto-repair sprite_id drift after every import
CI / check (push) Successful in 28s
CI / release (push) Skipped
CI / deploy (push) Successful in 54s

The emulator sends items_base.sprite_id to the client and Nitro resolves
the furniture by looking up that id in FurnitureData.json. Legacy rows
where sprite_id drifted from the id made the client render a completely
different item (e.g. a wired or custom asset instead of the purchased
furniture).

Add verifyAndFixSpriteIds() which repairs any row whose sprite_id no
longer matches its id while the local furnidata carries the item under
that id, and run it after every import path (single, batch, batch-regen,
clone) next to the offer_id rebuild.
This commit is contained in:
openhands committed 2026-08-21 14:02:42 +02:00
1 parent 92b0ba3b18
commit 984b5bf793
5 files changed
+84

No files matched your search

@@ -7,6 +7,7 @@ import {
appendFurniEntriesBatch,
rebuildCatalogOfferIds,
reconcileFurniDataWithItemsBase,
verifyAndFixSpriteIds,
} from "@/lib/services/furni-data";
import {
ensureDirectories,
@@ -229,6 +230,7 @@ export const POST = withAdmin(
let furniDataMissing = 0;
let furniDataConflicts = 0;
let offerRebuildFixed = 0;
let spriteFixed = 0;
let interactionFixed = 0;
try {
offerIdsFixed = (await reconcileImportedOfferIds()).fixed;
@@ -242,6 +244,7 @@ export const POST = withAdmin(
furniDataMissing = furniReconcile.missing;
furniDataConflicts = furniReconcile.conflicts;
offerRebuildFixed = (await rebuildCatalogOfferIds()).fixed;
spriteFixed = (await verifyAndFixSpriteIds()).fixed;
interactionFixed = (await verifyAndFixInteractionModesCount()).fixed;
} catch (err) {
console.warn(
@@ -264,6 +267,7 @@ export const POST = withAdmin(
furniDataMissing,
furniDataConflicts,
offerRebuildFixed,
spriteFixed,
interactionFixed,
duration: Date.now() - startTime,
});