Skip to content

Go: standard-library HTTP client calls (http.Get / http.Post / http.NewRequest) never produce HTTP_CALLS edges #2538

Description

@akynte

Version

Version: 0.11.0 (release). Also reproduced on main @ 96c3f41 built from source.

Platform

Linux (x64)

Install channel

GitHub release archive / install.sh / install.ps1

Binary variant

standard

What happened, and what did you expect?

Outbound HTTP calls made with Go's net/http package produce no HTTP_CALLS edge,
even with a literal absolute URL. Not even a plain CALLS edge is recorded for them. In
consequence cross-repo-intelligence never links a Go caller to the service it calls.
Equivalent Python (requests.get(url)) and JS (fetch(url)) calls do produce
HTTP_CALLS.

Expected: one HTTP_CALLS edge per call (GET /v1/payments/42, POST /v1/payments),
and CROSS_HTTP_CALLS to a service that registers matching routes.

Reproduction

  1. Code (go.mod: module example.com/client, go 1.22):
package main

import "net/http"

func getPayment() {
	_, _ = http.Get("http://payments:8080/v1/payments/42")
}

func createPayment() {
	req, _ := http.NewRequest(http.MethodPost, "http://payments:8080/v1/payments", nil)
	_, _ = http.DefaultClient.Do(req)
}

func main() { getPayment(); createPayment() }
  1. Index it, plus a server repo that registers http.HandleFunc("/v1/payments", h) and
    http.HandleFunc("/v1/payments/{id}", h). Then:
codebase-memory-mcp cli get_graph_schema '{"project":"<client>"}'
codebase-memory-mcp cli index_repository '{"repo_path":"/path/to/client","name":"<client>","mode":"cross-repo-intelligence","target_projects":["<server>"]}'
  1. Output: HTTP_CALLS is absent from the edge types, and cross_http_calls: 0.
    http.Post(url, ...), http.Get(url) and (&http.Client{}).Get(url) behave the same.

Attached repro.sh, section "Issue 2".

What we observed while debugging (instrumented build of 96c3f41, not a proposed patch)

  • Extraction is fine. For http.Get(...), first_string_arg is
    http://payments:8080/v1/payments/42, consistent with
    TEST(extract_go_binary_concat_url_issue1249).
  • In resolve_single_call (src/pipeline/pass_calls.c), registry resolution of
    http.Get is empty. The call then goes to the external-client fallback (comment at
    line 748, cross-repo-intelligence returns 0 edges for a byte-identical call/route #523), which classifies on the raw callee_name.
  • callee_name is http.Get. The service table entry is "net/http"
    (internal/cbm/service_patterns.c:54), so it never matches, and the import map passed
    in at that point is empty for this file (imp_count == 0), so the alias http cannot be
    expanded to net/http. The imports array, which does contain net/http, is
    available in the same function. Python works because the module name appears in the
    callee text (requests.get).

Full self-contained script (creates throwaway repos in a temp dir, isolated cache): see attached repro.sh.txt, section "Issue N". Run with bash repro.sh.txt [path/to/codebase-memory-mcp].

repro.sh.txt

Logs

"== Issue 2: Go net/http client calls produce no HTTP_CALLS edge"
repo i2-client go.mod <<<'module example.com/client

go 1.22'
repo i2-client main.go <<'GO'
package main

import "net/http"

func getPayment() {
	_, _ = http.Get("http://payments:8080/v1/payments/42")
}

func createPayment() {
	req, _ := http.NewRequest(http.MethodPost, "http://payments:8080/v1/payments", nil)
	_, _ = http.DefaultClient.Do(req)
}

func main() { getPayment(); createPayment() }
GO
commit i2-client; index i2-client
check "HTTP_CALLS edges in Go client" "$(count i2-client HTTP_CALLS)" 2
check "CROSS_HTTP_CALLS client -> legacy server (issue 1 control repo)" "$(cross i2-client i1-legacy cross_http_calls)" 2

Diagnostics trajectory (memory / performance / leak issues)


Project scale (if relevant)

No response

Confirmations

  • I searched existing issues and this is not a duplicate.
  • My reproduction uses shareable code (a dummy snippet or a public OSS repository), not proprietary code.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingparsing/qualityGraph extraction bugs, false positives, missing edgeswindowsWindows-specific issues

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions