Repository navigation
Conversation
…eneric wrap - test_guess_version_reports_a_preface_with_no_frame_as_such's GOAWAY case asserted str(exception) == 'HTTP/2: invalid format', which #814 produced when the sixteen-octet GOAWAY's oversized declared length drove the ``debug`` field negative and struct.calcsize raised a bare struct.error. - #811 (fix(fields): raise ProtocolError, not struct.error, on a negative resolved field length) landed after #814's branch point and fixed that exact case at its root: FieldBase.length now raises ProtocolError itself, so http.py's ``except ProtocolError: raise`` passes it through unchanged instead of reaching the ``except (ValueError, struct.error)`` wrap that produced #814's message. The assertion was stale, not the behaviour. - Update the assertion to the field-level message ("Field debug resolved to a negative length; template='-1s'") while keeping every other check #814 cared about: still a catchable BaseError, still not a bare struct.error, still chained to the original struct.error via __cause__. Verified the failure on stock 3cbdf89 (CPython 3.14) and the fix passing on both 3.14 and 3.10; tests/protocols/application/ and tests/corekit/ otherwise pass (338 passed, 16 skipped -- 5 unrelated pre-existing failures in test_http_runtime.py were just missing generated sample captures, fixed by running examples/generators/make_samples.py). No production code changed, so coverage of pcapkit/protocols/application/http.py (98%) and pcapkit/corekit/fields/field.py (75%) is unchanged. Closes #822
|
CI evidence that this fix works, and that the 2 remaining red legs are not this PR's. On That is #819 — red on 3.10/3.11/3.12 only, fixed by #820, inherited here because this branch is cut from current So the board's entire red surface is now two defects with a PR each: #819 → #820, #822 → this. Cross-review is running; verdict to follow. |
|
Cross-review verdict: GOOD TO GO (opus; author was sonnet). It tested the judgement call empirically rather than reasoning about it, which is what makes this verdict worth having. Direction (B) really was rejected on a true premise. The reviewer patched (B) in — deleted the I verified the mechanism myself: Fix confirmed on both interpreters: FAIL/FAIL on One partial refutation, which I confirmed. Two of the three surviving assertions are tautologies inside Your indentation observation was right and is not a gate. Line 663 sits at column 27 against a visual indent of 26 — pycodestyle Three follow-ups filed rather than folded in here: #824 and #825. The 5 red legs are #819's, inherited — see above. I am holding the |
|
CI is complete — The decisive evidence that the fix works, rather than just that fewer things are red: Python 3.13, 3.14, Engines 3.13 and Engines 3.14 are all SUCCESS. Those are exactly the legs All 6 remaining failures are #819, one defect, confirmed from two logs rather than extrapolated from one: Same test, same assertion, on 3.10/3.11/3.12 × (Unit, Engines) only — inherited from |
…k comment (#824) The fallback-arm comment in `_guess_version` (roughly :358-395) documented measurements from before #799 and #811 landed, so three sentences described behaviour the code no longer has: - `HTTP(io.BytesIO(b'\x00' * 8), 8)` was cited as raising a bare `struct.error`; #799's nine-octet guard now answers `ProtocolError: unknown HTTP version` instead, re-measured on this tree. - The 16-octet `GOAWAY` example was cited as still raising a bare `struct.error` through `httpv2.HTTP` directly, with the fix left as future work "tracked as #805". #811 closed that at `FieldBase.length`; the same input now raises `ProtocolError: Field debug resolved to a negative length; template='-1s'`. - Both sentences are rewritten in the past tense with the current, re-measured outcome, keeping the surrounding causal explanation (why the last arm still suppresses `struct.error`, as defence in depth) intact. Comment-only change, no behaviour touched. Verified `tests/protocols/application/` still passes (122 passed, 1 pre-existing failure: #822's `test_guess_version_reports_a_preface_with_no_frame_as_such`, confirmed failing identically on stock `origin/main`, fixed by open PR #823 rather than here). Closes #824
|
Landed on
Verified before pushing, on top of
|
Please follow the guide below
make pylint,make mypy,make isort) -- not run this passmake testpasses, and a test case covers the change -- ran the targeted scope directly (pytest/unittest), not themake testwrapper; see belowdocs/source/changelog/and regeneratedCHANGELOG.md, if the change is user-visible -- N/A, changelog centralised in docs(changelog): shared 1.5.0 changelog — long-lived, merges last (#610, #616, #617, #618, #620) #657What is the purpose of your pull request?
fix— corrects a defectfeat— adds a featureperf— changes performance, not behaviourrefactor— changes neither behaviour nor performancetest— tests onlydocs— documentation onlyci— workflows or build toolingchore— anything elseDescription of your pull request and other information
mainwas red ontest_guess_version_reports_a_preface_with_no_frame_as_such's GOAWAY case: it assertedstr(exception) == 'HTTP/2: invalid format'(#814's generic wrap), but #811 landed after #814's branch point and fixes that exact negative-length case at its actual root —FieldBase.lengthnow raisesProtocolErroritself instead of a barestruct.error.http.py'sexcept ProtocolError: raisethen passes that more specific error through unchanged rather than reaching the wrap that produced #814's message. The assertion was stale, not the behaviour, so this updates it to the field-level message while keeping every other check #814 cared about (still a catchableBaseError, still not a barestruct.error, still chained via__cause__).No production code changed. Verified the failure on stock
3cbdf8999and the fix passing on CPython 3.14 and 3.10 (pcapkit.__file__checked in both).tests/protocols/application/+tests/corekit/otherwise pass (338 passed, 16 skipped); the 5test_http_runtime.pyfailures seen before regenerating samples were pre-existing and unrelated (missing generated captures, fixed byexamples/generators/make_samples.py). Coverage ofhttp.py(98%) andfield.py(75%) is unchanged since no source line moved.Closes #822