Skip to content

fix(browser): isolate script URLs with empty query or fragment - #2074

Merged
morluto merged 1 commit into
morluto:mainfrom
1052326311:fix/empty-url-delimiters
Oct 12, 2026
Merged

morluto merged 1 commit into
morluto:mainfrom
1052326311:fix/empty-url-delimiters

Conversation

@1052326311

Copy link
Copy Markdown
Contributor

Summary

Keep script URLs ending in an empty ? or # in isolated export layouts. URL.search and URL.hash return "" for both absent and explicitly empty components, so these variants currently receive a canonical url-path layout even though the exporter explicitly excludes query/fragment identities from that layout.

Problem and expected behavior

A capture containing only https://fixture.test/query.js? currently exports it under origins/<origin-hash>/query.js. This can make the captured variant appear to be the canonical local target for ./query.js. Empty components remain part of serialized URL identity and should follow the same isolation policy as nonempty query/fragment variants. Found in the export planner; no separate issue exists.

Change and scope

Detect component delimiters in the parsed URL's serialized href, which preserves empty components. Keep the original reported URL, source bytes, origin handling, and collision policy. Add empty ?, #, and ?# cases to the existing planner matrix and verify persisted export output through the real filesystem publication service.

Contract and boundary impact

  • Semantic owner and earliest changed stage: candidatePath in webScriptExportPlan.
  • CLI and MCP/tool-catalog contract: exported variants now report layout: isolated; schemas unchanged.
  • Provider, bridge, target-format, or platform compatibility: no capture/browser provider changes.
  • Evidence, artifact, provenance, or reconstruction contract: exact URL and bytes are retained; empty URL components no longer establish a canonical local module layout.
  • Process execution, authorization, cleanup, or containment impact: none.
  • Generated metadata, package, or installation impact: none.

Evidence and regression coverage

The filesystem regression reads a saved capture, publishes scripts, reads back bytes and manifest, and verifies an ordinary URL remains url-path while separate empty-query and empty-fragment URLs are isolated. The regression fails against the original owner (url-path received instead of isolated). Existing source/capture/provenance tests continue to pass.

  • 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 24.18.0 / npm 11.16.0, macOS arm64:

  • npm run test:focused -- src/domain/webScriptExportPlan.test.ts tests/boundary/filesystem/webScriptExport.test.ts — 45 passed.
  • npm run check — passed.
  • npm run docs:check — passed after integrating upstream's translation-link correction.
  • git diff --check — passed.

Compatibility, safety, and release

No schema, package, migration, or authority changes. Export paths for the affected URL variants intentionally change to the existing isolated layout. No live browser, separate CLI/MCP transport, or full suite run; this change consumes already-retained captures and is verified at the filesystem export boundary.

Review checklist

  • Concrete bug and one focused conventional title; no separate issue as explained above.
  • Changed output, preserved source bytes, ordinary controls, and manifest persistence covered.
  • Relevant checks run; generated outputs remain ignored.
  • Final diff inspected for secrets, unrelated changes, and unsupported claims.

AI-assisted with Codex.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-12T06:31:00.509861Z 9224115 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@morluto
morluto merged commit 9b780c4 into morluto:main Oct 12, 2026
2 checks passed
@github-actions github-actions Bot mentioned this pull request Oct 12, 2026
3 tasks done
@morluto

morluto commented Oct 12, 2026

Copy link
Copy Markdown
Owner

@1052326311, thanks for catching that URL.search and URL.hash erase the distinction between absent and explicitly empty delimiters. Checking the serialized URL keeps ?, #, and ?# variants isolated during export, so they cannot be mistaken for the canonical local script. Welcome to REA!

@morluto morluto added the bug Something isn't working label Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants