Skip to content

feat(mapper): add rust source-group slices - #186

Merged
steipete merged 3 commits into
openclaw:mainfrom
joshuaboys:feat/rust-source-groups
Aug 11, 2026
Merged

feat(mapper): add rust source-group slices#186
steipete merged 3 commits into
openclaw:mainfrom
joshuaboys:feat/rust-source-groups

Conversation

@joshuaboys

Copy link
Copy Markdown
Contributor

Summary

  • Map Rust package modules under each crate src/ into bounded rust-source-group review slices (max 12 files), using the same partition helper as Node/Python.
  • Leave lib.rs, main.rs, and bin entrypoints on the existing library/command features so they are not double-owned.
  • Document the behaviour and cover ownership, chunking, and identity stability in mapper tests.

This is aimed at Cargo workspaces (for example anvil) where heuristic map previously only owned crate entrypoints (~18% of .rs files). Dry-run on anvil with this change raised owned source coverage from ~42% to ~88%.

Test plan

  • pnpm test src/mapper.test.ts -t Rust (7 tests)
  • pnpm test src/mapper.test.ts (430 tests)
  • pnpm typecheck && pnpm lint && pnpm format:check
  • pnpm build
  • Dry-run map against anvil: rust seeds 146 → 271; ownedSourceFiles 593 → 1236 of 1398

Post-merge

  • Install/link the release or main tip, then clawpatch map on consumers that want deeper Rust review coverage.

@joshuaboys
joshuaboys requested a review from a team as a code owner August 10, 2026 19:53
@clawsweeper

clawsweeper Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

Map package modules under each crate src/ into bounded review
features so Cargo workspaces get module-level ownership without
re-owning lib/main/bin entrypoints.
@joshuaboys
joshuaboys force-pushed the feat/rust-source-groups branch from 3ee9ff3 to 18239bd Compare August 10, 2026 19:54
@joshuaboys

Copy link
Copy Markdown
Contributor Author

Rebased onto latest main (resolved CHANGELOG conflict with 0.7.3).

CI workflows from this fork are currently in action_required (first-time/fork approval). Once a maintainer approves the CI / Secret Scanning / CodeQL runs and they go green, this is ready for rebase merge.

@clawsweeper clawsweeper Bot added P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 10, 2026
@clawsweeper

clawsweeper Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 10, 2026, 9:44 PM ET / August 11, 2026, 01:44 UTC.

ClawSweeper review

What this changes

Adds bounded feature slices for non-entrypoint Rust modules in Cargo packages, with mapper tests and documentation.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

Keep open: current main does not emit Rust source-group features, while the current PR head resolves the earlier identity and changelog feedback and has sufficient real Cargo-project proof for normal merge review.

Priority: P3
Reviewed head: 37b7c410203cbb4d317d143672c8aea0718fff92

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Focused implementation, regression coverage, green validation, and real Cargo-project proof make this a normal merge-ready PR.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): A maintainer recorded after-fix CLI output against real Cargo-generated projects, including stable source-group identity after adding an earlier module.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): A maintainer recorded after-fix CLI output against real Cargo-generated projects, including stable source-group identity after adding an earlier module.
Evidence reviewed 5 items Current-main gap: Current main's Rust mapper emits command, library, bin, and integration-test seeds but no bounded module source groups, so the PR's central capability is not already implemented.
Feature identity contract: Feature IDs are derived from kind, source, entry path, and identity key; anchoring Rust groups to the Cargo manifest while retaining the partition label addresses the previously identified ID churn path.
History and area ownership: Blame attributes the current Rust mapper baseline to the v0.7.2 release commit; history also records Peter Steinberger's earlier Rust mapping and bounded-test work.
Findings None None.
Security None None.

How this fits together

Clawpatch converts repository structure into deterministic feature records used by its review workflow. The Rust mapper reads Cargo package layouts and emits command, library, test, and now module-group feature records for downstream persistence.

flowchart LR
  A[Cargo packages] --> B[Rust mapper]
  B --> C[Detect entrypoints]
  B --> D[Collect module files]
  D --> E[Partition bounded groups]
  C --> F[Command and library features]
  E --> G[Feature mapping records]
Loading

Before merge

  • Complete next step (P2) - No repair lane is needed: the current head resolves the prior findings and already has sufficient behavior proof.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Implementation versus coverage production +99, tests +132, docs +2 The focused regression coverage exceeds the mapper implementation growth and includes ownership, chunking, and identity behavior.

Technical review

Best possible solution:

Merge the manifest-anchored, bounded Rust source-group implementation so Cargo workspaces gain module-level coverage without changing ownership of command or library entrypoints.

Do we have a high-confidence way to reproduce the issue?

Not applicable: this PR adds new deterministic mapper coverage rather than fixing a reported runtime failure.

Is this the best way to solve the issue?

Yes. Reusing the existing partition helper and a manifest-anchored identity key adds coverage without competing with established entrypoint features.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 1571f3143be5.

Labels

Label justifications:

  • P3: This is a bounded mapper coverage feature, not a repair for a broken user workflow.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): A maintainer recorded after-fix CLI output against real Cargo-generated projects, including stable source-group identity after adding an earlier module.
  • proof: sufficient: Contributor real behavior proof is sufficient. A maintainer recorded after-fix CLI output against real Cargo-generated projects, including stable source-group identity after adding an earlier module.

Evidence

