mirror of
https://github.com/morluto/rea.git
synced 2026-11-03 05:16:16 +00:00
Retain producer traversal uncertainty through inventory, extraction, Interface Builder decoding and executable-root discovery. Keep known copied files and decoded facts with honest coverage; share omission normalization and bound omitted archive paths with their source reasons. Fixes #6852 Fixes #6825 Fixes #6582
35 lines
1.2 KiB
TypeScript
35 lines
1.2 KiB
TypeScript
import { compareUnicodeCodePoints } from "../domain/unicodeCodePointOrder.js";
|
|
import { normalizeArtifactPath } from "./ArtifactPaths.js";
|
|
import type {
|
|
ArtifactReaderTraversal,
|
|
ArtifactTraversalOmission,
|
|
ArtifactTraversalOptions,
|
|
} from "./ArtifactReader.js";
|
|
|
|
/** Retain producer coverage and omissions across one or more exhausted traversals. */
|
|
export class ArtifactTraversalObservation implements ArtifactTraversalOptions {
|
|
readonly #limitations = new Set<string>();
|
|
#unknown = false;
|
|
|
|
readonly onCoverage = (coverage: ArtifactReaderTraversal): void => {
|
|
this.#unknown ||= coverage.status === "unknown";
|
|
for (const limitation of coverage.limitations)
|
|
this.#limitations.add(limitation);
|
|
};
|
|
|
|
readonly onOmission = (omission: ArtifactTraversalOmission): void => {
|
|
const path = normalizeArtifactPath(omission.path);
|
|
this.#unknown = true;
|
|
this.#limitations.add(
|
|
`Artifact traversal omitted ${omission.kind} at ${JSON.stringify(path)}.`,
|
|
);
|
|
};
|
|
|
|
snapshot(): ArtifactReaderTraversal {
|
|
return {
|
|
status: this.#unknown ? "unknown" : "complete",
|
|
limitations: [...this.#limitations].sort(compareUnicodeCodePoints),
|
|
};
|
|
}
|
|
}
|