Skip to content

ruff_charon: rows v2 for Codegraph queries (D-CODEGRAPH-0 slice C, intake half) - #132

Merged
AdaWorldAPI merged 4 commits into
mainfrom
claude/codegraph-c-v2-rows
Nov 2, 2026
Merged

AdaWorldAPI merged 4 commits into
mainfrom
claude/codegraph-c-v2-rows

Conversation

@AdaWorldAPI

Copy link
Copy Markdown
Owner

Summary

Slice C (callers, callees, impact and diagnostics, read on the lance-graph side) needs facts that today's rows do not carry. All of them come from Charon's LLBC; nothing is inferred.

new from Charon why slice C needs it
PUBLIC f f item_meta.attr_info.public a dead-function check must not report API
IMPLEMENTS f Trait::method FunDecl.src TraitImpl / TraitDefault joins a possible dispatch to the impl methods it may reach
SYNTHETIC f f a name element other than Ident / Impl {promoted_const} would otherwise read as a dead function
REFERENCES f g ConstantExprKind::FnDef / FnPtr operands (not callees) a function used only as a pointer would otherwise read as dead
CRATE c COMPLETE|PARTIAL (store) has_errors absent rows from a partial crate are not evidence of absence
MAY_DISPATCH object Trait::method via kind the call's method id, previously dropped possible callers of one impl method, without matching names
  • Every new fact counts in the receipt: it is either a row or a residual (TRAIT_METHOD_NOT_FOUND, REFERENCE_NOT_NAMED).
  • The rows artifact goes to #version 2.
  • Kythe output is unchanged:
    • the new predicates emit no anchors;
    • MAY_DISPATCH targets the trait through a new Relation::kythe_target.

Charon detail. Charon marks trait-impl methods public, because they take the trait's visibility. The two Shape::area impls therefore have PUBLIC rows: 9 in cg_lib, against its 7 pub fn. This transcribes Charon's flag as is.

Test Plan

Fixtures

  • cg_lib.kythe.golden and cg_app.kythe.golden are the Kythe output of main before this change. The v2 output equals them byte for byte.

  • fnref.rs / fnref.llbc is a new fixture with:

    • a function used only as a pointer;
    • an unused private function;
    • a call through a pointer argument.

    rustc reports dead_code on unused_private only.

  • cg_broken produces no LLBC: rustc stops on E0425/E0432 before Charon runs. A PARTIAL crate is therefore tested by setting has_errors on a loaded crate.

Results

  • All tests pass: 3 unit, 8 intake, 8 intake_v2, 10 store.
  • cargo clippy --all-targets -- -D warnings and cargo fmt --check are clean.

Disable runs, each red in its own test:

  1. References not collected: a_function_pointer_use_is_a_reference.
  2. Method dropped from MAY_DISPATCH: dispatch_is_never_a_confirmed_call and may_dispatch_names_the_method_and_keeps_the_kythe_target.
  3. Kythe skip of the v2 predicates removed: a_reference_is_not_a_kythe_anchor.
    • The goldens alone cannot see this leak. PUBLIC, IMPLEMENTS and SYNTHETIC rows reuse the DEFINES span, and the emitter drops duplicate entries.
    • Only a REFERENCES span (bytes 247..253 in fnref) shows the leak, so the first disable run stayed green until this test was added.
  4. Crate status ignores has_errors: the_crate_row_records_charon_errors.
  5. SYNTHETIC off: synthetic_items_are_flagged and the receipt count.
  6. PUBLIC off: public_functions_are_marked and the receipt count.

Not in this PR: the lance-graph reader, queries and diagnostics. They follow as a new lance-graph crate reading these artifacts.


Generated by Claude Code

…TE status; MAY_DISPATCH names the method

Slice C (D-CODEGRAPH-0) needs facts today's rows lack: visibility, which impl
method implements which trait method, synthetic items, function-pointer uses
(otherwise a pointer-only function reads as dead), and whether Charon reported
errors for the crate. MAY_DISPATCH now names Trait::method; Kythe output is
unchanged (golden test). Rows artifact version 2. New fixture fnref.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X6y3drwKSE2zSgoexheLFX
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X6y3drwKSE2zSgoexheLFX
@coderabbitai

coderabbitai Bot commented Nov 2, 2026

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8fdb7bff-1ee1-45a6-ad5b-b38a3a2d563a
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-02T06:49:28.872671Z 8846d81 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@AdaWorldAPI
AdaWorldAPI merged commit ed8fd41 into main Nov 2, 2026
35 of 37 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.

2 participants