Skip to content

fix(javascript): project decoded file URL paths - #810

Merged
N0zoM1z0 merged 2 commits into
morluto:mainfrom
rudycelekli:fix/file-url-path-projection-20261006
Oct 7, 2026
Merged

N0zoM1z0 merged 2 commits into
morluto:mainfrom
rudycelekli:fix/file-url-path-projection-20261006

Conversation

@rudycelekli

@rudycelekli rudycelekli commented Oct 6, 2026 •

Copy link
Copy Markdown

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.

@rudycelekli

Copy link
Copy Markdown
Author

Corrected the hosted shard regression in signed amendment 2ff18c7b905cb01a444e587582b58ce9ee4e7743: decoded file URLs retain the established explicit ./ observation spelling. The existing inert-extraction assertion remains unchanged.

I reproduced the failing suite locally (1 failed / 27 passed); all 110 related tests now pass, along with check, check:fast, build, and four native Node/public application caller controls. Hosted checks on the new head are pending. The coverage job failure was downstream of the shard failure.

@N0zoM1z0 N0zoM1z0 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed head2ff18c7b90. Known source-relative file URLs now use Node fileURLToPath with an inert, sufficiently deep POSIX anchor; decoded filenames, removed URL query/fragment, parent segments and established ./ spelling reach the existing confined artifact resolver. Plain filesystem punctuation stays literal; malformed/dynamic/remote/encoded-separator forms remain unknown. Existing syntactic callee recognition and target-platform limits are explicit. Production build and the focused filesystem/application/path suites passed, including native Node URL/read oracles. All19 exact-head hosted checks are green. No blocking findings.

@N0zoM1z0
N0zoM1z0 merged commit 2572e1e into morluto:main Oct 7, 2026
19 checks passed
@morluto

morluto commented Oct 7, 2026

Copy link
Copy Markdown
Owner

Thanks, @rudycelekli, for your work on “fix(javascript): project decoded file URL paths.” I appreciate your contribution to REA.

darsrc pushed a commit to darsrc/rea that referenced this pull request Oct 10, 2026
* fix(javascript): project decoded file URL paths

Signed-off-by: Rudy Celekli <[email protected]>

* fix: preserve explicit source-relative URL observation spelling

Signed-off-by: Rudy Celekli <[email protected]>

---------

Signed-off-by: Rudy Celekli <[email protected]>
@morluto morluto added bug Something isn't working area: domain Domain logic, errors, and pure functions labels Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: domain Domain logic, errors, and pure functions bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants