Skip to content

TypeScript/Vitest test callers are missing, so explore falsely reports no covering tests #1415

Description

@niksh06

This was generated by AI during triage.

Summary

In an indexed TypeScript/Vitest project, direct calls from test cases to a production function are visible in the test source returned by node, but the corresponding test CALLS/coverage edges are absent. As a result, explore reports no covering tests found for a function that is directly exercised by several indexed tests, and callers(include_tests=true) omits those callers.

This is a silent false-negative in the test-provenance contract, not a missing or skipped test file.

Environment

  • codebase-memory-mcp 1.0.0-rc.1
  • macOS 26.5.1, arm64
  • Full index; coverage metadata is complete and current for all files in the reproduction
  • TypeScript source with Vitest tests and a barrel export

Reproduction shape

Production function:

// src/store/root-lease.ts
export async function inspectRootLease(root: string) {
  // implementation
}

The function is re-exported from src/store/index.ts. The test imports through that barrel:

// tests/store/lease-handoff.test.ts
import { inspectRootLease } from "../../src/store/index.js";
import { describe, expect, it } from "vitest";

describe("multi-agent lease handoff", () => {
  it("recognizes an exited owner", async () => {
    await expect(inspectRootLease(root)).resolves.toMatchObject({
      state: "recoverable",
    });
  });
});

In the real indexed file, inspectRootLease is called five times across four it(...) cases.

After indexing:

  1. node(file="tests/store/lease-handoff.test.ts") returns the complete test source, including direct calls.
  2. search_graph finds the test module and marks it is_test=true.
  3. explore(symbols=["inspectRootLease"]) reports no covering tests found.
  4. callers(symbol="inspectRootLease", include_tests=true, depth=3) returns only one production caller and no test caller:
{
  "symbol": "inspectRootLease",
  "callers": [
    {
      "name": "acquireRootLeaseWithRecovery",
      "file_path": "src/store/root-lease.ts",
      "hop": 1
    }
  ],
  "total_matched": 1
}

The indexed test-file node exposes only the module and helper functions; the Vitest it(...) callbacks that contain the calls are not represented as test callers.

Expected behavior

  • A direct call from an indexed test case must produce a test-provenance edge to the production function, whether the import is direct or through a barrel.
  • callers(include_tests=true) must return a test-owned caller or file-level test provenance for this case.
  • explore must not claim no covering tests found when indexed test source directly exercises the symbol.
  • If test linkage is incomplete, the response should report coverage as unknown/partial rather than a definitive negative.

Acceptance criteria

  • A TypeScript/Vitest regression fixture imports a function through a barrel and calls it inside multiple it(...) callbacks.
  • Every test use is represented by CALLS, TESTS, or TESTS_FILE provenance without collapsing the test cases.
  • callers(include_tests=true) exposes the test relationship.
  • explore no longer emits no covering tests found for the exercised function.
  • Direct imports and non-test callbacks remain unchanged as negative controls.

Related issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    parsing/qualityGraph extraction bugs, false positives, missing edges

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions