Repository navigation
feat(policy): support dotted paths for nested tool arguments (#22) - #158
Open
RupeshMaster wants to merge 1 commit into
Open
RupeshMaster wants to merge 1 commit into
RupeshMaster wants to merge 1 commit into
Conversation
Constraint field names in when / require / forbid can now walk nested
tool arguments, so `recipient.domain` reads {"recipient": {"domain": ...}}.
- An argument key that matches the field name verbatim still wins, so
existing top-level rules behave as before.
- A missing key or a non-object intermediate (including lists) resolves
to None, the same rule as $context paths.
- The arg-proximity fitness signal follows the same paths, so numeric
when-boundaries on nested arguments still guide the search.
Closes CodewithJha#22
|
@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 was referenced Nov 27, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
when/require/forbidcan now be dotted paths into nested tool arguments, sorecipient.domainreads{"recipient": {"domain": ...}}. Closes policy: support dotted paths for nested tool arguments #22.None, the same rule as$context.paths. No wildcards or list indexes.arg_proximityfitness signal uses the same lookup. This was not in the issue's acceptance list, but without it a numericwhenboundary on a nested argument (payment.amount: {gt: 200}) gives the search no gradient. Happy to split it out if you'd rather keep this PR to the evaluator.What changed
mutiny_core/policy/constraints.py: newresolve_argument_value(arguments, field), used bymatches_constraint_map(exported frommutiny_core.policynext toresolve_context_value).mutiny_core/fitness/__init__.py:_arg_proximityreadswhenfields through the same helper.docs/SYSTEM_DESIGN.md(constraint operators section) andCHANGELOG.md(Unreleased).TestDottedArgumentPathsintests/unit/test_policy_evaluator.py(require, forbid,when, deeper paths, missing and non-object intermediates,$contextcomparison, verbatim-key precedence, YAML load) and one fitness test. Existing tests are untouched.Type of change
Checklist
Fixes #N) or Discussion when applicableuv run pytest tests/unit -q)Test plan
uv run --locked ruff check→ all checks passeduv run pytest tests/unit tests/integration tests/reliability -q→ 880 passed. Run locally on Python 3.12 only (macOS,OPENAI_API_KEYunset); 3.11 is left for CI.examples/openai_support_agent,mutiny --help,mutiny init,mutiny runwithMUTINY_SAMPLE_OFFLINE=1and emptyOPENAI_API_KEY/FEATHERLESS_API_KEY→ violation found, regression saved.apps/webis not touched.tests/unit/test_package_release.pypassed as part of the unit run;./scripts/verify_release_artifacts.shnot run.Extra checks:
main(ee7e898) and pass with this change.TargetAdapterwhoseissue_refundtool takes{"payment": {"amount": ..., "review": {"approved": false}}}and the policy above:mutiny runfindsnested_refund_limitin generation 0 andmutiny testreplays it; onmainthe same project ends with no violation after 48 candidates.Notes
SYSTEM_DESIGN.mdfor now.