fix(apple): preserve decoded keyed archive scalar identity

Move plist projection into the graph owner and identify generated scalar
wrappers by producer identity through every dictionary/UID consumer. Remove
the intermediate JSON clone that erased those facts. Literal wrapper-shaped
dictionaries remain dictionaries; scalar $top values fail as malformed.
Keep numeric projection after graph interpretation, preserve unknown counts,
and retain binary prototype-key partial facts with an explicit limitation.

Adapt @Jax367's relevant scalar proposal and public regression from PR #4317.
Add scalar-root, literal-root and binary prototype controls. Correct only
the captured Foundation data node expectation and its manifest digest;
original producer bytes and source are unchanged. Unrelated PR changes excluded.

Validation: 175 focused checks across 23 files pass, one skipped; build,
check:fast and docs:check pass. Public CLI and stdio MCP cover both encodings.
Baseline scalar controls fail; 24 tiny completed CLI cost comparisons retain
ordinary full replies and Evidence IDs byte for byte. No statistical speed
claim, heavy profiling, target execution or real deep-provider verification.

Fixes #4295
Fixes #4785
This commit is contained in:
morluto committed 2026-10-17 20:20:53 +08:00
1 parent 5d6029ea62
commit 2cf9c28f27
12 files changed
+431 -55

No files matched your search

+5 -10
View File
@@ -6,10 +6,7 @@ import {
AnalysisInputError,
AnalysisUnsupportedTargetError,
} from "../../domain/analysisErrorCore.js";
import {
projectPlistValue,
unknownDateLimitation,
} from "../../domain/apple/plistValue.js";
import { unknownDateLimitation } from "../../domain/apple/plistValue.js";
import { createPlistNumberProjection } from "../../domain/apple/plistNumbers.js";
import {
decodeBinaryPlistNumbers,
@@ -85,12 +82,10 @@ export const decodeKeyedArchiveBytes = (
: 0,
}
: parseXmlPropertyList(xmlText ?? "");
const {
value: plistValue,
unknownRealCount,
unknownDateCount,
} = projectPlistValue(parsed.value);
const graph = projectKeyedArchive(plistValue, selection);
const { unknownRealCount, unknownDateCount, ...graph } = projectKeyedArchive(
parsed.value,
selection,
);
const numbers = createPlistNumberProjection(
binary
? binaryNumberMetadata!.literals