fix: furniture interaction detection and automatic catalog offer_id rebuild

Interaction detection:
- Trust SWF-derived sit/lay/stand flags only when the logic XML actually
  contains action data (new hasActions metadata); otherwise fall back to
  keyword detection so custom furni without <action> nodes are still
  classified correctly
- Add French/Dutch/German/Spanish/Italian keywords (chaise, banquette,
  stoel, silla, sedia, stuhl, tafel, mesa, ...) to sit/lay/stand detection
  with token-boundary matching to avoid false positives like bedside_table
- Unify interaction_modes_count priority: mechanic fixed modes, then raw
  animation state count, then sit/lay fallback, then keyword default
- Detect mechanic type even when real flags are not used

Catalog integrity:
- Skip duplicate catalog_items inserts in clone and upload imports
- Re-check live catalog rows before applying generated repair SQL
- Add rebuildCatalogOfferIds() which rebuilds every catalog_items.offer_id
  from the local FurnitureData.json (matched by entry id, then classname)
  and run it after every import path (single, batch, batch-regen, clone)
This commit is contained in:
openhands committed 2026-08-21 13:39:21 +02:00
1 parent 652d331402
commit 4b7cb519df
14 files changed
+418 -58

No files matched your search

+39 -3
View File
@@ -30,16 +30,52 @@ describe("autoDetectInteraction with real data", () => {
expect(result.interactionType).toBe("bed");
});
it("respects all-false real flags (no keyword false positive)", () => {
it("respects curated all-false real flags (no keyword false positive)", () => {
const result = autoDetectInteraction("table_plasto_4leg", "Table", {
cansiton: false,
canlayon: false,
canstandon: false,
hasActionData: true,
});
expect(result.canSit).toBe(false);
expect(result.canLay).toBe(false);
expect(result.canStand).toBe(false);
expect(result.interactionModesCount).toBe(0);
});
it("falls back to keywords when flags carry no action data", () => {
const result = autoDetectInteraction("chaise_metal_lamarr", "Chaise", {
cansiton: false,
canlayon: false,
canstandon: false,
animationStates: 4,
});
expect(result.canSit).toBe(true);
expect(result.canStand).toBe(false);
expect(result.interactionModesCount).toBe(4);
});
it("detects French bench (banquette) with raw state count", () => {
const result = autoDetectInteraction("banquette_lamarr", "Banquette", {
cansiton: false,
canlayon: false,
canstandon: false,
animationStates: 6,
});
expect(result.canSit).toBe(true);
expect(result.interactionType).toBe("bench");
expect(result.interactionModesCount).toBe(6);
});
it("does not match short keywords without token boundaries", () => {
const result = autoDetectInteraction("bedside_table", "Bedside Table", {
cansiton: false,
canlayon: false,
canstandon: false,
});
expect(result.canSit).toBe(false);
expect(result.canLay).toBe(false);
expect(result.canStand).toBe(false);
expect(result.interactionModesCount).toBe(0);
expect(result.interactionType).toBe("table");
});
it("detects dice mechanics from classname with fixed modes=6", () => {