Skip to content

fix(wasm): retain glue query and fragment across line terminators - #6802

Merged
gensokyo-dev merged 2 commits into
morluto:mainfrom
gongfpp:fix/wasm-glue-url-separators-6639
Oct 23, 2026
Merged

gensokyo-dev merged 2 commits into
morluto:mainfrom
gongfpp:fix/wasm-glue-url-separators-6639

Conversation

@gongfpp

@gongfpp gongfpp commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #6639. WASM glue inspection dropped .wasm string literals when a query or fragment contained LF, CR, CRLF, U+2028 or U+2029, while still reporting the source parse complete. The same literal values, UTF-16 coordinates and candidate associations now remain visible across those terminators. Bare paths with a trailing terminator remain rejected.

Approach and scope

endsWithWasmReference tests the complete cooked value with dotAll instead of slicing to the last physical line. Existing association logic continues to own local-path versus basename matching and preserves uncertainty. The change touches the predicate, its regressions and the existing real-WABT verifier; there are no schema, dependency, cache or provider-authority changes. Static glue parsing uses the existing WABT analysis workflow; runtime_execution and network_fetch semantics are unchanged. This is an ordinary correctness fix within existing boundaries; a separate maintainer scope decision is not applicable.

Current validation

Updated head 74a59dd8, integrated onto main f2db494b; Linux, Node 24.22.1/npm 11.16.0:

  • npm run test:focused -- src/wasm/WabtOutput.test.ts src/wasm/WabtArtifactProvider.test.ts: 69 passed, including hostile long literals and lifecycle regressions.
  • npm run check: passed.
  • Official WABT 1.0.42 archive verified against its GitHub asset SHA-256; node scripts/verify-wasm-artifact.mjs --require-tools: 61 cases passed, covering real provider CLI/MCP schemas, output, warnings and cleanup.
  • Real source-map mappings.wasm (48,526 unchanged bytes) plus its shipped loader and three explicitly added query/fragment variants: clean main retained only the original reference; this head retained all four exact values/coordinates and expected candidate classifications. The added glue is a controlled derivative, not a claim about shipped source-map URLs. Filtered compiled CLI output agreed with MCP summary plus retained-Evidence glue pages. Original digests and access to the complete parent Evidence were preserved.
  • Fresh-process/warm-filesystem application workflow, main/PR: elapsed 6.56/6.29 s, CPU 11.71/11.57 s, sampled family peak 517/517 MiB. The real verifier peaked at 1,573 MiB under a 2 GiB stop threshold. These small shared-host observations establish no speedup; no OS-cold run or actual whole-model token measurement was made. Selected-delivery tokenx estimates were 8,734/9,895, excluding initialization/framing/prompts/preknown schemas. Independent review and evidence scope.

CI run 40020767003 failed with 15 test failures, all reproduced on clean CI base f2db494b; seven remaining shards were cancelled. Static/build/native-package checks, title/readiness and Greptile passed; latest Codex review reports no actionable findings. Main then advanced to d29ae43a: this unchanged PR was re-integrated there, and 42 producer/MCP tests, full check and the real application workflow passed again. Final baseline and latest-main evidence.

Author readiness

Human owner: @gongfpp

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 23, 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-23T20:42:12.974531Z 74a59dd 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.

@greptile-apps

greptile-apps Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no blocking issues were found.

Summary

Retains complete .wasm literals when a query or fragment contains line terminators.

  • Wasm glue inspection keeps qualified .wasm references across line breaks.

Reviews (2) · Last reviewed commit: "Merge branch 'main' into fix/wasm-glue-u..." · Reviewed by Greptile

@gongfpp

gongfpp commented Oct 23, 2026

Copy link
Copy Markdown
Contributor Author

Current-head CI is red for reasons outside this diff. On the exact base of this PR (60accad2de8f2862fe91901502fe26cc5390fb36), main's own CI run 39975172638 fails the same jobs with the same tests: Source tests — environmentBundle.test.ts (discovery budget), environmentReplayCapacity.test.ts (late repeated query), sourceToBundleComparison.test.ts (webpack:// sourceRoot); Test shard (5/8) — javascriptIndirectLoaderOwners.test.ts; Test shard (6/8) — peCertificatesCli.test.ts and javascriptLiteralLoaderOwnership.test.ts. This PR touches only src/wasm/WasmGlueAdapter.ts, src/wasm/WabtOutput.test.ts and scripts/verify-wasm-artifact.mjs, and its Static checks and Build package jobs pass. I am not folding unrelated baseline repairs into this PR.

@gensokyo-dev gensokyo-dev 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 updated head 74a59dd8225f99438734d05350e63b91bb0c4c2c; its tree matches my tested integration onto main f2db494bfca6.

The fix belongs in the cooked-literal predicate: test the complete value with dotAll, then let existing association logic preserve the literal and classify local-path versus basename candidates. This removes the last-line representation that discarded valid qualifiers. Source coordinates, candidate uncertainty and existing CLI/MCP Evidence ownership remain intact. I found no further directly related refactor needed; no target execution or URL fetch capability is added.

