Skip to content

fix(javascript): accept retained empty endpoint seeds - #6462

Merged
morluto merged 1 commit into
morluto:mainfrom
Lew1sWong:fix/js-semantic-empty-event-seed
Nov 3, 2026
Merged

morluto merged 1 commit into
morluto:mainfrom
Lew1sWong:fix/js-semantic-empty-event-seed

Conversation

@Lew1sWong

@Lew1sWong Lew1sWong commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

trace-javascript-semantics now accepts {"kind":"endpoint","value":""}, so a retained empty literal endpoint can be selected by its preserved value instead of being refused with invalid_request.

This is the endpoint half of the defect reported in #6458. The event half ({"kind":"event","name":""}) landed on main in cf5e4f6 and that issue is closed. No separate issue covers the endpoint seed; the reproduction is below.

Problem and expected behavior

analyze-javascript-application preserves the complete literal request endpoint in properties.endpoint, including "" (requestEndpoint returns the literal unchanged). The seed schema in javascriptSemanticQuerySchemas.ts still declares value: z.string().min(1) for endpoint, so a seed carrying the retained value fails input validation before matching, while the sibling event seed already accepts "".

Expected: the empty endpoint seed reaches exact matching and selects the retained request node, the same way the empty event seed does.

Change and scope

  • Drop the minimum length from the endpoint seed. Matching is unchanged: exact equality against the preserved property, so "" matches only empty literal endpoints and never a dynamic (null) endpoint.
  • Not changed: boundary-field keeps its minimum, because boundary nodes take field from the boundary method name and never produce an empty value.

Contribution scope: ordinary fix within existing boundaries; maintainer scope decision not applicable.

Contract and boundary impact

  • Semantic owner and earliest changed stage: the semantic query seed schema, shared by CLI and MCP through applicationWorkflowInputContracts.

  • Contribution scope fit and linked maintainer decision: not applicable (bug fix).

  • CLI and MCP/tool-catalog contract: the trace_javascript_semantics input schema relaxes minLength: 1 on the endpoint value. Previously valid inputs stay valid.

  • Provider, bridge, target-format, or platform compatibility: none.

  • Evidence, artifact, provenance, or reconstruction contract: none; trace Evidence shape is unchanged.

  • Target selection, authority, upstream behavior, and cleanup details: not applicable.

  • Generated metadata, package, or installation impact: none committed. npm run docs:check passes.

  • Read existing files or captured data.

Evidence and regression coverage

  • Test added: tests/acceptance/applications/javascriptEventPayload.test.ts gains a public CLI workflow. It analyzes an app whose only request is fetch(""), confirms the graph retains a request node with endpoint: "", traces with {"kind":"endpoint","value":""}, and asserts seed_node_ids equal exactly the retained empty-endpoint nodes.
  • Base reproduction (macOS arm64, e54bf1006; main at 317bf3fe2 still declares value: z.string().min(1) for the endpoint seed): the same app and seed through the CLI return invalid_request with issues: [{"path":["query","seed","value"],"reason":"out_of_range","minimum":1}]. On this branch the trace succeeds with the request node as its seed.
  • Mutation check: with .min(1) restored on the endpoint seed, the new test fails with that invalid_request; with the change it passes.
  • Remaining proof gaps: MCP was not exercised separately. It parses the same input contract, and the existing test in this file covers the MCP trace path.

For evidence-bearing changes:

  • 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.22.1, macOS 27.0 arm64. Head 2dd67e478 on 317bf3fe2.

  • npm run check:fast — passed (typecheck, lint 0 errors)
  • npm run knip — exit 1 with 9 findings (unused exports/types, duplicate exports) in analysisView.ts, artifactGraph.ts, javascriptRpcEndpoints.ts, javascriptSemanticOpaqueEffects.ts and analysisResourceLimits.ts; the identical 9 findings appear on unmodified 317bf3fe2, and none is in a file this PR touches
  • npm run docs:check — passed
  • npm run test:focused -- on src/domain/javascript, src/contracts, tests/conformance/contracts, and every test that references the semantic query or trace-javascript-semantics — 215 files, 5086 passed, 3 skipped
  • Full npm run check:pr — not run
  • Rebased onto 317bf3fe2, whose push CI is green, to clear the earlier CI failure: on d5eb4321b the only failure was tests/process-global/pwntoolsStageRetirement.test.ts, which failed identically in main's own push CI at b675073b7 and 4557791a2 at the time.

Compatibility, safety, and release

  • Breaking changes or migration steps: none; the input schema only accepts more values.
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: static analysis of caller-selected Evidence only.

Author readiness

Human owner: @Lew1sWong

  • 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.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • 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.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

🤖 Generated with Claude Code

@Lew1sWong
Lew1sWong force-pushed the fix/js-semantic-empty-event-seed branch from 896e946 to 930f66b Compare October 23, 2026 19:02
@Lew1sWong
Lew1sWong force-pushed the fix/js-semantic-empty-event-seed branch from 930f66b to d5eb432 Compare October 26, 2026 11:23
@Lew1sWong Lew1sWong changed the title fix(javascript): accept retained empty event and endpoint seeds fix(javascript): accept retained empty endpoint seeds Oct 26, 2026
@greptile-apps

greptile-apps Bot commented Oct 26, 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

Allows endpoint seeds with value: "" to select retained empty literal endpoints.

  • Semantic traces can select endpoints whose value is empty.

Reviews (2) · Last reviewed commit: "fix(javascript): accept retained empty e..." · Reviewed by Greptile

@Lew1sWong
Lew1sWong marked this pull request as ready for review October 26, 2026 12:23
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 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 ⚠️ Failed 2026-10-30T04:18:48.289664Z
We couldn’t complete this review. Comment @codex review to try again.
2dd67e4 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.

@morluto

morluto commented Oct 26, 2026

Copy link
Copy Markdown
Owner

Thank you for separating these seed cases. I am keeping this PR open: #6458 was closed for empty event names, while main at ca3fd7b still applies min(1) to an endpoint seed’s value. This PR addresses the separate retained-empty-endpoint case. That distinction is from source inspection; I have not run the current PR or reproduced the workflow in this pass.

Application analysis preserves the complete literal request endpoint,
including the empty string, and the event seed already accepts a
retained empty name. The endpoint seed still required a non-empty
value, so trace-javascript-semantics refused to select a retained ""
endpoint with invalid_request.

The endpoint seed now accepts any string and keeps exact matching.
Boundary-field seeds keep their minimum because boundary nodes are only
produced from method names.

Found while fixing morluto#6458; the event half of that report landed in
cf5e4f6.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@Lew1sWong
Lew1sWong force-pushed the fix/js-semantic-empty-event-seed branch from d5eb432 to 2dd67e4 Compare October 30, 2026 04:18
@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.

@Lew1sWong

Copy link
Copy Markdown
Contributor Author

Hi @morluto, a gentle ping on this one: it's rebased on main (2dd67e4), CI is green and it merges cleanly. As you noted above, main still applies min(1) to the endpoint seed, so the fix is still needed. Happy to adjust anything. Thanks!

@morluto
morluto merged commit b912ec1 into morluto:main Nov 3, 2026
41 of 43 checks passed
@morluto morluto added bug Something isn't working area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior labels Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants