Skip to content

fix: preserve matched conditions in require_args evidence - #84

Merged
CodewithJha merged 1 commit into
CodewithJha:mainfrom
Sonike:fix/require-args-matched-when
Sep 24, 2026
Merged

CodewithJha merged 1 commit into
CodewithJha:mainfrom
Sonike:fix/require-args-matched-when

Conversation

@Sonike

@Sonike Sonike commented Sep 24, 2026

Copy link
Copy Markdown

Summary

  • A compliant require_args call with a matching condition incorrectly reported matched_when=False. Track whether any relevant call satisfies the condition so successful evidence reports True, including when later calls do not match.
  • Keep scanning for later violations and preserve the existing violation and proximity results. Extend the policy matrix to cover matching/nonmatching conditions, multiple-call ordering, a later violation, absent tools, and unconditional requirements.
  • Fixes [BUG] MUT-037: Successful require_args records matched_when=False #79.

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

Validated with Python 3.12.13 and the offline sample mode (MUTINY_SAMPLE_OFFLINE=1), with isolated temporary database paths:

  • uv run --offline pytest tests/unit/test_policy_evaluator.py -q --tb=short: 5 failures before the fix; 123 passed after.
  • uv run --offline pytest tests/unit -q --tb=short: 380 passed, including package build/content checks.
  • uv run --offline pytest tests/integration tests/reliability -q --tb=short: 140 passed (one existing Starlette deprecation warning).
  • git diff --check: passed.

@vercel

vercel Bot commented Sep 24, 2026

Copy link
Copy Markdown

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

A member of the Team first needs to authorize it.

@CodewithJha CodewithJha left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Sonike — this hits #79 / MUT-037 cleanly: the require_args success path now tracks whether any relevant call matched when, so a compliant issue_refund(amount=250, approved=True) reports matched_when=True instead of the hardcoded False. Multi-call ordering, later violations, unmatched when, and absent tools stay correct. GitHub Actions green on 3.11/3.12; ignoring Vercel auth.

@CodewithJha
CodewithJha merged commit df2bafe into CodewithJha:main Sep 24, 2026
5 of 6 checks passed
@CodewithJha

Copy link
Copy Markdown
Owner

Merged — thank you @Sonike. Exactly the kind of focused Core evaluator fix Mutiny needs: compliant require_args evidence now reports matched_when=True when the when clause actually matched, without changing violation or proximity semantics.

If you'd like to continue working on Mutiny, these would be good related areas to look at:

  • #1 — policy operator cheatsheet; you already know the evaluator evidence shape
  • #65 — Core campaign knobs that currently no-op or stall (use_boundary_seeds, elite_count)
  • #7 — richer per-rule comment headers in the sample policy (XS, comments-only)

No pressure — only if you want another one.

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] MUT-037: Successful require_args records matched_when=False

2 participants