Skip to content

fix: recognize currency-formatted numeric policy arguments - #83

Merged
CodewithJha merged 1 commit into
CodewithJha:mainfrom
fatihcvs:fix/currency-numeric-constraints
Sep 24, 2026
Merged

CodewithJha merged 1 commit into
CodewithJha:mainfrom
fatihcvs:fix/currency-numeric-constraints

Conversation

@fatihcvs

Copy link
Copy Markdown
Contributor

Summary

Fixes #66. Numeric inequalities now accept a leading $ and valid comma-separated thousands groups, so $250 and 1,000.50 reach the same policy boundary as JSON numbers. Validate grouping before removing separators, so malformed values such as 1,00 remain non-numeric. Equality and $context. references are unchanged.

Document the contract in SYSTEM_DESIGN and cover all four inequality operators, malformed formats, context/equality behavior and actual refund-policy violations.

Type of change

  • Bug fix
  • Tests
  • Core engine (policy, campaign, minimize, regression)

Checklist

  • Read CONTRIBUTING.md
  • Linked related issue
  • Core remains free of framework SDK imports
  • Behavioral tests added and unit suite run
  • Documentation matches the implemented behavior
  • One concern per PR
  • Authorized local testing only

Test plan

  • New policy tests against unchanged code: 26 failed, 133 passed.
  • pytest tests/unit tests/integration tests/reliability -q --tb=short: 555 passed, one existing smoke script failed printing a Unicode character under the Windows default encoding.
  • With PYTHONUTF8=1, pytest tests/reliability/test_smoke_gate.py -q --tb=short: both tests passed, including that failing case.
  • Ran with MUTINY_SAMPLE_OFFLINE=1, isolated database/cache/temp paths, and uv available on PATH (the initial unit run could not locate uv for its wheel-build test).
  • git diff --check passed. No live model or hosted service was used.

@vercel

vercel Bot commented Sep 24, 2026

Copy link
Copy Markdown

@fatihcvs 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 @fatihcvs — this hits #66 / MUT-017 cleanly: _as_number now accepts a leading $ and validated thousands groups ($250, 1,000.50) for inequality operators, while $context. refs, equality, and malformed grouping (1,00, 250$) stay fail-closed. The unit matrix covers all four inequalities plus the refund_limit path, and SYSTEM_DESIGN documents the contract. GitHub Actions green on 3.11/3.12; ignoring Vercel auth.

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

Copy link
Copy Markdown
Owner

Merged — thank you @fatihcvs. Exactly the kind of focused Core policy fix Mutiny needs: LLM-style "$250" / "1,000.50" no longer slip past inequality constraints, malformed grouping stays fail-closed, and $context. / equality are left alone.

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

  • #1 — policy operator cheatsheet; the $ / thousands-group contract you just documented in SYSTEM_DESIGN belongs there too
  • #65 — another Core correctness hole (use_boundary_seeds / elite_count) in the same policy-campaign neighborhood
  • #7 — small policy.yaml comment-header polish if you want a lighter docs bite

No pressure — only if you want another one.

CodewithJha pushed a commit that referenced this pull request Sep 24, 2026
Keep the contributor-facing audit index accurate now that MUT-017/020/023/024/025/037 shipped.

Co-authored-by: Cursor <cursoragent@cursor.com>
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-017: Numeric constraints reject "$250"

2 participants