feat: set interaction_type at import and track cross-section normalizations

Newly imported items with a generic .nitro logicType stayed on interaction_type
'default' until the post-import verification sweep ran. Fall back to the same
auto-detected type used by the sweep (classname mechanic + keyword + real flags)
so imports carry the correct interaction immediately; updates keep their
existing emulator handler types.

Also count cross-section id alignments under a separate normalizedIds field in
reconcileFurniDataWithItemsBase so fixedIds keeps its original meaning.
This commit is contained in:
openhands committed 2026-08-20 15:09:18 +02:00
1 parent b811086de6
commit 56bfa164a1
2 files changed
+18 -2

No files matched your search

+5 -2
View File
@@ -449,6 +449,8 @@ export interface FurniDataReconcileResult {
fixedIds: number;
/** Entries whose stale offerid was corrected to the DB id. */
fixedOfferIds: number;
/** Cross-section copies (same classname in both sections) whose stale id was aligned to their offerid. */
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. */
@@ -503,6 +505,7 @@ export async function reconcileFurniDataWithItemsBase(): Promise<FurniDataReconc
let fixedIds = 0;
let fixedOfferIds = 0;
let normalizedIds = 0;
let missing = 0;
let conflicts = 0;
@@ -550,13 +553,13 @@ export async function reconcileFurniDataWithItemsBase(): Promise<FurniDataReconc
if (offer <= 0 || Number(e.id) === offer) continue;
if (dbById.get(offer) !== e.classname) continue;
e.id = offer;
fixedIds++;
normalizedIds++;
}
}
if (fixedIds > 0 || fixedOfferIds > 0) {
await writeFurniData(furniData as Record<string, unknown>);
}
return { fixedIds, fixedOfferIds, missing, conflicts };
return { fixedIds, fixedOfferIds, normalizedIds, missing, conflicts };
});
}
+13
View File
@@ -908,6 +908,19 @@ export async function importSingleFurni(params: {
});
const interactionModesCount = autoInteraction.interactionModesCount;
// When the .nitro logicType produced no specific handler, fall back to the
// auto-detected type (classname mechanic + keyword + real flags) exactly
// like the post-import verification sweep, so newly imported items carry the
// correct interaction_type immediately instead of waiting for the sweep.
// Never applied to updates — existing emulator handler types must survive.
if (
!isUpdate &&
interactionType === "default" &&
autoInteraction.interactionType !== "default"
) {
interactionType = autoInteraction.interactionType;
}
// Update items_base with ALL enriched data
try {
const update = buildItemsBaseEnrichmentUpdate({