[PR #2963] fix(javascript): recover RPC link URLs declared with template literals #5520

Open
opened 2026-10-31 01:07:16 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/2963
Author: @ArifAli8866
Created: 10/13/2026
Status: 🔄 Open

Base: main ← Head: fix/route-property-template-literals


📝 Commits (1)

  • 071db60 fix(javascript): recover RPC link URLs declared with template literals

📊 Changes

3 files changed (+26 additions, -3 deletions)

View changed files

📝 src/domain/javascript/javascriptAstValues.ts (+5 -1)
📝 src/domain/javascript/javascriptRpcEndpoints.test.ts (+11 -0)
📝 tests/acceptance/applications/javascriptRpcPropertyOwnershipCli.test.ts (+10 -2)

📄 Description

Summary

Recovers tRPC HTTP link URLs whose options are declared with expression-free template literals (e.g. httpLink({ url: /api/template })). Isolates the remaining producer fix and RPC-link regressions from #2805 after route and dynamic-import template handling landed on main in 88afcc738.

Problem and expected behavior

When recovering client-side transport URLs in javascriptRpcEndpoints.ts, trpcLinkUrl extracts the url property using semanticFinalObjectStringProperty(options, "url"). Previously, semanticFinalObjectStringProperty strictly checked t.isStringLiteral(value).

As a result, constant transport URLs declared as expression-free template literals (such as (0, t.httpLink)({ url: /api/template }) or httpBatchLink({ url: /trpc/template })) were dropped rather than captured as network endpoints (trpc:link:<factory>).

Expected behavior: Transport URL options declared as expression-free template literals should be extracted with their exact string value, while dynamic interpolated templates remain unknown.

Change and scope

  • Update semanticFinalObjectStringProperty in src/domain/javascript/javascriptAstValues.ts to use readExactJavaScriptLiteral(value) so that expression-free template literals are resolved to their exact string values without accepting dynamic interpolations or non-string primitives.
  • Note on scope: As semanticFinalObjectStringProperty is a shared helper, constant expression-free template literals also resolve when reading GraphQL operation properties (kind, operation, name.value).
  • Add unit tests in src/domain/javascript/javascriptRpcEndpoints.test.ts verifying constant and interpolated template literal link URLs across object-property ownership tables and bundled factory wrappers.
  • Add regression coverage in tests/acceptance/applications/javascriptRpcPropertyOwnershipCli.test.ts validating that template literal RPC options are retained in both CLI and stdio MCP graphs.

Contract and boundary impact

  • Semantic owner and earliest changed stage: AST inspection in src/domain/javascript/javascriptAstValues.ts.
  • Contribution scope fit and linked maintainer decision: Follows maintainer review on #2963 to isolate the unmerged RPC link producer fix and regression coverage from #2805.
  • CLI and MCP/tool-catalog contract: Unchanged schema; improves recall for constant RPC link endpoints.
  • Provider, bridge, target-format, or platform compatibility: Pure static AST analysis; platform-independent.
  • Evidence, artifact, provenance, or reconstruction contract: Preserves exact coordinates and trpc:link:* mechanisms.
  • Target selection, authority, upstream behavior, and cleanup details: Read-only static AST analysis.
  • Generated metadata impact: None.

Expected effects:

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests added or updated:
    • src/domain/javascript/javascriptRpcEndpoints.test.ts: Added table test cases covering constant template literals, final overrides, and rejected interpolations in RPC link options, as well as template literal URL recovery in bundled call wrappers.
    • tests/acceptance/applications/javascriptRpcPropertyOwnershipCli.test.ts: Added fixture and assertions verifying template literal link URLs through CLI and stdio MCP analysis.
  • Base reproduction: Base revision dropped { url: /api/template } link options.
  • Remaining proof gaps: None.

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

  • npm run check:fast — passed (typecheck and lint)
  • npm run format:check — passed (oxfmt)
  • npm run verify:module-boundaries — passed (1928 source files checked)
  • npm run verify:test-discovery — passed (1326 test files verified)
  • npm run test:focused -- src/domain/javascript/javascriptRpcEndpoints.test.ts tests/acceptance/applications/javascriptRpcPropertyOwnershipCli.test.ts — passed (102 tests passed)

Compatibility, safety, and release

  • Breaking changes or migration steps: None.
  • Real Hopper/Ghidra, browser, or OS coverage: Pure domain AST analysis.
  • Package or release metadata impact: None.
  • Security, privacy, process, or containment review: Pure static analysis; no execution or mutation authority.

Author readiness

Human owner: @ArifAli8866

  • 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 (Follow-up to #2805).
  • 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.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/2963 **Author:** [@ArifAli8866](https://github.com/ArifAli8866) **Created:** 10/13/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/route-property-template-literals` --- ### 📝 Commits (1) - [`071db60`](https://github.com/morluto/rea/commit/071db60f0814fbc50228729187f4926c326cb702) fix(javascript): recover RPC link URLs declared with template literals ### 📊 Changes **3 files changed** (+26 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `src/domain/javascript/javascriptAstValues.ts` (+5 -1) 📝 `src/domain/javascript/javascriptRpcEndpoints.test.ts` (+11 -0) 📝 `tests/acceptance/applications/javascriptRpcPropertyOwnershipCli.test.ts` (+10 -2) </details> ### 📄 Description ## Summary Recovers tRPC HTTP link URLs whose options are declared with expression-free template literals (e.g. `httpLink({ url: `/api/template` })`). Isolates the remaining producer fix and RPC-link regressions from #2805 after route and dynamic-import template handling landed on main in 88afcc738. ## Problem and expected behavior When recovering client-side transport URLs in `javascriptRpcEndpoints.ts`, `trpcLinkUrl` extracts the `url` property using `semanticFinalObjectStringProperty(options, "url")`. Previously, `semanticFinalObjectStringProperty` strictly checked `t.isStringLiteral(value)`. As a result, constant transport URLs declared as expression-free template literals (such as `(0, t.httpLink)({ url: `/api/template` })` or `httpBatchLink({ url: `/trpc/template` })`) were dropped rather than captured as network endpoints (`trpc:link:<factory>`). Expected behavior: Transport URL options declared as expression-free template literals should be extracted with their exact string value, while dynamic interpolated templates remain unknown. ## Change and scope - Update `semanticFinalObjectStringProperty` in `src/domain/javascript/javascriptAstValues.ts` to use `readExactJavaScriptLiteral(value)` so that expression-free template literals are resolved to their exact string values without accepting dynamic interpolations or non-string primitives. - Note on scope: As `semanticFinalObjectStringProperty` is a shared helper, constant expression-free template literals also resolve when reading GraphQL operation properties (`kind`, `operation`, `name.value`). - Add unit tests in `src/domain/javascript/javascriptRpcEndpoints.test.ts` verifying constant and interpolated template literal link URLs across object-property ownership tables and bundled factory wrappers. - Add regression coverage in `tests/acceptance/applications/javascriptRpcPropertyOwnershipCli.test.ts` validating that template literal RPC options are retained in both CLI and stdio MCP graphs. ## Contract and boundary impact - Semantic owner and earliest changed stage: AST inspection in `src/domain/javascript/javascriptAstValues.ts`. - Contribution scope fit and linked maintainer decision: Follows maintainer review on #2963 to isolate the unmerged RPC link producer fix and regression coverage from #2805. - CLI and MCP/tool-catalog contract: Unchanged schema; improves recall for constant RPC link endpoints. - Provider, bridge, target-format, or platform compatibility: Pure static AST analysis; platform-independent. - Evidence, artifact, provenance, or reconstruction contract: Preserves exact coordinates and `trpc:link:*` mechanisms. - Target selection, authority, upstream behavior, and cleanup details: Read-only static AST analysis. - Generated metadata impact: None. Expected effects: - [x] Read existing files or captured data. - [ ] Launch or attach to a process. - [ ] Inject instrumentation or run scripts/code. - [ ] Change process memory, registers, files, or configuration. - [ ] Contact network services. - [ ] Recover protected code or work around protections. - [ ] Documentation or usability only; no target interaction. - [ ] Not sure yet; investigation or maintainer guidance needed. ## Evidence and regression coverage - Tests added or updated: - `src/domain/javascript/javascriptRpcEndpoints.test.ts`: Added table test cases covering constant template literals, final overrides, and rejected interpolations in RPC link options, as well as template literal URL recovery in bundled call wrappers. - `tests/acceptance/applications/javascriptRpcPropertyOwnershipCli.test.ts`: Added fixture and assertions verifying template literal link URLs through CLI and stdio MCP analysis. - Base reproduction: Base revision dropped `{ url: `/api/template` }` link options. - Remaining proof gaps: None. For evidence-bearing changes: - [x] Observed, derived, and inferred claims remain distinguishable. - [x] Artifact identity, source provenance, and failed attempts remain preserved. - [x] Unsupported, incomplete, unavailable, or uncertain outcomes remain visible. ## Validation performed - `npm run check:fast` — passed (typecheck and lint) - `npm run format:check` — passed (oxfmt) - `npm run verify:module-boundaries` — passed (1928 source files checked) - `npm run verify:test-discovery` — passed (1326 test files verified) - `npm run test:focused -- src/domain/javascript/javascriptRpcEndpoints.test.ts tests/acceptance/applications/javascriptRpcPropertyOwnershipCli.test.ts` — passed (102 tests passed) ## Compatibility, safety, and release - Breaking changes or migration steps: None. - Real Hopper/Ghidra, browser, or OS coverage: Pure domain AST analysis. - Package or release metadata impact: None. - Security, privacy, process, or containment review: Pure static analysis; no execution or mutation authority. ## Author readiness Human owner: @ArifAli8866 - [x] 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. - [x] I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps. - [x] I declare this PR ready for initial maintainer review. ## Before merge - [x] This PR addresses a concrete problem or an agreed enhancement. - [x] Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff. - [x] The PR has one focused outcome and the title follows `type(scope): outcome`. - [x] Related issue is linked (Follow-up to #2805). - [x] Tests cover changed observable behavior and meaningful failure paths. - [x] Owning docs, contracts, and generated metadata are updated where needed. - [x] User-visible CLI/MCP changes include representative output. - [x] I checked the final diff for secrets, unrelated cleanup, and unsupported claims. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#5520
No description provided.