Skip to content

feat(templates): enhance YAML templates with comprehensive guidance [OMN-964] - #6

Merged
jonahgabriel merged 15 commits into
mainfrom
jonah/omn-964-create-yaml-templates
Dec 25, 2025
Merged

jonahgabriel merged 15 commits into
mainfrom
jonah/omn-964-create-yaml-templates

Conversation

@jonahgabriel

@jonahgabriel jonahgabriel commented Dec 23, 2025 •

Copy link
Copy Markdown
Contributor

Summary

This PR enhances the YAML templates for Day Close and Ticket Contract with comprehensive guidance to meet OMN-964 requirements.

Changes

Templates Enhanced

  1. templates/day_close.template.yaml:

    • Added schema alignment documentation
    • Documented all valid enum values (PR states, drift categories, invariant statuses)
    • Added guidance for unknown handling (use "unknown" for invariants when status cannot be determined)
    • Made copy/paste safe with clear placeholders and examples
  2. templates/ticket_contract.template.yaml:

    • Added comprehensive evidence requirements guidance (all 5 evidence kinds: tests, docs, ci, benchmark, manual)
    • Added guidance for unknown handling scenarios (temporary empty interfaces_touched, incomplete evidence requirements)
    • Added detailed emergency bypass field guidance with warnings
    • Documented interface change validation rules

Tests Added

  • test_template_day_close_minimal_valid: Validates minimal valid day close
  • test_template_ticket_contract_minimal_valid: Validates minimal valid ticket contract
  • test_template_ticket_contract_with_evidence_requirements: Validates all evidence kinds
  • test_template_ticket_contract_unknown_handling: Validates unknown/incomplete scenarios
  • test_template_ticket_contract_emergency_bypass: Validates emergency bypass configuration

Acceptance Criteria Met

✅ Templates are schema-aligned
✅ Copy/paste safe with clear guidance
✅ Include guidance for evidence requirements
✅ Include guidance for unknown handling
✅ Include guidance for bypass fields (for emergency policy)
✅ Templates validate against schemas when filled with minimal valid values (all tests pass)

Test Results

All 5 new template validation tests pass ✅

Summary by CodeRabbit

  • Documentation

    • Added a comprehensive TEMPLATE_GUIDE covering Day Close and Ticket Contract fields, examples, and validation guidance; enriched templates with clearer inline guidance and examples.
  • Tests

    • Expanded YAML parsing test suite with fixtures and broader coverage for templates and edge cases.
  • Chores

    • Added several Day Close drift snapshot files capturing plans, repo PR status, and invariant checks; updated pre-commit configuration to use official lint tooling.

✏️ Tip: You can customize this high-level summary in your review settings.

…OMN-964]

- Add comprehensive guidance to day_close.template.yaml:
  - Schema alignment documentation
  - Valid enum values for all fields
  - Unknown handling guidance for invariants
  - Copy/paste safe structure

- Add comprehensive guidance to ticket_contract.template.yaml:
  - Evidence requirements guidance (all 5 evidence kinds)
  - Unknown handling scenarios
  - Emergency bypass field guidance with warnings
  - Interface change validation rules

- Add template validation tests:
  - Minimal valid values for both templates
  - Evidence requirements with all enum values
  - Unknown handling scenarios
  - Emergency bypass configuration

All templates now validate against schemas with minimal valid values.
All tests pass.
@coderabbitai

coderabbitai Bot commented Dec 23, 2025 •

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Expanded YAML templates and a new TEMPLATE_GUIDE; added comprehensive YAML parsing tests; four dated day-close drift snapshot files added; updated .pre-commit-config to use the official ruff-pre-commit and consolidated ruff hooks. Template files gain clearer inline guidance and example values; no production API/signature changes.

Changes

Cohort / File(s) Summary
YAML Templates
templates/day_close.template.yaml, templates/ticket_contract.template.yaml
Added/expanded inline comments and examples: day_close now uses explicit PR entries, clarified drift entries, invariant "pass" values, and guidance comments; ticket_contract clarifies ticket_id format, is_seam_ticket/interface_change semantics, narrows evidence_requirements to "tests", and expands emergency_bypass guidance.
Documentation
docs/TEMPLATE_GUIDE.md
New comprehensive guide describing Day Close and Ticket Contract templates: field references, allowed values, unknown handling, validation guidance, examples, and links to model definitions under src/onex_change_control/models/.
Tests
tests/test_yaml_parsing.py
Added/expanded tests and fixtures (TEMPLATE_DIR constant, emergency_bypass fixture), covering minimal valid data, template parsing with placeholders, edge cases (unknown invariant statuses, evidence_requirements), and template-derived parsing scenarios.
Day Close Drift Snapshots
drift/day_close/2025-12-21.yaml, drift/day_close/2025-12-22.yaml, drift/day_close/2025-12-23.yaml, drift/day_close/2025-12-24.yaml
Four new dated drift reports capturing schema_version/date, plans, actual_by_repo PR lists (merged/open states and notes), drift_detected, invariants_checked statuses, and empty corrections/risks sections.
Pre-commit configuration
.pre-commit-config.yaml
Switched to official ruff-pre-commit (rev v0.14.2), consolidated ruff checks into a single hook with --fix --exit-non-zero-on-fix semantics, removed local ruff integration, and adjusted mypy-type-check as a local/pre-push hook running on changed Python files.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰
Templates polished, carrots of guidance laid,
Four days of progress, each snapshot displayed.
Tests nibble edge cases, tidy and bright,
Ruff hops in neatly, linting through the night.
A rabbit cheers softly — tidy code, alright!

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main enhancement to YAML templates with comprehensive guidance, directly matching the primary objective of improving documentation and validation in both day_close and ticket_contract templates.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch jonah/omn-964-create-yaml-templates

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f846e9b and eaccb2b.

📒 Files selected for processing (3)
  • templates/day_close.template.yaml
  • templates/ticket_contract.template.yaml
  • tests/test_yaml_parsing.py
🧰 Additional context used
🧬 Code graph analysis (1)
tests/test_yaml_parsing.py (2)
src/onex_change_control/models/model_day_close.py (1)
  • ModelDayClose (144-236)
src/onex_change_control/models/model_ticket_contract.py (2)
  • ModelTicketContract (67-186)
  • is_complete (167-186)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: claude-review
🔇 Additional comments (13)
templates/day_close.template.yaml (4)

1-14: Excellent header documentation!

The header block provides clear, actionable guidance for users. The step-by-step usage instructions and validation command reference make the template truly copy-paste safe.


16-27: Clear format guidance and empty list handling.

The ISO date format example and empty list guidance help users understand edge cases and expected formats.


41-55: Comprehensive enum documentation and unknown handling guidance.

The state enum values and drift categories are clearly documented. The unknown handling guidance (e.g., "TBD - requires investigation" for uncertain drift) provides practical direction for incomplete information scenarios.


57-76: Well-documented invariants with unknown handling and consistent placeholders.

The invariants section clearly documents valid status values including "unknown" for pending investigations. The corrections and risks sections maintain the pattern of empty list guidance established earlier.

tests/test_yaml_parsing.py (5)

77-114: Solid minimal validation test for day_close template.

This test confirms the template structure accepts minimal valid data (empty lists for optional collections). The assertions comprehensively validate all required fields and collection lengths.


116-150: Comprehensive minimal validation test for ticket_contract template.

The test correctly validates the interface constraint (interface_change=False requires empty interfaces_touched) and exercises all required fields with minimal valid data.


152-209: Thorough coverage of all evidence requirement kinds.

This test validates all five evidence kinds (tests, docs, ci, benchmark, manual) and correctly demonstrates that the command field is optional. The assertions verify each kind individually, ensuring robust validation.


211-241: Accurate test of incomplete state handling.

This test correctly validates the temporary state where interface_change=True but interfaces_touched is empty. The assertion that is_complete returns False aligns perfectly with the ModelTicketContract property logic.


243-270: Complete emergency bypass scenario validation.

This test properly validates the emergency bypass configuration when enabled, ensuring both required fields (justification and follow_up_ticket_id) are present. The test data represents a realistic emergency scenario.

templates/ticket_contract.template.yaml (4)

1-21: Consistent header and clear seam ticket documentation.

The header documentation maintains consistency with the day_close template, and the seam ticket explanation clearly defines when to mark tickets as touching cross-repo interfaces.


23-36: Comprehensive interface documentation with clear rules.

The interface_change and interfaces_touched documentation is thorough, clearly stating the validation rules and providing practical unknown handling guidance. The enum values listed match the expected interface surfaces.


38-58: Excellent evidence requirements documentation covering all five kinds.

The documentation comprehensively covers all evidence kinds (tests, docs, ci, benchmark, manual) with clear descriptions and examples. The optional command field is properly demonstrated, and unknown handling guidance is practical.


59-77: Well-crafted emergency bypass documentation with appropriate warnings.

The emergency bypass section strikes the right balance between documenting the feature and discouraging misuse. The WARNING emphasis and clear required fields (justification, follow_up_ticket_id) help ensure proper usage in genuine emergencies.

Comment thread templates/day_close.template.yaml Outdated
@claude

claude Bot commented Dec 23, 2025

Copy link
Copy Markdown

Pull Request Review: feat(templates): enhance YAML templates with comprehensive guidance [OMN-964]

Summary

This PR successfully enhances YAML templates with comprehensive documentation and adds robust test coverage. The changes are well-structured and align with the stated acceptance criteria. Overall, this is high-quality work with excellent attention to detail.


Strengths

1. Excellent Documentation

  • Clear usage instructions: Both templates now include step-by-step usage guides
  • Comprehensive inline comments: Every field has helpful explanations with valid values
  • Unknown handling guidance: Proper guidance for edge cases and incomplete information
  • Schema alignment: Templates explicitly reference the corresponding Pydantic models

2. Strong Test Coverage

The 5 new tests comprehensively validate:

  • Minimal valid configurations
  • All evidence requirement kinds
  • Unknown/incomplete scenarios
  • Emergency bypass functionality

3. Code Quality

  • Consistent formatting and style
  • Clear test names following pytest conventions
  • Good use of comments to explain test intent
  • Proper assertions with helpful error messages

Issues & Recommendations

CRITICAL: Invalid Template Data

Location: templates/day_close.template.yaml:39

Issue: The template contains invalid placeholder data that will cause validation errors.

Problem: According to ModelDayClosePR in model_day_close.py:63, the pr field has validator ge=1 (greater than or equal to 1). The template uses pr: 0 which will fail validation.

Fix: Change line 39 from pr: 0 to pr: 1

Impact: Users copying this template as-is will get validation errors, defeating the copy/paste safe goal.


MINOR: Test Coverage Gap

Consider adding a test validating day close reports can use unknown for invariant statuses, matching the template guidance in lines 57-60.


SUGGESTION: Template Validation Script

Consider adding a test that parses template files with minimal placeholders. This would catch issues like pr: 0 automatically in CI.


Security Assessment

No security concerns identified.

  • All new code is data validation and test code
  • No user input handling or external API calls
  • Pydantic models already have security constraints
  • Templates properly document security-sensitive fields

Performance Considerations

No performance issues. All changes are:

  • Static template files (no runtime impact)
  • Test code that runs in CI only
  • Well-scoped test cases with minimal data

Best Practices Alignment

Follows Repository Conventions

  • Naming conventions: All test functions follow test_ prefix
  • Code style: Consistent with existing structure
  • Documentation: Clear docstrings on all new test functions

Follows Python/Pytest Best Practices

  • Tests are isolated and independent
  • Clear arrange-act-assert pattern
  • Proper use of Pydantic validation

Template Best Practice Violation

The pr: 0 placeholder violates the copy/paste safe goal.


Acceptance Criteria Review

Criterion Status Notes
Templates are schema-aligned PASS Both templates correctly reference schema models
Copy/paste safe with clear guidance PARTIAL Mostly yes, but pr: 0 will fail validation
Include guidance for evidence requirements PASS Comprehensive coverage of all 5 evidence kinds
Include guidance for unknown handling PASS Well-documented in both templates
Include guidance for bypass fields PASS Excellent warnings and examples
Templates validate with minimal valid values PARTIAL Tests pass, but template has invalid placeholder

Recommendations Summary

Must Fix (Blocking)

  1. Fix pr: 0 to pr: 1 in templates/day_close.template.yaml:39

Should Consider (Non-blocking)

  1. Add test for unknown invariant statuses
  2. Consider automated template parsing validation

Nice to Have

  1. Improve comment formatting consistency

Final Verdict

Recommendation: Request changes for the critical pr: 0 issue.

