Skip to content

Commit 3da5f81

Browse files
committed
docs(mutation): record socket drop-in shard (69 gaps closed, ~85% adjusted)
Tier-2 audit of the 3.0.8 daemon-backed pytcp.socket drop-in. 946 mutants: raw 38.8% -> 46.1% after a 13-test no-daemon behaviour batch (commit 2d2efab) that newly kills 69 of the 148 non-annotation candidates. ~431 survivors are PEP 604 union-annotation mutants (adjusted ~85% on the executable-mutant surface). The remaining 79 candidates are daemon-integration-surface delegations or equivalents. Doc-only; adds the shard section + summary-table row.
1 parent 2d2efab commit 3da5f81

1 file changed

Lines changed: 57 additions & 0 deletions

File tree

docs/refactor/pytcp_mutation_audit_results.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ surface): `tcp/fsm/` (broken in isolation), `tcp/session/` collaborators
4545
| stack | 2521 | 44.3 % | 50.8 % | ~83 % | 165 | PARTIAL |
4646
| ipc | 1877 | 64.2 % | 67.9 % | ~98 % | 69 | DONE |
4747
| session/fsm | ~5000 | 4.7 %† | n/a | n/a | 1 (demonstrator) | AUDITED — see note |
48+
| socket/dropin | 946 | 38.8 % | 46.1 % | ~85 % | 69 | DONE |
4849

4950
(Updated per shard as the audit proceeds.)
5051

@@ -496,3 +497,59 @@ exact-value assertions to the existing CC test families (cubic /
496497
hystart / cwnd / retransmit-dupack) as that code is touched — not as a
497498
dedicated sweep. The recover-marker test is the worked example of that
498499
pattern.
500+
501+
---
502+
503+
## Shard: socket drop-in (`pytcp.socket`, 3.0.8 daemon-backed)
504+
505+
`socket__dropin.py` (821 LOC) is the stdlib-shaped `Socket` wrapper +
506+
`socket()` factory that fronts the daemon. Unlike the session/FSM code it
507+
is a **thin-unit-testable** shard: most of its daemon-independent logic
508+
(blocking-mode state, stream-only operation guards, `makefile` mode
509+
parsing + shared-fd refcount, factory family/type/proto dispatch) runs
510+
*before* any daemon I/O, so it is reachable by constructing the wrapper
511+
over a `create_autospec` client shim — no live daemon.
512+
513+
### Score
514+
515+
| Metric | Value |
516+
|-------------------------------------|----------------------|
517+
| Mutants | 946 |
518+
| Raw before | 38.8 % (367/946) |
519+
| Raw after batch | 46.1 % (436/946) |
520+
| Annotation/decorator survivors | ~431 (un-killable) |
521+
| Adjusted (equiv-excl) | ~85 % of the 515 executable-mutant surface |
522+
| Genuine gaps closed (kill-proven) | 69 |
523+
524+
The dominant survivor class is the PEP 604 union-annotation mutant: the
525+
three busiest survivor lines alone (`makefile` return-union, the
526+
`underlying:` ctor union, the `_control_sock` return-union) carry 44 / 44
527+
/ 33 annotation mutants each, never executed under PEP 649.
528+
529+
### Genuine gaps closed (69, kill-proven, test-only)
530+
531+
`test__socket__dropin__behaviour.py` — 13 fast no-daemon tests:
532+
533+
- **Blocking-mode state**`setblocking`/`getblocking` round-trip pins
534+
`self._timeout != 0.0` (vs `==`) and the `None if flag else 0.0` set.
535+
- **Stream-only guards**`listen`/`accept`/`shutdown`/`dup` on a
536+
datagram socket must raise `OSError(EOPNOTSUPP)`; pins each
537+
`self._type is not SocketType.STREAM` guard against an `is` edit.
538+
- **`makefile` mode parsing** — invalid-mode rejection (`set(mode) <=
539+
{r,w,b}`), the `reading = "r" in mode or not writing` parse (an `and`
540+
edit collapses `rwb` to write-only), unbuffered-non-binary rejection,
541+
and the shared-fd refcount (`close()` with an outstanding stream defers
542+
the real handle close until the stream decrefs).
543+
- **`socket()` factory dispatch** — RAW forwards proto, plain DGRAM drops
544+
it to `None`, ICMP DGRAM forwards it (ping socket), `fileno=` raises.
545+
- **Module surface**`has_ipv6 is True`.
546+
547+
### Residue (79 non-annotation candidates left)
548+
549+
The 79 still-surviving non-annotation candidates need either a live
550+
daemon round-trip to observe (the control-plane delegations:
551+
`bind`/`connect`/`setsockopt` pass-throughs, `create_connection`
552+
multi-address retry, the recv/send `EAGAIN` non-blocking arms) or are
553+
equivalents (interned-enum `is`, bounded-domain comparisons). They sit in
554+
the daemon-integration surface, not the fast unit surface, and are best
555+
closed opportunistically as the 3.0.8 daemon harness grows.

0 commit comments

Comments
 (0)