Skip to content

Design: Configurable document types (#224)#225

Merged
nesono merged 2 commits intomainfrom
design/configurable-document-types
Apr 3, 2026
Merged

Design: Configurable document types (#224)#225
nesono merged 2 commits intomainfrom
design/configurable-document-types

Conversation

@nesono
Copy link
Copy Markdown
Owner

@nesono nesono commented Mar 31, 2026

Summary

  • Adds a design document for issue Design configuration for FIRE #224: making FIRE's document types consumer-configurable via YAML
  • Covers YAML config schema, dynamic Pydantic model generation, Bazel integration, and auto-generated FORMAT_SPECIFICATION.md
  • Outlines 5 implementation phases with backwards compatibility as a key constraint

Purpose

This PR is for team discussion and review of the proposed design before implementation begins.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@nesono nesono force-pushed the design/configurable-document-types branch from ef177f1 to 48198f6 Compare April 1, 2026 05:29
- Rename .ipsra.md to .hara.md and add .tara.md as example doc types
- Add PL-a through PL-d (ISO 13849 machine safety) to SIL enum values
- Change handbook description from "Operational" to "Product"

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@nesono nesono enabled auto-merge (squash) April 3, 2026 06:37
@nesono nesono merged commit 6a9af5a into main Apr 3, 2026
21 checks passed
@nesono nesono deleted the design/configurable-document-types branch April 3, 2026 06:46
nesono added a commit that referenced this pull request Apr 4, 2026
## Summary

- Add YAML-driven configuration system for custom document types (field
definitions + document type definitions)
- Build Pydantic validation models dynamically from config at runtime,
with identical behaviour to the static models
- Wire optional `config` attribute into `requirement_library()`,
`release_report()`, and their Python scripts
- Add `generate_format_specification()` Bazel rule to auto-generate
FORMAT_SPECIFICATION.md from config
- Ship `default_fire_config.yaml` matching the built-in
sysreq/swreq/regreq types (including new PL-a through PL-d values)
- Document custom document types in README.md

Implements the design from #225.

## New files

| File | Purpose |
|------|---------|
| `fire/starlark/default_fire_config.yaml` | Default config matching
built-in types |
| `fire/starlark/config_models.py` | Pydantic models for config schema +
`load_config()` |
| `fire/starlark/dynamic_requirement_model.py` | Factory: config →
Pydantic model at runtime |
| `fire/starlark/generate_format_spec.py` | Generates
FORMAT_SPECIFICATION.md from config |
| `fire/starlark/format_spec.bzl` | Bazel rule
`generate_format_specification()` |

## Test plan

- [x] All 24 existing tests pass (backwards compatibility)
- [x] New config_models_test validates config parsing and rejection of
invalid configs
- [x] New dynamic_requirement_model_test proves equivalence with static
models (accept/reject same inputs)
- [x] New generate_format_spec_test verifies generated output covers all
document types and fields
- [x] Full `bazel build //...` succeeds
- [x] CI passes on all platforms

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 4.6 <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.

2 participants