Once the PR number placeholder is fixed to use pr: 1, this PR will be ready to merge. The issue is minor but important - it directly contradicts the copy/paste safe goal.

Great work overall! The documentation improvements are substantial and the test coverage is excellent.

- Fix critical issue: Change pr: 0 to pr: 1 in day_close template
  (pr field has ge=1 validator, pr: 0 would fail validation)

- Add test for unknown invariant statuses
  (validates template guidance for using 'unknown' when status cannot be determined)

- Add template file parsing validation test
  (catches invalid placeholder values automatically in CI)

- Fix linting: Move imports to top level

All review feedback addressed. All tests pass.
@claude

claude Bot commented Dec 23, 2025

Copy link
Copy Markdown

PR Review: feat(templates): enhance YAML templates with comprehensive guidance [OMN-964]

Overall Assessment

This is a well-executed PR that significantly improves the usability and safety of the YAML templates. The enhancements are thorough, well-documented, and include comprehensive test coverage. The code quality is excellent with strong adherence to the repository's conventions.

Verdict: ✅ Approve with minor suggestions


Code Quality & Best Practices ✅

Strengths:

  1. Excellent documentation: Inline comments are clear, structured, and provide copy/paste guidance
  2. Schema alignment: Templates properly align with Pydantic models (ModelDayClose, ModelTicketContract)
  3. Comprehensive testing: 5 new tests cover core functionality, edge cases, and template validation
  4. Naming conventions: All code follows omnibase_core conventions (no model/enum changes in this PR)
  5. Type safety: All test code is properly typed and validated

Test Coverage:

  • ✅ test_template_day_close_minimal_valid: Validates minimal day close
  • ✅ test_template_ticket_contract_minimal_valid: Validates minimal ticket contract
  • ✅ test_template_ticket_contract_with_evidence_requirements: Tests all 5 evidence kinds
  • ✅ test_template_ticket_contract_unknown_handling: Tests incomplete/temporary states
  • ✅ test_template_ticket_contract_emergency_bypass: Tests emergency bypass configuration
  • ✅ test_template_day_close_unknown_invariant_statuses: Tests "unknown" invariant handling
  • ✅ test_template_files_parse_with_minimal_replacements: Template validation test

Test quality is exemplary - tests are well-named, documented, and cover both happy paths and edge cases.


Potential Issues & Suggestions

1. Template Example PR Number (Minor Issue)

Location: templates/day_close.template.yaml:39

The template now uses pr: 1 as an example, which is good! However, the comment on line 39 says:

- pr: 1  # PR number (must be >= 1)

Suggestion: Consider making it even more explicit that this is a placeholder:

- pr: 123  # PR number (must be >= 1, replace with actual PR number)

This makes it clearer that users should replace with their actual PR number, not just use 1.

2. Test Duplication (Code Quality)

Location: tests/test_yaml_parsing.py:239-290

The test_template_files_parse_with_minimal_replacements() test duplicates logic from the earlier minimal valid tests. This creates maintenance burden if schemas change.

Suggestion: Consider refactoring to reduce duplication:

def test_template_files_parse_with_minimal_replacements() -> None:
    """Test that template files can be parsed with minimal placeholder replacements."""
    
    # Test day_close template
    day_close_template_path = TEMPLATE_DIR / "day_close.template.yaml"
    if day_close_template_path.exists():
        with day_close_template_path.open() as f:
            day_close_data = yaml.safe_load(f)
        
        # Use the same minimal data from the earlier test
        minimal_day_close = _get_minimal_day_close_data()
        day_close_data.update(minimal_day_close)
        
        day_close = ModelDayClose.model_validate(day_close_data)
        assert day_close.schema_version == "1.0.0"

3. Unknown Handling Guidance Clarity

Location: templates/ticket_contract.template.yaml:33-35

The unknown handling guidance for interfaces_touched says:

# Unknown handling: If unsure which interfaces are affected, set interface_change=true
#     and leave this empty temporarily, but populate before ticket completion

This is good, but could be clearer about the validation behavior.

Suggestion: Add a note about the is_complete property:

# Unknown handling: If unsure which interfaces are affected, set interface_change=true
#     and leave this empty temporarily. NOTE: The contract.is_complete property will
#     return False until interfaces_touched is populated. Populate before ticket completion.

4. Evidence Requirements Command Optionality

Location: templates/ticket_contract.template.yaml:52

The comment says # Optional: null if not applicable but this could be clearer about when to use null vs when to omit the field.

Suggestion: Clarify with examples:

command: "poetry run pytest tests/test_models.py"  # Optional: null or omit if not applicable

Or in the examples:

# Example with command:
# - kind: "tests"
#   description: "Unit tests for ModelDayClose date validation"
#   command: "poetry run pytest tests/test_models.py::test_day_close_date_validation"
# 
# Example without command (docs don't need reproduction commands):
# - kind: "docs"
#   description: "Update ADR for ticket contract schema"
#   command: null  # or simply omit this field

Performance Considerations ✅

No performance concerns. The changes are template documentation and tests only. Test execution time is minimal.


Security Concerns ✅

No security issues identified:

  • ✅ All validation is handled by existing Pydantic models with proper constraints
  • ✅ No user input processing or external dependencies introduced
  • ✅ Templates use safe placeholder syntax (<...>, YYYY-MM-DD)
  • ✅ Emergency bypass warnings are prominently displayed

Architecture & Design ✅

The PR follows the repository's design philosophy:

  • ✅ Templates are schema-aligned with Pydantic models
  • ✅ Guidance supports both "steady state" and "temporary/unknown" scenarios
  • ✅ Emergency bypass guidance includes appropriate warnings
  • ✅ Copy/paste safety is prioritized with clear placeholders

Additional Observations

Excellent Additions:

  1. Unknown handling guidance: The explicit guidance for "unknown" invariant statuses (templates/day_close.template.yaml:57-60) is particularly valuable
  2. Emergency bypass warnings: The prominent warnings in templates/ticket_contract.template.yaml:60-62 will help prevent misuse
  3. Evidence kinds documentation: Comprehensive coverage of all 5 evidence kinds with clear examples
  4. Validation guidance: The usage instructions at the top of each template are clear and actionable

Test Quality Highlights:

  • Tests use descriptive docstrings explaining what they validate
  • Edge cases are well-covered (empty lists, unknown statuses, emergency bypass)
  • Test data matches the guidance in the templates
  • Tests verify the is_complete property behavior

Recommendations

Before Merge:

  1. ✅ All tests pass (confirmed in PR description)
  2. ✅ Schema determinism check should pass (no schema changes, only templates/tests)

Future Enhancements:

  1. Consider adding a template validation script to CI that automatically tests templates can be parsed
  2. Consider adding examples of "bad" templates that should fail validation (negative test examples)

Summary

This PR successfully meets all acceptance criteria from OMN-964:

  • ✅ Templates are schema-aligned
  • ✅ Copy/paste safe with clear guidance
  • ✅ Evidence requirements guidance included
  • ✅ Unknown handling guidance included
  • ✅ Emergency bypass guidance with warnings
  • ✅ All tests pass

The suggestions above are minor and don't block merging. Great work on making these templates production-ready! 🎉


Reviewed by: Claude Code Assistant
Review date: 2025-12-23

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
tests/test_yaml_parsing.py (1)

308-363: Consider explicit skip markers for missing templates.

The if template_path.exists() checks silently pass when templates are missing. This could mask issues if templates are accidentally deleted. For consistency with test_parse_existing_day_close_yaml (line 18), consider using pytest.mark.skipif or asserting template existence with a clear failure message.

🔎 Alternative approach with explicit skip
 def test_template_files_parse_with_minimal_replacements() -> None:
     """Test that template files can be parsed with minimal placeholder replacements.
     ...
     """
     # Test day_close template with minimal replacements
     day_close_template_path = TEMPLATE_DIR / "day_close.template.yaml"
-    if day_close_template_path.exists():
+    if not day_close_template_path.exists():
+        pytest.skip(f"Template not found: {day_close_template_path}")
+    
+    with day_close_template_path.open() as f:
+        day_close_data = yaml.safe_load(f)
         ...

Alternatively, split into separate test functions with @pytest.mark.skipif decorators.

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between eaccb2b and 5d48b7a.

📒 Files selected for processing (2)
  • templates/day_close.template.yaml
  • tests/test_yaml_parsing.py
🧰 Additional context used
🧬 Code graph analysis (1)
tests/test_yaml_parsing.py (2)
src/onex_change_control/models/model_day_close.py (1)
  • ModelDayClose (144-236)
src/onex_change_control/models/model_ticket_contract.py (2)
  • ModelTicketContract (67-186)
  • is_complete (167-186)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: claude-review
🔇 Additional comments (12)
templates/day_close.template.yaml (5)

1-14: Well-documented template header.

Clear usage instructions with schema version and validation command. The copy/paste workflow guidance is practical and actionable.


36-44: PR number constraint addressed.

The pr: 1 value now satisfies the >= 1 requirement, making the template copy/paste safe. Good inline documentation for valid states.


46-55: Clear drift detection guidance.

The unknown handling guidance (lines 48-49) is practical for cases requiring investigation. Valid category enum values are well-documented.


57-65: Comprehensive invariant guidance with unknown handling.

Valid enum values documented inline, and the "unknown" option is properly explained for cases where status cannot be determined. This aligns with the corresponding test (test_template_day_close_unknown_invariant_statuses).


72-76: Risk section structure is clear.

Explicit field names (risk, mitigation) with placeholder values make the structure obvious.

tests/test_yaml_parsing.py (7)

11-12: LGTM.

Path resolution correctly navigates from tests/ to templates/ directory.


80-116: Solid minimal validity test.

Covers all required fields with minimal valid values. Assertions are comprehensive without being redundant.


119-152: LGTM.

Minimal ticket contract test correctly enforces the constraint that interfaces_touched must be empty when interface_change=False.


155-211: Comprehensive evidence requirements coverage.

Tests all five evidence kinds with varied command field usage (some with values, some with None). Good use of expected_evidence_count constant for clarity.


214-243: Good test for incomplete state handling.

Validates that interface_change=True with empty interfaces_touched is allowed but correctly marked as incomplete via is_complete=False. This aligns with the model's validation behavior.


246-273: LGTM.

Emergency bypass test covers enabled state with required justification and follow-up ticket fields.


276-305: LGTM.

Validates "unknown" status for invariants, confirming the template guidance that this is a valid value when status cannot be determined.

- Add 2025-12-21.yaml day close report
- Add 2025-12-22.yaml day close report
- Add 2025-12-23.yaml day close report

All files validated against ModelDayClose schema.
@claude

claude Bot commented Dec 24, 2025

Copy link
Copy Markdown

Pull Request Review: PR #6 - Template Enhancements [OMN-964]

Overview

This PR enhances YAML templates for Day Close and Ticket Contract with comprehensive inline guidance and adds robust validation tests. The changes are well-executed and meet the stated acceptance criteria.


✅ Strengths

1. Documentation Quality

  • Excellent inline guidance: Both templates now include clear, copy-paste-safe documentation with:
    • Schema version alignment
    • Valid enum values explicitly listed
    • Unknown handling guidance
    • Field format examples (e.g., ISO date format)
  • Template headers: Well-structured headers explain usage, schema alignment, and validation steps
  • Defensive documentation: Emergency bypass warnings appropriately emphasize the exceptional nature of this feature

2. Test Coverage

  • Comprehensive test suite: 5 new tests cover:
    • Minimal valid values for both templates
    • All evidence kinds (tests, docs, ci, benchmark, manual)
    • Unknown handling scenarios
    • Emergency bypass configuration
    • Template file parsing validation
  • Template validation: The test_template_files_parse_with_minimal_replacements() test is particularly valuable - it catches invalid placeholder values (like the pr: 0 bug) automatically in CI
  • Edge cases: Tests validate the is_complete property for incomplete contracts (e.g., interface_change=True with empty interfaces_touched)

3. Code Quality

  • Consistent with codebase standards: Follows existing patterns in test_yaml_parsing.py
  • Good test names: Descriptive function names clearly indicate what each test validates
  • Proper use of Pydantic validation: Tests validate against the models, ensuring schema alignment

🔍 Areas for Consideration

1. Day Close YAML Files - Missing Actual Work

Location: drift/day_close/2025-12-21.yaml, 2025-12-22.yaml, 2025-12-23.yaml

Issue: All three day close reports show empty actual_by_repo.prs arrays for all repositories, including OmniNode-ai/onex_change_control. However, based on the PR description, work was completed during this period (OMN-962, OMN-963, OMN-964).

