fix: harden furni import pipeline for production
CI / check (push) Successful in 26s
CI / release (push) Skipped
CI / deploy (push) Successful in 57s

- importSingleFurni: actually update an existing item instead of failing on a primary key INSERT collision; refuse to reassign a spriteId owned by a different classname
- reconcileFurniDataWithItemsBase: also sync each entry's offerid to the DB sprite id, not just the id
- Move the full-table interaction_modes_count verification out of the per-item import hot path and run it once per batch/single import
- clone-import: apply the auto-detected interaction_type (was hardcoded 'default'), set FurnitureData offerid and catalog_items.offer_id to the new local sprite id (was the source hotel's id / -1)
- clone batch route: run the same post-import reconcile/verify/ownership/RCON consolidation as the furni batch route
- upload-import: set offer_id to the allocated id in both the direct insert and the generated SQL migration (was -1)
- generateCatalogSql: use the classname as catalog_name and the item id as offer_id so rows match the app-managed import convention
- stats + missing-nitro endpoints: match catalog membership via item_ids instead of the catalog_name join, so translated display names no longer break counts
- deleteImportedItem/rollback: delete catalog rows by the canonical item_ids link only
- classifyFurni: wall items always classify as 'walls' before prefix rules (rare_/val_/xmas_) can misfile them
This commit is contained in:
openhands committed 2026-08-20 11:48:51 +02:00
1 parent 2b9a015afb
commit 6021a91ef7
9 files changed
+162 -66

No files matched your search

@@ -10,8 +10,16 @@ import { getSource } from "@/lib/services/clone-sources";
import {
appendFurniEntriesBatch,
appendFurniEntry,
reconcileFurniDataWithItemsBase,
} from "@/lib/services/furni-data";
import {
ensureFurniOwnership,
reconcileImportedOfferIds,
syncAssetsToGamedataBundle,
verifyAndFixInteractionModesCount,
} from "@/lib/services/furni-import";
import { runSseBatch } from "@/lib/services/import/core/sse-batch";
import { rcon } from "@/lib/services/rcon";
interface BatchItem {
classname: string;
@@ -126,6 +134,22 @@ export const POST = withAdmin(
`FurnitureData batch write failed: ${(err as Error).message}`,
);
}
// Post-import consolidation, mirroring the furni batch route:
// keep offer_id / FurnitureData offerid in sync with the new local
// sprite ids, verify interaction_modes_count, and refresh the
// emulator + asset ownership. Never fails the stream — best effort.
try {
await reconcileImportedOfferIds();
await reconcileFurniDataWithItemsBase();
await verifyAndFixInteractionModesCount();
await ensureFurniOwnership();
await syncAssetsToGamedataBundle();
await rcon.updateCatalog();
await rcon.updateItems();
} catch {
/* best effort — post-import consolidation is non-fatal */
}
},
});
},