Independent Linux verification with Node 24.22.1/npm 11.16.0:

  • 69 WabtOutput/provider tests passed, including multiline hostile inputs and lifecycle failures; full npm run check passed.
  • Official WABT 1.0.42 release archive was checked against its GitHub asset SHA-256. The updated real-tool verifier passed 61 cases, exercising CLI/MCP schema/output/cleanup behavior. Sampled process-family peak was 1,573 MiB (30 ms sampling, 2 GiB stop threshold); no stop occurred.
  • The real source-map package's unchanged 48,526-byte mappings.wasm was inspected with its shipped loader plus three explicitly added query/fragment variants. This is a controlled glue derivative, not a claim that those qualifiers ship in source-map. Clean main returned only the original reference and still said complete; this head retained all four exact values/UTF-16 coordinates and their correct candidate classification. Binary/glue digests were preserved. Both runs used filtered compiled CLI output, MCP first-call summary, and two retained-Evidence glue-page reads; CLI and MCP facts agreed and the complete parent remained accessible.
  • Fresh-process/warm-filesystem application workflow: main/PR elapsed 6.56/6.29 s, CPU 11.71/11.57 s, sampled family peak 517/517 MiB. Warm retained glue access took 6.3/7.2 ms. Selected-delivery tokenx estimates were 8,734/9,895; extra retained references account for the changed answer. These are small observations, not a speedup claim. No OS-cold run or actual whole-model token measurement was made; token estimates exclude initialization, framing, prompts and preknown schemas.

Current CI run 40020767003 is still running; this approval records code review and the independent checks above, not a claim that pending CI passed.

@gensokyo-dev

Copy link
Copy Markdown
Collaborator

CI run 40020767003 failed Source tests (job 120646487849) with 11 failures. I reran the four affected files on clean base f2db494bfca6, with no PR changes: the same 11 failure titles matched exactly (155 passes).

Command: npm run test:local -- src/application/frida/FridaInstrumentationService.test.ts src/domain/javascript/javascriptStaticAnalysis.mapEndpoints.test.ts src/domain/javascript/javascriptStaticAnalysisReturnedInvocation.test.ts src/server/BundleResourcesMcp.test.ts. Failures are four Frida lifecycle cases, five Map-endpoint cases, the finite callable alias graph and BundleResourcesMcp.

These failures are pre-existing on this PR’s current CI base. The independent PR-specific checks passed: 69 source/provider tests, full npm run check, 61 real-WABT verifier cases and the real source-map WASM/controlled-glue CLI/MCP workflow described in the review. Static checks and package build passed online. Sharded tests and remaining native checks are still running or queued; no pass is claimed for them.

@gensokyo-dev

Copy link
Copy Markdown
Collaborator

CI run 40020767003 is complete with failure. All 15 reported test failures reproduced on clean CI base f2db494bfca62528a48fc219038a2bd883dbb9f3 with identical failure titles:

  • Source tests: the same 11 failures across four files, with 155 passes (command and attribution above).
  • Shard 2: the same 4 failures in registrationRuntimeEnvironmentCli.test.ts and cdpResourceCompleteness.test.ts; clean-base command npm run test:focused -- tests/acceptance/setup/registrationRuntimeEnvironmentCli.test.ts tests/boundary/browser/cdpResourceCompleteness.test.ts produced 4 failures/34 passes/1 skip. The setup failures concern three selected environment-variable validations; the CDP failure concerns an optional/empty resource field.
  • The other seven shards were cancelled by fail-fast; they did not pass. Portable tests and CI required failed as aggregates.

Static checks, package build, Windows native controls, Linux native package baseline, PR title/readiness and Greptile passed. Latest Codex review reports no actionable findings and there are no unresolved threads.

Main advanced during CI to d29ae43aeb522559da6f25faae29b5d907e1fe40. The WASM implementation/contracts, verifier and dependencies are unchanged by those new main commits. I re-integrated the unchanged PR there (tree bf7ca2b457953d1fbf712e1866693de5c38e9112), reran the relevant producer/MCP tests (42 passed) and full npm run check, then repeated the real source-map WASM/controlled-glue filtered-CLI → MCP summary → retained-glue-page workflow (passed, 6.52 s/12.02 CPU-s, sampled family peak 517 MiB; no speedup claim). Earlier independent checks passed 69 source/provider tests and all 61 real WABT verifier cases.

Applying the maintainer’s explicit authorization to bypass proven pre-existing/unrelated CI failures and merge reviewed head 74a59dd8225f99438734d05350e63b91bb0c4c2c. Failed and cancelled checks remain recorded as such.

@gensokyo-dev
gensokyo-dev merged commit d65c027 into morluto:main Oct 23, 2026
33 of 45 checks passed
@gensokyo-dev

Copy link
Copy Markdown
Collaborator

Post-merge verification on actual merged commit d65c027c2d207ce399d69a8568bc42d849d71465: 31 WabtOutput tests passed, the runtime/packaged-skill build passed, and the real source-map WASM/controlled-glue workflow passed through filtered compiled CLI output, first-call MCP summary and retained-Evidence glue paging. All four exact literal values/coordinates and candidate classifications remained correct; binary/glue digests and complete parent-Evidence access were preserved.

This checked the actual tree, which also contains the independently merged native-export paging capability. A fresh-process/warm-filesystem observation took 6.67 s, 12.18 CPU-s and sampled process-family peak 514 MiB (30 ms samples). No speedup or whole-model token measurement is claimed. The first probe correctly refused because the fresh worktree had no compiled runtime; after npm run build:cached, the same workflow passed without source changes.

@morluto morluto mentioned this pull request Oct 25, 2026
3 tasks done
@morluto morluto added the bug Something isn't working label Nov 23, 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.

[Bug] WASM glue drops valid URL literals with line separators in queries or fragments

3 participants