Repository navigation
feat(artifacts): add dry-run plan for artifact extraction #7177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
777b04a
47f478c
93c3ab3
74029e0
77f9884
545c4e3
20ae0c4
a0bf542
8f417b4
041f0ef
f2305a1
4c411c0
38a8e9d
e37d5ef
2f987e4
e29807d
8facdbb
0ffad06
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
…shot in dry-run
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -379,6 +379,7 @@ const materializeSelection = async ({ | |
| zipSource !== undefined || reader.prepareContainer !== undefined; | ||
| unresolvedPlan = await planSelectedEntries({ | ||
| reader, | ||
| inventory, | ||
| outputRoot: resolvedOutputRoot, | ||
| platform, | ||
| caseSensitivity: destinationCaseSensitivity, | ||
|
|
@@ -535,6 +536,7 @@ const verifyPlannedEntry = async ( | |
|
|
||
| const planSelectedEntries = async ({ | ||
| reader, | ||
| inventory, | ||
| outputRoot, | ||
| platform, | ||
| caseSensitivity, | ||
|
|
@@ -545,6 +547,7 @@ const planSelectedEntries = async ({ | |
| signal, | ||
| }: { | ||
| readonly reader: ArtifactReader; | ||
| readonly inventory: ArtifactInventorySnapshot; | ||
| readonly outputRoot: string; | ||
| readonly platform: NodeJS.Platform; | ||
| readonly caseSensitivity: DestinationCaseSensitivity; | ||
|
|
@@ -562,10 +565,31 @@ const planSelectedEntries = async ({ | |
| readonly selectedItem: SelectedOccurrence; | ||
| readonly destinationPath: string; | ||
| }[] = []; | ||
| const inventoriedNonFile = new Map( | ||
| inventory.occurrences | ||
| .filter( | ||
| (occurrence) => | ||
| occurrence.logical_path !== "." && | ||
| (occurrence.entry_kind === "directory" || | ||
| occurrence.entry_kind === "symlink" || | ||
| occurrence.entry_kind === "metadata"), | ||
| ) | ||
| .map((occurrence) => [occurrence.logical_path, occurrence] as const), | ||
|
greptile-apps[bot] marked this conversation as resolved.
Resolved
|
||
| ); | ||
| const observedNonFile = new Set<string>(); | ||
| const nonFileMismatches: string[] = []; | ||
| for await (const entry of reader.entries(signal, traversal)) { | ||
| const path = normalizeArtifactPath(entry.path); | ||
| readerRegistry.add(path, entry.kind); | ||
| if (entry.kind !== "file" && entry.kind !== "slice") continue; | ||
| if (entry.kind !== "file" && entry.kind !== "slice") { | ||
| observedNonFile.add(path); | ||
| if (!inventoriedNonFile.has(path)) { | ||
|
greptile-apps[bot] marked this conversation as resolved.
Resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When an empty directory source entry is replaced by a symlink at the same path between inventory and the dry-run traversal, this path-only AGENTS.md reference: AGENTS.md:L50-L52 Useful? React with 👍 / 👎. |
||
| nonFileMismatches.push( | ||
| `Newly observed ${entry.kind} entry ${path} is not in the inventory snapshot.`, | ||
| ); | ||
| } | ||
| continue; | ||
| } | ||
| const selectedItem = byPath.get(path); | ||
| if (selectedItem === undefined) { | ||
| throw new ArtifactReaderFailure( | ||
|
|
@@ -608,6 +632,13 @@ const planSelectedEntries = async ({ | |
| "integrity", | ||
| `Inventoried regular artifact entries were not materialized: ${[...byPath.keys()].sort(compareUnicodeCodePoints).join(", ")}`, | ||
| ); | ||
| for (const [path, occurrence] of inventoriedNonFile) { | ||
| if (!observedNonFile.has(path)) { | ||
| nonFileMismatches.push( | ||
| `Inventoried ${occurrence.entry_kind} entry ${path} was not observed by the live reader.`, | ||
| ); | ||
| } | ||
| } | ||
| const unresolvedByOccurrenceId = new Map<string, string>(); | ||
| const limitations: string[] = []; | ||
| let hasCaseLimitation = false; | ||
|
|
@@ -661,6 +692,12 @@ const planSelectedEntries = async ({ | |
| ? "Destination directory case sensitivity is unknown because the destination parent has no observable cased entry; case-colliding paths remain unresolved in the dry-run plan." | ||
| : "Non-ASCII case-folding paths depend on the destination filesystem case table and cannot be verified without creating files; affected paths remain unresolved in the dry-run plan.", | ||
| ); | ||
| if (nonFileMismatches.length > 0) { | ||
| limitations.push( | ||
| ...nonFileMismatches, | ||
| "Non-file inventory entries were not fully reconciled with the live reader; affected directory, symlink, and metadata facts remain unresolved.", | ||
| ); | ||
| } | ||
| return { byOccurrenceId: unresolvedByOccurrenceId, limitations }; | ||
| }; | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When inventory expansion found a directory or metadata occurrence inside a nested ASAR/ZIP, this map includes it even though the active reader deliberately stops at the containing regular file. A stable second traversal can therefore never add that nested path to
observedNonFile, and the result falsely reports that the entry disappeared and that non-file facts were not reconciled; restrict expected non-files to occurrences exposed by the active reader's ancestry.AGENTS.md reference: AGENTS.md:L19-L19
Useful? React with 👍 / 👎.