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
|
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.