From 25be8df73d7bf97fb9621f1092674b10b83f3236 Mon Sep 17 00:00:00 2001 From: Nate Date: Wed, 14 Oct 2026 01:23:31 -0400 Subject: [PATCH] Fix source ledgers for cache-aware inventories --- electron/source-ledger.cjs | 1 + tests/installed-inventory.test.mjs | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/electron/source-ledger.cjs b/electron/source-ledger.cjs index 25ba346..e7249bf 100644 --- a/electron/source-ledger.cjs +++ b/electron/source-ledger.cjs @@ -213,6 +213,7 @@ async function buildSourceLedger(inventory, downloadRoots, options = {}) { 'credential-or-browser-state', 'cache-log-or-backup-directory', 'runtime-log-or-cache', + 'regenerable-python-bytecode', 'mod-directory-inventoried-separately', 'profiles-inventoried-separately', 'overwrite-inventoried-separately', diff --git a/tests/installed-inventory.test.mjs b/tests/installed-inventory.test.mjs index 6155e2c..06f8b72 100644 --- a/tests/installed-inventory.test.mjs +++ b/tests/installed-inventory.test.mjs @@ -7,6 +7,8 @@ import crypto from 'node:crypto'; import { createRequire } from 'node:module'; const require = createRequire(import.meta.url); const { inspectMo2 } = require('../electron/installed-inventory.cjs'); +const { buildSourceLedger } = require('../electron/source-ledger.cjs'); +const { mapArchiveSources } = require('../electron/archive-mapping.cjs'); function fixture() { const root = fs.mkdtempSync(path.join(os.tmpdir(), 'loadstone-inventory-')); for (const dir of [ @@ -352,6 +354,20 @@ test('instance inventory excludes regenerable Python plugin caches while retaini `fixture: ${file}`, ); } + const ledger = await buildSourceLedger(report, []); + assert.deepEqual(ledger.installation, report.installation); + assert.deepEqual(ledger.exclusions, report.exclusions); + const mapped = await mapArchiveSources(ledger); + assert.deepEqual(mapped.installation, report.installation); + assert.deepEqual(mapped.exclusions, report.exclusions); + assert.equal(mapped.installable, false); + assert.equal(mapped.publicationApproved, false); + const unsupported = structuredClone(report); + unsupported.exclusions[0].reason = 'unknown-exclusion'; + await assert.rejects( + buildSourceLedger(unsupported, []), + /Invalid inventory exclusion record/, + ); await assert.rejects( inspectMo2(f.root, { hashFiles: true,