feat: relocate import tools into studio and harden catalog/furnidata integrity
CI / check (push) Failing after 26s
CI / release (push) Skipped
CI / deploy (push) Skipped

- Move /admin/import/* tools under /admin/studio/* and add studio nav, layout and tabs
- Add shared catalog maintenance panel plus a /admin/studio/maintenance tab
- Make furnidata reconciliation overwrite conflicting entries with the
  DB-authoritative items_base classname/id (surfaced via fixedConflicts)
- Add furnidata_translate_enabled setting to skip the heavy localized
  furnidata build during import (manual build-languages still forces it)
- Update staff smoke contract test for the studio hub
This commit is contained in:
openhands committed 2026-08-24 17:13:03 +02:00
1 parent c2e61dc324
commit c7ba04bda1
36 files changed
+616 -2835

No files matched your search

+32 -7
View File
@@ -485,7 +485,12 @@ export interface FurniDataReconcileResult {
normalizedIds: number;
/** items_base rows with no matching furnitype entry (need re-import). */
missing: number;
/** spriteIds used by a different classname in the file; left untouched. */
/** spriteIds used by a different classname in the file, now resolved by
* overwriting the entry's classname with the items_base (authoritative)
* value so the client renders the correct furniture. */
fixedConflicts: number;
/** spriteIds still used by a different classname after the pass (none, once
* fixedConflicts resolves every conflict). */
conflicts: number;
}
@@ -498,8 +503,10 @@ export interface FurniDataReconcileResult {
* the emulator's catalog offer lookup stays in sync with the local ids;
* - rows missing entirely from the file are counted (they need a re-import
* or batch-regen, since building an entry requires the SWF/nitro metadata);
* - genuine spriteId conflicts (id used by a different classname) are counted
* but never auto-fixed.
* - genuine spriteId conflicts (id used by a different classname) are resolved
* in favour of items_base: the furnidata entry occupying that id has its
* classname overwritten with the items_base classname, so the client renders
* the real (imported) furniture instead of a legacy/conflicting one.
*/
export async function reconcileFurniDataWithItemsBase(): Promise<FurniDataReconcileResult> {
return withFurniDataLock(async () => {
@@ -539,7 +546,8 @@ export async function reconcileFurniDataWithItemsBase(): Promise<FurniDataReconc
let fixedOfferIds = 0;
let normalizedIds = 0;
let missing = 0;
let conflicts = 0;
let fixedConflicts = 0;
const conflicts = 0;
const entryOfferId = (entry: Record<string, unknown>): number => {
const v = Number(entry.offerid);
@@ -551,7 +559,17 @@ export async function reconcileFurniDataWithItemsBase(): Promise<FurniDataReconc
const existing = byId.get(spriteId);
if (existing) {
if (existing.entry.classname !== row.itemName) {
conflicts++;
// items_base is authoritative: this furnidata entry sits at the
// wrong classname for this id (legacy/conflicting data). Overwrite
// it so the client renders the imported furniture, not a stray one.
const displaced = String(existing.entry.classname ?? "");
existing.entry.classname = row.itemName;
existing.entry.id = spriteId;
existing.entry.offerid = spriteId;
// Keep the in-memory maps coherent for the corrected classname.
byClass.set(row.itemName, existing);
if (displaced) byClass.delete(displaced);
fixedConflicts++;
} else if (entryOfferId(existing.entry) !== spriteId) {
existing.entry.offerid = spriteId;
fixedOfferIds++;
@@ -589,10 +607,17 @@ export async function reconcileFurniDataWithItemsBase(): Promise<FurniDataReconc
}
}
if (fixedIds > 0 || fixedOfferIds > 0) {
if (fixedIds > 0 || fixedOfferIds > 0 || fixedConflicts > 0) {
await writeFurniData(furniData as Record<string, unknown>);
}
return { fixedIds, fixedOfferIds, normalizedIds, missing, conflicts };
return {
fixedIds,
fixedOfferIds,
normalizedIds,
missing,
fixedConflicts,
conflicts,
};
});
}