Impact: This creates a plan vs. actual mismatch. The day close reports should either:

  1. Include the actual PRs that were merged during these days, OR
  2. Show drift detection entries if the PRs weren't in the original plan

Recommendation: Review the actual work done on these dates and update the reports accordingly. For example, if PR #6 was worked on during Dec 23, the report should include:

actual_by_repo:
  - repo: "OmniNode-ai/onex_change_control"
    prs:
      - pr: 6
        title: "feat(templates): enhance YAML templates with comprehensive guidance [OMN-964]"
        state: "open"  # or "merged" if merged that day
        notes: "Implements comprehensive template guidance for OMN-964"

2. Template Comments - Line Length

Location: templates/day_close.template.yaml:16-76, templates/ticket_contract.template.yaml:14-77

Observation: Some comment blocks are quite long (60+ lines in ticket_contract template). While the documentation is valuable, it may be overwhelming for users who just want to quickly fill out a template.

Suggestion: Consider a two-tier documentation approach:

  • Keep essential guidance inline (field requirements, valid values)
  • Move detailed explanations (e.g., emergency bypass warnings, unknown handling rationale) to a separate TEMPLATE_GUIDE.md referenced in the header

Benefit: Balances discoverability with usability for experienced users

3. Test Data Duplication

Location: tests/test_yaml_parsing.py:80-363

Observation: Some test data structures are repeated across tests (e.g., minimal emergency_bypass configuration appears in multiple tests). While the duplication is minimal, it creates maintenance burden if the schema changes.

Suggestion: Consider extracting common test fixtures:

@pytest.fixture
def minimal_emergency_bypass():
    return {
        "enabled": False,
        "justification": "",
        "follow_up_ticket_id": "",
    }

@pytest.fixture
def minimal_day_close_data(minimal_emergency_bypass):
    # ...

Benefit: Reduces duplication and makes schema changes easier to propagate through tests


🔒 Security

No concerns identified. The templates and tests don't introduce any security vulnerabilities:

  • No hardcoded credentials or sensitive data
  • Tests validate against existing security constraints (_MAX_STRING_LENGTH, _MAX_LIST_ITEMS)
  • Emergency bypass feature has appropriate validation (justification and follow-up ticket required when enabled)

⚡ Performance

No concerns identified. The changes are documentation and test additions that don't affect runtime performance:

  • Template files are static resources
  • Tests run quickly (no heavy I/O or computation)
  • YAML parsing is already optimized in existing codebase

📋 Style & Conventions

Adheres to repository conventions:

  • ✅ Follows naming conventions from README.md (Model* classes, snake_case for files)
  • ✅ Uses consistent YAML formatting
  • ✅ Test functions follow test_* pattern
  • ✅ Proper use of type hints (implied by passing mypy)
  • ✅ Docstrings follow existing style

🎯 Acceptance Criteria Met

All acceptance criteria from OMN-964 are satisfied:

  • ✅ Templates are schema-aligned
  • ✅ Copy/paste safe with clear guidance
  • ✅ Include guidance for evidence requirements
  • ✅ Include guidance for unknown handling
  • ✅ Include guidance for bypass fields
  • ✅ Templates validate against schemas with minimal valid values

📝 Recommendations Summary

High Priority:

  1. Update day close YAML files (2025-12-21 through 2025-12-23) to reflect actual work completed, or add drift detection entries if work was unplanned

Medium Priority:
2. Consider extracting lengthy template guidance to a separate TEMPLATE_GUIDE.md for better usability

Low Priority (Optional):
3. Extract common test fixtures to reduce duplication and improve maintainability


✅ Verdict

Approve with minor recommendations. This PR delivers high-quality template enhancements with excellent documentation and comprehensive test coverage. The only substantive issue is the day close YAML files showing no actual work despite PRs being created during that period. This should be corrected to maintain the integrity of the drift control system.

The template improvements are production-ready and will significantly improve the developer experience when creating day close reports and ticket contracts.


Reviewed by: Claude Code (Sonnet 4.5)
Review Date: 2025-12-24

…nd improve template guidance [OMN-964]

- Update day close YAML files (2025-12-21 through 2025-12-23) to include actual PRs worked on
  - 2025-12-21: Added PR #4 (merged) and PR #5 (open)
  - 2025-12-22: Added PR #5 (open)
  - 2025-12-23: Added PR #5 (merged) and PR #6 (open)
- Improve day_close template: Change PR placeholder from pr: 1 to pr: 123 with clearer comment
- Improve ticket_contract template:
  - Enhance unknown handling guidance to mention is_complete property behavior
  - Add examples for evidence requirements command optionality (null vs omit)

All changes validate successfully against schema models.
…t test fixtures [OMN-964]

- Extract lengthy template guidance to docs/TEMPLATE_GUIDE.md for better usability
- Update templates to reference guide while keeping essential inline comments
- Extract common test fixtures (minimal_emergency_bypass, minimal_day_close_data, minimal_ticket_contract_data) to reduce duplication
- Addresses PR #6 review feedback: medium priority (template guidance extraction) and low priority (test fixture extraction)

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 262eb40 and f195e9a.

📒 Files selected for processing (7)
  • docs/TEMPLATE_GUIDE.md
  • drift/day_close/2025-12-21.yaml
  • drift/day_close/2025-12-22.yaml
  • drift/day_close/2025-12-23.yaml
  • templates/day_close.template.yaml
  • templates/ticket_contract.template.yaml
  • tests/test_yaml_parsing.py
🚧 Files skipped from review as they are similar to previous changes (4)
  • drift/day_close/2025-12-22.yaml
  • drift/day_close/2025-12-21.yaml
  • templates/ticket_contract.template.yaml
  • drift/day_close/2025-12-23.yaml
🧰 Additional context used
🪛 GitHub Actions: CI
docs/TEMPLATE_GUIDE.md

[error] 1-1: End-of-file-fixer hook failed. The hook modified files (docs/TEMPLATE_GUIDE.md).

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: claude-review
🔇 Additional comments (15)
tests/test_yaml_parsing.py (8)

11-12: LGTM!

The template directory path construction is correct and clearly documented.


18-27: LGTM!

The minimal emergency bypass fixture correctly represents a disabled bypass state with proper type hints.


29-48: LGTM!

The minimal day close fixture correctly provides all required fields with valid minimal values, making it suitable for testing template validation.


50-65: LGTM!

The minimal ticket contract fixture correctly composes the emergency bypass fixture and provides all required fields with valid minimal values.


88-125: LGTM!

Good refactoring to use the shared fixture, reducing duplication while maintaining test coverage.


127-293: LGTM!

Excellent test coverage including:

  • Minimal valid cases for both templates
  • All five evidence requirement kinds (tests, docs, ci, benchmark, manual)
  • Unknown handling scenarios with proper is_complete validation
  • Emergency bypass configuration

The tests are well-documented and cover important edge cases.


295-319: LGTM!

This test correctly validates that all invariant fields accept "unknown" as a valid status value, ensuring the template guidance for unknown handling is properly supported by the schema.


321-357: LGTM!

This integration test effectively validates that the template files are schema-aligned by loading them directly and replacing placeholders with minimal valid values. The existence checks and validation against Pydantic models provide good safety.

templates/day_close.template.yaml (4)

1-29: LGTM!

The enhanced header documentation provides clear usage instructions, validation commands, and references to the detailed guide. The date placeholder and empty list guidance improve template usability.


36-46: LGTM!

The PR placeholder is now set to 123 (>= 1), making it copy-paste safe and consistent with the inline comment. The state enum values are clearly documented, and the empty PR list example adds useful guidance.


48-56: LGTM!

The drift detection section now includes concrete examples and documents all valid enum values, making it easier for users to fill out correctly. The reference to the detailed guide is helpful.


58-76: LGTM!

The invariants section clearly documents all valid status values ("pass" | "fail" | "unknown") and provides inline explanations for each invariant. The empty list guidance for corrections and risks is consistent with other sections.

docs/TEMPLATE_GUIDE.md (3)

1-99: LGTM!

The Day Close Template documentation is comprehensive and accurate, covering all fields with proper types, validation rules, and unknown-handling guidance. This aligns well with the template file itself.


100-192: LGTM!

The Ticket Contract Template documentation thoroughly covers all fields including detailed evidence requirements guidance and appropriate warnings for emergency bypass usage. The code examples are well-formatted and demonstrate proper YAML syntax.


193-222: LGTM!

The Common Patterns section effectively consolidates guidance on unknown handling, empty lists, and validation procedures. The schema alignment references are helpful for developers.

Comment thread docs/TEMPLATE_GUIDE.md
@@ -0,0 +1,222 @@
# Template Guide for ONEX Change Control

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Add newline at end of file to fix pre-commit hook.

The end-of-file-fixer hook failed because the file is missing a newline at the end. This is a standard POSIX text file requirement and many editors/linters enforce it.

🔎 Fix: Add newline at end of file

