Skip to content

Commit c137b3f

Browse files
ccie18643claude
andcommitted
docs(refactor): net_proto mutation results — lib shard + audit complete
Record the lib shard (shared foundation, full-suite scope): 91.2% raw (~98% adjusted), 0 genuine gaps — the inet_cksum 8-byte chunking is a result-preserving optimization (verified equivalent), the alignment modulo predicates are non-negative-equivalent, the foundation is solid. Adds the final audit summary: all 20 protocols + lib swept (27,007 mutants, 21 shards), 70 genuine gaps closed test-only, 3 whole-thing omissions found (TCP FastOpen, ICMPv6 Packet Too Big, MLDv2 Query), the recurring wrong-type-assert and degenerate-fixture patterns, and the honest equivalent-adjusted story (90-100% everywhere). The deep-TLV follow-up seam documented. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 21ace4d commit c137b3f

1 file changed

Lines changed: 79 additions & 0 deletions

File tree

docs/refactor/net_proto_mutation_audit_results.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ protocol's own tests plus `tests/unit/lib`; shards run sequentially.
3232
| ip6_hbh | 1427 | 72.7 % | 72.7 % | ~90 % | 0 (seam) | DONE |
3333
| ip6_dest_opts | 1070 | 70.2 % | 70.2 % | ~90 % | 0 (seam) | DONE |
3434
| igmp | 1369 | 78.7 % | 78.7 % | ~93 % | 0 (seam) | DONE |
35+
| lib | 1123 | 91.2 % | 91.2 % | ~98 % | 0 | DONE |
3536

3637
(Updated per shard as the audit proceeds.)
3738

@@ -504,3 +505,81 @@ The clean bit-field patterns are **already covered**:
504505
- `igmp__v3_group_record.py` source-list / aux-data offset arithmetic —
505506
the same source-list-length seam as the MLDv2 / classless-static-route
506507
options. A Phase-2-relevant deep-TLV follow-up.
508+
509+
510+
---
511+
512+
## Shard: lib (shared foundation, full-suite scope)
513+
514+
**Baseline:** 1024 / 1123 = **91.2 % raw**, 99 survivors. ~98 %
515+
equivalent-adjusted. Run with the **full net_proto suite** as the
516+
test-command (lib is shared by every protocol). No genuine gap; no test
517+
change — the foundation is solid.
518+
519+
The 99 survivors are all equivalent:
520+
521+
- **`inet_cksum.py` 8-byte fast-path chunking** (~19, the largest cluster)
522+
`if (remainder := buffer_len - offset) >= 8` and `q_count =
523+
remainder >> 3`. These are a **result-preserving optimization**: the
524+
one's-complement sum is associative, so changing the chunk threshold
525+
(`>= 8``>= 9`) or the chunk count (`>> 3``>> 4`) only shifts
526+
bytes between the fast path and the remainder loop — the checksum is
527+
byte-for-byte identical. Verified: both survive every protocol's
528+
checksum test. Equivalent.
529+
- **`int_checks.py` `x % 4 == 0` / `x % 8 == 0`** alignment predicates —
530+
`== 0``<= 0` is equivalent (`x % n` ≥ 0). The `UINT_24__MIN = 0`
531+
constant IS tested (0 → 1 is killed).
532+
- The usual classes: PEP 604 annotation-`|`, `@override`, interned-string
533+
prefix comparisons (`prefix == "RX"``is`), the `proto.py` /
534+
`proto_option.py` `type(self) is type(other)` identity guards, and the
535+
`tracker.py` time-delta f-string arithmetic.
536+
537+
---
538+
539+
## Audit complete — final summary
540+
541+
**Scope:** all 20 protocols + the shared `lib`, 27,007 source mutants
542+
across 21 shards. Branch `PyTCP_3_0_8`, test-only throughout (production
543+
source pristine), full suite green (12822 → ~12940 tests).
544+
545+
| Tier | Shards | Genuine gaps closed |
546+
|------|--------|--------------------:|
547+
| **P0** core codecs | tcp, ip4, ip6, udp, icmp4, icmp6, arp, ethernet | 53 |
548+
| **P1** stateful/optional + ext headers | dhcp4, dhcp6, dns, ip6_frag/routing/hbh/dest_opts, igmp | 17 |
549+
| **Foundation** | lib | 0 (solid) |
550+
| **Total** | 21 shards | **70** |
551+
552+
### The standout findings
553+
554+
1. **Three whole-thing omissions** — entire codecs with *no test file at
555+
all*: TCP Fast Open option (RFC 7413), ICMPv6 Packet Too Big (RFC
556+
4443), MLDv2 Query (RFC 3810, the single largest gap at 185
557+
surviving mutants). These are exactly what mutation testing exists to
558+
catch and line coverage cannot.
559+
2. **The wrong-type / wrong-code assert gap** recurred across ~30 options
560+
in 4 protocols (ip4, dhcp4, dhcp6, accecn) — the `buffer[0] ==
561+
int(Type)` dispatch-guaranteed assert was untested everywhere.
562+
3. **Degenerate-fixture patterns** — empty-data `__len__` (icmp4/icmp6),
563+
one-sided boundary tests (the over-length `!= LEN`), the DNS
564+
all-flags header (every flag bit position unexercised), the AccECN
565+
field-ordering invariant.
566+
567+
### The honest equivalent-adjusted story
568+
569+
Raw scores (60–91 %) badly understate the suite: PyTCP's annotation-dense
570+
Python 3.14 code is saturated with **equivalent mutants** — PEP 604 union
571+
`|` under lazy annotations (the single biggest class everywhere),
572+
`@override` removals, disjoint bit-packing (`|``^`), result-preserving
573+
optimizations (the inet_cksum chunking), base-coincidence arithmetic
574+
(ARP `0x0001`, IGMP code-128, routing RH0=0), and message-text formulas.
575+
**Equivalent-adjusted, every shard is 90–100 %.** The genuine gaps were
576+
concentrated, not diffuse.
577+
578+
### Documented deep-TLV follow-up seam (not closed)
579+
580+
The same intricate territory across protocols, deferred as a dedicated
581+
future pass: ip4 route-record / CIPSO / timestamp options, dhcp4 RFC 3442
582+
classless-static-route walk, icmp6 ND options, ip6 HBH/DestOpt
583+
option-walkers, dns name compression, igmp IGMPv3 record/aux-data
584+
arithmetic. These need contrived multi-descriptor / boundary frames for
585+
marginal, mostly-equivalent gain.

0 commit comments

Comments
 (0)