Commit 4959dde
committed
fix(scripts/apidocgen/postprocess): surface masked scanner errors
extractSectionName now checks scanner.Err() when the first Scan fails, so a
section whose first line exceeds bufio.Scanner's token limit reports a scanning
error instead of a misleading missing-header error. Switch the heading check to
strings.CutPrefix and add a test covering the scanner-error path.
Ports the format-agnostic generator hardening from #27297 (CRF-8, CRF-15). The
front-matter-parsing branch and sectionPreview helper there are specific to that
PR's template-level front-matter emission and do not apply here, where the
widdershins templates still emit the "# {name}" heading that the postprocessor
reads and swaps.
Linear: DOCS-483
> This PR was created with AI assistance (Coder Agents).1 parent 80c0def commit 4959dde
2 files changed
Lines changed: 20 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
239 | 239 | | |
240 | 240 | | |
241 | 241 | | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
242 | 248 | | |
243 | 249 | | |
244 | 250 | | |
245 | 251 | | |
246 | | - | |
| 252 | + | |
| 253 | + | |
247 | 254 | | |
248 | 255 | | |
249 | | - | |
| 256 | + | |
250 | 257 | | |
251 | 258 | | |
252 | 259 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
| 5 | + | |
4 | 6 | | |
5 | 7 | | |
6 | 8 | | |
| |||
56 | 58 | | |
57 | 59 | | |
58 | 60 | | |
59 | | - | |
60 | | - | |
| 61 | + | |
| 62 | + | |
61 | 63 | | |
62 | 64 | | |
63 | 65 | | |
| |||
70 | 72 | | |
71 | 73 | | |
72 | 74 | | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
73 | 82 | | |
0 commit comments