Integrate the numeric precision correction from #1135 with complete supplemental metadata handling. Keep decoded numbers with an explicit limitation for mixed XML content or unclassified integer text, rather than assigning another literal's exact decimal. Project nonnumeric UID and CF$UID dictionary values recursively while preserving numeric references, graph identity and original byte digests. Add filesystem, built CLI and MCP regressions for the review findings, adjacent XML representations and numeric reference controls. Retain the original native Foundation qualification fixtures and verifier. Verification: 84 focused tests; npm run check; npm run docs:check; npm run verify:test-discovery; npm run verify:keyed-archive (real Foundation, CLI and stdio MCP). No real Hopper or Ghidra verification was needed or run. Co-authored-by: Rudy Mizrahi Celekli <47457359+rudycelekli@users.noreply.github.com> Signed-off-by: morluto <76467478+morluto@users.noreply.github.com>
62 lines
2.2 KiB
TypeScript
62 lines
2.2 KiB
TypeScript
import { describe, it, expect } from "vitest";
|
|
import { inspectBundleKeyedArchive } from "../../../src/artifacts/apple/KeyedArchiveReader.js";
|
|
import { keyedArchiveResultSchema } from "../../../src/domain/apple/keyedArchive.js";
|
|
import { parseEvidence } from "../../../src/domain/evidence.js";
|
|
import {
|
|
keyedArchiveIntegerFormats,
|
|
keyedArchiveIntegerCases,
|
|
keyedArchiveIntegerFixture,
|
|
expectKeyedArchiveIntegerCase,
|
|
} from "../../fixtures/keyedArchiveIntegers.js";
|
|
import { cliTest } from "../../support/cli/cliFixture.js";
|
|
|
|
const cases = keyedArchiveIntegerFormats.flatMap((format) =>
|
|
keyedArchiveIntegerCases.map((selectedCase) => ({ format, selectedCase })),
|
|
);
|
|
// Selected by the existing required native keyed-archive verifier, not Linux skips.
|
|
describe.skipIf(process.platform !== "darwin")(
|
|
"Foundation archive integer precision",
|
|
() => {
|
|
it.each(cases)(
|
|
"filesystem preserves $format $selectedCase numeric meaning",
|
|
async ({ format, selectedCase }) => {
|
|
const fixture = await keyedArchiveIntegerFixture(format);
|
|
const result = await inspectBundleKeyedArchive({
|
|
bundlePath: fixture.root,
|
|
targetSha256: fixture.digest,
|
|
parameters: { path: fixture.selected.filename, limit: 100 },
|
|
});
|
|
expectKeyedArchiveIntegerCase(
|
|
result,
|
|
selectedCase,
|
|
fixture.selected,
|
|
fixture.digest,
|
|
);
|
|
},
|
|
);
|
|
cliTest.for(cases)(
|
|
"built CLI preserves $format $selectedCase numeric meaning",
|
|
async ({ format, selectedCase }, { cli }) => {
|
|
const fixture = await keyedArchiveIntegerFixture(format);
|
|
const output = await cli.run({
|
|
arguments: ["inspect-keyed-archive", fixture.archivePath, "--json"],
|
|
environment: {
|
|
REA_LOG_LEVEL: "silent",
|
|
REA_ANALYSIS_PROVIDER: "auto",
|
|
},
|
|
});
|
|
expect(output.exitCode).toBe(0);
|
|
const result = keyedArchiveResultSchema.parse(
|
|
parseEvidence(output.json).normalized_result,
|
|
);
|
|
expectKeyedArchiveIntegerCase(
|
|
result,
|
|
selectedCase,
|
|
fixture.selected,
|
|
fixture.digest,
|
|
);
|
|
},
|
|
);
|
|
},
|
|
);
|