Skip to content

feat: Add status frontmatter field for section state detection#91

Merged
williamzujkowski merged 1 commit intomainfrom
feat/90-status-frontmatter
Mar 30, 2026
Merged

feat: Add status frontmatter field for section state detection#91
williamzujkowski merged 1 commit intomainfrom
feat/90-status-frontmatter

Conversation

@williamzujkowski
Copy link
Copy Markdown
Collaborator

Summary

Moves section status detection from fragile title-string matching in templates to a proper frontmatter field generated by the transformer.

Transformer

  • New SectionStatusSchema enum: active, repealed, reserved, omitted, transferred, renumbered
  • detectSectionStatus(heading) derives status from heading text
  • status field added to YAML frontmatter output

Content Collection

  • status field added to schema with 'active' default (backwards compatible with existing data that lacks the field)

Frontend

  • Statute page and browse listings now check entry.data.status first, with title-based fallback for data generated before this change
  • Eliminates duplicated string-matching logic across 2 templates

Impact

  • Existing data: works unchanged (schema default is 'active', title fallback preserved)
  • New data: will have explicit status field, no fallback needed
  • Next re-import: will regenerate all sections with the new field

Issues

Test plan

  • pnpm test — all 266 tests pass
  • svelte-check — 0 errors
  • Transformer build succeeds
  • After re-import: verify status field appears in frontmatter

🤖 Generated with Claude Code

)

Transformer:
- Add SectionStatusSchema enum (active|repealed|reserved|omitted|transferred|renumbered)
- Add detectSectionStatus() function to derive status from heading text
- Generate status field in YAML frontmatter for every section
- Export new types and function

Content Collection:
- Add status field to schema with 'active' default for backwards compat

Frontend (statute + browse):
- Use entry.data.status as primary check with title-based fallback
- Eliminates fragile string matching as sole detection method
- Single source of truth for status in the transformer

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@williamzujkowski williamzujkowski merged commit 686e1de into main Mar 30, 2026
1 check failed
@williamzujkowski williamzujkowski deleted the feat/90-status-frontmatter branch March 30, 2026 01:00
williamzujkowski added a commit that referenced this pull request Mar 30, 2026
The status field was added to FrontmatterSchema in PR #91 but the
test fixture in transformer.test.ts was not updated, causing CI
typecheck failures.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
williamzujkowski added a commit that referenced this pull request Mar 30, 2026
The status field was added to FrontmatterSchema in PR #91 but the
test fixture in transformer.test.ts was not updated, causing CI
typecheck failures.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

feat: Add 'status' frontmatter field to transformer output

1 participant