Skip to content

Implement configurable document types (#224)#226

Merged
nesono merged 7 commits intomainfrom
feat/configurable-document-types
Apr 4, 2026
Merged

Implement configurable document types (#224)#226
nesono merged 7 commits intomainfrom
feat/configurable-document-types

Conversation

@nesono
Copy link
Copy Markdown
Owner

@nesono nesono commented 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

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

🤖 Generated with Claude Code

nesono and others added 7 commits April 4, 2026 12:57
Add a YAML-driven configuration system that allows consumers to define
custom document types with their own metadata fields and validation rules.

- Add default_fire_config.yaml matching the built-in sysreq/swreq/regreq types
- Add config_models.py with Pydantic models for config schema (FireConfig,
  FieldDefinition, DocumentTypeDefinition) and load_config()
- Add dynamic_requirement_model.py that builds Pydantic validation models
  from config at runtime, matching the static models' behaviour
- Wire --config into validate_cross_references.py and release_report.py
- Add optional config attr to requirement_library() and release_report() rules
- Add generate_format_spec.py and format_spec.bzl for auto-generating
  FORMAT_SPECIFICATION.md from config
- Document custom document types in README.md

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Path(__file__).parent does not resolve correctly in Bazel runfiles on
Windows. Embed the default FIRE configuration as a Python string constant
instead of reading default_fire_config.yaml at runtime.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds a custom_config/ directory to the integration test with:
- A fire_config.yaml defining a custom .handbook.md document type
- A handbook requirement (HB-001) and a sysreq linking to it
- BUILD targets exercising requirement_library(config=...),
  generate_format_specification(), and release_report(config=...)
- Verification in run.sh that the generated format spec contains the
  custom type and the release report includes the handbook requirement

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The custom fire_config.yaml should be comprehensive — include swreq and
regreq alongside the new handbook type, since consumers are expected to
define all the document types they need.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
A custom fire_config.yaml fully replaces the built-in configuration,
it does not extend it. Updated the wording and example to make this
clear.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
MSYS2 (Git Bash on Windows) converts //path arguments to /path,
breaking Bazel target labels like //custom_config:target. Set
MSYS2_ARG_CONV_EXCL="*" to disable this conversion.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
MSYS2_ARG_CONV_EXCL="*" was too broad and prevented conversion of
real file paths like --repository_cache=$HOME/.cache/bazel-repo.
Restrict the exclusion to arguments starting with // (Bazel target
labels) so that file path arguments are still converted correctly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@nesono nesono merged commit 782da36 into main Apr 4, 2026
21 checks passed
@nesono nesono deleted the feat/configurable-document-types branch April 4, 2026 21:10
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