Skip to content

fix(pipeline): compose axios.create baseURL into HTTP_CALLS (#1916) - #2332

Merged
DeusData merged 2 commits into
mainfrom
fix/issue-1916
Sep 30, 2026
Merged

DeusData merged 2 commits into
mainfrom
fix/issue-1916

Conversation

@DeusData

Copy link
Copy Markdown
Owner

The Vue-admin wrapper pattern -- const api = axios.create({ baseURL: '/api' }); export default api in one module, api.get('/orders') in
another -- produced no HTTP_CALLS edge, so cross-repo-intelligence found
nothing to link to the backend's GET /api/orders.

Root cause: nothing recorded that api is an axios instance. The call
api.get('/orders') fell through to the route-registration suffix
fallback (.get + a '/'-leading argument), which treats it as an Express
app.get REGISTRATION: a CALLS edge to a phantom server-side Route
/orders (via=route_registration), and never an HTTP_CALLS edge. The
base path was unknowable anyway.

Fix, reusing HTTP_CALLS/Route (no new labels):

  • extraction (JS/TS/TSX/ArkTS): a module-level binding initialised by
    axios.create(...) records http_client="axios" and the literal
    baseURL (NULL when absent or non-literal, never guessed); the Module
    def carries the same pair when its default export is such a client
    (export default api / export default axios.create(...)). ES default
    imports are flagged (CBMImport.is_default).
  • both call resolvers (pass_calls.c, pass_parallel.c), before the cross-repo-intelligence returns 0 edges for a byte-identical call/route #523
    callee-spelling check and the route-registration fallback: a
    <recv>.<verb>(path) whose receiver binds -- same file, named import, or
    default import -- to a client emits HTTP_CALLS to base + path (axios
    combineURLs: trailing '/' trimmed, absolute URLs kept as-is, path kept
    when the base is unknown). Shared helper
    cbm_pipeline_http_client_call_url keeps the two paths identical.
  • incremental: the client pair joins the file's LSP surface (only for files
    that have one, so every other surface sha is unchanged), so a baseURL
    edit pulls importers into the closure; delta preseed proxies carry the
    two keys so a caller re-resolved alone still sees its unchanged wrapper.
  • result_compact relocates the two new strings (ASan caught the dangling
    worker-arena pointer).

Look-alikes (factory.create({ baseURL }), a plain object's .get) are
unchanged.

Test: pipeline_axios_wrapper_baseurl_composes_http_calls_issue1916 --
default/named/same-file/dynamic-base/look-alike cases, sequential vs
parallel resolver equality, and same-DB closure-repair reindex (wrapper
edit, then caller-only edit) converging with fresh indexes. RED on origin/
main (seq.wrapper_http == 0); each of the parallel, surface and preseed
pieces reverted alone turns its own assertion RED.

Fixes #1916


Touches the call resolvers (pass_calls.c / pass_parallel.c) like the #2053 PR, and extract_defs.c like #1428/#1457.

The Vue-admin wrapper pattern -- `const api = axios.create({ baseURL:
'/api' }); export default api` in one module, `api.get('/orders')` in
another -- produced no HTTP_CALLS edge, so cross-repo-intelligence found
nothing to link to the backend's GET /api/orders.

Root cause: nothing recorded that `api` is an axios instance. The call
`api.get('/orders')` fell through to the route-registration suffix
fallback (`.get` + a '/'-leading argument), which treats it as an Express
`app.get` REGISTRATION: a CALLS edge to a phantom server-side Route
`/orders` (via=route_registration), and never an HTTP_CALLS edge. The
base path was unknowable anyway.

Fix, reusing HTTP_CALLS/Route (no new labels):
- extraction (JS/TS/TSX/ArkTS): a module-level binding initialised by
  `axios.create(...)` records http_client="axios" and the literal
  `baseURL` (NULL when absent or non-literal, never guessed); the Module
  def carries the same pair when its default export is such a client
  (`export default api` / `export default axios.create(...)`). ES default
  imports are flagged (CBMImport.is_default).
- both call resolvers (pass_calls.c, pass_parallel.c), before the #523
  callee-spelling check and the route-registration fallback: a
  `<recv>.<verb>(path)` whose receiver binds -- same file, named import, or
  default import -- to a client emits HTTP_CALLS to base + path (axios
  combineURLs: trailing '/' trimmed, absolute URLs kept as-is, path kept
  when the base is unknown). Shared helper
  cbm_pipeline_http_client_call_url keeps the two paths identical.
- incremental: the client pair joins the file's LSP surface (only for files
  that have one, so every other surface sha is unchanged), so a baseURL
  edit pulls importers into the closure; delta preseed proxies carry the
  two keys so a caller re-resolved alone still sees its unchanged wrapper.
- result_compact relocates the two new strings (ASan caught the dangling
  worker-arena pointer).

Look-alikes (`factory.create({ baseURL })`, a plain object's `.get`) are
unchanged.

Test: pipeline_axios_wrapper_baseurl_composes_http_calls_issue1916 --
default/named/same-file/dynamic-base/look-alike cases, sequential vs
parallel resolver equality, and same-DB closure-repair reindex (wrapper
edit, then caller-only edit) converging with fresh indexes. RED on origin/
main (seq.wrapper_http == 0); each of the parallel, surface and preseed
pieces reverted alone turns its own assertion RED.

Fixes #1916

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
pc_module_var added a third compute-QN / find_by_qn / free sequence to
pass_calls.c, growing its memory-core ratchet (23 -> 24). Route all three
through pc_find_by_computed_qn, which leaves 22 raw sites, and ratchet the
pass_calls.c baseline down to match.

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
@DeusData
DeusData merged commit 5910c47 into main Sep 30, 2026
40 checks passed
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.

cross-repo-intelligence: HTTP_CALLS edges not detected for axios wrapper pattern

1 participant