Skip to content

fix(regress): do not report PASS for replays that could not check the rule (#159) - #161

Open
RupeshMaster wants to merge 1 commit into
CodewithJha:mainfrom
RupeshMaster:fix/replay-inconclusive-pass
Open

RupeshMaster wants to merge 1 commit into
CodewithJha:mainfrom
RupeshMaster:fix/replay-inconclusive-pass

Conversation

@RupeshMaster

Copy link
Copy Markdown

Summary

Fixes #159. replay_regression returned PASS whenever no guarded rule fired, including when the rule could not have fired.

  • Core raises a new RegressionInconclusiveError instead of returning PASS when:
    • a guarded rule id is missing from the current policy (renamed or removed) — checked before the target is executed;
    • the artifact lists no rules or no conversation;
    • the target errored or timed out (trace.status == "error") and no guarded rule had fired. A violation observed before the timeout is still FAIL.
  • No caller changes were needed for the status: mutiny test and Hosted _run_one_test already turn replay exceptions into SKIPPED, and mutiny test already exits nonzero on unexpected skips (fix(cli): exit non-zero when tests have skipped cases unless --allow-skip (#71) #88).
  • mutiny test now prints the reason under the summary for each SKIPPED case (it was only in the JSON report), so a stale regression is actionable:
○ cli_discovered_violation .... SKIPPED  (0ms · rules=refund_limit · policy v1)

Summary: 0 passed, 0 failed, 1 skipped
Report:  .mutiny/test-report.json

  SKIPPED cli_discovered_violation: replay error: regression guards rule(s) missing from the current policy: refund_limit (renamed or removed?)

Behavior change to review

A regression whose rule was intentionally removed now shows as SKIPPED (exit 1 unless --allow-skip and another case passed) until the regression file is updated or deleted. That is the point of the fix, but it will surface in CI for projects that already have stale regressions. If you would rather report these as FAIL, or add a dedicated status, I can change it.

Files

  • mutiny_core/regress/__init__.py: RegressionInconclusiveError + checks in replay_regression (exported from mutiny_core).
  • mutiny_cli/test_cmd.py: print skip reasons.
  • docs/CLI.md, CHANGELOG.md.
  • Tests: 8 in tests/unit/test_regression.py (missing rule on vulnerable and fixed agents, partial missing, policy_rule_ids fallback, empty artifact, timeout before and after a violation) and 3 in tests/unit/test_mutiny_cli_test.py.

Type of change

Checklist

  • I read CONTRIBUTING.md (where to ask, how reviews work, how to run tests)
  • Linked related issue (Fixes #N) or Discussion when applicable
  • Core stays free of framework SDK imports (adapters own glue)
  • Tests added or updated when behavior changes (uv run pytest tests/unit -q)
  • Docs / README claims match reality (no PyPI / multi-adapter claims unless shipped)
  • One concern per PR when possible
  • Authorized testing only — no open-internet attack-proxy behavior

Test plan

  • Python lint: uv run --locked ruff check → all checks passed
  • Backend tests: uv run pytest tests/unit tests/integration tests/reliability -q → 859 passed. Run locally on Python 3.12 only (macOS, OPENAI_API_KEY unset); 3.11 is left for CI.
  • CLI smoke: from a copy of examples/openai_support_agent, mutiny --help, mutiny init, mutiny run with MUTINY_SAMPLE_OFFLINE=1 and empty OPENAI_API_KEY / FEATHERLESS_API_KEY → violation found, regression saved.
  • Web typecheck + build: not run; apps/web is not touched.
  • Package build + isolated artifact gate: tests/unit/test_package_release.py passed as part of the unit run; ./scripts/verify_release_artifacts.sh not run.

Extra: the reproduction from #159 (rename refund_limit in the sample policy, then mutiny test) now reports SKIPPED with exit 1 instead of PASS with exit 0. The existing suite needed no changes.

Notes

… rule

replay_regression returned PASS whenever no guarded rule fired, including
when the rule could not have fired:

- the guarded rule id is no longer in the policy (renamed or removed), so
  renaming a rule turned every saved regression green with exit 0
- the artifact lists no rules or no conversation
- the target errored or timed out before the conversation finished

These now raise RegressionInconclusiveError, which the CLI and Hosted
already report as SKIPPED (nonzero exit in `mutiny test`). A violation
observed before a timeout is still FAIL. `mutiny test` also prints the
reason for each skipped case, which was only in the JSON report before.
@vercel

vercel Bot commented Nov 27, 2026

Copy link
Copy Markdown

@RupeshMaster is attempting to deploy a commit to the priyanshu's projects Team on Vercel.

A member of the Team first needs to authorize it.

This branch has not been deployed

No deployments
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.

[bug] mutiny test reports PASS when the guarded rule was renamed/removed or the target timed out

1 participant