Skip to content

fix(javascript): resolve module-relative Worker URL references - #2104

Merged
baron merged 16 commits into
morluto:mainfrom
shoyann:fix/worker-import-meta-url
Oct 12, 2026
Merged

baron merged 16 commits into
morluto:mainfrom
shoyann:fix/worker-import-meta-url

Conversation

@shoyann

@shoyann shoyann commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Recover the common new Worker(new URL("./worker.js", import.meta.url), { type: "module" }) pattern as a Worker-to-file relationship. Previously the Worker was retained as an unknown expression with no maps_to edge.

Found during a source audit; no existing issue was identified for this pattern.

Problem and expected behavior

A literal URL relative to the current module gives enough static evidence to locate an inventoried Worker script. It must use exact URL resource lookup, including one percent-decoding pass and query/fragment removal before pathname admission, without selecting a similarly named bundled module or applying CommonJS extension/index/package fallbacks.

Representative artifact-graph result, verified through the production source pipeline:

Field Before After
declared_specifier null "./worker.js"
resolved_path null "worker.js"
Worker maps_to absent Worker script file

Change and scope

  • Recognize a new URL argument with a literal string or substitution-free template, an unshadowed global URL, and an import.meta.url base. Reuse the canonical transparent-expression unwrapping for TypeScript assertions, non-null expressions, and satisfies, including wrapped URL callees and module bases. Keep lexical shadow checks and the original Worker evidence node.
  • Require an outer constructor with an unshadowed browser Worker binding, or a runtime ESM named/namespace Worker import from worker_threads/node:worker_threads. The lexical owner distinguishes runtime ESM imports from type-only and import-equals syntax. Keep local classes, parameters, unrelated imports, reassigned bindings, default imports, and CommonJS objects unresolved; mutable module objects do not establish a Worker identity.
  • Reuse the existing module-URL predicate and lexical binding index. Preserve the raw specifier for the owning URL resolver. Existing direct-string Worker detection remains unchanged.
  • Make URL resource lookup exact, and keep Worker references out of bundled module/chunk lookup. Preserve directory-form endings (/, /., /..) before filesystem normalization, and leave repeated URL separators unresolved instead of collapsing distinct URL identities. Reuse the existing HTML directory predicate and confinement handling.
  • Validate only the URL pathname; encoded separators, backslashes, NUL, and other suffix data in query/fragment cannot invalidate an existing script path. Preserve the complete raw specifier, including suffixes.
  • Preserve unsupported or ambiguous inputs as expressions. Empty/query-only and pathnames requiring whitespace/control normalization remain unresolved; dynamic expressions, custom constructors, and shadowed URL are not guessed.

Contract and boundary impact

  • Semantic owner and earliest changed stage: domain static reference production; application artifact URL resolution and graph linking consume that fact.
  • CLI and MCP/tool-catalog contract: no schema or tool changes; shared analysis gains the missing relationship.
  • Provider, target-format, or platform compatibility: static JavaScript only; no new provider requirement.
  • Evidence and provenance: original specifiers, source ranges, and unresolved expressions are retained; no runtime execution is inferred.
  • Process execution, authorization, cleanup, or containment impact: none.
  • Generated metadata, package, or installation impact: none.

Evidence and regression coverage

  • Added three public compiled CLI journeys covering 25 resolved and 34 unresolved cases: relative/parent/template URLs, encoding and query/fragment handling, double-decoding decoy, ordinary string Worker, bundled-module collision, dynamic/shadowed/custom URL cases, missing exact files with extension/index/package decoys, external URLs, and unsupported URL forms.

  • The ordinary Worker URL bug was reproduced before the change through the production analyzer and graph builder.

  • Added resolver regressions for both query and fragment data (%2F, %2E, %5C, %00, %FF, raw backslash, and NUL), while retaining pathname rejection. Both suffix tests failed on 4943b6a and pass after the fix. Six directory/empty-segment regression cases failed on 5b97315 and now pass; interior dot segments, dotfiles, root confinement, and existing HTML behavior remain covered.

  • Added eight TypeScript wrapper scenarios and three wrapped shadow/dynamic negative scenarios. The as URL case reproduced a missing relationship on 6301950; all pass through the production source pipeline after the fix.

  • Added 21 constructor-identity cases (7 resolved, 14 unknown), including browser namespaces, both Node built-in module spellings, local classes/parameters, custom imports, type-only imports, reassignment, mutable namespaces, and calls without new. The local-class case fails against c534ada by creating a false file edge and passes after the fix.

  • Independently executed all 59 new fixture expectations through real file inventory, production source analysis, and graph construction. All passed, including the competing bundled-module assertion.

  • Remaining proof gap: compiled CLI and native-worker boundary tests are blocked locally before worker startup by the installed macOS Command Line Tools SwiftBridging duplicate module definition. No process ownership checks were bypassed.

  • 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

