Repository navigation
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bb9c156adc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| input.startsWith("/") || | ||
| DRIVE_OR_UNC.test(input) | ||
| ) | ||
| if (input.includes("\0") || input.startsWith("/") || DRIVE_PREFIX.test(input)) |
There was a problem hiding this comment.
Preserve Windows rejection in host-path consumers
On Windows, a crafted web-export manifest can now put ..\secret.js in content.relative_path: LocalWebScriptArtifacts.#load treats this function's success as path validation and passes the result to native join(root, "files", portable) (src/browser/assets/LocalWebScriptArtifacts.ts:81-91). Windows join resolves that spelling to root\secret.js, and assertContained checks only root, so the loader opens a sibling of files (and can return it when the manifest supplies its digest) instead of rejecting traversal. Add a Windows host-path check to this consumer and any other native-path consumer rather than relying on the newly logical-only normalizer.
AGENTS.md reference: AGENTS.md:L25-L25
Useful? React with 👍 / 👎.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
1 open finding
What changed in this PR
Fixes artifact inventory + extraction behavior so that literal backslashes in POSIX filenames are preserved as part of the logical name, while Windows materialization refuses those names at the destination boundary.
Changes:
- Allow backslashes in logical artifact paths by treating logical paths as slash-separated only (backslash is a literal character) in shared normalization + schema.
- Add Windows-specific rejections when materializing outputs / selecting sources (instead of rejecting during shared admission).
- Add boundary tests covering POSIX preservation and Windows refusal behavior.
| File | Description |
|---|---|
| tests/boundary/filesystem/webScriptManifestPaths.test.ts | Adds regression coverage for literal-backslash script paths (POSIX) and Windows-admission refusal messaging. |
| tests/boundary/filesystem/artifactLiteralBackslash.test.ts | New end-to-end tests for inventory + extraction preserving literal backslashes on POSIX, and Windows SafeOutputTree refusal/rollback. |
| src/domain/artifactGraph.ts | Relaxes result schema to allow backslashes in bounded relative paths. |
| src/browser/assets/LocalWebScriptArtifacts.ts | Adds Windows-only guard rejecting backslashes in selected source paths. |
| src/artifacts/SafeOutputTree.ts | Moves backslash-as-separator rejection to Windows destination normalization. |
| src/artifacts/ArtifactPaths.ts | Updates shared logical-path normalization to stop rejecting backslashes and to keep rejecting absolute/drive-prefixed paths. |
🧠 Review effort: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| extractArtifact({ | ||
| inputPath: input, | ||
| inputFormat: "asar", | ||
| outputRoot: output, | ||
| environment: {}, | ||
| integrityPolicy: "fail", | ||
| resourceScope, | ||
| }), |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 405ffc2767
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| input.startsWith("/") || | ||
| DRIVE_OR_UNC.test(input) | ||
| ) | ||
| if (input.includes("\0") || input.startsWith("/") || DRIVE_PREFIX.test(input)) |
There was a problem hiding this comment.
Admit literal backslashes in JavaScript graph paths
When a POSIX directory or ASAR contains a relevant source such as literal\name.js, the new shared admission lets readJavaScriptArtifactFiles retain it, and createFileTarget passes file.path into artifactObservationEvidence (src/application/javascript/JavaScriptArtifactGraphStructure.ts:408-413). The application graph's relativePathSchema still rejects every backslash (src/domain/javascript/javascriptApplicationEvidenceSchemas.ts:8-17), so createJavaScriptApplicationNode throws at runtime and analyze_javascript_application cannot process the same artifact that inventory/extraction now accept. Update the downstream artifact/semantic graph path contracts while keeping module/URL reference syntax checks separate.
AGENTS.md reference: AGENTS.md:L25-L25
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 782665630c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| input.startsWith("/") || | ||
| DRIVE_OR_UNC.test(input) | ||
| ) | ||
| if (input.includes("\0") || input.startsWith("/") || DRIVE_PREFIX.test(input)) |
There was a problem hiding this comment.
Preserve artifact bases during reference resolution
On POSIX, when an admitted artifact contains literal\dir/main.js importing ./dep.js, relativeCandidate preserves the literal component and produces literal\dir/dep.js, but confineCandidate in JavaScriptArtifactPathResolution.ts still calls normalizeJoinedLogicalPath, which rewrites that base to literal/dir/dep.js. The import is therefore left unresolved or, if both layouts exist, linked to the wrong slash-named file; preserve the owner-produced artifact base and apply separator normalization only to the declaration.
AGENTS.md reference: AGENTS.md:L23-L23
Useful? React with 👍 / 👎.
| const relativeLogicalPath = (value: string): string | null => { | ||
| const normalized = normalizeJoinedLogicalPath(value); | ||
| // These are artifact names or already parsed runtime paths, not declarations. | ||
| const normalized = logicalPathNfc(posix.normalize(value)); |
There was a problem hiding this comment.
Normalize raw declarations before runtime matching
For a Windows application with a static declaration such as loadFile("dist\\index.html"), nodePaths includes the raw declared_path, while runtime file-root mapping converts the observed native path to dist/index.html. Replacing the old reference normalizer here now indexes the declaration as literal dist\index.html, so an otherwise valid renderer location becomes unmatched; distinguish raw declarations using their resolution context from owned artifact paths instead of treating every value as already parsed.
AGENTS.md reference: AGENTS.md:L29-L29
Useful? React with 👍 / 👎.
| const unsafePathSegments = new Set(["", ".", ".."]); | ||
| const isSafeRelativePath = (path: string): boolean => { | ||
| if (path.startsWith("/") || path.includes("\\")) return false; | ||
| if (path.startsWith("/")) return false; |
There was a problem hiding this comment.
Admit literal backslashes in runtime artifact prefixes
When a valid static graph path is literal\dir/app.js and a deployed runtime root must map to that subdirectory, the caller needs artifact_prefix: "literal\\dir"; however, reconcileJavaScriptRuntimeInputSchema still rejects every backslash in safePrefixSchema before this new logical-path handling runs. This leaves runtime reconciliation unable to address newly admitted artifact subtrees, so the artifact-prefix contract should use the same slash-separated logical-name semantics.
AGENTS.md reference: AGENTS.md:L25-L25
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3e75ad47bb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| .map((path) => | ||
| relativeLogicalPath(windows ? path.replaceAll("\\", "/") : path), | ||
| ) |
There was a problem hiding this comment.
Anchor native declarations to their owning module
When a filesystem expression comes from a nested source (for example, sub/main.cjs declares loadFile("dist\\index.html")), this normalizes only the raw declaration, so the native index contains dist\index.html for POSIX or dist/index.html for Windows, while mappedRuntimePaths produces sub/dist... for the observed target; the new lookup therefore reports the renderer as unmatched, and Windows declarations such as ..\index.html that are valid relative to a nested owner are discarded as root escapes. Anchor each format-specific declaration to its observation's owning artifact directory before indexing it. The fresh case beyond the existing root-level raw-declaration review is that the added regression keeps main.cjs at the artifact root and therefore never exercises this missing base.
AGENTS.md reference: AGENTS.md:L19-L19
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7b74f88d31
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ...(mapping.fileStyle === null | ||
| ? [] | ||
| : (index.byNativeDeclarationPath.get( | ||
| `${mapping.fileStyle}\0${layerCategoryPathKey(layer.layerId, entity.staticKind, mapping.path)}`, |
There was a problem hiding this comment.
Apply artifact prefixes to raw loadFile declarations
When a file-root mapping uses a non-empty artifact_prefix (for example, runtime root /deployed mapped to app) and a renderer is discovered from raw loadFile("dist/index.html"), mappedRuntimePaths produces app/dist/index.html, but nativeDeclarationPaths indexes only dist/index.html and this lookup uses the prefixed mapping.path verbatim. The renderer is therefore reported unmatched even when /deployed/dist/index.html is exactly the declared target; compare native declarations to the mapping suffix or apply the mapping's prefix consistently. Beyond the existing nested-owner thread, the non-empty operator prefix is fresh evidence because the added prefix regression covers only JavaScript assets, not renderer declarations.
AGENTS.md reference: AGENTS.md:L19-L19
Useful? React with 👍 / 👎.
| format === "artifact" | ||
| ? withoutQuery | ||
| : withoutQuery.replace(SCHEME_URL_PREFIX, "").replaceAll("\\", "/"); |
There was a problem hiding this comment.
Admit literal names in historical source graphs
When a POSIX reference tree contains a source such as literal\name.js, pathFromRoot preserves that spelling, but referenceSourceGraph.ts still rejects every backslash in its entry-path schema, so import_reference_source returns a parse failure before this newly format-aware comparison can run. This leaves the current artifact side able to retain the filename while the exact caller-selected historical filename cannot be compared; update the historical entry-path contract while keeping import-specifier syntax separate.
AGENTS.md reference: AGENTS.md:L13-L13
Useful? React with 👍 / 👎.
Normalize path facts once at the owning filesystem boundary, preserve caller spelling and unavailable inventory members, and retain typed read failures. Record exclusion entry kinds so only proven directories can establish descendant symlink targets; omitted legacy kinds stay unknown. Reviewed fixes include #1969, #2642, #2759, and #2994. Validation: 26 reference graph source tests passed; prior artifact checks passed 275 tests with one Windows-only skip. Updated compiled import workflows are included in final validation after regeneration.
|
CI-fix track: this change is already on main via ec27112, which lists #2994 among its reviewed fixes. After merging current main, 22 of the 23 files match main exactly. The one conflict, |
|
Thanks for incorporating the fixes into main. This PR appears fully covered now, and #2992 and #3000 have been narrowed to the remaining regression tests. Could you review and merge those tests if they look good, and close out this PR as already covered, or let me know if anything else is needed? I'm keeping at most three PRs open at a time, so I need to get this batch resolved before opening the next one. |

Summary
Fixes #2619. Preserve supported POSIX filenames containing literal backslashes through inventory, extraction, JavaScript graphs, runtime mapping, and historical reference import.
Problem and expected behavior
Directory and ASAR readers return a member such as
literal\name.jsintact, but shared path admission rejects the inventory. Downstream graph validators also reject that spelling, while several graph consumers reinterpret it asliteral/name.js, causing false location matches or source-map paths. A recorded artifact name must retain the reader's identity.Change and scope
Keep slash-separated logical names in the shared normalizer and inventory/application/semantic result validators. Refuse backslash interpretation at Windows output and saved-source read boundaries before host joins.
Artifact joins preserve an inventoried importer base, so a valid relative import resolves to its literal directory rather than a slash-named decoy. Runtime matching preserves owned artifact facts and POSIX paths. Raw
loadFiledeclarations use application-root semantics and the captured native file format; their source-relative static inference is not promoted to an owned runtime target. Genuine resolved artifact facts suppress competing raw aliases. Runtime mappings accept safe logical backslash prefixes without decoding them. Native declaration lookup retains the mapped file-root suffix and uses source provenance only to constrain the selected application prefix; overlapping mapping interpretations remain uncertain. Source comparison uses resolved artifact facts instead of reinterpreting their raw declarations. Explicitscheme://observation metadata keeps URL query/fragment handling, while canonical and resolved artifact identities remain exact. Source-map resolution preserves its exact artifact base and checks encoded separators in the parsed declaration pathname, keeping Windows, URL authority, and query semantics separate.The runtime view leaves the existing static source-relative
loadFileinference in the supplied graph and does not treat that derivation as owning target identity. This corrects existing inventory/reconstruction workflows; no separate maintainer scope decision is applicable. Historical entry and observed symlink-target validation accepts literal backslashes while retaining NUL, traversal, absolute-target, and membership checks. Internal symlink classification first verifies the exact or uniquely Unicode-equivalent relative inventory target, so an inventoried POSIX name resembling a Windows UNC path remains internal; unproven Windows external targets retain their existing classification. The reader already preserves these names; CLI failures on original base729ca2ab6prove this is a pre-existing contract gap. Raw import-specifier parsing, module/URL admission, and symlink authority/IO remain unchanged.Contract and boundary impact
bundle.jssnapshot naming is preserved.Expected effects:
Evidence and regression coverage
Red regressions establish each affected boundary:
729ca2ab6: directory and packed-ASAR inventory reject supported literal names withArtifactReaderFailurereasonpath.loadFiledeclaration fails to match; suppressing its raw declaration in favor of a source-relative inference also drops a legitimate application-root match from a nested module (compared against exact earlier head7826656).729ca2ab6. After admission, a real internal symlink to a UNC-looking POSIX filename fails target-state validation.../outside.jstraversal; a positive inventory control keeps literal and slash names distinct.Controls cover embedded/leading/doubled/nested backslashes, ordinary names, distinct slash paths, verified digests, extraction readback, cleanup, containment/collisions, recorded Windows roots, URL prefixes, UNC/source-map declarations, encoded URI authority data, and Windows native literal percent sequences, application-prefix isolation, overlapping mapping ambiguity, Unicode prefix equivalence, historical exact digests, input bytes unchanged, and observed symlink targets.
Built public CLI inspection/extraction and CLI/pinned-SDK MCP application analysis preserve
literal\name.js; extraction readback matches, input bytes remain unchanged, and MCP ping succeeds afterward. Fresh independent agent review of the final diff found no remaining issue; remote CI and PR automatic review remain separate checks.Validation performed
npm run build:cached,npm run typecheck,npm run knip, module-boundary and architecture guards: passed.npm run verify:test-discovery: all 1,124 files discovered exactly once.git diff --check: passed.npm run check: unchanged baseline lint error insrc/dotnet/ManagedCilDecoding.test.ts:248(162 function lines, maximum 150), reproduced on clean base.npm run docs:check: unchanged Turkish README link drift, independently reproduced with prepared prerequisites on clean base.HUSKY=0, without hook/global configuration changes.macOS, Node 24.18.0/npm 11.16.0. Windows destination checks use the writer's explicit platform parameter; saved-source tests simulate Windows admission. Recorded Windows/runtime fixtures verify interpretation, not native Windows IO or live Electron behavior. Real Hopper/Ghidra were not run. The pinned Wakaru binary was not run locally; its audited source explicitly folds multi-input public names and importer bases from backslashes to slashes. The local snapshot refusal preserves the existing prelaunch contract without claiming engine support. No performance claim is made. OpenAI Codex prepared the implementation and automated verification; no human-authored implementation or human review is claimed.
Latest-head CI evidence
Head
aadbe63d0c1c77fccfad1643453f1f4a0e28d85b: the final local related suite passed 915 tests with 47 explicit platform skips (82 files passed / three skipped). CI run 38478453214 completed with failing required checks; build, static checks, docs and the Windows lane passed. Real Linux recovery verified 12 CLI/MCP fixtures with Wakaru 1.14.0; this did not exercise a literal-backslash engine input. The real source-map lane also passed.The executed merge was
8c0702e90f70a8aa13d24d1176b30d5dc8905f8dinto basecd740a6764d24e466f31613c2cef3368c3f64cba. The remaining test failures have clean-base controls:ProviderAdapterError. Reproduced after locked installation on clean4d98123279c5a6f5442c458307f5a3ec678fd49e, mirroring the source CI job's no-dist layout. The test, worker, workflow and package/config inputs are identical at the current base; the baseline comparison is public.cd740a6withGITHUB_STEP_SUMMARYdirected to a temporary file: the unchanged report script writes the summary instead of stdout. One selected test failed; seven others were unselected, not platform skips.The partial aggregate contains 7,974 passed / two failed / 30 skipped. Four sibling shards were cancelled by fail-fast and are absent from that report, so it is not complete all-green coverage. Required checks remain failing pending these upstream corrections.
Before merge