feat(core): add config loader and Jinja2 template renderer - #5
Merged
Conversation
src/core/config.py: - Pydantic models for all core.yaml sections (Organisation, Role, Clause, Document, RecordType, KPI, CapaState, CoreConfig) - _deep_merge() for core + overlay YAML - load_config() validates the merged result with CoreConfig.model_validate() src/core/renderer.py: - build_context() maps CoreConfig fields to Jinja2 template variables - render_template() renders any .md.j2 with StrictUndefined (fails fast on missing variables) tests/test_config.py: validates core.yaml structure (clause refs, KPI fields, CAPA state machine transitions) tests/test_renderer.py: renders policy, procedure, and CAPA form with a mock config, asserts key content Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Remove extra blank line in config.py import block (I001) - Drop unused pytest/CoreConfig/load_config imports in tests (F401) - Replace autoescape=False with select_autoescape() in renderer (B701) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
src/core/config.py: Pydantic models for all core.yaml sections +load_config()that deep-merges core + overlay YAML and validates the resultsrc/core/renderer.py:render_template()renders any.md.j2withStrictUndefined(fails fast on missing variables)adapters/__init__.pystubs for selfhosted / atlassian / m365 (content in next PR)tests/test_config.py: validatescore.yamlstructure — clause refs, KPI fields, CAPA state machinetests/test_renderer.py: renders policy, procedure, CAPA form with mock configTest plan
test_configassertions pass against currentcore.yamltest_rendererassertions pass against current templatesGenerated with Claude Code