Skip to content

feat(xtask): add non-Rust inventory command (#212, rollout PR 4/12)#216

Merged
EffortlessSteven merged 2 commits into
mainfrom
feat/xtask-non-rust-inventory-20260511
May 11, 2026
Merged

feat(xtask): add non-Rust inventory command (#212, rollout PR 4/12)#216
EffortlessSteven merged 2 commits into
mainfrom
feat/xtask-non-rust-inventory-20260511

Conversation

@EffortlessSteven

Copy link
Copy Markdown
Member

Summary

Fourth PR in the 12-PR file-policy rollout. First real Rust code in the ladder. Adds the xtask crate with the seed command that every later file-policy check will consume.

Issue

Closes #212. Refines #180 umbrella. Builds toward PR 5 (#204), PR 6 (#205), PR 7 (#206), PR 8 (#207), and the unified report (PR 9 / #208). Tracks #109.

Scope

  • xtask/ — new non-publishable workspace crate, publish = false.
  • xtask/Cargo.toml — inherits edition/license/MSRV from workspace. Deps: anyhow, clap (derive), serde, serde_json.
  • xtask/src/main.rs — clap CLI with non-rust inventory subcommand. Future subcommands (check-file-policy, non-rust propose, check-generated, etc.) attach to the same dispatcher in their PRs.
  • xtask/src/file_policy.rs — the inventory implementation. ~180 lines.
  • .cargo/config.toml — adds xtask = "run --package xtask --" so cargo xtask <cmd> works workspace-wide.
  • Cargo.tomlxtask added to workspace members; Cargo.lock updated (10 new dep-graph lines).

Decisions

  • Decision: Defer globset, toml, walkdir from the rollout spec's listed deps to the PRs that actually use them.

    • Rationale: Keep PR 4 minimal. inventory only needs git ls-files, extension matching, and JSON output. PR 5's check-file-policy will add toml (read the allowlists), globset (glob match), etc.
    • Alternatives rejected: Add all spec-listed deps upfront — adds review surface and unused transitives.
  • Decision: Binary classification (Rust source vs non-Rust). No finer-grained categorization in this PR.

  • Decision: Use git ls-files -z (subprocess) rather than walkdir.

    • Rationale: Spec is explicit. Also: respects .gitignore, doesn't traverse target/, and matches what the future checker should reason about.

Acceptance

  • cargo check -p xtask --locked passes.
  • cargo check --workspace --locked passes.
  • cargo clippy -p xtask --all-targets --locked -- -D warnings clean.
  • cargo fmt -p xtask -- --check clean.
  • cargo xtask non-rust inventory ran on this branch and reported:
    wrote target/policy (1184 total, 168 Rust, 1016 non-Rust)
  • Both target/policy/non-rust-inventory.md and target/policy/non-rust-inventory.json produced.
  • unsafe_code = "forbid" inherited from [workspace.lints] (no unsafe blocks anywhere).

Output preview

| Extension | Count |
|---|---:|
| `.snap`           | 813 |
| `.md`             | 144 |
| `.toml`           |  27 |
| `.yml`            |  16 |
| `.feature`        |   8 |
| `(no extension)`  |   5 |
| `.txt`            |   2 |
| `.lock`           |   1 |

Follow-ups

Fourth PR in the 12-PR file-policy rollout decomposition. First real
Rust code in the ladder. Adds the `xtask` crate with the seed command
that feeds every later file-policy check.

## Scope

- `xtask/` — new non-publishable workspace crate
- `xtask/Cargo.toml` — `publish = false`, inherits edition/license/MSRV
  from workspace. Deps: anyhow, clap (derive), serde, serde_json. Other
  deps from the rollout spec (globset, toml, walkdir) are deferred to
  the PRs that actually need them.
- `xtask/src/main.rs` — clap CLI with `non-rust inventory` subcommand.
- `xtask/src/file_policy.rs` — the inventory implementation.
- `.cargo/config.toml` — adds `xtask = "run --package xtask --"` so
  `cargo xtask <cmd>` works.
- `Cargo.toml` — `xtask` added to workspace members.

## Behavior

`cargo xtask non-rust inventory`:

1. Resolves the workspace root from `CARGO_MANIFEST_DIR`.
2. Runs `git ls-files -z` to enumerate tracked files.
3. Classifies each as Rust source (`*.rs`) or non-Rust.
4. Aggregates non-Rust files by extension (descending count, then
   alphabetical for ties).
5. Writes:
   - `target/policy/non-rust-inventory.md` — human-readable summary.
   - `target/policy/non-rust-inventory.json` — structured payload that
     PR 5 (#204) `check-file-policy` and PR 6 (#205) `propose` will
     consume.

`unsafe_code = "forbid"` is inherited from `[workspace.lints]`.

## Validation

- `cargo check -p xtask --locked` passes.
- `cargo check --workspace --locked` passes.
- `cargo clippy -p xtask --all-targets --locked -- -D warnings` clean.
- `cargo xtask non-rust inventory` ran successfully on this branch and
  reported: 1184 tracked, 168 Rust, 1016 non-Rust.
- Both `target/policy/non-rust-inventory.md` and
  `target/policy/non-rust-inventory.json` are produced.

Closes #212.
@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented May 11, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@EffortlessSteven has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 2 minutes before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: cd050ce6-8d4d-446c-a050-b5302cb2ff8c

📥 Commits

Reviewing files that changed from the base of the PR and between 5f286e1 and debcf9b.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (5)
  • .cargo/config.toml
  • Cargo.toml
  • xtask/Cargo.toml
  • xtask/src/file_policy.rs
  • xtask/src/main.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/xtask-non-rust-inventory-20260511

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@factory-droid

factory-droid Bot commented May 11, 2026

Copy link
Copy Markdown

Droid finished @EffortlessSteven's task —— View job


Review validation complete.

Review validated for PR #216 (feat/xtask-non-rust-inventory-20260511)

Validation result: No candidates to validate.

The review summary ("LGTM — no issues found") is consistent with:

  • Empty comments array in candidates file
  • Pure additive PR adding a new xtask crate
  • No behavioral changes to shipper-core, shipper-cli, or shipper facade
  • Diff shows only new files: .cargo/config.toml, Cargo.toml updates, xtask/Cargo.toml, xtask/src/main.rs, xtask/src/file_policy.rs

Status: approved — no actionable findings.

Workspace-wide `cargo fmt --all -- --check` wanted the two
serde_json::to_string_pretty + fs::write chains on single lines.
Caught by CI Lint step.

Acceptance:
- `cargo fmt --all -- --check` clean.
- `cargo xtask non-rust inventory` still works.
@factory-droid

factory-droid Bot commented May 11, 2026

Copy link
Copy Markdown

Droid finished @EffortlessSteven's task —— View job



Review validation complete.

Review validated for PR #216 (feat/xtask-non-rust-inventory-20260511)

Validation result: No candidates to validate.

The review summary ("LGTM — no issues found") is consistent with:

  • Empty comments array in candidates file
  • Pure additive PR adding a new xtask crate
  • No behavioral changes to shipper-core, shipper-cli, or shipper facade
  • Diff shows only new files: .cargo/config.toml, Cargo.toml updates, xtask/Cargo.toml, xtask/src/main.rs, xtask/src/file_policy.rs

Status: approved — no actionable findings.


@EffortlessSteven EffortlessSteven merged commit 92e4498 into main May 11, 2026
20 checks passed
@EffortlessSteven EffortlessSteven deleted the feat/xtask-non-rust-inventory-20260511 branch May 11, 2026 22:34
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.

feat(xtask): add non-Rust inventory command (rollout PR 4/12)

1 participant