Commit 1025982
committed
test(generator): the Clone gate must see a real memcpy, not a name mention (#386)
Adversarial review of the parent commit (2c1394d) found the new
every_handle_buffer_is_duplicated_by_clone gate only checked that a buffer's
field name appeared as a substring in TA_<N>_Clone's body -- so a regression
to a raw alias (`sp->buf = stream->buf;`, corrupting both handles the moment
either advances) or a silent drop (`sp->buf = NULL;` with no copy) would
still contain the name and pass.
Now requires a `memcpy(...)` line naming both `sp->{buf},` and
`stream->{buf},` -- matched per line rather than as one fixed-spacing
literal (so a reformat of the emitter's call layout can't turn every buffer
in the corpus into a false offender), with the trailing comma as an
identifier-boundary guard (so a buffer whose name is a prefix of a
sibling's, e.g. `ring`/`ring2`, can't false-pass off the sibling's memcpy
line). Both were review findings on this same commit, in two separate
rounds.
Fixed a false positive the stricter check surfaced: MA (the Dispatch tier)
type-erases its one sub-handle as `void *sub`, cloned via a switch to the
correct sub-type's own `_Clone` rather than memcpy'd -- `handle_buffers`'s
existing `_Stream`-name exclusion doesn't catch a type-erased handle.
Flipped it from a denylist (`_Stream`, `void`) to a positive allowlist
(`double`/`int`, the only two types a real data buffer ever has in this
corpus), more robust against a hypothetical future pointer type than
enumerating what to exclude.
Sabotage-proved three times over three review rounds: (1) changing
clone_buffer_lines to emit the raw-alias form directly (the exact
regression the first review round named) -- the strengthened test failed,
naming every affected buffer; the original weak substring check would have
passed it silently. Restored, confirmed green each time.
Not addressed: a review round also noted that excluding `void *sub` means
MA no longer appears as a swept handle at all, so nothing in this file
verifies TA_MA_Clone's dispatch switch routes to the correct sub-type's own
Clone. That is a real gap, but a different gate than the one this commit
adds (buffer duplication, not sub-handle routing) -- left for the issue
rather than expanding this commit's scope unverified.
Claude-Session: https://claude.ai/code/session_01JXQFXKVdVJa1XKbo1sSpyY1 parent 17cc6e3 commit 1025982
1 file changed
Lines changed: 24 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
108 | | - | |
109 | | - | |
110 | | - | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
111 | 117 | | |
112 | 118 | | |
113 | 119 | | |
| |||
1350 | 1356 | | |
1351 | 1357 | | |
1352 | 1358 | | |
1353 | | - | |
1354 | | - | |
| 1359 | + | |
| 1360 | + | |
| 1361 | + | |
| 1362 | + | |
| 1363 | + | |
| 1364 | + | |
| 1365 | + | |
| 1366 | + | |
| 1367 | + | |
| 1368 | + | |
| 1369 | + | |
| 1370 | + | |
| 1371 | + | |
| 1372 | + | |
| 1373 | + | |
1355 | 1374 | | |
1356 | 1375 | | |
1357 | 1376 | | |
| |||
0 commit comments