What I checked:

  • Current-main gap: Current main's Rust mapper emits command, library, bin, and integration-test seeds but no bounded module source groups, so the PR's central capability is not already implemented. (src/mappers/rust.ts:22, 1571f3143be5)
  • Feature identity contract: Feature IDs are derived from kind, source, entry path, and identity key; anchoring Rust groups to the Cargo manifest while retaining the partition label addresses the previously identified ID churn path. (src/mapper-reconciliation.ts:4, 1571f3143be5)
  • History and area ownership: Blame attributes the current Rust mapper baseline to the v0.7.2 release commit; history also records Peter Steinberger's earlier Rust mapping and bounded-test work. (src/mappers/rust.ts:22, 3c2a1a4e2d04)
  • After-fix behavior proof: The maintainer follow-up records real Cargo-generated single-package and workspace runs, including an inserted earlier module retaining the source-group ID and entrypoints remaining outside groups. (src/mappers/rust.ts:63, 37b7c410203c)
  • Validation evidence: The PR context reports focused Rust tests, full tests, typecheck, lint, formatting, build, package smoke test, and GitHub CI, CodeQL, and secret-scan success on the current head. (37b7c410203c)

Likely related people:

  • steipete: Introduced and repeatedly maintained the Rust mapper history, then supplied the identity repair and changelog cleanup on this PR. (role: recent area contributor; confidence: high; commits: 2e7cf114fde8, e21f0a28cef6, a72a494ec588; files: src/mappers/rust.ts, src/mapper.ts, src/mappers/grouping.ts)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (4 earlier review cycles)
  • reviewed 2026-08-10T19:58:35.722Z sha 18239bd :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-11T01:12:34.608Z sha 18239bd :: needs real behavior proof before merge. :: [P2] Use a stable anchor for source-group IDs
  • reviewed 2026-08-11T01:36:13.957Z sha a72a494 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-11T01:39:29.546Z sha a72a494 :: needs changes before merge. :: [P3] Remove the release-owned changelog entry

@clawsweeper clawsweeper Bot added merge-risk: 🚨 session-state 🚨 Merging this PR could lose, corrupt, stale, or mis-associate session or agent state. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 11, 2026
@steipete

Copy link
Copy Markdown
Contributor

Maintainer follow-up pushed in a72a494.

The persisted-identity finding is fixed by anchoring every Rust source group to its crate manifest while retaining the partition label as the identity key. The regression now inserts a lexically earlier aardvark.rs; before the fix it changed feat_library_40e7ce0503 to feat_library_9f550a07a0, and after the fix the live CLI retained the same source-group ID.

Live proof used real Cargo-generated projects, not only test fixtures:

$ cargo check --manifest-path /tmp/clawpatch-rust-proof.dSZCr7/single/Cargo.toml
Checking single v0.1.0 (.../single)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.04s

$ node dist/cli.js --root /tmp/clawpatch-rust-proof.dSZCr7/single map --json
{
  "features": 4,
  "new": 0,
  "changed": 2,
  "stale": 0,
  "source": "heuristic",
  "usedAgent": false
}

$ rg --files /tmp/clawpatch-rust-proof.dSZCr7/single/.clawpatch/features | xargs jq -c 'select(.source == "rust-source-group") | {featureId,source,entrypoints,ownedFiles}'
{"featureId":"feat_library_b897c3972d","source":"rust-source-group","entrypoints":[{"path":"Cargo.toml","symbol":"src","route":null,"command":null}],"ownedFiles":[{"path":"src/aardvark.rs","reason":"source group src"},{"path":"src/alpha.rs","reason":"source group src"},{"path":"src/beta.rs","reason":"source group src"}]}

$ cargo check --manifest-path /tmp/clawpatch-rust-proof.dSZCr7/workspace/Cargo.toml
Checking cli v0.1.0 (.../workspace/crates/cli)
Checking core v0.1.0 (.../workspace/crates/core)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.14s

$ node dist/cli.js --root /tmp/clawpatch-rust-proof.dSZCr7/workspace map --skip-git-repo-check --json
clawpatch map inventory-done files=15 sourceFiles=9 ownedSourceFiles=9 weak=false elapsed=0s
{
  "features": 7,
  "new": 7,
  "changed": 0,
  "stale": 0,
  "source": "heuristic",
  "usedAgent": false
}

The workspace emitted one manifest-anchored source group for crates/cli owning commands.rs and the nested admin helper, and one for crates/core owning all four auth/storage modules. Dedicated lib.rs, main.rs, and bin main.rs entrypoints remained outside those groups.

Local validation:

$ pnpm test src/mappers/rust.test.ts
Test Files  1 passed (1)
Tests  5 passed (5)

$ pnpm test src/mapper.test.ts -t Rust
Test Files  1 passed (1)
Tests  7 passed | 429 skipped (436)

$ pnpm typecheck && pnpm lint && pnpm format:check && pnpm test && pnpm build && pnpm pack:smoke
exit 0

CI on a72a494 is green: CI run 31449622599, CodeQL run 31449622571 (Actions and TypeScript), and verified-secret scan 31449622586 all completed successfully.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. merge-risk: 🚨 session-state 🚨 Merging this PR could lose, corrupt, stale, or mis-associate session or agent state. labels Aug 11, 2026
@steipete
steipete merged commit ee535cf into openclaw:main Aug 11, 2026
7 checks passed
@joshuaboys
joshuaboys deleted the feat/rust-source-groups branch August 11, 2026 02:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants