feat(cli): enforce operator init distro#1255
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds an operator-controlled boundary for astrid init so embedded distributions can enforce an init distro via ASTRID_ENFORCED_DISTRO, preventing callers from overriding it while preserving standalone Astrid’s requirement for an explicit --distro when no operator value is present.
Changes:
- Resolve
ASTRID_ENFORCED_DISTROduringastrid initdispatch and reject any CLI--distrooverride when it’s set. - Add targeted unit tests for neutral/enforced/override-rejection and malformed operator values, plus a CLI parsing regression for leading global options.
- Document the new operator hook in the changelog under
[Unreleased].
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| crates/astrid-cli/src/dispatch.rs | Adds ASTRID_ENFORCED_DISTRO resolution logic for init and unit tests covering enforced/neutral/invalid cases. |
| crates/astrid-cli/src/cli.rs | Adds a parsing regression test ensuring global options before init don’t interfere with --distro. |
| CHANGELOG.md | Documents the new operator-enforced init distro hook under [Unreleased]. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Reviewed be84f92. One compile error found and fixed (commit
|
2712d73 to
2981acc
Compare
2981acc to
1a55953
Compare
|
Reviewed 1a55953. The new commit adds
|
|
Reviewed 684d069. This head corrects distro source guidance throughout — help text, error messages, and test values now consistently use
|
|
Reviewed 8a701c9. The commit moves the four distro-specific CLI contract tests (
|
Linked Issue
Closes #1253
Summary
Adds a neutral embedding boundary for distributions that ship Astrid Runtime. A
launcher can select the distro used by
astrid initwithout copying Astrid'sargument grammar, and Astrid rejects a simultaneous caller
--distrooverride.Standalone Astrid remains distro-neutral and still requires an explicit distro
when no launcher selection is present.
Changes
ASTRID_ENFORCED_DISTROat init dispatch--distrowhenever an embedding launcher supplies the environment value--distrorequirement when the value is absent--grant-capsulespath[Unreleased]initanddistro applyhelp/errors to list only supported source formscli.rsstays under the source-file capinitanddistro applysources at the shared dispatch boundarySecurity boundary
ASTRID_ENFORCED_DISTROis process input, not a privileged Astrid securityboundary. An embedding launcher must overwrite any inherited value before
executing Astrid. A caller invoking standalone Astrid can set its own process
environment; the hook selects product composition but grants no Astrid authority.
Verification
fd4f4a92578b06c76f5253025683b529e883f5ecmainatf255e5fe53fc1f7131888706273e59ff3b54d4c5ac74f152; all seven commits carry GPG signaturescargo fmt --all -- --checkcargo metadata --locked --no-deps --format-version 1git diff --check origin/main..HEADcargo test -p astrid distro -- --nocapture(86 passed)cargo test -p astrid cli:: -- --nocapture(14 passed)cargo test -p astrid dispatch::tests:: -- --nocapture(9 passed)cargo test -p astrid commands::init::tests::distro_source_resolution -- --nocapture(4 passed)cargo clippy -p astrid --all-targets --all-features -- -D warningscli.rs955 lines;cli_distro_tests.rs101 lines under the test capChecklist
[Unreleased]No release is created or published by this change.