feat(scanner): add native artifact pipeline

Add native IK-style capture processing, Artifact Inventory, explicit promotion and single-result review. Confirm the three live OCR corrections in the eval corpus and preserve extraction/value separation.
This commit is contained in:
AzuTear
2026-07-09 23:30:42 +02:00
parent 28d60eb915
commit 639b0b7f59
92 changed files with 13606 additions and 1703 deletions
+11
View File
@@ -5,6 +5,7 @@ import {
isPlausibleSubstat,
isPlausibleSubstatValue,
parseSubstatEntry,
possibleSubstatRollCounts,
} from "./substatRolls";
describe("substatRolls parsing", () => {
@@ -16,6 +17,13 @@ describe("substatRolls parsing", () => {
});
describe("substatRolls plausibility", () => {
it("reports possible roll counts for artifact-level consistency checks", () => {
expect(possibleSubstatRollCounts("DEF%+11.7%")).toContain(2);
expect(possibleSubstatRollCounts("DEF%+31.7%")).toContain(6);
expect(possibleSubstatRollCounts("HP+1,165")).toContain(4);
expect(possibleSubstatRollCounts("CRIT Rate+2.3%", 5)).toEqual([]);
expect(possibleSubstatRollCounts("CRIT Rate+2.3%", 4)).toEqual([1]);
});
it("accepts real single-roll values (5-star)", () => {
expect(isPlausibleSubstatValue("CRIT DMG", 7.8)).toBe(true); // 7.77 high roll
expect(isPlausibleSubstatValue("CRIT DMG", 5.4)).toBe(true); // 5.44 low roll
@@ -28,6 +36,8 @@ describe("substatRolls plausibility", () => {
expect(isPlausibleSubstat("CRIT DMG+13.2%")).toBe(true); // 5.44+7.77 or 6.22+6.99
expect(isPlausibleSubstat("Elemental Mastery+68")).toBe(true);
expect(isPlausibleSubstat("Energy Recharge+11.7%")).toBe(true);
expect(isPlausibleSubstat("CRIT Rate+2.3%", 5)).toBe(false);
expect(isPlausibleSubstat("CRIT Rate+2.3%", 4)).toBe(true);
});
it("rejects values that fit no roll combination at either rarity (OCR misreads)", () => {
@@ -47,6 +57,7 @@ describe("substatRolls plausibility", () => {
it("collects the implausible entries from a substat list", () => {
const bad = implausibleSubstats(["CRIT DMG+13.2%", "CRIT DMG+8.1%", "ATK+19"]);
expect(bad).toEqual(["CRIT DMG+8.1%"]);
expect(implausibleSubstats(["CRIT Rate+2.3%"], 5)).toEqual(["CRIT Rate+2.3%"]);
});
});