Commit 56c836d
committed
fix(compiler): close two crash paths from #71 review
Code review on PR #75 surfaced two function-aborting bugs that the
original defenses did not cover. Both shift the same silent-loss
class one step upstream — `_compile_concepts` raises before any
concept task runs, the v1 summary is never written on the short-doc
path, and the new `[WARN] planned vs written` line never fires.
- `_filter_concept_items` also requires a non-empty string `name`.
Without this, dicts that omit the `name` key (JSON mode constrains
syntax, not schema) reach the `planned_slugs` set comprehension at
line 1014 and raise `KeyError: 'name'`.
- New `_filter_related_slugs` mirrors the same guard for the
`related` list, dropping non-strings. The previous code passed
`parsed.get("related", [])` straight into `_sanitize_concept_name`,
which calls `unicodedata.normalize("NFKC", name)` and raises
`TypeError` on any non-`str` entry.
Verified end-to-end against the original screenwriter EPUB on
deepseek-v4-flash (no regression) and via direct unit-style calls
that feed every mishape into both helpers and observe the expected
drops + WARN messages.1 parent ac22a64 commit 56c836d
1 file changed
Lines changed: 39 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
306 | 306 | | |
307 | 307 | | |
308 | 308 | | |
309 | | - | |
| 309 | + | |
310 | 310 | | |
311 | 311 | | |
312 | | - | |
313 | | - | |
314 | | - | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
315 | 317 | | |
316 | 318 | | |
317 | 319 | | |
318 | 320 | | |
319 | 321 | | |
320 | | - | |
| 322 | + | |
321 | 323 | | |
322 | | - | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
323 | 330 | | |
324 | | - | |
325 | | - | |
| 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 | + | |
326 | 356 | | |
327 | 357 | | |
328 | 358 | | |
| |||
993 | 1023 | | |
994 | 1024 | | |
995 | 1025 | | |
996 | | - | |
| 1026 | + | |
997 | 1027 | | |
998 | 1028 | | |
999 | 1029 | | |
| |||
0 commit comments