chore: drop the unreachable duplicates in denial_reason() (#151) - #152
Merged
Conversation
The function ended with verbatim copies of two branches it had already run. Both conditions are character-identical to the earlier ones, the earlier ones always return, and nothing between them touches $required, $gate, or any state either condition reads — so the copies could never execute. Worth deleting rather than ignoring, because the duplicate tier block is a WORSE version of the one that runs: it omits the saddle_insufficient_scope branch. If it ever became reachable it would send an OAuth-scope-limited agent to raise the site's access level, which is the wrong screen — the exact bug #108 fixed. A stale copy of a corrected code path sitting next to the corrected one is how that comes back. No behaviour change and no new test: unreachable code cannot change behaviour, and the proof nothing moved is capabilities-test.php's existing gate-ordering coverage staying green. 612 tests, 0 lint errors. Closes #151
Contributor
Author
|
CI: red on the inherited #145 failure only.
Not claiming green. |
7 tasks
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.
Closes #151
What
Deletes 19 unreachable lines at the end of
Saddle_Capabilities::denial_reason().Why
The function ended with verbatim copies of two branches it had already run:
saddle_domain_drift.saddle_insufficient_scopeorsaddle_tier_denied— that block has no fall-through path.$requiredis assigned before both, and nothing between them touches it,$gate, or any state either condition reads.This is worth deleting rather than ignoring, because the duplicate tier block is a worse version of the one that runs — it omits the
saddle_insufficient_scopebranch. If it ever became reachable it would tell an OAuth-scope-limited agent to go raise the site's access level, which is the wrong screen, and is exactly the bug #108 fixed. A stale copy of a corrected code path sitting next to the corrected one is how that regression comes back.Found while reading
denial_reason()for #148, and kept out of that PR so the security diff stays reviewable.Testing
composer test— 612 tests, unchanged. No new test: unreachable code cannot change behaviour, and the proof nothing moved iscapabilities-test.php's existing gate-ordering coverage staying green.composer lint— 0 errorsphp -lcleanCI note:
mainis red onSaddle_Skills_Test::test_the_playbook_adapts_step_two_to_a_classic_theme(#145, CI-only, green locally). This branch inherits it; unrelated to this diff.