feat: add brick_callers and brick_uncalled caller-status queries #4

Merged
trevon merged 2 commits from feat/caller-status into feat/cpp-rust-resolution 2026-09-22 21:15:02 +00:00
Owner

Summary

Stacked on #3 (feat/cpp-rust-resolution); review and merge that first. This adds agent-facing MCP queries that answer "is this function used?" without ever turning an unresolved call graph into a dead-code verdict.

  • brick_callers {node_id, assume_closed_world?} returns one of three statuses:

    • resolved, with the complete caller edges;
    • unknown, with the reasons callers may exist;
    • unreferenced.

    It also returns an evidence basis (heuristic or compiler), the language's metrics.resolution coverage, and a fixed caveat.

  • brick_uncalled {language?, assume_closed_world?, include_unknown?, limit?} returns per-language status counts and a deterministic list of review candidates.

  • Reasons for unknown:

    • same-name unresolved call sites, with counts by reason and example provenance (foreign-typed receivers and macros are excluded);
    • references by name (callbacks, address-taken, macro bodies, attribute strings);
    • virtual, trait-impl, external-base and outside-class members;
    • framework attributes (#[test], #[tool], …);
    • implicit invocation (constructors, operators, coroutine/range-for protocol);
    • entry points and test code;
    • parse-incomplete files;
    • exported or external-linkage functions, unless assume_closed_world is set.
  • Also adds the research write-up (docs/research/cpp-rust-resolution.md): the audit, the literature found through paperbridge, the experiment contract, results, and limits.

Validation on YAMS (dead-code candidates checked with grep)

  • Open world: 2 candidates, both genuinely unused.
  • Closed world: 357 production candidates. A first random sample of 25 was 20 correct, and I fixed the rules behind the misses. An independent sample of 30 was then 29 correct, and I fixed that miss too.
  • On Fold, all 5 open-world candidates are unused.

Test plan

  • cargo test (103 tests), clippy and fmt pass.
  • tests/callers.rs covers each reason with positives and clean negatives.
  • The MCP CLI tests and the mcp_runner.py self-test/run pass with the two new tools.
  • ./scripts/quality-gate.sh passes.

🤖 Generated with Claude Code

## Summary Stacked on #3 (`feat/cpp-rust-resolution`); review and merge that first. This adds agent-facing MCP queries that answer "is this function used?" without ever turning an unresolved call graph into a dead-code verdict. - **`brick_callers {node_id, assume_closed_world?}`** returns one of three statuses: - `resolved`, with the complete caller edges; - `unknown`, with the reasons callers may exist; - `unreferenced`. It also returns an evidence `basis` (`heuristic` or `compiler`), the language's `metrics.resolution` coverage, and a fixed caveat. - **`brick_uncalled {language?, assume_closed_world?, include_unknown?, limit?}`** returns per-language status counts and a deterministic list of review candidates. - **Reasons** for `unknown`: - same-name unresolved call sites, with counts by reason and example provenance (foreign-typed receivers and macros are excluded); - references by name (callbacks, address-taken, macro bodies, attribute strings); - virtual, trait-impl, external-base and outside-class members; - framework attributes (`#[test]`, `#[tool]`, …); - implicit invocation (constructors, operators, coroutine/range-for protocol); - entry points and test code; - parse-incomplete files; - exported or external-linkage functions, unless `assume_closed_world` is set. - Also adds the research write-up (`docs/research/cpp-rust-resolution.md`): the audit, the literature found through paperbridge, the experiment contract, results, and limits. ## Validation on YAMS (dead-code candidates checked with grep) - **Open world:** 2 candidates, both genuinely unused. - **Closed world:** 357 production candidates. A first random sample of 25 was 20 correct, and I fixed the rules behind the misses. An independent sample of 30 was then 29 correct, and I fixed that miss too. - On Fold, all 5 open-world candidates are unused. ## Test plan - [x] `cargo test` (103 tests), clippy and fmt pass. - [x] `tests/callers.rs` covers each reason with positives and clean negatives. - [x] The MCP CLI tests and the `mcp_runner.py` self-test/run pass with the two new tools. - [x] `./scripts/quality-gate.sh` passes. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Agents asking "is this function used?" get resolved, unknown, or
unreferenced per function instead of a bare zero in-degree. Unknown lists
why callers may exist: same-name unresolved call sites (excluding foreign
receivers and macros), name references (callbacks, address-taken, macro
bodies), virtual/trait-impl/external-base/outside-class members, framework
attributes, implicit protocol invocations, entry points, test code,
incomplete parses, and, unless assume_closed_world is set, exported or
external-linkage functions. Unreferenced is a review candidate with an
explicit heuristic/compiler evidence basis, never a dead-code proof.

The queries are read-only over validated schema-4 models and return
complete canonical nodes and edges plus metrics.resolution coverage.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
docs: record C/C++ and Rust resolution research and validation
Some checks failed
build / build-macos (pull_request) Has been cancelled
build / release (pull_request) Has been cancelled
build / build-linux (pull_request) Has been cancelled
6d4335d3ae
Adds the audit, literature rationale, experiment contract, labeled-corpus
results, Fold/Paperbridge/Brick/YAMS coverage and dead-code spot checks,
model changes, identity changes, and remaining limits.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
trevon merged commit 583c26588d into feat/cpp-rust-resolution 2026-09-22 21:15:02 +00:00
Sign in to join this conversation.
No reviewers
No labels
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
trevon/brick!4
No description provided.