Repository navigation
ruff_charon: binary rows format with provenance and per-row FunDeclId (D-CODEGRAPH-0-BIN, PR A) - #133
Conversation
…RAPH-0-BIN) store_bin.rs: `<crate>.rows.bin` per lance-graph plan d-codegraph-0-binary-lanes §2/§8 - 64-byte header (magic, major/minor, PARTIAL flag, digest over [32..file_len), file_len, counts), an aligned section directory, codec9 codebook lanes (PRED, GRADE, FILE <=511 else u32, OBJ_KIND), u32 id lanes (SUBJ, OBJ, MAYT, START, END, FUNDECL), a symbol table with SYM_HASH and SYM_OWNER, and a PROV section where UNKNOWN is distinct from every value. The reader refuses each malformed shape with its own error. Not yet wired into Store. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01X6y3drwKSE2zSgoexheLFX
…e and FunDeclId `Store::import` writes `<crate>.rows.bin` first, then the TSV (on by default until the lance-graph reader reads the binary format), residuals and files. `rows()` reads the binary file and falls back to `rows.tsv` for a crate stored before the format existed; `rows_tsv()` keeps the text path. Each file carries one provenance record: Charon version, the Charon commit captured at build time, the LLBC digest, target triples and options, and rustc commit and source revision when the caller supplies them (`import_with`); anything not known is UNKNOWN. Every relation row carries the FunDeclId of the function it came from. A golden `cg_lib.rows.bin` pins the bytes for the lance-graph reader. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01X6y3drwKSE2zSgoexheLFX
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 63c74712fe
ℹ️ 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".
Summary
ruff_charonnow stores each crate's relation rows as<crate>.rows.binas well asrows.tsv. Ids are held in fixed-width lanes, labels live in their own sections, and a header digest covers everything after it. The lance-graph codegraph reader (PR B, a separate PR) will be able to skip an unchanged crate by reading 64 bytes and decode a changed crate without parsing text. The format follows lance-graph pland-codegraph-0-binary-lanes-v1.md§2 and Amendment A §8.store_bin.rscontains a pure writer and a verifying reader.[32..file_len),file_len, the counts, and reserved bytes that must be zero.EpiLane9codeword semantics with presence in bit 8. Codeword 0 means "absent" and never decodes as an entry. A crate with more than 511 files switches the file lane to a raw u32 lane.MAYTis precomputed exactly as the lance-graph reader'sdispatch_targetderives it.SYM_HASH(the digest of each label) andSYM_OWNER(the crate-prefix id).FUNDECLlane: each row's CharonFunDeclId. With one LLBC artifact per file,ARTREFis omitted.OBJ_KINDlane: today every object is a symbol.WORDandMETHODare reserved forINVOKES_WORD, whose source association is still an open decision.PROVsection: one record per LLBC artifact. It holds the Charon version, the Charon commit, the LLBC schema version, the LLBC digest, the rustc commit, the target triples plus Charon options, and the source revision. A field is UNKNOWN when it is not known, and the reader keeps UNKNOWN distinct from every value, including the string"UNKNOWN".ReadErrorvariant.Store:importwritesrows.binfirst, thenrows.tsv, residuals, and files last.with_tsv_export(false)turns it off.rows()readsrows.bin, falling back torows.tsvfor a crate stored before this change;rows_tsv()keeps the text path.import_with(.., &SourceProv)takes the rustc commit and source revision from the caller. The store never guesses them.provenance()reads the record back.build.rscaptures the Charon checkout's commit; any failure leaves the field UNKNOWN and never breaks the build.LlbcandRelation:Llbcgainscharon_versionandllbc_digest.Relationgainsfun: Option<FunDeclId>, set for every row harvested from a function.Golden fixture:
tests/data/golden/cg_lib.rows.binand.rows.tsvpin the bytes for the lance-graph reader. Re-bless them withCHARON_BLESS=1. Their provenance record leaves the build-dependent fields UNKNOWN.Test Plan
cargo testincrates/ruff_charon: every suite passes.store_bin: 27 tests.store_bin_store: 5 tests.cargo clippy --all-targets -- -D warningsandcargo fmtare clean.FUNDECL: the per-rowFunDeclIdtest fails.readers_refuse_unknown_versions_and_missing_columns, now callsrows_tsv(), because it exercises the TSV reader specifically.trait_impl_calls_are_not_danglingwrites a TSV-only store by hand and passes unchanged through the fallback.Limits:
loadreads the LLBC file twice, once for the digest and once through Charon's file deserializer. Charon has no JSON from-bytes API without a new dependency.Generated by Claude Code