Repository navigation
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #695 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 53 53
Lines 5900 5918 +18
Branches 939 942 +3
=========================================
+ Hits 5900 5918 +18
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This was referenced Oct 15, 2026
… evaluators Refs #692 Signed-off-by: Fernando Macedo <fgmacedo@gmail.com>
…restricted mode The restricted evaluator looked a bare name up in the event keyword arguments before the model, while the trusted evaluator let the model win. A document with a datamodel variable named like a send() keyword argument took a different transition depending on trusted=. Both now resolve the datamodel (or bound model) first; the payload stays reachable as _event.data.<name>. Refs #692 Signed-off-by: Fernando Macedo <fgmacedo@gmail.com>
…e in trusted mode The trusted evaluator only read the model's instance __dict__, so a property, a class attribute or a slot resolved in restricted mode but fell through to the event payload (or NameError) under trusted=True. It now uses the same boundary as the restricted evaluator, model first, then the call kwargs. Model methods stay out of the trusted bare-name lookup: the restricted guard dialect calls them, which eval cannot reproduce per name. Refs #692 Signed-off-by: Fernando Macedo <fgmacedo@gmail.com>
…expressions Resolving non-instance model attributes by bare name let a class attribute, a property or a catch-all __getattr__ shadow builtins such as len or type under trusted=True, which broke expressions that worked before. Refs #692 Signed-off-by: Fernando Macedo <fgmacedo@gmail.com>
fgmacedo
force-pushed
the
fgmacedo/uml-w2d_names
branch
from
October 16, 2026 22:24
516608a to
7111277
Compare
…sions Signed-off-by: Fernando Macedo <fgmacedo@gmail.com>
fgmacedo
force-pushed
the
fgmacedo/uml-w2d_names
branch
from
October 16, 2026 22:26
7111277 to
cc0daf8
Compare
|
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.



Why
With a datamodel item
value = 1andsend("go", value=5),cond: "value == 5"was True when the document was loaded with the default restricted evaluator and False withtrusted=True(probe from the #692 review, bug B8). The restricted evaluator looked a bare name up in the event kwargs first; the trusted one letmodel.__dict__win and could not see properties, class attributes or slots at all. The docs did not state the precedence; the maintainer chose "datamodel/model wins".Refs #692
What changes
send()keyword argument, under bothtrusted=Falseandtrusted=True._event.data.<name>, and a payload key still resolves bare when the model has no attribute of that name.len,type, ...), which keep their previous behavior.docs/io/formats.md(Guards) documents the precedence with a doctest.docs/releases/3.3.0.md: a bug-fix entry and three upgrade bullets (restricted precedence, catch-all__getattr__models, trusted mode now resolving properties, class attributes and slots).Evidence
tests/io/test_name_resolution.py: every case runs under both evaluators (restricted/trustedfixture): datamodel-only, kwarg-only, model-only (instance attribute, property, class attribute, slots), datamodel+kwarg, model+kwarg for each model kind, a value written byassignthen shadowing the payload,_event.datareaching the payload, plus trusted-only checks for methods and builtin-named class attributes. Against the base commit d5282e0, 13 of these fail.main(with fix: enter history states by default without running the incoming effect twice #693, feat: accept x- extension keys in native documents and run the OMG PSSM 1.0 test suite #697, fix: report errors raised while an invocation processes its done.invoke #698), through the pre-commit hook (--cov-fail-under=100, branch): 3001 passed, 26 skipped, 126 xfailed;ruff,mypy,pyrightclean.tests/io/test_security.py: 587 passed, 42 xfailed before and after, same xfail list.cond: "value == 5", datamodelvalue: 1,send("go", value=5)): before,s1restricted vss2trusted; after,s2in both modes.model.__dict__, so properties, class attributes and slots resolved differently between modes. Fixed (_TrustedNamespace), with the model-kind matrix added.__getattr__could shadow builtins such aslen. Fixed and tested; also verifiedevalhonors__getitem__on a dict subclass on Python 3.10 to 3.14.Not verified
trusted=True. A restricted guard calls a bare method name (guard dialect), so a method-vs-kwarg collision and bare-method guards still differ between modes. Follow-up.trusted=True, a non-instance model attribute named like a builtin (id,type, ...) resolves to the payload or the builtin, while restricted mode resolves it to the model.__getattr__(proxy, Mock-like) now shadows every bare payload name;_event.data.<name>still reaches it.