Skip to content

test: capture-driven parse→rebuild and dumper round trips (#1202) - #1445

Merged
JarryShaw merged 1 commit into
mainfrom
test/1202-roundtrip-coverage
Oct 9, 2026
Merged

JarryShaw merged 1 commit into
mainfrom
test/1202-roundtrip-coverage

Conversation

@JarryShaw

@JarryShaw JarryShaw commented Oct 9, 2026 •

Copy link
Copy Markdown
Owner

Refs #1202 (partly; see below). Both modules are fixture tier, so the integration job picks them up through fixture_tier_paths(); no workflow change.

Covered

  • tests/protocols/test_capture_roundtrip_runtime.py: every layer of every capture (6,6xx layers: the payload chain plus IPv6 extension headers) rebuilds from info and from info.to_dict(), Info survives to_dict/from_dict, and every capture rebuilds whole. 24 s, 223 MiB.
  • tests/dumpkit/test_capture_dump_runtime.py: format='pcap' is byte-identical for all 17 PCAP inputs; json/plist/tree are deterministic, with one section per record/block counted from the file; json frames carry every Info key and the chain. 33 s, 279 MiB.

Known failures: #1446 IPv6 extension-header .data keeps the rest of the datagram that .info lacks; #1447 from_data(info.to_dict()) drops the payload and IPv6 extension headers (HTTP raises ProtocolError); #1448 plistlib cannot read any plist dump (fractional <date>), now also cited by the existing skip in test_output_formats.py.

Not covered yet: protocol edge cases, reassembly/traceflow/engine parity/registry, corekit Field/Schema symmetry, const/vendor regeneration.

- tests/protocols/test_capture_roundtrip_runtime.py: every layer of every
  frame in examples/captures/ (payload chain plus IPv6 extension headers)
  rebuilds from its info, from info.to_dict(), and Info survives
  to_dict/from_dict; every capture rebuilds whole, byte for byte.
- tests/dumpkit/test_capture_dump_runtime.py: format='pcap' is
  byte-identical to its input; json/plist/tree are deterministic and hold
  one section per record or block; json frames carry every Info key and
  the protocol chain; plistlib reads the plist dump.
- Known failures sit in LAYER_GAPS (#1446), DICT_GAPS (#1447) and
  KNOWN_FAILURES (#1448), asserted in both directions; the existing
  plistlib skip in tests/integration/test_output_formats.py cites #1448.

Both modules are fixture tier (integration job): 4 + 6 tests, 24 s and
33 s, peak RSS 223 and 279 MiB.
@JarryShaw
JarryShaw force-pushed the test/1202-roundtrip-coverage branch from 485b151 to 0bc5b37 Compare October 9, 2026 01:07
@JarryShaw JarryShaw added review: running A cross-review is in flight against the current head - no verdict yet and removed review: pending No verdict for the current head - never reviewed, or the head moved since the last one labels Oct 9, 2026
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Coverage: 89.51% (unit tier, Python 3.14, 0bc5b3700, Unit Tests run success)

Package Statements Missed Branches Partial Cover
pcapkit (top level) 104 4 20 4 93.55%
pcapkit/const 18791 968 2352 869 90.90%
pcapkit/corekit 2043 89 636 25 94.77%
pcapkit/dumpkit 234 2 84 2 98.74%
pcapkit/foundation 2648 98 930 48 94.80%
pcapkit/interface 112 7 40 5 92.11%
pcapkit/protocols 16798 219 4520 183 98.08%
pcapkit/toolkit 539 74 168 3 84.58%
pcapkit/utilities 429 4 122 4 98.55%
pcapkit/vendor 4409 2342 1006 157 43.25%

Per-file detail: the coverage-html artifact of this run.

@JarryShaw

Copy link
Copy Markdown
Owner Author

Verdict: GOOD TO GO at 0bc5b3700 (Sonnet cross-review; the author ran on Opus).

  • The tests catch real breakage. Three deliberate mutations each turned the matching module red:
    • Ethernet make() dropping a byte: 3125 failing subtests.
    • A TCP MSS rebuilt off by one bit: 1181.
    • A JSON key reorder in dictdumper: 1616.
  • The known-failure table is checked both ways. Removing an entry fails the build, and so does listing a case that doesn't exist.
  • Coverage. The walk visits 6826 layers over 1616 frames in all 23 captures and stops only at NoPayload. PCAP-NG non-packet blocks are covered by the whole-file rebuild.
  • Known failures reproduce on 78991b7d5. fix(ipv6): an extension header parsed with extension=True cannot rebuild from its own info #1446 rebuilds 8 of 442 octets. fix(dumpkit): plist output is unreadable by plistlib because timestamps carry fractional seconds #1448 is dictdumper/plist.py:278.
  • Tier. fixture_tier_paths() lists both modules, and the tier-guard and docstring tests pass.
  • Cost. About 25 s / 225 MiB and 32 s / 279 MiB. The results are deterministic across two runs, one with TZ=Asia/Tokyo.
  • I re-ran both modules myself: 10 passed, 22,226 subtests.

Nit: the HTTP entry in DICT_GAPS is a different root cause from the other #1447 entries. http.py:327 _make_data accepts only Data_HTTPv1/Data_HTTPv2, not a generic data object built from a dict. I've passed this to the #1447 worker.

Merge order: the stale-entry check means that once #1446, #1447 or #1448 is fixed, its entry here must be removed in the same change. Merging this PR first lets each fix PR delete its own entries.

@JarryShaw JarryShaw added review: good-to-go Cross-review at the current head says ready; CI state is separate and removed review: running A cross-review is in flight against the current head - no verdict yet labels Oct 9, 2026
@JarryShaw
JarryShaw merged commit ec4c055 into main Oct 9, 2026
40 checks passed
@JarryShaw
JarryShaw deleted the test/1202-roundtrip-coverage branch October 9, 2026 02:02
JarryShaw added a commit that referenced this pull request Oct 9, 2026
…ed them

#1445 and #1449 merged back to back. The IPv6_Frag rows in LAYER_GAPS and
DICT_GAPS now pass, and the stale-entry check fails on them: 8 failures on
2f7aadd. With the rows removed, the module passes (4 tests, 20501 subtests).
@JarryShaw JarryShaw removed the review: good-to-go Cross-review at the current head says ready; CI state is separate label Oct 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test Pull requests that add or correct tests (test: subject prefix)

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant