feat(mapper): add contextFiles for rust seeds - #165
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed July 25, 2026, 12:35 PM ET / 16:35 UTC. ClawSweeper reviewWhat this changesThe branch adds Rust mapper context for each generated seed: its Cargo manifest, related crate entry point, and directly declared Rust modules, with focused Rust mapper tests. Merge readiness⛔ Blocked until real behavior proof from a real setup is added - 3 items remain This PR remains necessary because current main is identified as Priority: P2 Review scores
Verification
How this fits togetherClawpatch mappers turn repository files into feature seeds for later automated review and repair. The Rust mapper reads Cargo project structure and Rust source files, then emits each seed with nearby context files that downstream providers can inspect. flowchart LR
A[Rust workspace files] --> B[Rust mapper]
B --> C[Detect crate seeds]
C --> D[Collect manifest and module context]
D --> E[Feature seed]
E --> F[Provider review and repair]
A --> G[Cargo manifests]
G --> D
Before merge
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the focused Rust context expansion, then add a redacted terminal capture or live output from Do we have a high-confidence way to reproduce the issue? Unclear for a failing current-main path: the supplied issue and patch show that Rust seeds currently omit context, and the changed mapper path is source-reproducible, but this review could not run the mapper against a real fixture in the restricted read-only environment. Is this the best way to solve the issue? Yes, provisionally: extending the existing AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against deffd4b799bd. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
EvidenceReal Behavior Proof (clawpatch map): Ran clawpatch map on a real Rust project directory (src/main.rs with mod api;): json {
✓ src/mappers/rust.test.ts (3 tests) 15ms |
|
ClawSweeper status: review started. I am starting a fresh review of this pull request: feat(mapper): add contextFiles for rust seeds This is item 1/1 in the current shard. Shard 0/1. This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
|
Maintainer exact-head proof for
This resolves #164 while keeping direct module discovery bounded. |
Description
This PR resolves an issue where the Rust mapper emitted zero
contextFilesfor Rust seeds. As a result, AI-generated code and reviews lacked important project context, increasing the likelihood of incorrect assumptions about project structure, modules, and external crates.This change enriches Rust seed context by automatically including package manifests, crate entry points, and declared modules, resulting in more accurate and context-aware AI reasoning across Rust projects.
Changes Included
Manifest Context
Automatically includes the nearest
Cargo.tomlas a context file.Added with the reason:
cargo package manifest🔗 Entry Point Cross-Linking
When a crate contains both
src/main.rsandsrc/lib.rs, they are linked as context to each other.Added with the reasons:
crate library entrycrate binary entryThis mirrors the common Rust project structure where binaries import functionality from sibling libraries.
📁 Module Declaration Tracking
Added lightweight regex parsing for:
mod foo;pub mod foo;Module declarations are resolved to their actual source files:
src/foo.rssrc/foo/mod.rsResolved modules are included as context with the reason:
declared moduleContext expansion is capped at 16 files to avoid unnecessary AI context growth.
Testing
Added a dedicated test suite in
src/mappers/rust.test.tscovering:Type of Change
✔️ Verification
The following checks pass successfully:
Evidence
Test Results
Before
{ "entryPath": "src/main.rs", "contextFiles": [] }After
{ "entryPath": "src/main.rs", "contextFiles": [ { "path": "Cargo.toml", "reason": "cargo package manifest" }, { "path": "src/lib.rs", "reason": "crate library entry" }, { "path": "src/api.rs", "reason": "declared module" } ] }Closes #164