Skip to content

fix(parity): allow declared product changes through FR-014 guard - #704

Merged
Marc-cn merged 1 commit into
darnitdevorg:mainfrom
JohnsonLyu:fix/parity-fr014-guard
Nov 4, 2026
Merged

Marc-cn merged 1 commit into
darnitdevorg:mainfrom
JohnsonLyu:fix/parity-fr014-guard

Conversation

@JohnsonLyu

Copy link
Copy Markdown
Contributor

Summary

  • Preserve the FR-014 guard while allowing product PRs to declare necessary parity-harness caller updates via the Parity-Guard: not-a-parity-pr commit trailer.
  • Use Git's native trailer parsing to recognize explicit declarations, retaining the original fail-closed behavior otherwise.
  • Add regression tests covering path classification, valid and invalid trailers, and mixed product/parity changes.

Type of Change

  • Bug fix (non-breaking change fixing an issue)
  • New feature (non-breaking change adding functionality)
  • Breaking change (fix or feature causing existing functionality to change)
  • Documentation update
  • Refactoring (no functional changes)

Framework Changes Checklist

If this PR modifies the darnit framework (packages/darnit/):

  • Updated framework spec (docs/architecture/framework-design.md) if behavior changed
  • Ran uv run python scripts/validate_sync.py --verbose and it passes

No framework source changes.

Control/TOML Changes Checklist

If this PR modifies controls or TOML configuration:

  • Control metadata defined in TOML (not Python code)
  • SARIF fields (description, severity, help_url) included where appropriate
  • Ran validation to confirm TOML schema compliance

Not applicable; no control or TOML changes.

Testing

  • Tests pass locally (uv run pytest tests/ -v)
  • Added tests for new functionality (if applicable)
  • Linting passes (uv run ruff check .)

Additional validation:

  • FR-014 tests: 11 passed, 1 skipped.
  • Ruff formatting check passed.
  • git diff --check passed.
  • Simulated mixed product/parity PR correctly fails without the trailer and skips with a valid declaration.

AI assistance

  • No AI assistance was used
  • AI assistance was used

Cursor (Claude Opus 5.5) assisted with implementation, refactoring, and regression tests. Changes were reviewed and validated locally.

Additional Notes

This is a standalone fix for the FR-014 false positive identified during review of #620.

The trailer is an explicit, reviewer-visible declaration, not proof of compatibility. Reviewers must verify that the parity-harness changes are necessary for the product change. Without the declaration, the existing guard remains enforced.

Only tests/darnit/parity/tier1/test_no_product_changes.py is modified.

Preserve the parity scope guard while allowing product PRs to declare required harness compatibility updates using a Git commit trailer.

Assisted-by: Cursor:Claude-Opus-5.5
Signed-off-by: Johnson Lyu <cl7084@nyu.edu>

@Marc-cn Marc-cn left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Checked on the VM against main: 11 passed, the guard skips on this PR as the existing rule says (only the guard file changed), ruff clean. The escape is explicit, visible to the reviewer, read by git's own trailer parser so prose can't trigger it, and the default stays fail-closed; the tests cover the cases that matter (invalid value, mention in prose, later commit). Fine as the fix for the #620 false positive. One nit, not blocking: nothing outside this test file says the trailer exists, so the next person who hits the guard won't find it — a sentence in the FR-014 assertion message ('or declare a product PR with the trailer Parity-Guard: not-a-parity-pr') or in CONTRIBUTING would do.

@Marc-cn
Marc-cn merged commit c4cb6e6 into darnitdevorg:main Nov 4, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants