Warn instead of printing on ambiguous output rules - #103
Draft
cemde wants to merge 1 commit into
Draft
Conversation
cemde
marked this pull request as draft
August 9, 2026 14:49
Vode.get printed "WARNING: Multiple output rules matched..." to stdout. A bare print cannot be filtered, captured, routed to a log or promoted with -W error, and inside a jitted step it fires once at trace time and never again, while the rule it silently discards stays discarded. Closes liukidar#79
cemde
force-pushed
the
fix/79-warn-not-print
branch
from
August 9, 2026 18:23
9f837b7 to
6807f5a
Compare
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.
Bug
Vode.getreported an ambiguous ruleset withprint. The source carried a# TODO: use warnings.Impact
A bare print cannot be filtered, captured by
pytest.warns, routed to a log, or promoted to an error with-W error, so CI cannot fail on it and a notebook user scrolls past it. Meanwhile the effect it reports, silently discarding every matched rule but the first, is permanent.Fix
UserWarning, the default, because an ambiguous ruleset is a defect in what the user wrote at authoring time rather than a dubious runtime condition inside the library. It is also the category shown by default in__main__and notebooks. The guarding test assertspytest.warns(UserWarning, ...), andRuntimeWarningdoes not subclass it.One neighbouring test deliberately builds an ambiguous ruleset to assert the first-rule policy, so it now carries a local
filterwarningsmarker. Verified that it hides nothing: the file passes under-W error::UserWarning, and the gate's warning summary still contains only the pre-existing equinox deprecation.Known limitation:
stacklevelstacklevel=2attributes the warning to the caller ofVode.get, which is right for a directvode.get("e"). It is wrong forvode(u, output="e"), becauseVode.__call__callsself.get(...)internally, so the report lands on_vode.py:230. That is the form every tutorial uses.There is no single correct value: direct
getwants 2, the__call__path wants 3. Left at 2 pending a decision on which entry point to optimise for. Worth knowing that under the default warning filter, dedup is per location, so in the__call__case every ambiguous Vode in a model collapses to one report.Under
jitthe warning fires at trace time only. Theprintit replaces had the same limitation.Closes #79