Skip to content

ruff_charon: fix prek and the four Codex findings from #129 and #130 - #131

Merged
AdaWorldAPI merged 4 commits into
mainfrom
claude/ruff-charon-intake
Nov 2, 2026
Merged

AdaWorldAPI merged 4 commits into
mainfrom
claude/ruff-charon-intake

Conversation

@AdaWorldAPI

@AdaWorldAPI AdaWorldAPI commented Nov 2, 2026 •

Copy link
Copy Markdown
Owner

Summary

This follows #129 and #130. Both merged with a red prek job, and each had two Codex findings. This PR fixes all of them.

prek (main currently fails it on two lines this crate introduced):

  • typos: the base64 unit test used b"fo", which typos reads as a misspelling of "of"/"for". The vectors are now a / ab / abc.
  • markdownlint MD040: the test-data README had an unfenced command block. It is now a fenced sh block, and the README passes mdformat (with the hook's plugins) and markdownlint.

#129, Codex 1: an opaque body is counted twice in the receipt. A local function without a structured body was harvested once but counted as both a DEFINES row and a residual. The receipt could not conserve, so rows exited 3. The body is now harvested as its own item.

#129, Codex 2: a call through a known impl named only the trait. Two impls of one trait gave the same target, the row matched no DEFINES, and the Kythe call edge pointed at the trait. The row now names the function the call resolves to:

  • the impl's own method, from TraitImpl.methods;
  • otherwise the trait's default method.

An impl or method missing from the LLBC becomes a TRAIT_IMPL_METHOD_NOT_FOUND residual.

#130, Codex 1: dangling() reported trait-impl rows. After the fix above, no CALLS_RESOLVED row names a trait. The check also skips <trait> via … objects outright, so calls to functions are still checked.

#130, Codex 2: concurrent imports shared one temporary file. Every artifact write now goes through its own create_new temporary file (process id + counter) before the rename.

Test Plan

  • a_call_through_a_known_impl_names_the_resolved_function. It loads real LLBC of a one-file crate (tests/data/trprobe.rs, one trait with a default method, one impl) and rewrites three calls into TraitImpl calls. It checks three outcomes:

    • the impl's own method is named;
    • the inherited default is named;
    • a missing impl becomes the residual.

    It then removes the default from the impl's table, to reach the trait-default fallback. Charon itself emits no TraitImpl calls for any source tried: the fixture, mask-risc, and method, qualified and default-method calls. That is why the calls are rewritten.

  • an_opaque_body_keeps_the_receipt_conserved: the receipt conserves with one opaque body, which is harvested as a separate item.

  • trait_impl_calls_are_not_dangling: a trait row is not dangling, while a call to an undefined function in the same store still is.

  • concurrent_imports_of_one_crate_do_not_collide: 10 rounds of 8 threads importing one crate. Every import succeeds, the rows equal a clean import, and no temporary files are left.

  • Disable runs, each failing its own test:

    1. body not harvested separately;
    2. impl method ignored;
    3. no default fallback;
    4. trait rows checked by dangling again;
    5. one shared temporary path.

    Run 3 first stayed green: Charon lists inherited defaults in the impl's own table. The test now removes that entry to reach the fallback.

  • The crate passes (3 unit + 8 intake + 8 store); clippy -D warnings and fmt are clean. typos, markdownlint and mdformat on the changed files are clean. Full prek does not run in this sandbox.

🤖 Generated with Claude Code

https://claude.ai/code/session_01X6y3drwKSE2zSgoexheLFX

- typos: the base64 test's `b"fo"` reads as a misspelling; use a/ab/abc.
- markdownlint MD040: the test-data README's command block is now a fenced
  `sh` block.
- dangling(): a call resolved through a known trait impl names
  `<trait> via TraitImpl`, never a function, so a consistent store reported
  it as dangling. Such rows are no longer checked; function targets still are.
- Store::replace: every write goes through its own temporary file
  (create_new, pid + counter), so concurrent imports of one crate cannot
  publish each other's half-written bytes or rename each other's file away.

Tests: trait_impl_calls_are_not_dangling (a TraitImpl row is not dangling,
a call to an undefined function still is); concurrent_imports_of_one_crate_do_not_collide
(10 rounds of 8 threads, rows equal a clean import, no temp files left).

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: 5df7a25a-df43-448f-bc43-cf97c1f787c6
  • 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:20:22.050621Z 42bd8e3 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 42bd8e32a8

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/ruff_charon/src/store.rs Resolved
…129 review)

Two Codex findings on #129:

- A call through `TraitRefKind::TraitImpl` was a CALLS_RESOLVED row naming
  only the trait, so two impls of one trait gave one target, the row matched
  no DEFINES, and the Kythe ref/call edge pointed at the trait. It now names
  the function it resolves to: the impl's own method from
  `TraitImpl.methods`, else the trait's default method. An impl or method
  missing from the LLBC is a TRAIT_IMPL_METHOD_NOT_FOUND residual, never a
  row pointing at the trait.
- A local function without a structured body was harvested once but
  represented by its DEFINES row and also counted as a residual, so the
  receipt could not conserve and `rows` exited 3. The body is now harvested
  as its own item.

Tests: a_call_through_a_known_impl_names_the_resolved_function (real LLBC of
a one-file crate, calls rewritten into TraitImpl calls: impl method, trait
default, and a missing impl); an_opaque_body_keeps_the_receipt_conserved.
Charon emits no TraitImpl calls for any source tried here (fixture,
mask-risc, method/qualified/default-method calls), hence the rewrite.

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

The fixture's impl lists the inherited default method itself, so the
fallback was untested (a disable run stayed green).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X6y3drwKSE2zSgoexheLFX
@AdaWorldAPI AdaWorldAPI changed the title ruff_charon: fix prek (typos, markdownlint) and the two Codex findings from #130 ruff_charon: fix prek and the four Codex findings from #129 and #130 Nov 2, 2026
A restarted process can get the same id with its counter back at zero, so
an exclusive create hit a leftover and aborted the import. Try the next
counter on AlreadyExists; creation stays exclusive. A failed write removes
its own temporary file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X6y3drwKSE2zSgoexheLFX
@AdaWorldAPI
AdaWorldAPI merged commit 2033be4 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