Skip to content

Add version mismatch warnings and validate component requirements#32

Merged
nesono merged 5 commits intomainfrom
version-validation-warnings
Nov 16, 2025
Merged

Add version mismatch warnings and validate component requirements#32
nesono merged 5 commits intomainfrom
version-validation-warnings

Conversation

@nesono
Copy link
Copy Markdown
Owner

@nesono nesono commented Nov 16, 2025

Summary

  • Implemented version mismatch warnings that show when requirement references specify a version different from the actual requirement version
  • Made warnings highly visible with colored "WARNING:" prefix and "REQUIREMENT VERSION MISMATCH!" label
  • Added validation for software component requirements (*.swreq.md files)
  • Fixed validation logic to support multi-requirement documents with inline YAML blocks

Changes

Version Mismatch Warnings

fire/starlark/validate_cross_references.py

  • Extract version from ?version=N query parameters in requirement references
  • Compare reference version against actual requirement version
  • Print warnings to stdout (not stderr) so Bazel displays them during builds
  • Use ANSI color codes to make "WARNING:" text light red for visibility
  • Format: WARNING: REQUIREMENT VERSION MISMATCH! file.md: Reference to REQ-001 specifies version=1, but target.md is at version=2

Component Requirements Validation

examples/BUILD.bazel

  • Added component_requirements target to validate software component requirements
  • Validates: brake_actuator.swreq.md, brake_controller.swreq.md, vehicle_status.swreq.md
  • Previously only system requirements (*.sysreq.md) were validated

fire/starlark/validate_cross_references.py

  • Skip bi-directional frontmatter/body consistency checks for multi-requirement documents
  • Documents without an id field use inline YAML blocks per requirement, not centralized frontmatter
  • Prevents false positives for *.swreq.md files

Impact

Warnings Now Visible

Before: Version mismatches were silent - no warnings at all

After: 19 version mismatch warnings clearly displayed during builds:

  • 1 from system requirements (velocity_requirements.sysreq.md)
  • 18 from component requirements (5 + 8 + 5)

Example output during bazel build:

INFO: From Validating cross-references in component_requirements_validation:
WARNING: REQUIREMENT VERSION MISMATCH! examples/brake_actuator/doc/brake_actuator.swreq.md: Reference to REQ-BRK-001 specifies version=1, but examples/requirements/braking_requirements.sysreq.md is at version=2

Requirements Coverage

Before: Only 3 system requirement files validated

After: 6 files validated (3 system + 3 component requirements)

Test Plan

  • All 125 existing tests passing
  • Manually verified warnings appear in bazel build //examples:all
  • Verified warnings show correct file names and version numbers
  • Verified component requirements validation works without errors
  • Verified system requirements validation still works correctly

Related Work

This builds on the cross-reference validation framework and complements:

🤖 Generated with Claude Code

Jochen Issing and others added 5 commits November 16, 2025 10:11
…ATCH# prefix

Changed warning output to:
- Use stderr instead of stdout (appears in red in most terminals)
- Add distinctive #FIRE_VERSION_MISMATCH# prefix for easy grepping
- Makes warnings stand out from other build warnings

Example output:
```
#FIRE_VERSION_MISMATCH# WARNING: velocity_requirements.sysreq.md: Reference to REQ-BRK-001 specifies version=1, but braking_requirements.sysreq.md is at version=2
```

Benefits:
- Easy to find with `grep FIRE_VERSION_MISMATCH`
- Stands out visually with red text (stderr)
- Distinctive prefix prevents confusion with other warnings

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

Co-Authored-By: Claude <noreply@anthropic.com>
- Changed format to: WARNING: #FIRE_VERSION_MISMATCH#
- Added ANSI light red color to WARNING: text (\033[91m)
- Keep using stderr for red terminal output
- Makes warnings easily greppable and visually distinctive

Example output:
WARNING: #FIRE_VERSION_MISMATCH# file.md: Reference to REQ-001 specifies version=1, but target.md is at version=2

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

Co-Authored-By: Claude <noreply@anthropic.com>
Changed from "#FIRE_VERSION_MISMATCH#" to "REQUIREMENT VERSION MISMATCH!" for better readability.

Example output:
WARNING: REQUIREMENT VERSION MISMATCH! file.md: Reference to REQ-001 specifies version=1, but target.md is at version=2

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

Co-Authored-By: Claude <noreply@anthropic.com>
Changed warning output from stderr to stdout so Bazel displays them
during build/test runs. Bazel suppresses stderr from successful actions,
but shows stdout when the action has output.

Now warnings appear like this during builds:
INFO: From Validating cross-references in vehicle_requirements_validation:
WARNING: REQUIREMENT VERSION MISMATCH! file.md: Reference to REQ-001 specifies version=1, but target.md is at version=2

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

Co-Authored-By: Claude <noreply@anthropic.com>
Previously only system requirements (*.sysreq.md) were validated.
Now also validating software component requirements (*.swreq.md):
- brake_actuator.swreq.md (5 requirements)
- brake_controller.swreq.md (7 requirements)
- vehicle_status.swreq.md (5 requirements)

This catches 17 additional version mismatch warnings that were previously hidden.

Also fixed validation logic to skip bi-directional frontmatter/body
consistency checks for multi-requirement documents (those without 'id'
in frontmatter). These documents use inline YAML blocks per requirement
rather than centralized frontmatter references.

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

Co-Authored-By: Claude <noreply@anthropic.com>
@nesono nesono merged commit 5fa4f10 into main Nov 16, 2025
4 checks passed
@nesono nesono deleted the version-validation-warnings branch November 16, 2025 09:14
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