feat: unless exception clauses on require/forbid/permit/expect#52
Merged
Conversation
Extends require/forbid/permit/expect with an optional `unless <exception>` clause, mirroring the existing `when...unless` guard grammar but scoped to each verb's polarity: require/forbid/expect are excused when the exception holds, permit is narrowed (suppressed) when it holds. Zero new reserved words (`unless` was already a connective via `when` guards). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
rmichaelthomas
added a commit
that referenced
this pull request
Jul 15, 2026
feat: unless exception clauses on require/forbid/permit/expect
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
Adds
unless <exception>exception clauses to the four condition-grammar verbs —require,forbid,permit,expect— per Checkpoint v28 (Unless on Deontics Design Lock). Zero new reserved words:unlesswas already a connective via the existingwhen ... unlessguard grammar.Phases completed:
exception: ASTNode | Nonefield added toRequireNode/ForbidNode/PermitNode/ExpectNode(defaultcompare=True, since the exception is semantic content, not inert metadata).unlessconsumed inside each of the four verb parsers via a shared_try_consume_unless_exceptionhelper, positioned beforebecause/inherited/temporal metadata.require eachandwhenare untouched._exec_require/_exec_forbid/_exec_permit/_exec_expect:require/forbid/expectare excused when the exception holds;permitis narrowed (its emission suppressed) when the exception holds.unless <exception>renders between the condition and thebecausesuffix, in bothrenderandrender_with_explicit_precedence._check_choose_condition; mixedand/orin the exception triggers the amber prompt (this logic actually lives inparser.py's_contains_mixed_precedence/_condition_is_mixed, notanalyzer.pyas the original spec assumed — corrected during implementation);detect_contradictionsnow carries guarded deontics through with conditional wording (... unless <exception>[ or <exception>]) instead of excluding them.unless)" section indocs/language/syntax.md.test_require.py,test_forbid.py,test_permit.py,test_expect.py,test_contradiction_detection.py,test_render_roundtrip.py.Invariants verified:
VERBS|CONNECTIVES|OPERATORS|ARTICLES|V2_RESERVED|MULTI_WORD_RESERVED|DECLARATIONS) is identical before and after;vocabulary.pywas not touched. (Note:len(ALL_RESERVED)prints 61 both before and after this branch — a pre-existing, unrelated fact caused by the tombstonedcombineword being included in that constant.)RequireEachNodeandWhenNodeare untouched.unless, including full canonical metadata order.Test plan
pytest tests/— 1557 passed, 0 failedforbid total is above 10000 unless approved is equal to yeswithapproved = no→PROHIBITION_VIOLATEDapproved = yes→SUCCESS🤖 Generated with Claude Code