Pinned Node 24.18.0 / npm 11.16.0:

  • npm run check — passed: typecheck, lint (warnings, no errors), formatting, knip, metadata, module boundaries, and architecture guards.
  • Relevant source suites for URL path resolution, static references/source maps/module indexing, Electron identity/options, semantic import structure/require links/builtin defaults, and mutation initializer state — 241 tests passed across 10 files.
  • npm run verify:test-discovery — all 916 test files discovered exactly once.
  • git diff --cached --check — passed before commit.
  • npm run test:focused -- tests/acceptance/applications/javascriptWorkerUrlCli.test.ts — local execution blocked by the Swift toolchain startup failure. Both existing Worker CLI journeys, including TypeScript wrapper, suffix, and directory-form/empty-segment cases, passed in Linux CI on c534ada. The new constructor-identity journey awaits CI on the latest head.
  • Related focused source-map/file-URL boundary suites — 15 native-worker cases blocked by the same environment failure; 123 other tests passed in that run.

The previous PR CI run failed in MCP prompt completion and Darwin package prompt smoke tests. The same failures occur in main's CI at c22111e, following the independent prompt-completion lifecycle change in 07b36c1. Worker acceptance passed; no unrelated MCP change is included here.

Compatibility, safety, and release

  • Breaking changes or migrations: none. False URL extension/directory/module matches are intentionally removed.
  • Real browser/OS coverage: target JavaScript is parsed, not executed. No browser runtime verification claimed.
  • Package/release metadata and security/privacy/process/containment impact: none.

Review checklist

  • Concrete problem and one focused outcome; Conventional Commit title.
  • Reason for no related issue stated above.
  • Regression coverage includes meaningful failure paths and observable graph output.
  • No authored schema/documentation/generated metadata change required.
  • Final diff checked for secrets, unrelated cleanup, and unsupported claims.

@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-12T15:41:23.136064Z 5d84b26 New commits
ℹ️ 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4943b6aaa4

ℹ️ 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".

Comment on lines +129 to +130
!specifier.startsWith("?") &&
!specifier.startsWith("#")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Validate only the URL pathname

When the URL literal puts encoded path syntax only in its query or fragment—for example new URL("./worker.js?redirect=%2Ffoo", import.meta.url)—this returns the full value, and resolveArtifactPathByContext runs rejectDeclaration on it before contextualCandidate removes ?/#. The URL's pathname is still ./worker.js, but %2F (likewise %2E, %5C, a backslash, or NUL) causes the reference to be rejected, so an inventoried worker gets no maps_to edge. Strip or parse the URL suffix before path admission while preserving the declared specifier.

AGENTS.md reference: AGENTS.md:L25-L25

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5b97315a04

ℹ️ 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".

Comment on lines +128 to +130
return pathname.length > 0 &&
stripQueryAndFragment(htmlUrlText(specifier)) === pathname
? specifier

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve directory-form URL semantics

When the literal path ends in a dot segment, for example new URL("./worker.js/.", import.meta.url) in dist/app.mjs, this condition promotes it to a static specifier. URL resolution preserves the directory form as /dist/worker.js/, but relativeCandidate later uses posix.join, which collapses /. to dist/worker.js; if that file is inventoried, the graph emits a maps_to edge even though the Worker requests a distinct directory-form URL. Parse and carry the URL pathname's trailing-directory state, or leave these references unresolved, rather than treating the normalized filesystem path as an exact URL match.

AGENTS.md reference: AGENTS.md:L25-L25

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6301950464

ℹ️ 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".

