Commit d7e84c2
committed
Replace the networking figure; rewrite both code chunks' prose
User-flagged: /examples/networking attached protocol-layers (an
HTTP/TCP/IP stack figure) to an example whose code uses
socket.socketpair() to demonstrate the str ↔ bytes boundary. The
figure had no relationship to the lesson, and the two code chunks
on the page shared generic prose instead of explaining what each
chunk actually shows.
Figure
New socket-byte-boundary figure (src/marginalia.py): str "ping" →
encode → bytes b'ping' → [dashed socket pipe, labelled "socket"]
→ bytes b'ping' → decode → str "ping". The figure depicts what
the example's code does in one row: the encode/decode at each end
of the socket carrying bytes.
Canvas 364×46 → renders at 627 CSS px on desktop, comfortably
under the 640 banner ceiling.
Removed protocol_layers (now orphan after re-attaching). The
orphan-figure contract catches it automatically.
Cell prose (src/example_sources/networking.md)
Unsupported chunk now explains what its three-line code does —
socketpair returns two endpoints, sendall encodes, recv reads
bytes — with the Dynamic Workers caveat moved to a closing
parenthetical instead of leading the prose.
Cell chunk now explains what the full version adds over the
unsupported fragment: try/finally for cleanup, second print that
decodes the received bytes back to a str.
TDD: the new figure tripped Contract 2 (collision) on the first
draft — the "SOCKET" tag overlapped a bytes box. Moved the tag
above the dashed pipe instead of below. The attachment also tripped
Contract 6 (anchor coverage) — I attached to cell-1 but the example
has only one runnable :::cell. Fixed to cell-0. Both caught in CI,
fixed before merge.
57 tests pass; SCORES commentary updated.1 parent 604cca3 commit d7e84c2
5 files changed
Lines changed: 22 additions & 15 deletions
File tree
- public/prototyping
- src
- example_sources
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
687 | 687 | | |
688 | 688 | | |
689 | 689 | | |
690 | | - | |
691 | | - | |
| 690 | + | |
| 691 | + | |
692 | 692 | | |
693 | 693 | | |
694 | 694 | | |
| |||
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
| 44 | + | |
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1055 | 1055 | | |
1056 | 1056 | | |
1057 | 1057 | | |
1058 | | - | |
1059 | | - | |
1060 | | - | |
1061 | | - | |
1062 | | - | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
1063 | 1070 | | |
1064 | 1071 | | |
1065 | 1072 | | |
| |||
1347 | 1354 | | |
1348 | 1355 | | |
1349 | 1356 | | |
1350 | | - | |
| 1357 | + | |
1351 | 1358 | | |
1352 | 1359 | | |
1353 | 1360 | | |
| |||
1802 | 1809 | | |
1803 | 1810 | | |
1804 | 1811 | | |
1805 | | - | |
1806 | | - | |
| 1812 | + | |
| 1813 | + | |
1807 | 1814 | | |
1808 | 1815 | | |
1809 | 1816 | | |
| |||
2119 | 2126 | | |
2120 | 2127 | | |
2121 | 2128 | | |
2122 | | - | |
| 2129 | + | |
2123 | 2130 | | |
2124 | 2131 | | |
2125 | 2132 | | |
| |||
0 commit comments