diff --git a/crates/mvm-conformance/tests/steps/cli.rs b/crates/mvm-conformance/tests/steps/cli.rs index da96908c6b..5ed8de60eb 100644 --- a/crates/mvm-conformance/tests/steps/cli.rs +++ b/crates/mvm-conformance/tests/steps/cli.rs @@ -162,6 +162,24 @@ fn scratch_working_directory(world: &mut CliWorld) { world.scratch_dir = Some(tempfile::tempdir().expect("create scratch working directory")); } +/// The `./policy/api-group.toml` group the policies guide validates: the +/// documented example itself, staged verbatim, so the scenario exercises the +/// exact invocation a reader pastes. +#[given(expr = "an authored policy group file in the scratch directory")] +fn authored_policy_group_in_scratch(world: &mut CliWorld) { + let scratch = world + .scratch_dir + .as_ref() + .expect("`Given a scratch working directory` must run before this step"); + let policy_dir = scratch.path().join("policy"); + fs::create_dir(&policy_dir).expect("create policy fixture directory"); + fs::write( + policy_dir.join("api-group.toml"), + "description = \"Read the GitHub API\"\n\n[network]\nallow = [\"api.github.com:443\"]\n", + ) + .expect("write policy group fixture"); +} + #[when(expr = "I run the conformance runner with {string}")] fn run_conformance_runner(world: &mut CliWorld, args: String) { run_conformance_child(world, &args, None); diff --git a/features/suites/s29_doc_examples/doc_examples.feature b/features/suites/s29_doc_examples/doc_examples.feature index 7e4a2882a8..1f522b8121 100644 --- a/features/suites/s29_doc_examples/doc_examples.feature +++ b/features/suites/s29_doc_examples/doc_examples.feature @@ -31,6 +31,14 @@ Feature: Documented examples work And the output contains "identity.signer_id" And the output contains "hardware providers:" + Scenario: policy validate checks an authored group file offline + Given an isolated mvm home + And a scratch working directory + And an authored policy group file in the scratch directory + When I run mvmctl in the scratch directory with "policy validate ./policy/api-group.toml --verbose" + Then the command exits with code 0 + And the output contains "policy is valid" + Scenario: a sealed audit fixture has a correlated JSON verdict Given an isolated mvm home And a sealed audit fixture for session "sha256:1111111111111111111111111111111111111111111111111111111111111111" diff --git a/features/suites/s29_doc_examples/docs_coverage.toml b/features/suites/s29_doc_examples/docs_coverage.toml index bf069b12dc..17820e0b86 100644 --- a/features/suites/s29_doc_examples/docs_coverage.toml +++ b/features/suites/s29_doc_examples/docs_coverage.toml @@ -238,6 +238,9 @@ covered = [ "mvmctl pack info runtime/node", "mvmctl pack ls", "mvmctl pack verify runtime/node", + "mvmctl policy validate ./pack-sources/agent/codex/pack/profile.toml", + "mvmctl policy validate ./pack-sources/runtime/node/pack/group.toml", + "mvmctl policy validate ./policy/api-group.toml", "mvmctl pool warm --image alpine", "mvmctl run -- npm test", "mvmctl run -- uname -a", @@ -514,12 +517,7 @@ uncovered = [ "mvmctl policy resolve agent-apis -o agent.json", "mvmctl policy show", "mvmctl policy show agent-apis", - "mvmctl policy validate", - "mvmctl policy validate ./pack-sources/agent/codex/pack/profile.toml", - "mvmctl policy validate ./pack-sources/runtime/node/pack/group.toml", - "mvmctl policy validate ./policy/api-group.toml", "mvmctl pool warm --flake ./flake.nix", - "mvmctl prepare", "mvmctl pull agent/claude", "mvmctl pull agent/claude@1.0.1", "mvmctl pull agent/codex", @@ -604,7 +602,4 @@ uncovered = [ "mvmctl why --secret anthropic --profile agent/goose", "mvmctl why --secret openai --profile agent/codex", "mvmctl why --secret openai --profile agent/opencode", - "mvmctl why --tool mvm.machine.list", - "mvmctl why --tool mvm.machine.stop", - "mvmctl why --tool shell --profile agent-apis", ]