Comment on lines +116 to +118
const node = argumentNode(argument);
if (
!t.isNewExpression(node) ||

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Unwrap transparent expressions before matching Worker URLs

When TypeScript wraps the URL value in a runtime-transparent assertion, for example new Worker(new URL("./worker.js", import.meta.url) as URL), argumentNode returns a TSAsExpression, so t.isNewExpression(node) fails and the valid static URL remains an opaque expression with no maps_to edge. readExactJavaScriptLiteral already handles these wrappers through unwrapJavaScriptExpression; unwrap the Worker argument before applying this shape check as well.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c534adaeaf

ℹ️ 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".

addReference(context, {
node,
kind: "worker",
specifier: first ?? workerUrlSpecifier(node.arguments[0], bindings),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Check the outer Worker binding before resolving its URL

When an ESM file declares a different lexical Worker (for example, class Worker {}; new Worker(new URL("./worker.js", import.meta.url))), the name test still enters this block and only the inner URL is checked against bindings. This change therefore upgrades the previously opaque call to a static specifier and emits a maps_to edge to any matching file even though no worker is loaded; consult the outer callee's binding (while allowing proven worker implementations such as worker_threads.Worker) before promoting the nested URL.

AGENTS.md reference: AGENTS.md:L19-L19

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0c2803e1c7

ℹ️ 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".

]);
return exactUrlPathCandidate(
decoded,
relativeCandidate(input.sourcePath, decoded),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Leave drive-letter URL forms unresolved

When the analyzed module runs from a file URL (the Node/Electron case), WHATWG resolves new URL("c|/worker.js", import.meta.url) to file:///c:/worker.js, but this POSIX join produces dist/c|/worker.js for dist/app.mjs. If an artifact contains that legal POSIX path, the new Worker promotion emits a false maps_to edge to a file the runtime never requests; because the base scheme is not modeled and HTTP treats this spelling differently, leave this drive-letter form unresolved rather than joining it.

AGENTS.md reference: AGENTS.md:L25-L25

Useful? React with 👍 / 👎.

Use WHATWG file URL parsing before pathname decoding to detect drive-letter
forms whose resource identity depends on the unmodeled source URL scheme.
Preserve encoded and ordinary relative pipe paths, and cover false matches
through the compiled CLI and resolver boundary tests.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6862b0c0d5

ℹ️ 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".

Comment on lines +143 to +145
return pathname.length > 0 &&
stripQueryAndFragment(htmlUrlText(specifier)) === pathname
? specifier

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep absolute file-based Worker URLs unresolved

The final code now rejects drive-letter file URLs, but for a node:worker_threads call such as new Worker(new URL("/worker.js", import.meta.url)), this return still promotes the leading-slash specifier and relativeCandidate later maps it to inventory path worker.js. In Node the base is a file URL, so the runtime target is filesystem-root /worker.js (or the current drive root on Windows), not the selected application's worker.js; a same-named file therefore gains a false maps_to edge. Carry the file-URL base semantics or leave this absolute form unresolved.

AGENTS.md reference: AGENTS.md:L25-L25

Useful? React with 👍 / 👎.

Comment on lines +130 to +134
!isUnshadowedGlobal(
unwrapJavaScriptExpression(node.callee).node,
bindings,
"URL",
) ||

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Treat locally overwritten global URL as unknown

When source code replaces the global constructor before the call, for example const RealURL = URL; globalThis.URL = class { constructor() { return new RealURL("./other.js", import.meta.url); } };, this lexical-only check still treats the subsequent bare URL as the built-in. A proven worker_threads.Worker call is then linked to the literal worker.js even though runtime loads other.js; source-local writes to the global constructor should make the identity unknown.

AGENTS.md reference: AGENTS.md:L19-L19

Useful? React with 👍 / 👎.

addReference(context, {
node,
kind: "worker",
specifier: first ?? workerUrlSpecifier(node, bindings),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Consult bindings before filtering Worker callee spellings

When the immutable Node constructor is imported under an alias, such as import { Worker as ThreadWorker } from "node:worker_threads"; new ThreadWorker(new URL("./worker.js", import.meta.url)), calleeName is ThreadWorker, so the surrounding spelling gate never invokes this binding-aware fallback. The same happens for a TypeScript-wrapped outer callee even though isWorkerConstructor can unwrap it, leaving no worker finding or maps_to edge; run constructor identity before restricting the callee spelling.

AGENTS.md reference: AGENTS.md:L17-L17

Useful? React with 👍 / 👎.

Recognize known Worker bindings before filtering callee spellings so ESM
aliases and transparent constructor wrappers reach URL analysis. Keep
root-relative module URLs unknown without a modeled runtime base root.

Index direct source-local global writes with the shared mutation collector
before promoting URL and browser Worker constructors. Preserve lexical
shadowing and unrelated property identities, and exercise all three review
regressions through the compiled CLI.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bb76ee4dd3

ℹ️ 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".

if (
!t.isIdentifier(callee, { name: "URL" }) ||
!isUnmodifiedGlobalReference(callee, bindings, "URL") ||
!isImportMetaUrl(argumentNode(node.arguments[1]))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Treat writes to import.meta.url as unknown

When a Node ESM source rewrites the writable import.meta.url before this call—for example, import.meta.url = "file:///tmp/base.mjs"; new Worker(new URL("./worker.js", import.meta.url)) with an imported worker_threads.Worker—this syntax-only check still succeeds. Runtime resolves the URL to /tmp/worker.js, but the graph resolves it relative to the analyzed artifact and can emit a false maps_to edge to an inventoried sibling worker.js; track assignments/redefinitions/deletions of this meta property or retain the Worker argument as an expression when its base identity is mutable.

AGENTS.md reference: AGENTS.md:L19-L19

Useful? React with 👍 / 👎.

Track source-local import.meta writes alongside ambient global writes so
Worker URL expressions keep an unknown base after a possible URL mutation.
Tag the identity roots independently and cover direct mutation and unrelated
property cases through the compiled CLI.
@shoyann

shoyann commented Oct 12, 2026

Copy link
Copy Markdown
Contributor Author

finally

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8d30ba4c0a

ℹ️ 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".

Comment on lines +60 to +61
if (kind === "member" && globalObjectName(root, state) !== undefined)
return ["global"];

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Canonicalize nested global aliases before trusting URL

When a Node module mutates URL through the self-alias globalThis.global, for example globalThis.global.URL = class {}; before an imported worker_threads.Worker call, this branch retains ['global', 'global', 'URL']. isUnmodifiedGlobalReference checks only ['global', 'URL'], so the nested new URL(...) is promoted and an inventoried sibling receives maps_to, while runtime passes a plain object to Worker and throws instead of loading it. The fresh evidence after the earlier direct-global fix is this new index's noncanonical path; collapse known global-object aliases or keep the identity unknown.

AGENTS.md reference: AGENTS.md:L19-L19

Useful? React with 👍 / 👎.

Comment on lines +147 to +150
return pathname.length > 0 &&
!pathname.startsWith("/") &&
stripQueryAndFragment(htmlUrlText(specifier)) === pathname
? specifier

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep malformed-percent Node Worker URLs unresolved

When the proven constructor is imported from node:worker_threads and the literal path contains a stray percent, such as new Worker(new URL("./worker%.js", import.meta.url)), this promotes the argument; percentDecodeUrlPath leaves that malformed escape literal, so an inventoried worker%.js receives maps_to. Node converts this file URL to a path and throws URIError: URI malformed, so that file cannot be loaded; reject malformed path escapes or carry the known Node/file semantics before promotion.

AGENTS.md reference: AGENTS.md:L25-L25

Useful? React with 👍 / 👎.

Resolve ambient object identities before appending written properties, and
retain possible source-local aliases across rebinding. Reuse intrinsic
invocation handling for aliased and bound mutators, array spreads, and
transparent TypeScript wrappers while preserving Electron write semantics.

Keep malformed-percent nested Worker URL pathnames unknown because the base
scheme is unavailable and Node rejects these file URLs. Preserve tolerant
HTML URL handling, valid escapes, and query/fragment evidence.

Cover the new cases and unrelated writes through the compiled CLI with
existing-file decoys. All 591 targeted tests and npm run check pass.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5d84b26d7e

ℹ️ 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".

Comment on lines +125 to +127
if (possibleWrites && t.isConditionalExpression(root)) {
continueWith(root.consequent);
continueWith(root.alternate);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Bound repeated ambient alias expansion

When analyzed input contains a chain such as const aN = flag ? aPrev : aPrev followed by aN.URL = replacement, both branches are enqueued with independent visited sets and each re-expands the same preceding binding, so N aliases produce 2^N pending states before identical terminal paths are coalesced. This loop has no yield or resource budget and runs before static traversal, so a few dozen harmless-looking declarations can hang CLI/MCP analysis; deduplicate resolver states or cap expansion while preserving an unknown result.

AGENTS.md reference: AGENTS.md:L46-L46

Useful? React with 👍 / 👎.

node,
kind: "worker",
specifier:
first ??

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep Node worker strings in filesystem context

For a newly recognized alias such as import { Worker as W } from "node:worker_threads"; new W("/worker.js"), first wins here and resolveReference subsequently treats the string as an artifact-root URL, potentially emitting maps_to for the selected application's worker.js; Node instead interprets this as filesystem-root /worker.js (and resolves relative strings against the process cwd). The fresh evidence beyond the earlier nested-URL case is that binding-aware alias recognition now reaches this literal fast path and bypasses workerUrlSpecifier entirely, so distinguish Node constructors and leave string paths unresolved without filesystem/cwd context.

AGENTS.md reference: AGENTS.md:L25-L25

Useful? React with 👍 / 👎.

if (!t.isNewExpression(node)) return undefined;
const callee = unwrapJavaScriptExpression(node.callee).node;
if (
!t.isIdentifier(callee, { name: "URL" }) ||

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Admit qualified global URL constructors

When a proven Worker uses new globalThis.URL("./worker.js", import.meta.url) (likewise window.URL or self.URL), unwrapping yields a member expression and this guard rejects it before isUnmodifiedGlobalReference can apply the ambient-write proof it already supports for direct global properties. These forms invoke the same canonical constructor, but the reference remains opaque with no maps_to; let the identity helper validate qualified global URL constructors instead of requiring a bare identifier.

AGENTS.md reference: AGENTS.md:L17-L17

Useful? React with 👍 / 👎.

Join ambient identity projections instead of enumerating alias histories.
Memoize repeated value and provenance queries while preserving capture,
depth, and cycle-dependent uncertainty.

Keep Node Worker string arguments unresolved without filesystem or cwd
context, and admit qualified global URL constructors through identity checks.

Validate three 40-level alias branch shapes through the compiled CLI,
925 source tests, 25 CLI/boundary tests, and the full npm run check gate.
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

Preserve the author history and both binding-aware producer consumers: current-main bundler registration/esbuild inspection and Worker URL call inspection. Resolve only their shared call-site conflict.\n\nValidation: 398 related source tests, one additional scratch producer witness, six compiled CLI journeys with process-table access, check:fast and check. The sandboxed CLI attempt was blocked by spawn EPERM during process ownership inspection.
baron added 5 commits October 13, 2026 06:20
Retain CTS import-equals loader evidence and binding-aware Worker scans. Share active-stack and expression-depth dependence across value and provenance evaluation; retain live values only in the effects-aware state and provenance only for one query. Propagate memo dependencies through cache hits and invalidate all state-owned values when mutation facts change.

Source validation: 712 focused tests passed. check:fast and compiled Worker CLI journeys are blocked by unchanged upstream contractToolHandler.ts:69 (missing fourth argument). No hosted publication performed.
Pass the exact named contract returnsTargetContent flag through the shared partial-Evidence error delivery path introduced by the shortlist integration.

Exercise successful and failed recording through in-memory MCP for marked and unmarked contracts, preserving source payload and original failures. Observe both shared-handler emission and wire delivery so the SDK error-marker fallback cannot hide omissions. Suppressing the flag fails exactly the two marked cases.

Validation: check:fast, check, 736 semantic tests, 29 MCP transport/error tests and six compiled static Worker CLI journeys pass. No live target/provider execution or hosted publication.
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@baron baron 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.

Source verdict: APPROVE for 814b4bf3e8d50cea3167703694886197f3a629d8.

The integrated change preserves binding-aware Worker/import.meta.url, CTS import-equals, and bundler scans at their shared producer boundary. Caller-dependent/cyclic/depth-limited values cannot leak from analysis-state memoization. Query-local provenance propagates exact dependency proofs and rejects active-ancestor reuse. The unpublished integration's flattened transitive Sets were replaced before publishing a candidate head with immutable shared proofs; the original contributor is not being blamed for that integration defect. Obsolete duplicate value memo/cycle-epoch representation is removed.

A discriminating 32/64 reconvergent witness fails with the old owner and passes with the shared-proof representation. Independent exact-source verification confirms the prior blocker is resolved, including immutable union/membership and handler provenance. Proof construction/retention scaling is measured, not whole-analysis speed, token cost or process-family peak memory; those remain unmeasured.

Pinned validation: 738 semantic tests plus 39 static CLI/in-memory MCP tests (777 distinct passes), build prerequisites, check:fast, check and 998-file discovery. The four named-contract/retained-or-failed recording cases inspect handler emission AND wire framing; false-flag mutation fails the two marked cases. The production retained-partial provenance correction had already landed on main and is inherited, not duplicated. Static analysis never executed analyzed targets; simulated/in-memory producers do not establish real-provider behavior. Earlier sandbox-limited runtime residue remains preserved with ownership/cleanup settlement UNKNOWN; the later bounded journeys passed without bypassing ownership.

Fresh published-head hosted CI is green: Static checks, Test (coverage + timing), and CI required succeeded in run https://github.com/morluto/rea/actions/runs/38314617241. Optional skips are not represented as provider execution. Current-main integration is rechecked immediately before gated merge; no admin bypass or history rewrite.

@baron
baron merged commit 653067d into morluto:main Oct 12, 2026
34 checks passed
@morluto morluto mentioned this pull request Oct 13, 2026
3 tasks done
@morluto morluto added bug Something isn't working area: domain Domain logic, errors, and pure functions labels Oct 14, 2026
@morluto morluto added the area: runtime Process capture and runtime observation label Nov 23, 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 area: runtime Process capture and runtime observation bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants