Skip to content

test: add coverage for trace --step CLI flag - #2161

Draft
github-actions[bot] wants to merge 1 commit into
mainfrom
test/trace-step-cli-coverage-4d9509b2880ccf57
Draft

github-actions[bot] wants to merge 1 commit into
mainfrom
test/trace-step-cli-coverage-4d9509b2880ccf57

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Test Gap Fixes

Test suite snapshot: ~1940 unit tests, ~315 integration tests, 55+ test fixtures

Added Coverage

Module Function/Path Why It Matters Test Added
src/inspect/trace.rs / src/inspect/cli.rs::dispatch_trace ado-aw trace <build> --step <id> end-to-end CLI path The --step flag was only exercised via internal unit tests calling build_trace_report(..., Some(step)) directly. No test drove the full CLI path (dispatch_tracebuild_trace → JSON/text rendering), so the "step found" success shape and the "step not found" warning-on-stderr behavior for an unknown step id were unverified end-to-end. Extended audit_pipeline_artifact_layouts_are_equivalent_end_to_end in tests/audit_it.rs with two new assertions: (1) trace --step threatAnalysis --json succeeds with a populated step/location/upstream/downstream JSON section and no missing-step warning, (2) trace --step does-not-exist --json still exits 0, emits "requested step was not found in the local IR graph" on stderr, and the JSON step field is null.

Validation

  • cargo test --test audit_it (5 passed)
  • cargo clippy --all-targets --all-features (clean)

This PR was created by the automated test gap finder. Previous run: 2026-09-07. Modules audited this cycle: inspect/lint.rs, inspect/whatif.rs, inspect/catalog.rs, inspect/trace.rs, compile/imports/merge.rs. Only inspect/trace.rs surfaced a meaningful, test-only-fixable gap (the CLI --step path); the others already had adequate coverage.

Generated by Test Gap Finder · auto · 89.9 AIC · ⌖ 6.25 AIC · ⊞ 10.3K ·

Adds two end-to-end assertions to audit_pipeline_artifact_layouts_are_equivalent_end_to_end
covering the previously-untested --step flag on the trace CLI subcommand:

- trace --step <id-present-in-ir-graph> succeeds, returns a populated step/location/
  upstream/downstream JSON section, and does not warn.
- trace --step <unknown-id> still exits 0, prints the "requested step was not found in
  the local IR graph" warning on stderr, and omits the step section from JSON.

Previously src/inspect/trace.rs only had unit-level coverage for the step-filtering
path (build_trace_report(..., Some(step))); no test exercised the full CLI
(dispatch_trace -> build_trace -> trace::render/JSON) with --step set.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
2 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

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.

0 participants