Ensure the file ends with a single newline character after line 222. Most editors have a setting to automatically add this (e.g., VS Code's "files.insertFinalNewline": true).

🧰 Tools
🪛 GitHub Actions: CI

[error] 1-1: End-of-file-fixer hook failed. The hook modified files (docs/TEMPLATE_GUIDE.md).

🤖 Prompt for AI Agents
In docs/TEMPLATE_GUIDE.md around lines 1 to 1, the file is missing a trailing
newline which caused the pre-commit end-of-file-fixer hook to fail; add a single
newline character at the end of the file (ensure exactly one final newline, not
extra blank lines) and optionally enable your editor's "insert final newline"
setting so future edits preserve it.

@claude

claude Bot commented Dec 25, 2025

Copy link
Copy Markdown

PR Review: Enhanced YAML Templates with Comprehensive Guidance

Summary

This PR successfully delivers comprehensive template guidance for Day Close and Ticket Contract YAML templates, along with extensive test coverage and three day close reports. The implementation is well-structured, thoroughly documented, and demonstrates excellent alignment with the schema models.

✅ Strengths

1. Excellent Documentation Architecture

  • TEMPLATE_GUIDE.md (222 lines): Outstanding extraction of detailed guidance into a dedicated document
  • Clear separation of concerns: templates have inline quick-reference comments, guide has detailed explanations
  • Well-organized with table of contents, field-by-field documentation, and examples

2. High-Quality Template Design

Both templates are:

  • Schema-aligned: Perfectly match the Pydantic models
  • Copy/paste safe: Include clear placeholders and usage instructions
  • Self-documenting: Inline comments explain valid values and constraints

Key improvements:

  • templates/day_close.template.yaml:41: Changed pr: 0 to pr: 123 (fixes validator constraint ge=1)
  • Comprehensive inline documentation of all valid enum values
  • Clear guidance for unknown/incomplete states

3. Comprehensive Test Coverage

test_yaml_parsing.py adds 289 lines with 7 new tests:

  • test_template_day_close_minimal_valid: Validates minimal valid day close ✅
  • test_template_ticket_contract_minimal_valid: Validates minimal valid ticket contract ✅
  • test_template_ticket_contract_with_evidence_requirements: Tests all 5 evidence kinds ✅
  • test_template_ticket_contract_unknown_handling: Validates incomplete states and is_complete property ✅
  • test_template_ticket_contract_emergency_bypass: Validates emergency bypass configuration ✅
  • test_template_day_close_unknown_invariant_statuses: Tests "unknown" invariant values ✅
  • test_template_files_parse_with_minimal_replacements: Catches invalid placeholder values in CI ✅

Test quality highlights:

  • Uses pytest fixtures to reduce duplication
  • Tests edge cases: unknown handling, incomplete contracts, emergency bypass
  • Validates critical behaviors: is_complete property, constraint validation
  • Clear docstrings explaining test purpose

4. Real-World Day Close Reports

Three day close reports provide real examples with actual PR tracking and proper use of "unknown" for real_infra_proof_progressing.

5. Strong Commit History

Well-organized commits showing iterative refinement based on review feedback.

🎯 Acceptance Criteria Assessment

All acceptance criteria from OMN-964 are met:
✅ Templates are schema-aligned
✅ Copy/paste safe with clear guidance
✅ Include guidance for evidence requirements
✅ Include guidance for unknown handling
✅ Include guidance for bypass fields
✅ Templates validate against schemas when filled with minimal valid values

🚀 Performance Considerations

No performance concerns - templates are static YAML files, tests use fixtures efficiently.

🔒 Security Considerations

Excellent security awareness:

  • Templates include WARNING comments for emergency bypass: templates/ticket_contract.template.yaml:46
  • Guide emphasizes emergency bypass only for genuine emergencies: docs/TEMPLATE_GUIDE.md:178
  • Models enforce security constraints via _MAX_STRING_LENGTH and _MAX_LIST_ITEMS
  • Emergency bypass validation requires justification and follow-up ticket when enabled

📝 Potential Improvements (Minor)

1. Template Fixture Validation Test Could Be More Specific

Location: tests/test_yaml_parsing.py:321-358

The test_template_files_parse_with_minimal_replacements test loads template files but then completely replaces contents with fixture data. This doesn't actually test that template file placeholders are valid YAML.

Suggestion: Consider selectively replacing only placeholder fields or renaming the test to clarify it's testing fixtures.

Impact: Low - test still provides value but name is slightly misleading.

2. Day Close Template Drift Example Category

Location: templates/day_close.template.yaml:52

Consider using a more distinctive example category like architecture or interfaces instead of scope to make it more obvious this is a placeholder.

Impact: Very low - just a template ergonomics improvement.

3. Validation Script Reference

Location: templates/*.template.yaml (header comments)

Both templates reference: poetry run python scripts/validate_yaml_against_schema.py

Question: Does this script exist? If not, consider removing the reference, creating the script, or updating to reference an existing validation mechanism.

Impact: Low - users might try to run a non-existent script.

4. Test Fixture Type Hints

Location: tests/test_yaml_parsing.py:20-64

Fixtures use broad type hints like dict[str, str | bool]. Consider using TypedDict for better IDE support and type checking.

Impact: Low - current approach works fine, this would improve developer experience.

🎨 Best Practices Demonstrated

  1. DRY Principle: Test fixtures eliminate duplication
  2. Documentation First: Comprehensive guide before implementation details
  3. Real-World Examples: Day close reports show actual usage
  4. Clear Communication: Inline comments, guide references, and warnings
  5. Iterative Refinement: Commit history shows responsive improvements
  6. Schema Alignment: Perfect consistency between models and templates
  7. Edge Case Testing: Unknown states, incomplete contracts, emergency scenarios

📊 Test Coverage Analysis

The PR adds 7 comprehensive tests covering all template usage scenarios. No coverage gaps identified.

🔧 Files Changed Analysis

New Files (4):

  • docs/TEMPLATE_GUIDE.md (+222 lines)
  • drift/day_close/2025-12-21.yaml (+42 lines)
  • drift/day_close/2025-12-22.yaml (+40 lines)
  • drift/day_close/2025-12-23.yaml (+44 lines)

Modified Files (3):

  • templates/day_close.template.yaml (+44/-14 lines)
  • templates/ticket_contract.template.yaml (+38/-8 lines)
  • tests/test_yaml_parsing.py (+289/-6 lines)

Total: +719 additions, -28 deletions across 7 files

✨ Verdict

LGTM with minor suggestions

This is high-quality work that successfully achieves all stated objectives:

  • Templates are production-ready, schema-aligned, and user-friendly
  • Documentation is comprehensive and well-organized
  • Test coverage is excellent with good edge case handling
  • Real-world examples demonstrate proper usage
  • Security considerations are properly documented

The minor suggestions above are truly optional improvements that could be addressed in follow-up work. The PR is ready to merge as-is.

Recommended merge strategy: Squash and merge to consolidate the iterative refinements into a single clean commit.


Great work! This PR demonstrates excellent software engineering practices: comprehensive documentation, thorough testing, iterative refinement based on feedback, and real-world validation. The template guidance will significantly improve usability for the drift control system.

- Fix end-of-file formatting in docs/TEMPLATE_GUIDE.md
- Apply ruff formatting to tests/test_export_json_schema.py
@claude

claude Bot commented Dec 25, 2025

Copy link
Copy Markdown

PR Review: feat(templates): enhance YAML templates with comprehensive guidance [OMN-964]

Summary

This PR successfully enhances YAML templates with comprehensive guidance and creates supporting documentation. The implementation is well-structured with good test coverage. Overall, this is high-quality work that meets the stated requirements.

Strengths

  1. Excellent Documentation Structure - The extraction of guidance to docs/TEMPLATE_GUIDE.md is a smart design choice that keeps templates concise while providing comprehensive documentation
  2. Comprehensive Test Coverage - 8 new tests covering various scenarios (minimal valid, evidence requirements, unknown handling, emergency bypass)
  3. Schema Alignment - Templates properly align with Pydantic models with correct validation constraints
  4. Unknown Handling Guidance - Good approach to handling incomplete/unknown states
  5. Real-World Usage - Day close files (2025-12-21 through 2025-12-23) demonstrate practical usage

Code Quality Observations

Positive Patterns:

  • Type Annotations: Consistent use of proper type hints in test fixtures
  • Clear Test Documentation: Each test has a descriptive docstring
  • Immutability: Models use frozen=True for immutability (good for historical records)
  • Security: Proper length constraints to prevent DoS attacks

Minor Suggestions (Low Priority):

  1. In test_template_day_close_minimal_valid and similar tests, data = minimal_day_close_data.copy() performs a shallow copy. For nested dictionaries, consider copy.deepcopy(). Impact: Low, since current tests don't mutate nested structures.
  2. Consider adding a test that validates template files are valid YAML (even with placeholders)

Test Coverage Assessment

Coverage: Excellent

  • Minimal valid values for both templates
  • All evidence kinds (tests, docs, ci, benchmark, manual)
  • Unknown invariant statuses
  • Emergency bypass configuration
  • Interface change validation with is_complete property
  • Template file parsing with minimal replacements

Security Review

Status: Good

  1. Input Validation: Pydantic models enforce proper validation
  2. Length Constraints: _MAX_STRING_LENGTH (10000) and _MAX_LIST_ITEMS (1000) prevent DoS
  3. Immutability: Frozen models prevent tampering with historical records
  4. No Injection Risks: YAML parsing uses yaml.safe_load()

Performance Considerations

Status: Good

  • Compiled regex patterns at module level
  • Validation is efficient
  • No obvious performance bottlenecks

Style & Conventions

Status: Excellent

  • Follows repository naming conventions (Model*, Enum*)
  • Consistent with README.md conventions
  • Proper docstrings and type hints
  • Clean, readable code

Best Practices Observed

  1. DRY Principle: Good use of fixtures to avoid duplication
  2. Single Responsibility: Each test validates one specific scenario
  3. Clear Intent: Test names clearly describe what they validate
  4. Documentation: Templates reference the guide for detailed documentation
  5. Version Control: Schema versioning supports future migrations

Recommendations

High Priority: None
Medium Priority: None
Low Priority:

  1. Consider adding a test that validates template files are valid YAML (even with placeholders)
  2. Consider using copy.deepcopy() in tests that copy fixture data

Acceptance Criteria Verification

Per the PR description, all acceptance criteria are met:

  • Templates are schema-aligned
  • Copy/paste safe with clear guidance
  • Include guidance for evidence requirements
  • Include guidance for unknown handling
  • Include guidance for bypass fields (for emergency policy)
  • Templates validate against schemas when filled with minimal valid values

Conclusion

Recommendation: APPROVE

This PR delivers exactly what it promises with high code quality, comprehensive tests, and excellent documentation. The refactoring to extract guidance to TEMPLATE_GUIDE.md was a good design decision that improves usability.

No blocking issues were found. The low-priority suggestions are optional improvements that could be addressed in future PRs if desired.

Great work!

@claude

claude Bot commented Dec 25, 2025

Copy link
Copy Markdown

PR Review: Enhanced YAML Templates with Comprehensive Guidance [OMN-964]

I've completed a thorough review of this PR. Overall, this is excellent work that significantly improves the usability and maintainability of the YAML templates. The implementation is well-structured with comprehensive tests and documentation.


✅ Strengths

Code Quality & Best Practices

  • Excellent documentation structure: The new TEMPLATE_GUIDE.md is comprehensive and well-organized, providing clear field references, examples, and guidance.
  • Schema alignment: Templates are properly aligned with Pydantic models (ModelDayClose, ModelTicketContract).
  • Strong test coverage: Added 5 comprehensive validation tests covering minimal valid cases, evidence requirements, unknown handling, and emergency bypass scenarios.
  • Good use of fixtures: Test fixtures (minimal_emergency_bypass, minimal_day_close_data, minimal_ticket_contract_data) effectively reduce code duplication.
  • Inline template comments: Templates now have excellent inline comments that make them copy/paste safe with clear placeholders.

Security & Validation

  • No security concerns identified: All inputs are validated through existing Pydantic models with proper constraints.
  • DoS protection: Models already have _MAX_STRING_LENGTH and _MAX_LIST_ITEMS constraints defined.
  • Proper validation: Emergency bypass validation ensures required fields when enabled.

📋 Observations & Suggestions

1. Test Formatting Changes (Minor)

Location: tests/test_export_json_schema.py:57-59, tests/test_export_json_schema.py:94-96

The formatting changes from multiline assertions to single-line assertions are fine, but inconsistent with the rest of the file. The original multiline format is more readable when error messages are long. This is a minor style preference and not a blocker.

2. Day Close Files - Data Accuracy (Question)

Location: drift/day_close/2025-12-21.yaml, drift/day_close/2025-12-22.yaml, drift/day_close/2025-12-23.yaml, drift/day_close/2025-12-24.yaml

These files document historical work. Are all the PRs and dates accurate? For example, 2025-12-21.yaml shows PR #5 as "open" but it was likely merged before 2025-12-24. Consider whether these should be marked as historical snapshots or if they need updating based on actual PR states at those dates.

This isn't a code quality issue, just a data accuracy consideration for the drift control system's integrity.

3. Template Default Values (Minor Enhancement)

Location: templates/ticket_contract.template.yaml:41-43

The template shows an evidence requirement example with a placeholder command, but users might not realize that command is optional. Consider showing both examples (one with command, one without) in the template. The TEMPLATE_GUIDE.md already shows this clearly (lines 162-172), so this is just a usability enhancement.

4. Test Coverage - Interface Validation (Enhancement Opportunity)

Location: tests/test_yaml_parsing.py

The tests are comprehensive, but there's one edge case not covered: interface_change=False with non-empty interfaces_touched should raise a validation error (this is tested in the model but not explicitly in these template validation tests).

Consider adding a test like test_template_ticket_contract_interface_validation_error to ensure the validation logic is properly exercised.

5. Documentation - Unknown Handling (Clarification)

Location: docs/TEMPLATE_GUIDE.md:142, templates/ticket_contract.template.yaml:33

The guidance on interfaces_touched unknown handling is clear but could be more prominent in the template itself with a clearer warning about the is_complete property behavior.


🎯 Summary & Recommendation

Recommendation: ✅ Approve with minor suggestions

This PR successfully meets all acceptance criteria:

  • ✅ Templates are schema-aligned
  • ✅ Copy/paste safe with clear guidance
  • ✅ Include guidance for evidence requirements
  • ✅ Include guidance for unknown handling
  • ✅ Include guidance for bypass fields
  • ✅ Templates validate against schemas with minimal valid values

The suggestions above are optional enhancements and not blockers. The code is production-ready as-is.


📊 Metrics

  • Files changed: 9
  • Lines added: 776
  • Lines deleted: 34
  • Test coverage: 5 new comprehensive tests added
  • Documentation: 221 lines of new documentation in TEMPLATE_GUIDE.md

Great work on this implementation! The templates and documentation will significantly improve the developer experience for working with the ONEX drift control system.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5e5e26b and 082ee0f.

📒 Files selected for processing (1)
  • drift/day_close/2025-12-24.yaml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: claude-review
🔇 Additional comments (5)
drift/day_close/2025-12-24.yaml (5)

1-2: LGTM!

Metadata fields follow the expected format with semantic versioning and ISO date format.


6-10: LGTM!

Plan entries are well-structured with clear requirement IDs and summaries. The M1-TEMPLATES entry aligns perfectly with this PR's objectives (OMN-964).


37-40: Verify the intentional self-reference.

This drift file is being added by PR 6, which it also lists in actual_by_repo. While this meta-reference might be intentional for tracking the template work itself, please confirm this is the desired behavior rather than an artifact of the file creation process.


44-48: LGTM!

Invariants are properly structured and use valid enum values ("pass"). The passing status for real_infra_proof_progressing aligns well with the infrastructure PRs merged in actual_by_repo.


1-52: Well-structured drift snapshot.

The file follows the day_close template schema correctly with all required fields present. The structure is consistent with the enhanced template guidance described in the PR objectives. Empty arrays for drift, corrections, and risks are acceptable for a day without issues.

Comment thread drift/day_close/2025-12-24.yaml Outdated
@claude

claude Bot commented Dec 25, 2025

Copy link
Copy Markdown

PR Review: Template Enhancement for OMN-964

Overall Assessment

Verdict: Approve with Minor Recommendations ✅

This is a high-quality PR that successfully enhances the YAML templates with comprehensive guidance. The implementation is thorough, well-documented, and includes excellent test coverage. The changes align well with the repository conventions outlined in the README.md.


Code Quality & Best Practices ✅

Strengths:

  1. Excellent Documentation Structure: The new TEMPLATE_GUIDE.md is comprehensive and well-organized with clear sections, examples, and field-by-field documentation
  2. Schema Alignment: Templates are properly aligned with Pydantic models (ModelDayClose, ModelTicketContract)
  3. Naming Conventions: All code follows the established Model<Name> and Enum<Name> conventions per README.md requirements
  4. Immutability: Proper use of frozen=True in Pydantic models for thread-safety and historical record integrity
  5. Test Organization: Good use of pytest fixtures to reduce duplication (minimal_emergency_bypass, minimal_day_close_data, etc.)

Best Practice Observations:

  • Templates include inline comments that guide users effectively
  • Clear separation between "what to do" (templates) and "how to do it" (TEMPLATE_GUIDE.md)
  • Good use of validation constraints (max_length, ge=1 for PR numbers)

Test Coverage ✅

Excellent Coverage:
The PR adds 5 comprehensive test cases covering:

  1. ✅ Minimal valid day close
  2. ✅ Minimal valid ticket contract
  3. ✅ All evidence kinds (tests, docs, ci, benchmark, manual)
  4. ✅ Unknown/incomplete handling scenarios
  5. ✅ Emergency bypass configuration

Test Quality:

  • Tests validate both positive and edge cases
  • Good coverage of the "unknown" handling guidance
  • Tests verify the is_complete property behavior when interface_change=True but interfaces_touched=[]
  • Template parsing tests ensure schema alignment

Recommendation:
Consider adding a test for validation failures to ensure error messages are helpful:

def test_ticket_contract_invalid_interface_change_constraint():
    """Verify error when interface_change=False but interfaces_touched is non-empty."""
    data = {...}
    with pytest.raises(ValueError, match="interfaces_touched must be empty"):
        ModelTicketContract.model_validate(data)

Potential Issues & Bugs 🔍

Minor Issues Found:

  1. Template Consistency (templates/day_close.template.yaml:41):

    • The template shows pr: 123 as a placeholder, but includes a comment "replace with actual PR number"
    • Recommendation: Use pr: 1 as the minimal valid example to be more copy-paste safe
    • Rationale: Reduces chance of users accidentally leaving 123 in production
  2. Test File Formatting (tests/test_export_json_schema.py):

    • The PR includes unrelated formatting changes (lines 57-59, 94-96)
    • While these improve consistency, they're not directly related to the template enhancement
    • Recommendation: Future PRs should separate formatting changes from feature additions for clearer change tracking

No Critical Bugs Found ✅


Performance Considerations ✅

Security & DoS Protection:

  • ✅ Proper max length constraints on all string fields (_MAX_STRING_LENGTH = 10000)
  • ✅ List size limits to prevent DoS (_MAX_LIST_ITEMS = 1000)
  • ✅ Validation patterns compiled at module level for performance (_DATE_PATTERN)
  • ✅ Frozen models prevent accidental mutations

Performance Notes:

  • Pydantic validation is efficient for these schema sizes
  • No N+1 issues or expensive operations in validators
  • Date validation uses efficient regex pre-check before calendar validation

Security Concerns ✅

No Security Issues Found

Security Strengths:

  1. ✅ Input validation on all fields prevents injection attacks
  2. ✅ No user-controlled file paths or command execution
  3. ✅ DoS protection via length/size constraints
  4. ✅ No secrets or credentials in templates or examples
  5. ✅ Emergency bypass requires explicit justification (audit trail)

Emergency Bypass Validation (model_ticket_contract.py:50-64):

  • ✅ Excellent validation ensuring bypass abuse is traceable
  • ✅ Whitespace-only strings rejected for justification/follow-up
  • ✅ Clear warnings in template about proper usage

Documentation Quality ✅

TEMPLATE_GUIDE.md Strengths:

  • Clear table of contents with anchor links
  • Field-by-field reference with type, required status, and valid values
  • Excellent "Unknown Handling" guidance for both templates
  • Good examples with both valid and warning cases
  • Clear validation instructions

Template Comment Quality:

  • Inline comments are concise and actionable
  • Good use of examples (e.g., "2025-12-21" for date format)
  • Clear placeholder markers (<...>, YYYY-MM-DD)

Minor Recommendation:
In TEMPLATE_GUIDE.md:142, consider emphasizing the is_complete behavior more prominently:

**IMPORTANT**: Leaving `interfaces_touched` empty when `interface_change=true` 
will cause `contract.is_complete` to return `False`, blocking ticket completion.

Day Close Examples 📊

Quality of Example Data (drift/day_close/2025-12-2*.yaml):

Best Practice Observation:
The day close files serve dual purpose as both examples and actual drift tracking. This "dogfooding" approach validates the schema design in real-world use.


Recommendations Summary

High Priority:

  • None (all critical functionality is correct)

Medium Priority:

  1. Consider using pr: 1 instead of pr: 123 in template for better copy-paste safety
  2. Add validation failure tests to ensure error messages are helpful

Low Priority:

  1. Separate formatting changes from feature additions in future PRs
  2. Enhance emphasis on is_complete behavior in documentation

Acceptance Criteria Verification ✅

From PR description:

  • ✅ Templates are schema-aligned
  • ✅ Copy/paste safe with clear guidance
  • ✅ Include guidance for evidence requirements
  • ✅ Include guidance for unknown handling
  • ✅ Include guidance for bypass fields (for emergency policy)
  • ✅ Templates validate against schemas when filled with minimal valid values

All acceptance criteria met.


Conclusion

This PR demonstrates excellent engineering practices with comprehensive documentation, robust validation, and thorough test coverage. The templates will significantly improve the developer experience for creating day close reports and ticket contracts. The code is production-ready.

Recommendation: Approve and Merge 🚀

Great work on this implementation!

…d [OMN-964]

This ensures ruff-format behaves like ruff-fix: it checks formatting first,
and if files need formatting, it formats them and exits with code 1 to force
re-staging. This keeps pre-commit and CI in sync.
…[OMN-964]

Remove pass_filenames and simplify the bash command to check/format all files
instead of trying to handle individual filenames. This fixes the CI failure.
@claude

claude Bot commented Dec 25, 2025

Copy link
Copy Markdown

PR Review: feat(templates): enhance YAML templates with comprehensive guidance [OMN-964]

Summary

This PR successfully enhances the YAML templates with comprehensive guidance, schema alignment, and robust validation tests. The implementation is well-structured and meets the stated acceptance criteria.


✅ Strengths

1. Excellent Documentation

  • TEMPLATE_GUIDE.md (221 lines): Comprehensive reference with field-level details, valid values, and examples
  • Inline template comments: Clear, copy-paste-safe guidance
  • Unknown handling guidance: Well-documented patterns for incomplete states

2. Robust Test Coverage

  • 5 new comprehensive tests validating template usage patterns
  • Test fixtures reduce duplication (lines 19-64)
  • Template validation test ensures templates parse with minimal replacements

3. Schema Alignment

  • Templates correctly align with ModelDayClose and ModelTicketContract Pydantic models
  • All enum values properly documented
  • Clear validation rules (e.g., pr >= 1, interface constraints)

🔍 Code Quality Observations

Pre-commit Hook Enhancement (.pre-commit-config.yaml:40-46)

The ruff-format hook modification is excellent - checks formatting first, then formats if needed, exits with code 1 to force re-staging. This keeps pre-commit and CI in sync.

Test Organization (test_yaml_parsing.py)

  • Clear docstrings explaining each test purpose
  • Logical progression: minimal → with evidence → unknown handling → emergency bypass
  • Good use of fixtures

Minor suggestion: Consider extracting magic numbers to constants at module level.


🐛 Potential Issues

1. Template Placeholder (templates/day_close.template.yaml:41)

Using 123 as placeholder might be confusing. Consider using 1 with REPLACE: comment, or comment-only approach.

2. Day Close Files Purpose

The day close YAML files (2025-12-21.yaml through 2025-12-24.yaml) - are these test fixtures, examples, or production data? Consider clarifying their purpose or location.


🚀 Performance & 🔒 Security

No Performance Issues Identified

  • Pydantic models use frozen=True for immutability
  • Security constraints prevent DoS attacks (MAX_STRING_LENGTH, MAX_LIST_ITEMS)
  • Compiled regex patterns at module level

Security is Well-Handled

  • DoS Protection: Max string 10K chars, max 1K list items
  • Input Validation: SemVer, ISO dates, PR >= 1
  • Emergency bypass requires justification when enabled
  • Immutability prevents modification of historical records

🧪 Test Coverage

New tests provide excellent coverage of:

  • ✅ Minimal valid templates
  • ✅ All 5 evidence kinds
  • ✅ Unknown/incomplete scenarios
  • ✅ Emergency bypass configuration
  • ✅ Unknown invariant statuses

Current test suite is comprehensive. Additional edge case tests would be nice-to-have but not critical.


📋 Questions

  1. Does scripts/validate_yaml_against_schema.py exist? (referenced in templates)
  2. Are there CI checks to validate day close files against schemas?

Recommendation: Consider adding CI job to validate all YAML files in drift/day_close/ against schema.


💡 Recommendations

High Priority

  1. Consider more obvious template placeholders
  2. Clarify day close YAML files purpose

Medium Priority

  1. Add validation script if it does not exist
  2. Add CI validation for day close YAML files

Low Priority

  1. Extract magic numbers to constants in tests
  2. Add edge case tests for invalid scenarios

🎯 Acceptance Criteria Assessment

All acceptance criteria met:

  • ✅ Templates are schema-aligned
  • ✅ Copy/paste safe with clear guidance
  • ✅ Include guidance for evidence requirements
  • ✅ Include guidance for unknown handling
  • ✅ Include guidance for bypass fields
  • ✅ Templates validate with minimal values

🏁 Conclusion

This is a high-quality PR with excellent documentation, robust testing, and proper schema alignment. Code follows best practices for security, validation, and maintainability.

Recommendation: Approve with minor suggestions

Suggestions are mostly nice-to-haves and do not block merging. PR meets all acceptance criteria and adds significant value.

Great work!

The ruff-format hook was failing in CI because pre-commit passes filenames
as arguments, but the bash command was ignoring them and checking all files.
Adding pass_filenames: false ensures consistent behavior between local and CI.
@claude

claude Bot commented Dec 25, 2025

Copy link
Copy Markdown

PR Review: feat(templates): enhance YAML templates with comprehensive guidance [OMN-964]

Overview

This PR successfully enhances the YAML templates with comprehensive guidance and validation. The changes are well-structured and meet the stated requirements.

✅ Code Quality and Best Practices

Strengths

  1. Excellent Documentation: The new TEMPLATE_GUIDE.md is comprehensive and well-organized
  2. Template Inline Comments: Templates include helpful inline guidance with valid enum values
  3. Test Coverage: Added 5 new tests covering minimal valid cases, evidence requirements, unknown handling, and emergency bypass
  4. Fixtures for DRY Tests: Good use of pytest fixtures to reduce duplication
  5. Schema Alignment: Templates are properly aligned with Pydantic models

Areas for Improvement

1. Pre-commit Hook Change (.pre-commit-config.yaml:40)

The ruff-format hook change introduces a complex bash command that runs ruff format potentially twice (once for check, once for fix), which is inefficient. Pre-commit automatically detects file modifications and asks for re-staging, so the custom bash wrapper may be unnecessary. Consider using a simpler approach.

2. Template Placeholders (templates/day_close.template.yaml:41)

The template includes example PR number 123. Users might forget to replace this and accidentally create reports with PR 123. Consider using an obviously invalid placeholder (e.g., 999999) or showing the structure in comments only.

3. Test Assertion Formatting

Some assertions use inline comments while others use separate variables. Be consistent throughout the test file.

🐛 Potential Bugs or Issues

Day Close Example Files Reference This PR (drift/day_close/2025-12-24.yaml:37-40)

The day close file includes a self-reference to PR 6 with state "open". When PR 6 is merged, this will be historically inaccurate. Consider: (1) updating to "merged" before merging, (2) adding a comment explaining the state at time of commit, or (3) moving example files to an examples/ directory.

⚡ Performance Considerations

No significant performance concerns. The pre-commit hook change may cause ruff to run twice unnecessarily (minor).

🔒 Security Concerns

No security issues identified. The changes maintain existing security constraints (max string lengths, max list items, proper validation).

🧪 Test Coverage

Strengths

  • Comprehensive scenarios: minimal valid cases, all 5 evidence kinds, unknown handling, emergency bypass
  • Good fixture usage

Recommendations

Add edge case tests for:

  • Invalid date formats (e.g., "2025-13-01")
  • PR number validation with pr: 0 (should fail per ge=1 constraint)
  • Interface change validation (interface_change=false with non-empty interfaces_touched)
  • Emergency bypass validation (enabled=true with empty justification)

The test test_template_files_parse_with_minimal_replacements loads templates but completely replaces them with fixtures. Consider testing the actual template structure with only placeholders replaced.

📋 Additional Recommendations

  1. TEMPLATE_GUIDE.md: Add a "Quick Start" section at the top and a "Common Mistakes" section
  2. YAML Schema Files: Consider providing editor support (autocomplete, validation) by documenting how to configure editors to use exported schemas
  3. Template Validation Script: Add a script that validates template files have proper placeholders

Summary

This is a solid PR that successfully achieves its goals. The templates are well-documented, schema-aligned, and include comprehensive guidance.

Action Items (Priority Order)

  1. High: Review the pre-commit hook change - consider if the complexity is necessary
  2. Medium: Add edge case tests for validation failures
  3. Medium: Address the self-referential day close file issue
  4. Low: Make template placeholders more obviously invalid
  5. Low: Add Quick Start section to TEMPLATE_GUIDE.md

Approval Recommendation

This PR is approved with minor suggestions. The suggestions above are improvements but not blockers. The core functionality is solid and meets all acceptance criteria.

Great work on the comprehensive documentation and test coverage! 🎉

Removes complex bash wrapper in favor of simple 'ruff format --check'.
This is more portable across environments (local/CI) and provides
clearer error messages when files need formatting.
@claude

claude Bot commented Dec 25, 2025

Copy link
Copy Markdown

Pull Request Review: PR #6 - Enhanced YAML Templates with Comprehensive Guidance

Summary

This PR enhances the YAML templates for Day Close and Ticket Contract with comprehensive documentation and validation tests. The implementation is well-structured and meets the stated requirements (OMN-964). Overall, this is high-quality work with excellent attention to detail.


✅ Strengths

1. Excellent Documentation Quality

  • TEMPLATE_GUIDE.md (docs/TEMPLATE_GUIDE.md:1-221) is comprehensive and well-organized with clear examples, field references, and usage patterns
  • Templates include helpful inline comments with clear placeholder guidance
  • Good balance between inline guidance and reference documentation

2. Strong Test Coverage

  • Five new validation tests covering:
    • Minimal valid templates
    • All evidence requirement kinds
    • Unknown handling scenarios
    • Emergency bypass configuration
  • Tests use fixtures effectively to reduce duplication (tests/test_yaml_parsing.py:18-64)
  • Tests validate that templates are copy/paste safe

3. Schema Alignment

  • Templates correctly align with Pydantic models (ModelDayClose, ModelTicketContract)
  • Proper validation of edge cases (interface_change constraints, emergency bypass requirements)
  • Good use of the is_complete property for tracking contract completeness

4. Day Close Records

  • Four new day close YAML files provide historical tracking
  • Files demonstrate proper usage of the schema
  • Good evidence of the system being used in practice

🔍 Issues & Concerns

1. ⚠️ Pre-commit Hook Change Requires Careful Review

File: .pre-commit-config.yaml:40

The ruff-format hook was changed from a simple auto-format to a check-then-format-and-fail approach:

entry: bash -c 'if ! poetry run ruff format --check .; then poetry run ruff format . && exit 1; fi'

Concerns:

  • This is a significant workflow change that affects all developers
  • The approach is more complex than necessary
  • The comment states "This keeps pre-commit and CI in sync" but this pattern can be confusing for developers
  • When files need formatting, it formats them but then exits with code 1, requiring developers to re-stage
  • Alternative: Use --check mode without auto-formatting, or use simple auto-format without the conditional

Recommendation:

  • Consider reverting to the simpler approach: entry: poetry run ruff format
  • OR use entry: poetry run ruff format --check if you want check-only behavior
  • The current hybrid approach may cause confusion when files are formatted but the hook still fails

2. Minor: Test Assertion Formatting Inconsistency

File: tests/test_export_json_schema.py:94-96

The assertion formatting was changed to use line continuation:

assert (
    len(schema_item["sha256"]) == _SHA256_HEX_LENGTH
), f"SHA256 hash should be {_SHA256_HEX_LENGTH} characters"

While this is valid, it's inconsistent with the rest of the codebase and doesn't significantly improve readability for this simple assertion. The original single-line format was fine.

3. Documentation: Missing Validation Command Verification

Files: docs/TEMPLATE_GUIDE.md:14, templates/day_close.template.yaml:13

Both files reference poetry run python scripts/validate_yaml_against_schema.py but this script doesn't appear to exist in the repository. This will cause user confusion.

Recommendation: Either create the validation script or update the documentation to reference existing validation approaches.


💡 Suggestions for Improvement

1. Template Placeholder Consistency

File: templates/day_close.template.yaml:41

The template uses pr: 123 as a placeholder, which is better than the previous pr: 0, but it would be clearer to use a more obviously placeholder value like:

pr: 999  # Replace with actual PR number (must be >= 1)

This makes it more obvious that 123 is a placeholder to be replaced.

2. Evidence Requirements Example Clarity

File: templates/ticket_contract.template.yaml:40-43

The template includes an evidence requirement by default. Consider making this empty by default with a commented example:

evidence_requirements: []
# Example:
# - kind: "tests"
#   description: "Unit tests for feature X"
#   command: "poetry run pytest tests/test_x.py"

This would be more copy/paste safe for tickets without evidence requirements.

3. Day Close Files: Date Accuracy

Files: drift/day_close/2025-12-21.yaml, drift/day_close/2025-12-22.yaml, drift/day_close/2025-12-23.yaml, drift/day_close/2025-12-24.yaml

These files use dates from December 2025, but they're being created in December 2024. While this might be intentional for testing purposes, it's worth verifying that these dates are correct.

4. Test Organization Opportunity

File: tests/test_yaml_parsing.py

Consider organizing tests into classes by template type:

class TestDayCloseTemplate:
    def test_minimal_valid(self, ...): ...
    def test_unknown_invariant_statuses(self, ...): ...

class TestTicketContractTemplate:
    def test_minimal_valid(self, ...): ...
    def test_with_evidence_requirements(self, ...): ...
    def test_emergency_bypass(self, ...): ...

This would improve test organization and make it easier to run template-specific tests.


🔒 Security Considerations

Positive Security Aspects

  • ✅ DoS protection with max length constraints on strings (_MAX_STRING_LENGTH = 10000)
  • ✅ DoS protection with max list items (_MAX_LIST_ITEMS = 1000)
  • ✅ Proper validation of emergency bypass fields (prevents empty justifications)
  • ✅ Frozen models prevent accidental mutations

No New Security Issues Introduced

This PR doesn't introduce any security vulnerabilities.


🚀 Performance Considerations

  • Template parsing performance is good (Pydantic v2 is fast)
  • Test fixtures reduce duplication and improve test performance
  • No performance concerns identified

📊 Code Quality Assessment

Ratings

  • Code Style: ⭐⭐⭐⭐⭐ (5/5) - Excellent, follows conventions
  • Documentation: ⭐⭐⭐⭐⭐ (5/5) - Comprehensive and clear
  • Test Coverage: ⭐⭐⭐⭐⭐ (5/5) - Thorough coverage of edge cases
  • Security: ⭐⭐⭐⭐⭐ (5/5) - Good validation and constraints
  • Maintainability: ⭐⭐⭐⭐ (4/5) - Very good, minor pre-commit complexity

Best Practices Observed

✅ DRY principle with test fixtures
✅ Clear separation of concerns
✅ Comprehensive inline documentation
✅ Schema-aligned templates
✅ Edge case validation
✅ Immutable models (frozen=True)


📝 Recommendations Summary

Required Changes

  1. Review pre-commit hook change - The ruff-format hook change needs team discussion and potentially simplification

Suggested Changes (Non-blocking)

  1. Add the referenced validation script or update documentation
  2. Verify day close file dates (2025 vs 2024)
  3. Consider simplifying evidence_requirements template default
  4. Consider test organization improvements

Optional Enhancements

  1. More obvious placeholder values in templates
  2. Test class organization for better structure

✅ Final Verdict

APPROVED with minor concerns

This PR successfully implements OMN-964 requirements and provides excellent templates and documentation. The code quality is high, test coverage is comprehensive, and the implementation is thoughtful.

The main concern is the pre-commit hook change which should be reviewed by the team before merging. Otherwise, this is ready to merge.

Great work on this implementation! The comprehensive documentation and thorough test coverage will make these templates very usable for the team.


📍 File-Specific Notes

  • docs/TEMPLATE_GUIDE.md: Excellent comprehensive guide
  • templates/*.template.yaml: Well-documented, copy/paste safe
  • tests/test_yaml_parsing.py: Thorough test coverage with good fixtures
  • drift/day_close/*.yaml: Good historical records (verify dates)
  • .pre-commit-config.yaml: Needs review of ruff-format hook approach

@claude

claude Bot commented Dec 25, 2025

Copy link
Copy Markdown

Code Review: PR #6 - Enhanced YAML Templates with Comprehensive Guidance

Summary

This PR successfully enhances the YAML templates for Day Close and Ticket Contract with comprehensive documentation and validation tests. The work is well-structured and meets the stated OMN-964 requirements. Overall, this is high-quality work with strong attention to detail.

✅ Strengths

1. Excellent Documentation

  • The new docs/TEMPLATE_GUIDE.md is comprehensive and well-organized
  • Inline comments in templates are clear and actionable
  • Good use of examples throughout (e.g., evidence requirements with/without commands)
  • Clear separation between quick reference (templates) and detailed documentation (TEMPLATE_GUIDE.md)

2. Robust Test Coverage

  • 5 new template validation tests cover critical scenarios:
    • Minimal valid configurations
    • Evidence requirements (all 5 kinds)
    • Unknown handling
    • Emergency bypass
    • Unknown invariant statuses
  • Tests use fixtures effectively to reduce duplication
  • Good use of descriptive test names and docstrings

3. Schema Alignment

  • Templates are properly aligned with Pydantic models
  • Validation constraints match the models (e.g., pr >= 1)
  • Correct enum values documented throughout

4. Copy-Paste Safety

  • Templates include clear placeholders (<...>, YYYY-MM-DD)
  • Inline comments explain valid values and constraints
  • Examples show both empty list syntax and populated entries

5. Real-World Validation

  • Four day close YAML files (2025-12-21 through 2025-12-24) demonstrate actual usage
  • These files serve as both documentation and real drift tracking

🔍 Issues & Recommendations

CRITICAL: Pre-commit Hook Change

Location: .pre-commit-config.yaml:39

Issue: The pre-commit hook was changed from auto-formatting to check-only mode:

-        name: ruff format (auto-format)
-        entry: poetry run ruff format
+        name: ruff format (check formatting)
+        entry: poetry run ruff format --check

Impact: This is a significant workflow change that affects all developers:

  • Developers must now manually run ruff format . instead of having pre-commit auto-fix
  • This adds friction to the development workflow
  • The comment suggests this was intentional for CI, but it affects local development too

Recommendation:

  1. If this change is intentional, it should be documented in:
    • The PR description (it's missing from the "Changes" section)
    • README.md under development setup
    • A separate entry in process_changes_today of a day close report
  2. Consider using different hooks for local vs CI (via stages: [pre-commit] vs stages: [push])
  3. If this wasn't intentional for OMN-964, it should be reverted or moved to a separate PR

Why this matters: Process changes should be explicit, documented, and reviewable per the drift control philosophy.


Minor: Test File Formatting

Location: tests/test_export_json_schema.py:57-60, 94-97

Issue: The diff shows formatting changes that appear to be auto-generated by ruff:

# Before
assert isinstance(ticket_contract_data, dict), (
    "ticket_contract schema should be a dict"
)

# After  
assert isinstance(
    ticket_contract_data, dict
), "ticket_contract schema should be a dict"

Observation: This formatting change is inconsistent with the pre-commit hook change mentioned above. If ruff format is now check-only, how did these formatting changes occur?

Recommendation: Clarify the sequence of events. This might indicate that files were formatted manually or that the hook change happened after formatting.


Minor: Template Placeholder Inconsistency

Location: templates/day_close.template.yaml:41

Issue: The template shows a placeholder PR number:

- pr: 123  # PR number (must be >= 1, replace with actual PR number)

Observation: Using 123 as a placeholder is valid but might be accidentally left in by users. Consider using a more obvious placeholder like 999 or adding it to the "replace these" list in the header.

Recommendation: Use a more distinctive placeholder (e.g., 999) or add explicit validation guidance that would catch this in code review.


Enhancement: Test Assertion Clarity

Location: tests/test_yaml_parsing.py:226-232

Observation: The test uses a magic number for the expected count:

expected_evidence_count = 5
assert len(contract.evidence_requirements) == expected_evidence_count

Recommendation: This is good! But consider adding a comment linking to the enum:

# Test all 5 evidence kinds from EnumEvidenceKind: tests, docs, ci, benchmark, manual
expected_evidence_count = 5

Enhancement: TEMPLATE_GUIDE Completeness

Location: docs/TEMPLATE_GUIDE.md

Observation: The guide is excellent, but could benefit from:

  1. A section on "Common Mistakes" (e.g., leaving placeholder values)
  2. A troubleshooting section for validation errors
  3. Examples of invalid configurations that would fail validation

Recommendation: Consider adding these in a follow-up PR to make the guide even more robust.


Security: String Length Validation

Location: Models use _MAX_STRING_LENGTH = 10000

Observation: The PR doesn't change this, but it's worth noting that the models have good DoS protection via length limits. The templates don't explicitly mention these limits.

Recommendation: Consider adding a note in TEMPLATE_GUIDE.md about field length limits (e.g., "Fields are limited to 10,000 characters for security").


🎯 Best Practices Observed

  1. Immutability: Models use frozen=True - excellent for historical records
  2. Validation: Field validators ensure data integrity (date format, SemVer, etc.)
  3. Type Safety: Proper use of enums for constrained values
  4. DRY Principle: Test fixtures reduce duplication effectively
  5. Documentation: Docstrings explain not just "what" but "why"

🔐 Security Considerations

✅ No security concerns identified

  • Input validation is comprehensive (length limits, format validation, enum constraints)
  • No injection vulnerabilities
  • Proper use of yaml.safe_load() in tests

⚡ Performance Considerations

✅ No performance concerns

  • Regex patterns are compiled at module level (_DATE_PATTERN, SEMVER_PATTERN)
  • Frozen models enable hashability and safe caching
  • List length limits prevent DoS attacks

🧪 Test Coverage Assessment

Coverage: Excellent for template validation

  • ✅ Minimal valid configurations
  • ✅ All evidence kinds
  • ✅ Unknown handling scenarios
  • ✅ Emergency bypass (both enabled and disabled)
  • ✅ Template file parsing with replacements

Gap: No explicit tests for invalid configurations. Consider adding:

  • Test that interface_change=false with non-empty interfaces_touched fails
  • Test that empty emergency bypass justification (when enabled) fails
  • Test that invalid enum values fail

These edge cases are tested indirectly via the model validators, but explicit tests would improve documentation value.


📝 Documentation Quality

Aspect Rating Notes
Inline Comments ⭐⭐⭐⭐⭐ Clear, actionable, well-placed
Template Guide ⭐⭐⭐⭐⭐ Comprehensive and well-structured
Test Documentation ⭐⭐⭐⭐⭐ Excellent docstrings
PR Description ⭐⭐⭐⭐ Good, but missing pre-commit change
Examples ⭐⭐⭐⭐⭐ Real-world day close files included

🎬 Recommendations for Merge

Before Merging:

  1. Address the pre-commit hook change:

    • Document it in the PR description, OR
    • Revert it and handle in a separate PR, OR
    • Clarify that it's intentional and update docs
  2. Minor fixes (optional but recommended):

    • Consider the placeholder value suggestion for pr: 123
    • Add a note about field length limits to TEMPLATE_GUIDE.md

After Merging:

  1. Consider adding a "Common Mistakes" section to TEMPLATE_GUIDE.md
  2. Consider adding negative test cases (invalid configurations)
  3. Update onboarding documentation to reference the new TEMPLATE_GUIDE.md

🎉 Conclusion

This is high-quality work that successfully achieves the OMN-964 objectives. The templates are schema-aligned, copy-paste safe, comprehensive, and well-tested. The only blocker is clarifying the pre-commit hook change.

Recommendation: Approve after addressing the pre-commit hook documentation/decision.

Great work on this enhancement! 🚀

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
.pre-commit-config.yaml (1)

38-45: Verify team awareness of workflow change: formatting now check-only.

The ruff-format hook has been changed from auto-formatting to check-only mode. Developers will now need to manually run poetry run ruff format . and re-stage files when formatting issues are detected, rather than having them auto-fixed during pre-commit.

While this aligns well with CI behavior and is clearly documented in the comment, please confirm that the team is aware of this workflow change to avoid confusion.

Optional: Consider clarifying the performance comment

The performance optimization comment on lines 8-9 states "Formatting (ruff format/fix)" under the PRE-COMMIT stage. You might consider updating this to reflect that formatting is now check-only rather than auto-applied:

 # PRE-COMMIT (target: <15 seconds):
-#   - Formatting (ruff format/fix)
+#   - Format checking (ruff format --check/fix with manual re-stage)
 #   - Basic file checks (whitespace, large files, merge conflicts)

This makes it clearer that formatting is checked but not automatically applied.

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6a9e064 and d3dffd8.

📒 Files selected for processing (1)
  • .pre-commit-config.yaml

…OMN-964]

Replaces local poetry-based ruff hooks with the official ruff-pre-commit
repository. This ensures consistent ruff versions between local and CI
environments, fixing the persistent pre-commit failures.

Also applies ruff 0.14.0 formatting to test_export_json_schema.py.
@claude

claude Bot commented Dec 25, 2025

Copy link
Copy Markdown

Pull Request Review: feat(templates): enhance YAML templates with comprehensive guidance [OMN-964]

Summary

This PR significantly improves the usability and documentation of YAML templates for Day Close and Ticket Contract. The changes are well-structured and demonstrate attention to detail. Overall, this is high-quality work that successfully meets the acceptance criteria.

✅ Strengths

1. Excellent Documentation Coverage

  • The new TEMPLATE_GUIDE.md (221 lines) provides comprehensive field-level documentation with examples
  • Inline comments in templates are clear and actionable
  • Good balance between template comments and separate guide documentation
  • Unknown handling guidance is particularly well thought out

2. Comprehensive Test Coverage

  • 5 new test cases covering:
    • Minimal valid configurations
    • All evidence kinds (tests, docs, ci, benchmark, manual)
    • Unknown handling scenarios
    • Emergency bypass configuration
    • Invariant status handling with "unknown"
  • Tests use fixtures effectively to reduce duplication
  • Test names are descriptive and follow testing best practices

3. Schema Alignment

  • Templates correctly align with Pydantic models (ModelDayClose, ModelTicketContract)
  • All valid enum values are documented
  • Field constraints match model definitions (e.g., pr >= 1)

4. Copy-Paste Safety

  • Templates use clear placeholder syntax (<...>)
  • Helpful examples provided (e.g., "2025-12-21" for dates)
  • Empty list guidance prevents common errors
  • PR number changed from 0 to 123 to avoid validation errors

5. Pre-commit Improvements

  • Migration from local to official ruff-pre-commit repo improves consistency
  • Good separation of concerns (ruff for formatting/linting, poetry for mypy)
  • Clear comments explaining the changes

🔍 Areas for Improvement

1. Pre-commit Hook Behavior Change (Medium Priority)

Location: .pre-commit-config.yaml:40-41

- id: ruff-format
  name: ruff format (check formatting)
  stages: [pre-commit]

Issue: The hook name says "check formatting" but ruff-format auto-formats by default (not check-only). This is inconsistent with the comment.

Context: The old config explicitly used ruff format (which auto-formats). The new config uses the official ruff-pre-commit hook which also auto-formats by default.

Recommendation: Either:

  1. Keep auto-formatting behavior and update the name: name: ruff format (auto-format)
  2. OR add args: [--check] to make it check-only as the name suggests

Which behavior do you prefer?

2. Template Guide Examples Could Be More Specific (Low Priority)

Location: docs/TEMPLATE_GUIDE.md:162-172

The YAML examples in the guide use triple backticks without language tags:

```yaml
# Example with command:
- kind: "tests"
  description: "Unit tests for ModelDayClose date validation"

Recommendation: These are already correct! No change needed.

3. Test File Could Benefit from Docstring Consistency (Low Priority)

Location: tests/test_yaml_parsing.py:321-330

The test test_template_files_parse_with_minimal_replacements has excellent documentation, but the docstring could be clearer about what "minimal placeholder replacements" means.

Recommendation: This is fine as-is, but could optionally clarify that it tests template files can be loaded and validated after basic substitutions.

🛡️ Security Assessment

✅ No Security Concerns

  • DoS protection constraints are properly maintained (_MAX_STRING_LENGTH, _MAX_LIST_ITEMS)
  • No injection vulnerabilities introduced
  • Emergency bypass validation remains intact
  • Input validation through Pydantic models is comprehensive

🚀 Performance Considerations

✅ Positive Changes

  • Migration to official ruff-pre-commit improves hook performance
  • No performance regressions in model validation
  • Test fixtures reduce duplication and improve test execution time

📊 Code Quality

Excellent Practices Observed

  1. Type Safety: Proper use of type hints in fixtures (dict[str, str | bool])
  2. Immutability: Models remain frozen, ensuring thread safety
  3. Validation: Comprehensive field validation maintained
  4. Testing: Property-based validation in tests (e.g., checking is_complete behavior)
  5. Comments: Clear, concise, and helpful

Minor Style Notes

  • Line 226 in test file: Magic number 5 for evidence count - consider adding as constant EXPECTED_EVIDENCE_KINDS_COUNT = 5 (optional)
  • Consistency in comment style is excellent throughout

📋 Test Coverage Assessment

✅ Comprehensive Coverage

The PR adds tests for:

  • ✅ Minimal valid day close (templates/day_close.template.yaml:127-150)
  • ✅ Minimal valid ticket contract (templates/ticket_contract.template.yaml:153-175)
  • ✅ All 5 evidence kinds (test_yaml_parsing.py:178-233)
  • ✅ Unknown handling for invariants (test_yaml_parsing.py:295-319)
  • ✅ Unknown handling for interfaces (test_yaml_parsing.py:235-263)
  • ✅ Emergency bypass configuration (test_yaml_parsing.py:265-293)
  • ✅ Template parsing with minimal replacements (test_yaml_parsing.py:321-358)

Missing Coverage (Optional Future Work)

  • Edge case: What happens with very long strings near _MAX_STRING_LENGTH?
  • Edge case: Invalid enum values in templates (should fail validation)

These are not blockers - current coverage is excellent.

📝 Documentation Quality

Strengths

  • Field reference format is consistent and easy to scan
  • "Unknown Handling" sections provide clear guidance
  • Examples include both "with command" and "without command" cases
  • Warnings for emergency bypass are prominent and clear

Suggestions

  1. Consider adding a "Common Mistakes" section to TEMPLATE_GUIDE.md
  2. Consider adding a "Troubleshooting" section for validation errors

🎯 Acceptance Criteria Review

Criterion Status Evidence
Templates are schema-aligned ✅ All fields match Pydantic models
Copy/paste safe with clear guidance ✅ Placeholders, examples, and comments
Include guidance for evidence requirements ✅ All 5 kinds documented with examples
Include guidance for unknown handling ✅ Day Close invariants, Ticket Contract interfaces
Include guidance for bypass fields ✅ Emergency bypass documented with warnings
Templates validate with minimal values ✅ New tests verify this

🎬 Recommendation

APPROVE with minor suggestions.

This PR successfully delivers on OMN-964 requirements. The only actionable item is clarifying the pre-commit hook behavior (auto-format vs check-only). Everything else is high quality and ready to merge.

Great work! The templates and documentation will significantly improve developer experience.


Review Completed: 2025-12-25
Reviewed Files: 9 changed files (780 additions, 40 deletions)
Test Status: Not verified (CI checks pending approval)

- Change pr: 123 to pr: 1 in day_close template for better copy-paste safety
- Update validation command to use actual pytest command (script doesn't exist)
- Add emphasized warning about is_complete behavior in TEMPLATE_GUIDE.md

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d3dffd8 and 79d4656.

📒 Files selected for processing (1)
  • .pre-commit-config.yaml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: claude-review
🔇 Additional comments (1)
.pre-commit-config.yaml (1)

47-57: LGTM! Clean mypy configuration.

The migration to a local repo section with clear comments about poetry dependency requirements is well-structured. The pre-push stage placement balances thoroughness with developer experience.

Comment thread .pre-commit-config.yaml Outdated
Comment thread .pre-commit-config.yaml
@claude

claude Bot commented Dec 25, 2025

Copy link
Copy Markdown

PR Review: Template Enhancement for OMN-964

This PR successfully enhances the YAML templates with comprehensive guidance and validation. The implementation is well-structured with strong test coverage and excellent documentation.


Strengths

1. Excellent Documentation

  • The new TEMPLATE_GUIDE.md (223 lines) provides comprehensive field-by-field documentation
  • Inline comments in templates are clear and actionable
  • Unknown handling guidance is well-documented for both templates
  • Emergency bypass warnings are appropriately prominent

2. Strong Test Coverage

  • Added 5 new comprehensive tests validating templates against schemas
  • Tests use pytest fixtures effectively to reduce duplication
  • Template validation ensures schema alignment

3. Schema Alignment

  • Templates are properly aligned with Pydantic models (ModelDayClose, ModelTicketContract)
  • All enum values are documented inline
  • Validation rules are clearly explained

4. Pre-commit Configuration Improvement

  • Migrated from local to official ruff-pre-commit (v0.14.0)
  • More consistent across environments

Issues & Recommendations

HIGH PRIORITY - Before Merge

1. Template Guide: Validation Command Discrepancy

Location: docs/TEMPLATE_GUIDE.md:213-215

Issue: The guide suggests a validation script that doesn't exist:
poetry run python scripts/validate_yaml_against_schema.py

Current situation: Based on the PR, validation is done via pytest. Either update the guide to reference pytest or create the mentioned validation script.


MEDIUM PRIORITY - After Merge

2. Template Placeholder Validation

Location: templates/day_close.template.yaml:41, templates/ticket_contract.template.yaml:18

The templates contain placeholder values that could accidentally be committed (pr: 1, ticket_id: OMN-000, etc.). Consider adding a validation script or pre-commit hook that detects placeholder patterns in non-template YAML files.

3. Test Coverage Gaps

Current coverage is excellent but could benefit from negative test cases:

  • Invalid enum values rejection
  • String/list length limit enforcement
  • Invalid dates (e.g., 2025-02-30)
  • Interface change validation edge cases
  • Emergency bypass validation edge cases

LOW PRIORITY - Nice to Have

4. TEMPLATE_GUIDE.md Missing from README

The new TEMPLATE_GUIDE.md is not referenced in the README. Consider adding a link in the Where to start section.

5. Test Fixture Type Annotations

Consider using TypedDict for more precise type hints instead of broad union types like dict[str, str | bool].


Security Considerations

Good Security Practices:

  • DoS Protection via proper length constraints
  • Input Validation with SemVer pattern validation and date format validation
  • Immutability via frozen models
  • Emergency Bypass Validation ensures required fields
  • YAML Parsing using yaml.safe_load()

Potential Concerns:

  • Placeholder Injection: Placeholders could be accidentally committed (see Issue 2)

Performance Considerations

Good Practices:

  • Regex Compilation at module level
  • Frozen Models enable caching and thread-safe access

No Performance Issues Identified.


Acceptance Criteria Assessment

Based on the PR description, all acceptance criteria are met:

  • Templates are schema-aligned
  • Copy/paste safe with clear guidance
  • Include guidance for evidence requirements
  • Include guidance for unknown handling
  • Include guidance for bypass fields
  • Templates validate against schemas when filled with minimal valid values

Conclusion

This is a high-quality PR that successfully delivers on OMN-964 requirements. The documentation is thorough, tests are comprehensive, and the schema alignment is solid.

Recommendation: Approve after fixing Issue 1 (validation command)

Great work on the comprehensive template guidance and test coverage!

…[OMN-964]

- Fixes tar-parser vulnerability (CVSS 8.1) in astral-tokio-tar dependency
- Updates hook name from '(check formatting)' to '(auto-format)' for accuracy
- Fixes TEMPLATE_GUIDE.md validation command to use pytest instead of
  non-existent scripts/validate_yaml_against_schema.py
@claude

claude Bot commented Dec 25, 2025

Copy link
Copy Markdown

PR Review: feat(templates): enhance YAML templates with comprehensive guidance [OMN-964]

This is a comprehensive and well-executed PR that significantly improves the usability of the YAML templates. The work demonstrates excellent attention to detail, thorough testing, and good documentation practices.

✅ Strengths

1. Excellent Documentation Structure

  • The new TEMPLATE_GUIDE.md is well-organized, comprehensive, and user-friendly
  • Clear separation between quick reference (inline comments) and detailed documentation (guide)
  • Excellent examples and validation instructions
  • Good use of warnings and emphasis for critical information (e.g., the is_complete behavior warning at docs/TEMPLATE_GUIDE.md:144)

2. Strong Test Coverage

  • Comprehensive test suite with 5 new tests covering edge cases (tests/test_yaml_parsing.py:127-358)
  • Good use of pytest fixtures to reduce duplication (tests/test_yaml_parsing.py:19-64)
  • Tests validate minimal valid values, evidence requirements, unknown handling, and emergency bypass scenarios
  • Template file parsing validation catches invalid placeholder values automatically in CI (tests/test_yaml_parsing.py:321-358)

3. Security Improvements

  • Upgraded ruff-pre-commit from v0.14.0 to v0.14.2 to address CVE-2025-62518 (tar-parser vulnerability, CVSS 8.1)
  • Good security consciousness in addressing dependency vulnerabilities

4. Template Usability

  • Templates are copy/paste safe with clear placeholders
  • Inline comments provide just enough guidance without overwhelming users
  • Clear references to detailed documentation
  • Schema-aligned with Pydantic models

5. Code Quality

  • Clean, well-structured code following repository naming conventions
  • Good use of type hints and proper Python idioms
  • Proper fixture extraction reduces test duplication

📋 Code Quality & Best Practices

Overall Grade: A

  • ✅ Follows repository naming conventions (Model*, model_*.py pattern from README.md:15-19)
  • ✅ Comprehensive docstrings and comments
  • ✅ Type hints properly used throughout
  • ✅ DRY principle applied with pytest fixtures
  • ✅ Schema validation properly implemented

🐛 Potential Issues

No critical bugs identified. Minor observations:

  1. Template Placeholder Values - The day_close template uses pr: 1 as a placeholder (templates/day_close.template.yaml:41). While valid (>= 1 constraint), using a more obviously fake value like pr: 999 might make it clearer it's a placeholder. However, the current approach is acceptable and documented.

  2. YAML File Validation - The day close YAML files (drift/day_close/2025-12-*.yaml) contain real data that validates correctly. Good practice for demonstrating proper usage.

⚡ Performance Considerations

No performance concerns.

  • Test fixtures are efficiently designed
  • Pre-commit hooks properly configured for optimal developer experience
  • Proper use of file-level vs. all-files checking in pre-commit configuration

🔒 Security Assessment

Security Grade: A

  • ✅ CVE-2025-62518 addressed with ruff upgrade
  • ✅ Schema models include DoS protection (_MAX_STRING_LENGTH, _MAX_LIST_ITEMS)
  • ✅ Proper validation prevents whitespace-only bypass justifications
  • ✅ Emergency bypass properly documented with warnings
  • ✅ No injection vulnerabilities identified
  • ✅ No secrets or credentials in templates or test data

🧪 Test Coverage

Test Coverage Grade: A

Excellent comprehensive test coverage:

  1. ✅ Minimal valid values for both templates
  2. ✅ All evidence kinds validated (tests, docs, ci, benchmark, manual)
  3. ✅ Unknown handling scenarios tested
  4. ✅ Emergency bypass configuration tested
  5. ✅ Template file parsing with minimal replacements
  6. ✅ Unknown invariant statuses validated
  7. ✅ Existing day_close YAML parsing test maintained

Missing Tests (Optional Enhancements):

  • Integration tests for template validation command
  • Tests for invalid enum values to ensure proper error messages
  • Tests for max_length constraints to verify DoS protection

These are nice-to-haves, not blockers - current coverage is excellent.

💡 Recommendations

High Priority: None

All critical aspects are well-handled.

Medium Priority:

  1. Consider adding validation helper script - The guide correctly uses pytest commands, but a dedicated validation script (e.g., scripts/validate_template.py) could improve UX

  2. Pre-commit hook description update - Consider consistency between hooks

Low Priority:

  1. TEMPLATE_GUIDE.md Table of Contents could include subsection links for Field Reference sections

  2. Day Close YAML files could benefit from a README explaining their purpose as both examples and actual project records

  3. Test organization - Consider extracting test data fixtures to a separate tests/fixtures.py file if the test file grows larger

📝 Style & Conventions

Style Grade: A

  • ✅ Consistent with repository README conventions
  • ✅ Clear commit messages following conventional commits format
  • ✅ Proper YAML formatting with inline comments
  • ✅ Markdown documentation well-structured
  • ✅ Python code follows ruff formatting and linting rules
  • ✅ Good use of emphasis and warnings in documentation

🎯 Final Verdict

Recommendation: ✅ APPROVE with optional enhancements

This PR successfully meets all acceptance criteria from OMN-964:

  • ✅ Templates are schema-aligned
  • ✅ Copy/paste safe with clear guidance
  • ✅ Include guidance for evidence requirements
  • ✅ Include guidance for unknown handling
  • ✅ Include guidance for bypass fields
  • ✅ Templates validate against schemas with minimal valid values
  • ✅ All 5 new tests pass

The code quality is excellent, documentation is comprehensive, security is well-considered, and test coverage is thorough. The recommendations above are optional enhancements that could be addressed in future PRs if desired.

Special recognition for:

  • Addressing the security vulnerability (CVE-2025-62518)
  • Excellent refactoring to extract template guidance to separate doc file
  • Comprehensive test fixtures reducing duplication
  • Clear documentation of the is_complete behavior implications

Great work! 🚀

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
.pre-commit-config.yaml (1)

41-41: Consider simplifying the hook name.

The hook name "(auto-format)" accurately reflects the behavior, which is good. However, for consistency with the other hook names in this file (e.g., line 44's "ruff check"), you could simplify to just name: ruff format without the parenthetical, as the behavior is implicit in the hook ID.

Current: name: ruff format (auto-format)
Alternative: name: ruff format

Either works; this is a minor style preference.

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 79d4656 and e327357.

📒 Files selected for processing (4)
  • .pre-commit-config.yaml
  • docs/TEMPLATE_GUIDE.md
  • templates/day_close.template.yaml
  • templates/ticket_contract.template.yaml
🚧 Files skipped from review as they are similar to previous changes (2)
  • templates/ticket_contract.template.yaml
  • templates/day_close.template.yaml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: claude-review
🔇 Additional comments (4)
docs/TEMPLATE_GUIDE.md (1)

1-227: Excellent comprehensive documentation!

This guide provides clear, well-structured documentation for both YAML templates. The field references are thorough, the examples are helpful, and the validation guidance aligns with the PR objectives.

Highlights:

  • Clear field types, requirements, and formats throughout
  • Good use of "Unknown Handling" guidance for edge cases
  • The emphasized warning at line 144 about is_complete behavior is particularly valuable
  • Validation commands correctly use pytest as documented in PR objectives

Note: A past review flagged a missing trailing newline at EOF. If the end-of-file-fixer pre-commit hook still fails, ensure the file ends with exactly one newline character.

.pre-commit-config.yaml (3)

36-38: Security vulnerability successfully addressed.

The upgrade from v0.14.0 to v0.14.2 resolves CVE-2025-62518 (tar-parser vulnerability, CVSS 8.1) that was flagged in the previous review. The inline comment on line 38 properly documents the reason for the upgrade.


43-46: Clean ruff hook consolidation.

The consolidation of ruff checks into a single hook with --fix and --exit-non-zero-on-fix arguments is well-structured and follows ruff's recommended configuration. The descriptive name clearly indicates the hook handles both linting and import sorting.


47-57: Good mypy configuration with clear rationale.

Moving mypy to a local hook with poetry execution is appropriate since it needs access to project dependencies. The configuration aligns well with the documented two-stage validation strategy:

  • Runs at pre-push stage for performance (commented as "~1-5s for changed files")
  • Only checks changed files via pass_filenames: true
  • Targets both source and tests for consistency

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