Two conformance kits reported pass when you pressed Ctrl-C - #102
Merged
Merged
Conversation
Reading the 211 open code-scanning alerts turned up four things behind the noise. PR #99 handles the noise; these are the defects under it. **`except BaseException` on a path that returns `passed`.** In the store kit, `no-not-executed` swallowed everything a store method raised and then reported the case passed, and `insert-not-upsert` did the same after inspecting the record. Press Ctrl-C during either and the suite whose whole purpose is to refuse false greens produced one. SPEC-v0.1 §5.5 is the rule and it is not "catch less": the executor path must catch BaseException, record, and **re-raise**. The breadth was never the defect -- an adapter or a store may raise anything and the kit must grade it -- the swallow was. `_not_ours_to_grade` re-raises what is not an Exception, at every catch site in both kits. The adapter kit's sites returned `failed` rather than `passed`, so they surfaced an interrupt instead of hiding it, but an interrupted run still produced a conformance verdict blaming somebody's adapter for the operator's Ctrl-C. **A cycle between the two gateway servers, which #96 introduced.** Moving `check_jwt_flags` into `server.py` and typing it against `GatewayConfig | OperatorConfig` needed a TYPE_CHECKING import of the console, so the gateway named the console and the console imported the gateway -- `py/unsafe-cyclic-import`, six times, and a layering inversion against ARCHITECTURE §6. The shared half moves to `gateway/wire.py`, below both: response bytes, JSON-RPC envelopes, the header lookup, the flag validation. Neither server imports the other, and a test says so, because nothing did. **The access log took the client's request line unescaped.** `log_message` interpolated it straight into a line-per-record log, where a newline forges a whole record -- the hazard `state.py` refuses control characters in an approver's name for. A log line cannot be refused, so it is escaped. **`repoint-claims.py` wrote wrong line numbers and its guard accepted them.** Both sides asked "which symbol is this citation about" and both answered with the whole row, so a row citing six commands had every reference re-pointed at one definition and the guard passed, because that line does define a symbol the row names. Two further defects fell out while fixing it: the rewrite was a global `str.replace` on the citation's text, so two citations of one line in a row could not move apart and fixing a stale one broke a correct one; and the tokenizer took only the first identifier in a backtick span, so `ctrlrun delegate` owned `ctrlrun` and looked stale. `tools/docs_audit/claims.py` is now the one producer, imported by the writer and by the guard, and it caught a reference this branch's own refactor had shifted. 7 mutations, 7 red, control green. 4052 passed.
Contributor
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
| ) | ||
| except BaseException: | ||
| pass | ||
| except BaseException as other: |
| try: | ||
| store.put_delegation(_delegation(identifier)) | ||
| except BaseException: | ||
| except BaseException as raised: |
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.
Reading the 211 open code-scanning alerts turned up four defects behind the noise. PR #99
handles the noise — the query filters and the redundant imports. This is what was under it.
Two false greens in the conformance kits
conformance/store/suites.pycaughtBaseExceptionon a path that returnspassed(...), intwo cases. Press Ctrl-C during either and the suite whose entire purpose is to refuse false
greens produced one.
SPEC-v0.1 §5.5 is the rule, and it is not "catch less": the executor path must catch
BaseException, record, and re-raise. An adapter or a store may raise anything and the kitmust grade it — the breadth was never the defect, the swallow was.
_not_ours_to_gradere-raises what is not an
Exception, at every catch site in both kits.The adapter kit's sites returned
failedrather thanpassed, so they surfaced an interruptinstead of hiding it — but an interrupted run still produced a conformance verdict blaming
somebody's adapter for the operator's Ctrl-C.
A cycle between the two gateway servers, which #96 introduced
Mine. Moving
check_jwt_flagsintoserver.pyand typing it againstGatewayConfig | OperatorConfigneeded aTYPE_CHECKINGimport of the console — so the gatewaynamed the console and the console imported the gateway.
py/unsafe-cyclic-import, six times,and a layering inversion against ARCHITECTURE §6.
The shared half moves down to
gateway/wire.py: response bytes, JSON-RPC envelopes, the headerlookup, the flag validation. Neither server imports the other, and a test says so — nothing
did, which is why the cycle landed.
The access log took the client's request line unescaped
log_messageinterpolated it straight into a line-per-record log, where a newline forges a wholerecord. That is the hazard
state.pyrefuses control characters in an approver's name for. A logline cannot be refused, so it is escaped — with a control test, because escaping that mangled
every ordinary line would be worse than the hazard.
repoint-claims.pywrote wrong line numbers and its guard accepted themFlagged in #96 and now fixed. Both sides asked which symbol is this citation about and both
answered with the whole row, so a row citing six commands had every reference re-pointed at
one definition — and the guard passed, because that line does define a symbol the row names.
Two more defects fell out while fixing it:
str.replaceon the citation's text, so two citations of one line ina row could not move apart — fixing a stale one broke a correct one beside it;
`ctrlrun delegate`owned
ctrlrunand looked stale.tools/docs_audit/claims.pyis the one producer now, imported by the writer and by the guard, sothey cannot disagree again. It immediately caught a reference this branch's own refactor had
shifted.
Verification
cycle coming back — so the assertion for it was written and the row went red.
ruff,ruff format --checkandmypy --strictclean.
using.
Merge order
Touches
tests/test_packaging.py, which #99 also touches — #99 removes a redundant importthere, this rewrites the CLAIMS guard in the same file. Merge #99 first and this will need a
trivial rebase; the two edits are in different functions.