Skip to content

feat(srd): import Poisons and Diseases as structured hazard records (loreweaver-6ra)#159

Merged
jbongaarts merged 1 commit into
mainfrom
loreweaver-6ra-poisons-diseases
Jun 6, 2026
Merged

feat(srd): import Poisons and Diseases as structured hazard records (loreweaver-6ra)#159
jbongaarts merged 1 commit into
mainfrom
loreweaver-6ra-poisons-diseases

Conversation

@jbongaarts
Copy link
Copy Markdown
Owner

Summary

Imports the SRD 5.1 gamemastering Diseases (Cackle Fever, Sewer Plague, Sight Rot) and Poisons (14 named poisons) sections — previously absent from the pack — as structured records under the existing hazard kind, discriminated by data.category ('disease' / 'poison'). No new exhaustive record kind is minted, per the section-coverage audit's Note B. Closes loreweaver-6ra.

The pack goes from 8 → 25 hazard records (8 traps + 3 diseases + 14 poisons).

What's in each record

  • Diseases: category: 'disease' + re-flowed description.
  • Poisons: category: 'poison', poisonType (contact/ingested/inhaled/injury), price (per dose, from the Poisons reference table), and description (save DC and damage kept inline).

Extractor fix (the interesting part)

The p205 "Sample Poisons" page is a single column whose entries open with a short indented bold lead-in (Pale Tincture (Ingested).) immediately followed on the same baseline by the justified remainder of the first line (A creature subjected to). That pattern opened a phantom column gutter, so the extractor split the page and displaced every poison's first sentence to the bottom — corrupting the prose.

partitionItemsByColumn now merges such a page back to one column, gated by three conditions that together leave genuine two-column pages untouched:

  1. the widest cut straddles ≥2 contiguous baselines with no real gutter crossing,
  2. the widest cut is also the most balanced cut on the page (rules out p238 Robe of Eyes and p226 Horn of Valhalla, where the widest gap is a mid-line italic/embedded-table run, not the gutter), and
  3. the right side of the cut owns no standalone line (rules out the p63 armor table, whose right column is real).

The regenerated pack diff is purely additiveverify:dnd5e-srd-pack passes exactly, and the 296 creatures / 319 spells / 238 magic items baselines are unchanged.

Fail-closed coverage

The real import validates parsed names against EXPECTED_SRD_5_1_DISEASE_NAMES / _POISON_NAMES (throws DiseaseCoverageError / PoisonCoverageError on drift), mirroring the trap/ancestry gates.

Tests / gates

🤖 Generated with Claude Code

…loreweaver-6ra)

The SRD 5.1 gamemastering Diseases (Cackle Fever, Sewer Plague, Sight Rot)
and Poisons (14 named poisons) sections were absent from the pack. Import
them as structured records under the existing `hazard` kind, discriminated
by `data.category` ('disease' / 'poison') — no new exhaustive record kind,
per the section-coverage audit's Note B. Poisons additionally carry
`data.poisonType` (delivery method) and `data.price` (per dose, cross-
referenced from the Poisons table); save DC and damage stay in the
re-flowed `description`.

- parseDiseases.ts: exact-name match (like parseHazards), 3 records.
- parsePoisons.ts: inline `Name (Type).` bold lead-in detection + price
  table cross-reference, 14 records.
- emit: diseaseExtractionsToRecords / poisonExtractionsToRecords; both fold
  into the shared `hazard` concatenation. The pack goes 8 -> 25 hazards.
- sections: new `diseases` and `poisons` anchors (best-effort start,
  requireEndHeading).
- index: best-effort slicing + fail-closed coverage gates
  (EXPECTED_SRD_5_1_DISEASE_NAMES / _POISON_NAMES, Disease/PoisonCoverageError).

Extractor fix: the p205 "Sample Poisons" page is a single column whose
entries open with a short indented bold lead-in followed by the justified
remainder of the first line on the same baseline. That pattern opened a
phantom column gutter that displaced each poison's first sentence to the
end of the page. partitionItemsByColumn now merges such a page back to one
column when the widest cut straddles >=2 contiguous baselines with no real
gutter, is also the most balanced cut, and its right side owns no
standalone line — three conditions that together leave genuine two-column
pages (p238 Robe of Eyes, p226 Horn of Valhalla, p63 armor table)
untouched. The regenerated pack diff is purely additive (verify pack
reproducibility passes; 296 creatures / 319 spells / 238 magic items
unchanged).

Tests: parseDiseases/parsePoisons unit tests, emit record-shape tests, an
extract inline-lead-in regression test, and committed-pack coverage +
p205 reading-order assertions. README + section-coverage audit updated.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@jbongaarts jbongaarts merged commit fb23d41 into main Jun 6, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant