Repository navigation
fix(vendor): 16 crawlers' process() reads its own data argument (#2429) - #2430
Conversation
|
Coverage: 94.44% (unit tier, Python 3.15,
Per-file detail: the |
|
Review: NEEDS CHANGES at
Non-blocking: Everything else independently re-verified: AST walk over all 97 |
… (#2430) 16 of the 24 dict-based crawlers' `process(self, data)` ignored the `data` argument and read the module-level `DATA` literal instead: `ipv4/qs_function`, `tos_del`, `tos_ecn`, `tos_pre`, `tos_rel`, `tos_thr`, `ts_flag`; `ipv6/option_action`, `qs_function`, `smf_dpd_mode`; `mh/binding_error`, `lla_code`; and `pcapng/filter_type`, `hash_algorithm`, `secrets_type`, `verdict_type`. 8 siblings, such as `ipv4/classification_level`, already use `data` correctly. Harmless today, since every real call site passes `request()`'s own `DATA`-returning value, so `data is DATA` always held in practice -- but a caller passing different data, such as a test fixture or a future `LINK`-based fetch (the open TODO in `pcapng/filter_type.py` already points that direction), got the module's table back regardless, with no error. `pcapkit-vendor` regenerates `pcapkit/const/`, not `pcapkit/vendor/` itself: these dict-based crawlers are hand-written, so no template needed the same fix and no `const/` regeneration follows from it. New test drives each crawler's `count()` and `process()` on a fabricated registry sharing none of the module's names, proving the rendered output now reflects the argument rather than the module global; confirmed to fail against the unfixed crawlers first. Closes #2429.
b2e69d9 to
fd12a4c
Compare
|
Review: GOOD TO GO at
|
Round 10, the closing-condition test: a full re-grep across the entire repo found exactly 3 items, all outside the carve-outs round 9 already settled. * pcapkit/protocols/protocol.py + foundation/registry/protocols.py: RegistryError said "protocol must be a Protocol subclass" while the adjacent issubclass() check and the Raises: docstring both say ProtocolBase -- fixed the message text to match, with the three test assertions that locked the old string. * tests/foundation/reassembly/test_deferred_pickle_2423_unit.py: a docstring said "this pull request's earlier commit", stale now that #2424 landed as one squashed commit on main -- reworded to cite the issue instead of the PR's own history. * tests/protocols/transport/test_tcp_mptcp_option_attr_2293_unit.py: a cross-reference cited the nonexistent module pcapkit.corekit.fields.enums.EnumField; the real path is pcapkit.corekit.fields.numbers.EnumField. No executable logic changed: an AST structural diff (ignoring string constants) against origin/main is identical for every touched file, and the RegistryError fix only changes the text of a raised message, not what triggers it. Re-verified and rejected two relayed findings that didn't survive a direct check: a transport.py:188-189 and a registry/protocols.py:370 cross-reference claim both already read correctly on this base. Re-swept vendor/process() for siblings of #2429/#2430 -- none found. docs/source and the rest of tests/ came back clean. Build: tests/protocols/test_register_class_guard_unit.py, tests/foundation/registry/test_protocols.py, tests/foundation/reassembly/test_deferred_pickle_2423_unit.py, tests/protocols/transport/test_tcp_mptcp_option_attr_2293_unit.py and tests/project/test_docs_issue_pr_roles_1103_unit.py pass. Closes #1103.
make pylint,make mypy,make isort)make testpasses, and a test case covers the changedocs/source/changelog/and regeneratedCHANGELOG.mdWhat is the purpose of your pull request?
fix— corrects a defectDescription of your pull request and other information
16 of the 24 dict-based
pcapkit.vendorcrawlers'process(self, data)ignored thedataargument and read the module-level
DATAliteral instead. Harmless today, since every realcall site passes
request()'s ownDATA-returning value, sodata is DATAalways held inpractice — but a caller passing different data would have gotten the module's table back
regardless, with no error.
pcapkit-vendorregeneratespcapkit/const/, notpcapkit/vendor/itself, so thesehand-written crawlers needed no template fix and no
const/regeneration follows.New test (
tests/vendor/test_vendor_process_uses_passed_data_2429_unit.py) drives eachcrawler's
count()/process()on a fabricated registry and proves the output now reflectsthe argument rather than the module global; confirmed to fail against the unfixed code first.
Closes #2429.