Skip to content

test(corekit): field, schema and Info round trips (#1202) - #1492

Merged
JarryShaw merged 1 commit into
mainfrom
test/1202-corekit-roundtrips
Oct 9, 2026
Merged

JarryShaw merged 1 commit into
mainfrom
test/1202-corekit-roundtrips

Conversation

@JarryShaw

@JarryShaw JarryShaw commented Oct 9, 2026 •

Copy link
Copy Markdown
Owner

What is the purpose of your pull request?

  • test — tests only

Description of your pull request and other information

The corekit slice of #1202: field pack/unpack in both directions for every concrete corekit field, Schema.unpack(bytes(s)) re-packing and from_dict(to_dict()) for all schemas under pcapkit/protocols/schema/, and Info.from_dict(info.to_dict()) for all 487 Info classes, including repeated keys, __short_read__ and __truncated_raw__.

Module Subtests Time Peak RSS
tests/corekit/test_field_roundtrip_unit.py 735 3.0 s 163 MiB
tests/corekit/test_schema_roundtrip_unit.py 883 4.2 s 144 MiB
tests/corekit/test_info_roundtrip_unit.py 1,436 4.5 s 175 MiB

Known failures, checked in both directions: #1487 (BitField unnamed bits), #1488 (NumberField bit_length narrower than its octets), #1489 (ListField without item_type), #1490 (non-final Info child leaking internal keys). Standalone ListFields are named by hand because of #1491.

Refs #1202

- Field pack/unpack symmetry for every concrete corekit field class, in
  both directions, plus the context-only fields inside minimal schemas.
- Schema pack/unpack and from_dict/to_dict for every Schema subclass
  under pcapkit/protocols/schema, from a minimal instance and a
  patterned one, and every dispatcher through its targets.
- Info from_dict(to_dict()) for every Info subclass, with repeated
  keys and the __short_read__ / __truncated_raw__ bookkeeping keys.
- Known failures recorded per root cause (#1487, #1488, #1489, #1490),
  checked in both directions.

Refs #1202
@JarryShaw

Copy link
Copy Markdown
Owner Author

Verdict: GOOD TO GO at c55de8a77. Cross-reviewed on Sonnet; the author ran on Opus. Test-only: four files under tests/corekit/.

  • The known-failure table is enforced both ways. I re-checked one direction myself: deleting the fix(corekit): a ListField without item_type cannot pack what it unpacks #1489 row makes 5 subtests fail as unexpected. The reviewer checked the other:
  • The tests are not vacuous. They cover 431 of the 447 Schema classes as plain cases; the other 16 are 6 dispatchers (reached through 21 dispatch cases) and 10 fieldless bases. They also cover every concrete Field class and every annotated Info subclass, with UNBUILDABLE empty. Every caught exception becomes a named outcome that fails unless it is listed.
  • Order independence. The tests define no Info or Schema subclass at module level. Running the new modules first or last gives the same result (118 passed, 3321 subtests). util/run_unittest_leg.py corekit gives 658 tests, 0 failures.
  • Other checks: I re-ran the three modules myself: 20 passed, 3054 subtests. The tier and docstring guards pass, and no capture files are read.

Non-blocking: the #1487 and #1488 rows have an empty failure fragment, so they match on status alone. Their labels are narrow enough for that to be safe.

@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
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Coverage: 89.65% (unit tier, Python 3.14, c55de8a77, Unit Tests run success)

Package Statements Missed Branches Partial Cover
pcapkit (top level) 104 4 20 4 93.55%
pcapkit/const 18795 958 2356 871 90.99%
pcapkit/corekit 2107 68 672 29 96.15%
pcapkit/dumpkit 242 2 88 2 98.79%
pcapkit/foundation 2648 98 930 48 94.80%
pcapkit/interface 112 7 40 5 92.11%
pcapkit/protocols 17086 238 4628 190 97.98%
pcapkit/toolkit 539 74 168 3 84.58%
pcapkit/utilities 431 4 124 4 98.56%
pcapkit/vendor 4409 2342 1006 157 43.25%

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

@JarryShaw
JarryShaw merged commit d9e12e8 into main Oct 9, 2026
38 checks passed
@github-project-automation github-project-automation Bot moved this from In review to Done in PyPCAPKit Oct 9, 2026
@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