intent: the gated requiredWhen check is proved at runtime, not in the generated source (#7238) - #7424
Merged
Merged
Conversation
… generated source (#7238) Two coverage gaps from #7129 (`checks: requiredWhen`). The assistant-guide half landed in #7414, which added the kind's bullet; this adds the sentence that was still missing there - the `status:` gate is OPTIONAL and its PRESENCE is the routing (no gate: every controller's validate(), a 400; a gate: the repository, on the synchronous transition path). The second half is the IT. `IntentEmissionCoverageIT` asserted the gated check over its generated source only - the hop load, the condition, the message - and a source assertion cannot tell a gate that fires from one whose condition is never true, which is exactly the boxing failure mode the sibling #7237 was filed for. It could not do more: the check read `Account.name`, and that column is `required: true`, so the value it guards is always present and no write could ever be refused. `Account` therefore gains an optional `taxCode` and the check reads that. The runtime block drives all three outcomes over REST: an audited entry against an account with no tax code is refused at its gate status with the authored message (400), an entry with no note reaches the same status against the SAME account (the rule is a condition, not a `required` nobody declared), and the audited one passes once the ACCOUNT is amended - the related row, not the entry, which is what proves the gate reads the hop when the write is checked rather than a copy taken at create time. The entries carry balanced lines so the two document checks gating on the same status cannot be what refuses them. Fixes #7238 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
The gaps
Two, both from #7129 (
checks: requiredWhen, #7094).1. The assistant guide. Already fixed by #7414 (merged this morning), which added the kind's bullet. What was still missing there is the routing, the one thing an author has to decide: the
status:gate is OPTIONAL, and its presence is what decides where the rule is enforced. Added as two sentences to that bullet.2. The IT asserted source text only.
IntentEmissionCoverageITcheckedAccountRepository().findById(hop0Fk),java.util.Objects.equals(entity.Note, "audited")and the authored message over the rendered repository. Nothing drove a record to the gate status, so a guard that never fires would pass identically - which is precisely the failure mode of the sibling issue #7237 (Objects.equals(Long, int)is never true, so the rule looks authored and enforces nothing).And it could not do more as it stood: the check read
Account.name, which the fixture declaresrequired: true. The value it guards is therefore always present, and no write could ever be refused - the reason this check stayed source-text-only whilecomparegot a runtime block on the same day.The change
Accountgains an optionaltaxCode, and the gated check readsAccount.taxCode(message reworded accordingly). A rule over a REQUIRED column of the related row is unfalsifiable; the comment in the fixture says so.assertRuntimeEnforcement, all three outcomes over REST:Note: "audited"against an account with no tax code, with balanced lines so theitemsMin/itemsSumEqualgates on the same status cannot be what refuses it → 400 carrying the authored message;requirednobody declared);The ungated twin (
Doc, the controller's 400) already had runtime coverage from #7237; this is the other routing.Verification
mvn -o -P integration-tests -pl tests/tests-integrations verify -Dit.test=IntentEmissionCoverageIT -Dit.groups= -Dit.excludedGroups= -Dselenide.headless=true→Tests run: 1, Failures: 0, Errors: 0in 193 s, BUILD SUCCESS, against a fullquick-build installof this branch in an isolated local repository.mvn -o -pl tests/tests-integrations formatter:validatewith the formatter cache wiped first → BUILD SUCCESS.Fixes #7238
🤖 Generated with Claude Code