Skip to content

feat(coreutils-port): add module-vendor mode with manifest and drift CI#1593

Merged
chaliy merged 3 commits intomainfrom
claude/module-vendor-mode-I9ToM
May 7, 2026
Merged

feat(coreutils-port): add module-vendor mode with manifest and drift CI#1593
chaliy merged 3 commits intomainfrom
claude/module-vendor-mode-I9ToM

Conversation

@chaliy
Copy link
Copy Markdown
Contributor

@chaliy chaliy commented May 7, 2026

Summary

Adds module-vendor mode to bashkit-coreutils-port — a port-module
subcommand that vendors platform-clean uucore modules verbatim into
crates/bashkit/src/builtins/generated/<out>/, gated by a
vendored.toml manifest declaring per-import substitution policy.
Args mode is unchanged. Closes #1533. The first consumer (uucore::format
for the printf migration) lands separately as #1534.

What

  • port-module <UUTILS_DIR> <MODULE> [<REV>] subcommand. Existing
    positional CLI (args mode) is preserved unchanged.
  • Source split: main.rs (dispatcher) → args.rs, module.rs,
    manifest.rs. Args logic relocates verbatim.
  • Policy enforcement: walks every top-level use, flattens nested
    groups. Hard errors on Fluent / uucore::translate / uucore::i18n.
    Every other uucore-internal use must match a manifest substitution
    (unmatched aborts the port — silent emission of broken imports is
    rejected).
  • Substitution actions: error is fully implemented; inline /
    replace_with are accepted in the schema but error at runtime — they
    need the future syn-based import rewriter, which the first real
    consumer (Vendor uucore::format and migrate printf.rs to use it #1534) will drive.
  • vendored.toml lives next to the tool (the tool owns the manifest;
    the drift workflow only reads it). Initial manifest is empty.
  • coreutils-args-drift.yml extends to iterate the manifest and
    re-port every vendored module against uutils HEAD; args drift and
    module drift now land in a single auto-PR.
  • Spec updates: specs/coreutils-args-port.md gains a Module Mode
    section. specs/maintenance.md broadens the drift checklist.
    AGENTS.md spec-table description updated.

Why

Verification on a probe branch ruled out depending on uucore at
runtime: +98 s cold build, declared-but-unused 9 KB binary growth,
and a hard wasm32 break (uucore → rustix → errno). Vendoring
selected modules at port-time using the same machinery (and drift CI)
that args mode uses today gives reviewable, grep-able output and
predictable build times — at the cost of needing to re-run the recipe
on every uutils bump (the drift workflow handles that).

Tests

13 unit tests in bashkit-coreutils-port covering:

  • Happy path (external imports pass through verbatim with banner)
  • Fluent / uucore::translate / uucore::i18n hard errors
  • Unresolved uucore-internal imports
  • error action policy rejection
  • replace_with / inline rewriter-not-implemented errors
  • Module-not-in-manifest
  • Recursive directory walking
  • Use-tree group flattening (use uucore::{a, b})
  • Manifest schema parsing + unknown-action rejection

Test plan

  • cargo test -p bashkit-coreutils-port — 13/13 green
  • cargo fmt --check clean
  • cargo clippy --all-targets -- -D warnings clean across workspace
  • CLI smoke: port-module usage prints, missing module surfaces
    manifest path
  • YAML lint of updated drift workflow
  • CI green on this PR

Closes #1533


Generated by Claude Code

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented May 7, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
bashkit 407ccf0 Commit Preview URL

Branch Preview URL
May 07 2026, 10:40 PM

chaliy added 3 commits May 7, 2026 22:39
Adds a `port-module` subcommand to `bashkit-coreutils-port` that vendors
platform-clean uucore modules verbatim into
`crates/bashkit/src/builtins/generated/<out>/`, gated by a
`vendored.toml` manifest declaring per-import substitution policy.
Args mode is unchanged (legacy positional CLI preserved).

Tool capability only: the first consumer (uucore::format for the
printf migration, #1534) lands separately.

- main.rs splits into `args` / `module` / `manifest` modules; args
  logic relocates verbatim.
- Module mode walks every top-level `use`, flattens nested groups,
  hard-errors on Fluent / `uucore::translate` / `uucore::i18n`
  imports, and requires every other uucore-internal path to match a
  manifest substitution. `error` action is fully implemented;
  `inline` / `replace_with` are accepted in the schema but error at
  runtime — they need the future `syn`-based import rewriter.
- `vendored.toml` lives next to the tool (the tool owns it; the
  drift workflow only reads it). Initial manifest is empty.
- `coreutils-args-drift.yml` extends to iterate the manifest and
  re-port every vendored module against uutils HEAD; args drift and
  module drift now land in a single auto-PR.
- Spec updates: `specs/coreutils-args-port.md` gains a Module Mode
  section covering the substitution model, manifest schema, and
  drift integration. `specs/maintenance.md` broadens the drift
  review checklist. AGENTS.md spec table description updated.
- 13 unit tests cover happy path, Fluent rejection, unresolved
  imports, error/inline/replace_with actions, directory walking,
  and use-tree group flattening.

Closes #1533
`bashkit-coreutils-port` adds a `toml = "0.8"` dep to parse the
vendored-module manifest. cargo-vet's supply-chain audit fails CI
without exemptions for the transitive crates pulled in
(toml, toml_edit, toml_datetime, toml_write, serde_spanned, winnow).
@chaliy chaliy force-pushed the claude/module-vendor-mode-I9ToM branch from 586dbe0 to 407ccf0 Compare May 7, 2026 22:39
@chaliy chaliy merged commit 6738dde into main May 7, 2026
34 checks passed
@chaliy chaliy deleted the claude/module-vendor-mode-I9ToM branch May 7, 2026 23:09
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.

Add module-vendor mode to bashkit-coreutils-port

1 participant