Handle references into inactive modules

This commit is contained in:
2026-04-21 14:00:37 +00:00
parent 6d8f7a0559
commit 7d574f7c1b
12 changed files with 125 additions and 11 deletions

View File

@@ -0,0 +1,40 @@
import assert from "node:assert/strict";
import { buildFindings, createFileRecord } from "../scripts/core/finding-engine.js";
import { createFileLocator } from "../scripts/core/path-utils.js";
const files = [
createFileRecord(createFileLocator("data", "modules/example-module/icons/token.webp"), 1234)
];
const references = [
{
sourceType: "world-document",
sourceScope: { ownerType: "world", ownerId: "demo-world", systemId: "demo-system", subtype: "actors" },
sourceLabel: "Actor demo",
normalized: {
...createFileLocator("data", "modules/example-module/icons/token.webp"),
targetKind: "local-file"
}
}
];
const packageActivity = {
modules: new Map([["example-module", false]]),
moduleLabels: new Map([["example-module", "Example Module"]])
};
const result = buildFindings({ files, references, packageActivity, i18n: { format: (key, data={}) => `${key}:${data.modules ?? ""}` } });
assert.equal(
result.findings.some(finding => finding.kind === "non-package-to-package-reference"),
false,
"world references into inactive modules should not be reported as unanchored package targets"
);
assert.equal(
result.notices.some(notice => notice.kind === "inactive-module-references" && notice.moduleIds.includes("example-module")),
true,
"inactive module references should create a report notice"
);
console.log("inactive-module-reference-test: ok");