Round two: G22 was passing for the wrong reason, and four regressions from round one - #166
Merged
Merged
Conversation
A second adversarial review round found eight defects, four of them regressions introduced by answering the first round. This is the one that matters most, and the review did not find it: it fell out of a document written to test one of the review's mutation survivors. G22 resolved the charges it fills the budget with through Control._charges_for, which answers from _AUTHORITY_RESULT, a context variable only execute sets, and G22 runs it before its own control leg. It therefore returned () whenever nothing had executed in that context yet: the synthetic hold reserved nothing, the budget was never filled, and the next action ran. On examples/authority/payments.yaml, ctrlrun verify --only G22 reported FAIL, which is the status that means the kernel is broken. In a full run it got the right charges only because an earlier scenario's execute had left its result in that variable. The milestone's headline guarantee, the one that proves a budget holds a charge at all, was passing because of what ran before it. G22 now resolves authority for its own action and asks the Authority directly, and a control leg asserts the charges are non-empty rather than filling nothing quietly. T413s grades G22 alone and in a full run and requires the two to agree. Four regressions from the first round, all demonstrated by the review: - An observed resumed receipt reported another action's spend. execute clears _BUDGET_CHARGES at its top; resume relied on _resumed_charges to do it, and the observe path skipped that call. A receipt for an action whose metric cannot be measured claimed a charge of 700 belonging to a different effect, on the one receipt §8.3 makes the whole evidence for an MCP multi round-trip. That is T448's defect on the observe path. - The resumed recompute was handed a throwaway _Observation(), so the block was discarded and the event written twice: the receipt said ALLOW with no blocked reason while two ACTION_DENIED events beside it said otherwise. An answer and the evidence may not disagree about the same action, which is the rule acs.py states one boundary lower. - Splitting the observe check dropped effect_key from the observed budget refusal, so the one event naming which effect a budget would refuse stopped naming it. - _UnmeasurableError was not picklable and InvalidArgument is. A caller fanning Control.execute across a ProcessPoolExecutor lost the pool instead of catching the refusal. Nothing in this repository pickles it, so only probing the type could have found it. And verify still exited 3 and still reported FAIL on ordinary documents, because _deciding_grant was wired into the resize loop but not the early return, and because it applied two of the four predicates Authority.evaluate applies. A task-bound grant carrying no budget was returned as the decider for an action outside its task, so a sibling's budget went unchecked. It now applies all four, in the same order. T413l to T413s pin these, plus four guards a mutation run found removable with the whole suite green: the grant-identity check in the resize loop, the resource-miss refinement, the metric miss note, and the per-candidate unmeasurable reset. Signed-off-by: arpan <contact@arpanghoshal.com>
…about which Enforce mode raises at the first refusal and never reaches the budget; observe mode runs every check and kept going, so it wrote a budget_exhausted event for an action enforce mode refuses out of scope. An operator reading the log saw a refusal that would never have happened. _observe_spend skips itself once anything has blocked. Its own docstring claimed the earlier clauses had already returned by then, which is not true of the scope block or the approval gate, and that sentence is corrected rather than left as the reason the bug was invisible. And §4.2.1 said the report and the enforcement cannot drift. That is true of the arithmetic and false of the ordering, which an independent review demonstrated twice more after three cases had already been fixed. §4.2.1b now states the limit: observe mode reports a refusal exactly when enforce mode would refuse, and does not promise to name the same one. The two cases still unaligned are named, with what they cost, and neither is an enforcement difference. Aligning the rest means one ordered list of checks both modes walk, which is a refactor of _secure and _observe_secure together rather than a fourth reordering. Three reorderings in this milestone produced four regressions between them. That is the argument for stopping here and saying so. Signed-off-by: arpan <contact@arpanghoshal.com>
|
Warning Review limit reachedNext included review available in 14 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (5)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
The invariant G22 broke. A guarantee that grades differently under --only is reading state an earlier scenario left behind, and then the report cannot be trusted either way round: whichever answer is right, one of them is produced for the wrong reason. Checked by hand across all twenty-four against the shipped example after the G22 fix, and all twenty-four now agree; G22 was the only one. The test keeps the three this milestone added honest, against the fixture the rest of the file uses so it stays cheap. Signed-off-by: arpan <contact@arpanghoshal.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.
A second adversarial review pass, requested before tagging 0.9.0. It found eight defects and seven surviving mutations; a ninth fell out of a document written to test one of the survivors, and it is the one that matters most.
G22 was passing for a reason that had nothing to do with G22
ctrlrun verify --only G22reported FAIL onexamples/authority/payments.yaml— the status that means the kernel is broken — while the full run reported PASS.G22 resolves the charges it fills the budget with through
Control._charges_for, which answers from_AUTHORITY_RESULT: a context variable onlyexecutesets. G22 runs it before its own control leg, so it returned()whenever nothing had executed in that context yet. The synthetic hold reserved nothing, the budget was never filled, and the next action ran.In a full run it got the right charges only because an earlier scenario's
executehad left its result in that variable. The milestone's headline guarantee — the one that proves a budget holds a charge at all — was passing because of what ran before it. G22 now resolves authority for its own action and asks theAuthoritydirectly, and a control leg asserts the charges are non-empty rather than filling nothing quietly.--onlyis the switch that exposed it, and T413s now grades G22 both ways and requires the two to agree.Four regressions from round one
All four were introduced by fixing the first review's findings.
executeclears_BUDGET_CHARGESat its top;resumerelied on_resumed_chargesto do it, and the observe path skipped that call. A receipt for an action whose metric cannot be measured claimed a charge of 700 belonging to a different effect — on the one receipt §8.3 makes the whole evidence for an MCP multi round-trip. That is T448's defect, on the observe path._Observation(), so the block was discarded and the event written twice: the receipt saidALLOWwith no blocked reason while twoACTION_DENIEDevents beside it said otherwise. An answer and the evidence may not disagree about the same action, which is the ruleacs.pystates one boundary lower._UnmeasurableErrorwas not picklable andInvalidArgumentis. A caller fanningControl.executeacross aProcessPoolExecutorlost the pool instead of catching the refusal. Nothing in this repository pickles it, so only probing the type could have found it.ctrlrun verifystill exited 3, and still accused the kernel_deciding_grantwas wired into the resize loop but not the early return, and it applied two of the four predicatesAuthority.evaluateapplies. A task-bound grant carrying no budget was returned as the decider for an action outside its task, so a sibling's budget went unchecked. It now applies all four, in the same order.Also fixed from the earlier round, both demonstrated by the first review and both mine: a resize could move the action onto a grant whose budget was never checked, and the resize set only the first budgeted metric, so a grant with budgets on two metrics was declined even when a fitting vector existed — silently, at exit 0, taking a document from thirteen graded guarantees to none.
Where I stopped, and why
§4.2.1 claimed the report and the enforcement "cannot drift". That is true of the arithmetic and false of the ordering:
_secureand_observe_secureare separate implementations and_Observationkeeps the first reason it is given. Three cases were found and aligned across the two rounds (approval gate, reservation, scope). The review demonstrated two more.§4.2.1b now states the limit instead of patching a fourth time: observe mode reports a refusal exactly when enforce mode would refuse, and does not promise to name the same one. The two unaligned cases are named with what they cost. Neither is an enforcement difference — observe mode refuses nothing either way.
Aligning the rest means one ordered list of checks both modes walk, which is a refactor of both functions together. Three reorderings in this milestone produced four regressions between them, which is the argument for stopping and saying so rather than continuing.
Verification
4,363 tests pass with Postgres;
mypy --strictandruffclean. Every fix here landed with the probe that reproduced it first, and eight of the review's mutations now die where they previously survived.ctrlrun verifyon the shipped example: 22/22, and now identical under--only G22.