Skip to content

fix(synthesis): a test's request reaches only its own app's routes - #3370

Merged
colbymchenry merged 1 commit into
mainfrom
claude/issue-3320-test-requests-own-language
Nov 18, 2026
Merged

colbymchenry merged 1 commit into
mainfrom
claude/issue-3320-test-requests-own-language

Conversation

@colbymchenry

Copy link
Copy Markdown
Owner

Summary

In a repository holding a Java backend and a JavaScript or TypeScript server, a Spring test's request that no Java route served was linked to the TypeScript server's catch-all route. codegraph affected then selected Java tests for a change to the web code. A Spring/Kotlin test's request now reaches only JVM routes, and a Laravel test's only PHP routes.

Root cause

The test-request pass (#2100) links a Spring or Laravel test's request (MockMvc's get("/owners"), $this->get('/about')) to the route it reaches, so the controllers those suites exercise don't read as untested. testRequestEdges (src/resolution/tier-synthesizer.ts) matched each request against every route node in the index, whatever its language.

When no Java route served the path (an actuator path, or a controller in a module the index lacks), the request could land on a TypeScript Express catch-all GET /*. That edge made the Java suite a dependent of the server's code, and through it of whatever the server imports. That is the issue's "Java tests for an Angular service".

Fix

A test's request is served by the program it tests. The pass now matches a Java or Kotlin test only against JVM routes, and a PHP test only against PHP routes (sameLanguageFamily). The route table is filtered once per language.

Validation

  • __tests__/test-request-edges.test.ts, three new cases. The two cross-language cases fail on main and pass here; the file's 8 existing cases pass (11 passed).

    • A Java test's get("/management/health") no longer reaches a TypeScript Express GET /*, and the server's file no longer lists the test among its dependents. get("/owners") still reaches its Java route.
    • A Laravel test's $this->get('/pricing') no longer reaches the Express catch-all, and /about still reaches its PHP route.
    • A Kotlin test still reaches a Java route.
  • The issue's shape as a fixture: Spring + Angular, plus an Express server that imports the Angular service. codegraph affected on the service:

    • v1.6.3: the two Angular specs and HealthIT.java;
    • this branch: the two Angular specs.
  • A/B against v1.6.3's sources, 3 interleaved rounds:

    repo graph
    jhipster-sample-app (Spring + Angular, 62 test-request edges) byte-identical
    jsoup (Java) byte-identical
    invoiceplane (PHP) byte-identical
    flask, gin (controls) byte-identical

    Index-time medians moved within this machine's noise.

  • Full suite: see the PR's READY note.

Left out (a product call)

codegraph affected walks every edge kind. That includes the cross-tier edge from a web client's literal fetch/HttpClient call to the backend route it calls (http-client, also queue-job/event-bus). So a change to a Java class still selects the Angular specs of the services that call its endpoints: on the fixture, ItemService.java lists item.service.spec.ts and item.component.spec.ts. Whether test selection should cross that wire is the maintainer's decision, and this PR doesn't change it.

Credit

Thanks @jotder for the report.

Fixes #3320

🤖 Generated with Claude Code

@colbymchenry
colbymchenry force-pushed the claude/issue-3320-test-requests-own-language branch from 3db9451 to daba660 Compare November 18, 2026 03:54
The test-request pass (PR #2100) links a Spring or Laravel test's request
(MockMvc's `get("/owners")`, `$this->get('/about')`) to the route it reaches.
It matched the request against every route node in the index, whatever its
language. In a repository that holds a Java backend and a JavaScript or
TypeScript server, a Java test's request that no Java route serves (an
actuator path, a controller in a module the index lacks) landed on the
TypeScript server's catch-all `GET /*`. That edge made the Java suite a
dependent of the server's code, so `codegraph affected` selected Java tests
for a change to an Angular service the server imports, which the issue
reports as hundreds of Java tests for one `.service.ts`.

A test's request is served by the program it tests: the pass now matches a
Java or Kotlin test against JVM routes and a PHP test against PHP routes
(sameLanguageFamily), filtering the route table once per language.

Validation:
- test-request-edges.test.ts: a Java test's request no Java route serves
  no longer reaches a TypeScript Express catch-all (and the server's file
  no longer lists the test among its dependents), a Laravel test's
  `/pricing` no longer reaches it either, and a Kotlin test still reaches a
  Java route. The two cross-language cases fail on main and pass here;
  the file's 8 existing cases pass (11 passed).
- The issue's shape as a fixture (Spring + Angular + an Express server
  importing the Angular service): `codegraph affected` on the service lists
  the two Angular specs and no longer the Java test.
- A/B against v1.6.3 sources (3 interleaved rounds): jhipster-sample-app
  (Spring + Angular, 62 test-request edges), jsoup, invoiceplane, and
  controls flask and gin all produce byte-identical graphs; index-time
  medians moved within this machine's noise.

Left out, for the maintainer: `affected` also follows the cross-tier edges
from a web client's literal `fetch`/`HttpClient` call to the backend route it
calls, so a change to a Java class still selects the Angular specs of the
services that call its endpoints. Whether test selection should cross that
wire is a product call, left to the maintainer.

Fixes #3320

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

codegraph affected over-reports: returns tests in other languages and more files than the repo holds

1 participant