Repository navigation
fix(foundation): keep format='pcap' when an unavailable engine falls back to the default one (#1264) - #1430
Merged
Conversation
…back to the default one (#1264) Extractor replaced format='pcap' with 'json' from the requested engine name, before run() found that engine missing and ran the default PCAP engine, so out.json was written where out.pcap was asked for. The trace format guard had the same flaw. - Factor the availability check out of run() into _select_engine(), and call it in __init__ before the format decisions, so both follow the engine that actually runs. A second call is silent, so each fallback still warns once. - The FormatWarning now names the normalised engine, as the trace one does. - test_extraction._traced patches _select_engine out with run, so its dict-frame cases keep testing the guard on hosts missing those engines. Tests: new test_extraction_engine_fallback_format_unit.py (fails without the fix: 29 failed, 3 passed); foundation/interface modules and the foundation unittest leg pass.
Owner
Author
|
Verdict: GOOD TO GO at
|
Contributor
|
Coverage: 89.45% (unit tier, Python 3.14,
Per-file detail: the |
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.
make pylint,make mypy,make isort) — run onextraction.py(isort also on the tests); no new findingsmake testpasses, and a test case covers the change —tests/foundationandtests/interfacemodule by module, thefoundationunittest leg, andtests/projectWhat is the purpose of your pull request?
fix— corrects a defectDescription of your pull request and other information
Closes #1264
Extractor.__init__swappedformat='pcap'for'json'from the requested engine name;run()only later found the engine unavailable and ran the default PCAP engine. The availability check now lives in_select_engine(), which__init__calls before the format and trace-format guards, so both follow the engine that runs. Each fallback still warns once.Probe (
examples/captures/test.pcap,format='pcap'/'cap', Python 3.14):pypcap,pcap_ct(not installed),pyshark,pypcapfile(unsupported) wroteout.jsonbefore and now writeout.pcap, byte-identical to the input.dpkt/scapy, which do run, still getout.jsonplus theFormatWarning.tests/foundation/test_extraction.py::_tracednow patches_select_engineout alongsiderun; it pinned the guard firing for engines that can't run on this host. TheFormatWarningtext now names the lowercased engine (engine=dpkt, notengine=DPKT), as the trace one already did.New
test_extraction_engine_fallback_format_unit.py: 4 passed / 28 subtests with the fix; 29 failed, 3 passed without it.