Commit 9ac4349
committed
Address round-3 review: Splice negative-Start, IsGitHubAlert contract pin
Recall agent surfaced three findings after commit 17cca70; one was
the F5 silent-corruption path already closed in commit 131a9f1. The
remaining two land here.
#2: markdown.Splice's precondition check fired for negative-Start
edits via the generic "overlaps previous edit ending at 0" panic. A
producer that subtracts past 0 and emits Start=-1 sent the debugger
chasing a non-existent previous edit. Add a dedicated `Start < 0`
guard that names the actual fault, plus a pin in
TestSpliceInvariantViolation.
#3: fixGitHubAlerts removed the local (Paragraph, non-empty Lines)
re-check and trusts flavor.IsGitHubAlert's contract — but no
behavior test pinned that contract. The four existing fix tests
exercise inputs where IsGitHubAlert returns true via the real
parser; they would not catch a future relaxation of IsGitHubAlert
that returns true for a non-Paragraph first child. Add
TestIsGitHubAlertContractPostcondition: walk a corpus of alert /
non-alert / degenerate blockquotes, and on every IsGitHubAlert==true
case assert FirstChild is *ast.Paragraph with non-empty Lines.
Coverage in pkg/markdown and pkg/markdown/flavor stays at 100%;
mdsmith check and golangci-lint clean.
https://claude.ai/code/session_0144ZKUS2Zrg7xBft54qyoti1 parent ba74889 commit 9ac4349
3 files changed
Lines changed: 72 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
310 | 310 | | |
311 | 311 | | |
312 | 312 | | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
313 | 368 | | |
314 | 369 | | |
315 | 370 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
157 | 157 | | |
158 | 158 | | |
159 | 159 | | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
160 | 172 | | |
161 | 173 | | |
162 | 174 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
45 | 50 | | |
46 | 51 | | |
47 | 52 | | |
| |||
0 commit comments