Commit fbe5acb
fix(governance): TypeScript-exemption heading detection must be heading-anchored and accept common variants
The TypeScript exemption-table parser used `re.search(r'TypeScript [Ee]xemptions', line)`,
which two distinct ways:
1. It only matched the exact phrase "TypeScript Exemptions" with a single
space between the words. Common variants like
"### TypeScript / JavaScript Exemptions (Approved)" failed silently.
2. It was unanchored, so prose mentions ("the TypeScript exemptions
above") triggered table parsing — picking up whichever table happened
to follow that prose line, often the wrong one.
Estate impact: any repo whose CLAUDE.md used a heading variant other than
the exact "TypeScript Exemptions" got the wrong exemption table parsed —
or none at all — and the `Language / package anti-pattern policy` check
went red on every PR. This was the case for hyperpolymath/affinescript,
whose heading "### TypeScript / JavaScript Exemptions (Approved)" caused
the script to fall through to the Runtime Exemptions section's prose
mention and parse two JS entries instead of the three TS ones.
Replace the search with a heading-anchored regex:
^#{1,4}\s+.*TypeScript.*[Ee]xemption
This:
- Requires a markdown heading prefix (1-4 #'s + whitespace), so prose
mentions never trigger.
- Matches "TypeScript" anywhere in the heading text.
- Matches both "Exemption" and "Exemptions" (singular/plural).
Verified against 9 representative cases:
✓ "### TypeScript Exemptions (Approved)"
✓ "### TypeScript / JavaScript Exemptions (Approved)"
✓ "## TypeScript exemptions"
✓ "# TypeScript Exemption Table"
✓ "#### TypeScript-specific Exemptions"
✗ "The TypeScript exemptions above remain." (prose)
✗ "**Closed exemptions:** for the TypeScript ..." (prose)
✗ "### Runtime Exemptions (Approved)" (off-topic)
✗ "### TypeScript" (no Exemption)
Refs hyperpolymath/affinescript PR #374 (downstream repo-local workaround that became unnecessary after this fix).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 431adbb commit fbe5acb
1 file changed
Lines changed: 10 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
174 | 174 | | |
175 | 175 | | |
176 | 176 | | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
177 | 186 | | |
178 | 187 | | |
179 | | - | |
| 188 | + | |
180 | 189 | | |
181 | 190 | | |
182 | 191 | | |
| |||
0 commit comments