[PR #810] [MERGED] fix(javascript): project decoded file URL paths #2257

Closed
opened 2026-10-16 21:16:22 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/810
Author: @rudycelekli
Created: 10/6/2026
Status: ✅ Merged
Merged: 10/7/2026
Merged by: @N0zoM1z0

Base: main ← Head: fix/file-url-path-projection-20261006


📝 Commits (2)

  • 63ad3c9 fix(javascript): project decoded file URL paths
  • 2ff18c7 fix: preserve explicit source-relative URL observation spelling

📊 Changes

2 files changed (+150 additions, -2 deletions)

View changed files

➕ src/application/JavaScriptFileUrlPaths.test.ts (+95 -0)
📝 src/domain/javascriptStaticAnalysisHelpers.ts (+55 -2)

📄 Description

Summary

Preserve the filesystem path produced by a known fileURLToPath(new URL(..., import.meta.url)) expression when discovering Electron entrypoints.

Problem and expected behavior

For fileURLToPath(new URL("./preload%20name.cjs", import.meta.url)), Node reads preload name.cjs. Static application analysis instead resolves an inventoried preload%20name.cjs decoy. A query or fragment in the URL likewise remains in the inferred filesystem path even though Node discards it.

This is a focused correction to an existing recognized expression; no separate issue was filed.

Change and scope

Decode known literal file URLs with Node's URL/file-path conversion and project their paths relative to an inert source-directory anchor. Preserve parent segments without consulting the host cwd. Keep dynamic, malformed, encoded dot/separator, remote and source-filename-only forms unknown. Plain filesystem strings retain their literal percent, question-mark and hash characters.

Recognition retains the existing syntactic callee-name heuristic; this does not add binding analysis or resolve shadowed functions. Similarly named convertFileURLToPath is not recognized. Target JavaScript is not executed by analysis.

Contract and boundary impact

  • Semantic owner and earliest changed stage: inert static path projection, before artifact-confined entrypoint resolution.
  • CLI and MCP/tool-catalog contract: unchanged request/result schema.
  • Provider, bridge, target-format, or platform compatibility: canonical POSIX artifact paths, using Node's explicit windows: false conversion; no Windows filesystem execution claim.
  • Evidence, artifact, provenance, or reconstruction contract: derived entrypoint paths now match the recognized conversion; artifact identities and inference authority remain unchanged.
  • Process execution, authorization, cleanup, or containment impact: none; existing path admission remains in place.
  • Generated metadata (docs/product-catalog.json), package, or installation impact: none.

Evidence and regression coverage

  • Tests added or updated: public application analysis with real owned files and Node read/URL oracles, encoded space/Unicode/punctuation, query/fragment, parent-directory and ordinary controls; unsupported/dynamic syntax and literal filesystem punctuation controls.

  • Base reproduction or other evidence: new regressions on base 472b72a produce 13 failures / 6 passing controls. Separate native Node/public application caller resolves the encoded-name decoy and misses the query-bearing URL; ordinary control succeeds. Afterward all four native caller cases, including plain filesystem punctuation, resolve the actual files.

  • User-visible CLI/MCP output: the encoded-space preload observation changes resolved_path: "preload%20name.cjs" to resolved_path: "preload name.cjs"; the query-bearing URL resolves preload.cjs.

  • Remaining proof gaps: no actual Electron process, target bootstrap execution, scope binding resolution or Windows runtime matrix was used.

  • Observed, derived, and inferred claims remain distinguishable.

  • Artifact identity, source provenance, and failed attempts remain preserved.

  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

  • node node_modules/vitest/vitest.mjs run src/application/JavaScriptFileUrlPaths.test.ts src/domain/javascriptStaticPathResolution.test.ts src/application/JavaScriptApplicationService.test.ts — 82 passed.
  • npm run check — all five tasks passed; 129 existing lint warnings, zero errors.
  • npm run check:fast — both tasks passed.
  • npm run build — passed.
  • Owned native Node24.18.0/public application caller — four cases passed; temporary files removed.

Compatibility, safety, and release

  • Breaking changes or migration steps: none; corrections to derived path observations.
  • Real Hopper/Ghidra, browser, or OS coverage: native Node24 on macOS; none required for the unchanged browser/bridge providers.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: no authorization or filesystem publication changes; no encoded separator/dot admission expansion.

Review checklist

  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed; none changes here.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

AI assistance was used for investigation, implementation and test preparation. I reviewed the change and ran the reported native checks.

Hosted regression correction

Hosted shard 1 caught an existing inert-extraction assertion: the original patch decoded the target correctly but changed the explicit ./preload.mjs observation spelling to preload.mjs. Signed amendment 2ff18c7b905cb01a444e587582b58ce9ee4e7743 preserves that established spelling after decoding. The existing assertion is unchanged.

The actual failing suite reproduced locally (1 failure / 27 passes); afterward all 110 related tests pass, including the original suite and parent-directory / normalized-path URL controls. Exact-head check (5 tasks), check:fast (2 tasks), build, and all four native Node/public application caller cases pass. Lint retains 129 existing warnings and zero errors. The failed coverage job was downstream of the failing shard. Hosted checks on the amended head are pending; no full matrix success is claimed.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/810 **Author:** [@rudycelekli](https://github.com/rudycelekli) **Created:** 10/6/2026 **Status:** ✅ Merged **Merged:** 10/7/2026 **Merged by:** [@N0zoM1z0](https://github.com/N0zoM1z0) **Base:** `main` ← **Head:** `fix/file-url-path-projection-20261006` --- ### 📝 Commits (2) - [`63ad3c9`](https://github.com/morluto/rea/commit/63ad3c90390a6c9854012a4f70431ac4d03bd427) fix(javascript): project decoded file URL paths - [`2ff18c7`](https://github.com/morluto/rea/commit/2ff18c7b905cb01a444e587582b58ce9ee4e7743) fix: preserve explicit source-relative URL observation spelling ### 📊 Changes **2 files changed** (+150 additions, -2 deletions) <details> <summary>View changed files</summary> ➕ `src/application/JavaScriptFileUrlPaths.test.ts` (+95 -0) 📝 `src/domain/javascriptStaticAnalysisHelpers.ts` (+55 -2) </details> ### 📄 Description ## Summary Preserve the filesystem path produced by a known `fileURLToPath(new URL(..., import.meta.url))` expression when discovering Electron entrypoints. ## Problem and expected behavior For `fileURLToPath(new URL("./preload%20name.cjs", import.meta.url))`, Node reads `preload name.cjs`. Static application analysis instead resolves an inventoried `preload%20name.cjs` decoy. A query or fragment in the URL likewise remains in the inferred filesystem path even though Node discards it. This is a focused correction to an existing recognized expression; no separate issue was filed. ## Change and scope Decode known literal file URLs with Node's URL/file-path conversion and project their paths relative to an inert source-directory anchor. Preserve parent segments without consulting the host cwd. Keep dynamic, malformed, encoded dot/separator, remote and source-filename-only forms unknown. Plain filesystem strings retain their literal percent, question-mark and hash characters. Recognition retains the existing syntactic callee-name heuristic; this does not add binding analysis or resolve shadowed functions. Similarly named `convertFileURLToPath` is not recognized. Target JavaScript is not executed by analysis. ## Contract and boundary impact - Semantic owner and earliest changed stage: inert static path projection, before artifact-confined entrypoint resolution. - CLI and MCP/tool-catalog contract: unchanged request/result schema. - Provider, bridge, target-format, or platform compatibility: canonical POSIX artifact paths, using Node's explicit `windows: false` conversion; no Windows filesystem execution claim. - Evidence, artifact, provenance, or reconstruction contract: derived entrypoint paths now match the recognized conversion; artifact identities and inference authority remain unchanged. - Process execution, authorization, cleanup, or containment impact: none; existing path admission remains in place. - Generated metadata (`docs/product-catalog.json`), package, or installation impact: none. ## Evidence and regression coverage - Tests added or updated: public application analysis with real owned files and Node read/URL oracles, encoded space/Unicode/punctuation, query/fragment, parent-directory and ordinary controls; unsupported/dynamic syntax and literal filesystem punctuation controls. - Base reproduction or other evidence: new regressions on base `472b72a` produce 13 failures / 6 passing controls. Separate native Node/public application caller resolves the encoded-name decoy and misses the query-bearing URL; ordinary control succeeds. Afterward all four native caller cases, including plain filesystem punctuation, resolve the actual files. - User-visible CLI/MCP output: the encoded-space preload observation changes `resolved_path: "preload%20name.cjs"` to `resolved_path: "preload name.cjs"`; the query-bearing URL resolves `preload.cjs`. - Remaining proof gaps: no actual Electron process, target bootstrap execution, scope binding resolution or Windows runtime matrix was used. - [x] Observed, derived, and inferred claims remain distinguishable. - [x] Artifact identity, source provenance, and failed attempts remain preserved. - [x] Unsupported, incomplete, unavailable, or uncertain outcomes remain visible. ## Validation performed - `node node_modules/vitest/vitest.mjs run src/application/JavaScriptFileUrlPaths.test.ts src/domain/javascriptStaticPathResolution.test.ts src/application/JavaScriptApplicationService.test.ts` — 82 passed. - `npm run check` — all five tasks passed; 129 existing lint warnings, zero errors. - `npm run check:fast` — both tasks passed. - `npm run build` — passed. - Owned native Node24.18.0/public application caller — four cases passed; temporary files removed. ## Compatibility, safety, and release - Breaking changes or migration steps: none; corrections to derived path observations. - Real Hopper/Ghidra, browser, or OS coverage: native Node24 on macOS; none required for the unchanged browser/bridge providers. - Package or release metadata impact: none. - Security, privacy, process, or containment review: no authorization or filesystem publication changes; no encoded separator/dot admission expansion. ## Review checklist - [x] The PR has one focused outcome and the title follows `type(scope): outcome`. - [x] Related issue is linked, or the reason for not linking one is stated above. - [x] Tests cover changed observable behavior and meaningful failure paths. - [x] Owning docs, contracts, and generated metadata are updated where needed; none changes here. - [x] User-visible CLI/MCP changes include representative output. - [x] I checked the final diff for secrets, unrelated cleanup, and unsupported claims. AI assistance was used for investigation, implementation and test preparation. I reviewed the change and ran the reported native checks. ## Hosted regression correction Hosted shard 1 caught an existing inert-extraction assertion: the original patch decoded the target correctly but changed the explicit `./preload.mjs` observation spelling to `preload.mjs`. Signed amendment `2ff18c7b905cb01a444e587582b58ce9ee4e7743` preserves that established spelling after decoding. The existing assertion is unchanged. The actual failing suite reproduced locally (1 failure / 27 passes); afterward all 110 related tests pass, including the original suite and parent-directory / normalized-path URL controls. Exact-head `check` (5 tasks), `check:fast` (2 tasks), build, and all four native Node/public application caller cases pass. Lint retains 129 existing warnings and zero errors. The failed coverage job was downstream of the failing shard. Hosted checks on the amended head are pending; no full matrix success is claimed. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-16 21:16:22 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#2257
No description provided.