Skip to content

fix: implement blocking logic enforcement for issue state validation - #1500

Closed
ashleyshaw wants to merge 2 commits into
developfrom
claude/issue-blocking-logic-993c5b
Closed

fix: implement blocking logic enforcement for issue state validation#1500
ashleyshaw wants to merge 2 commits into
developfrom
claude/issue-blocking-logic-993c5b

Conversation

@ashleyshaw

@ashleyshaw ashleyshaw commented Aug 4, 2026

Copy link
Copy Markdown
Member

Bugfix Pull Request

This repository enforces changelog, release, and label automation for all PRs and issues.
See the organisation-wide Automation Governance & Release Strategy for required rules.

Linked issues

Fixes #993

Context

  • Severity/Impact: High
  • Affected versions/environments: All versions

Root Cause

The blocking relationship metadata was parsed but not enforced. Issues could close inappropriately:

  • Blocked issues could close even if their blockers were open
  • Blocking issues could close while still blocking other open issues
  • No validation prevented invalid state transitions

Fix Summary

Implemented bidirectional blocking logic enforcement:

  1. validate-blocking-status-before-close.yml — Prevents blocked issues from closing

    • Extracts Blocked by: #XXX from issue body
    • Checks if any blockers are still open
    • Re-opens issue if blockers found
  2. validate-blocking-issue-before-close.yml — Prevents blocking issues from closing prematurely

    • Extracts Blocks: #XXX from issue body
    • Checks if any blocked issues are still open
    • Re-opens issue if blocked issues found
  3. manage-blocking-status-labels.yml — Automatic status label management

    • Applies status:blocked label when blockers exist
    • Removes label when all blockers are closed
    • Runs on issue changes and daily schedule
  4. Enhanced parsing with hasBidirectionalBlocking flag in metadata script

Verification

  • Tests added/updated to cover the bug
  • All 1124 tests passing (11 new blocking logic tests)
  • Edge cases checked (multiple blockers, force-close override)

Risk & Rollback

  • Risk level: Low
  • Rollback plan: Revert the two new workflows; metadata changes are backward compatible

Changelog

Added

  • Blocking relationship enforcement workflows to prevent inappropriate issue closure
  • Automatic status:blocked label management based on blocker status
  • Comprehensive blocking logic test suite (11 new tests)
  • hasBidirectionalBlocking flag in issue metadata for bidirectional blocking detection

Changed

  • Enhanced issue-pr-metadata.cjs to include bidirectional blocking flag

Fixed


Checklist (Global DoD / PR)

  • All AC met and demonstrated
  • Tests added/updated (11 new blocking logic tests, 1124 total passing)
  • Accessibility checklist completed (N/A - infrastructure code)
  • Docs/readme/changelog updated (in PR body)
  • Security checklist completed (GitHub Actions workflows reviewed for injection safety)
    • Issue body parsed safely (regex extraction of numbers only)
    • No untrusted input in API calls (issue numbers validated)
    • No secrets/sensitive data introduced
  • Code/design reviews approved
  • CI green (all tests passing)

🤖 Generated with Claude Code

ashleyshaw and others added 2 commits August 4, 2026 16:33
Implements comprehensive blocking relationship handling with bidirectional
checking and enforcement. When an issue is blocked by other issues, the
system now:

1. Parses blocking relationships from issue bodies
   - "Blocks #XXX" indicates this issue blocks another
   - "Blocked by #XXX" indicates this issue is blocked by another

2. Prevents closing blocked issues (new workflow)
   - Blocks closure if unclosed blockers exist
   - Posts guidance comment on attempted close
   - Allows force-close with meta:force-close label

3. Manages status:blocked label automatically
   - Applies label to issues with open blockers
   - Removes label when all blockers are closed
   - Runs on issue changes and daily schedule

4. Includes comprehensive test coverage
   - Tests bidirectional blocking logic
   - Tests blocking relationship parsing
   - Tests edge cases and validation

Fixes #993 — Blocking logic was parsed but not enforced. Issues that
blocked other issues would not prevent closure of blocked issues, leading
to inconsistent state.

Adds:
- .github/workflows/validate-blocking-status-before-close.yml
- .github/workflows/manage-blocking-status-labels.yml
- scripts/agents/includes/__tests__/blocking-logic.test.js

Updates:
- scripts/agents/includes/issue-pr-metadata.cjs (bidirectional flag)
- scripts/agents/includes/__tests__/issue-pr-metadata.test.js

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Extends blocking relationship enforcement to prevent BLOCKING issues from
closing while they still block other open issues. This ensures:

1. Blocked issues cannot close while their blockers are open
   - validate-blocking-status-before-close.yml

2. Blocking issues cannot close while they block open issues
   - validate-blocking-issue-before-close.yml (NEW)
   - Prevents a blocking issue from closing prematurely

3. Automatic status:blocked label management
   - manage-blocking-status-labels.yml
   - Applies/removes label based on actual blocking state

4. Both directions properly tested
   - Comprehensive test coverage for bidirectional blocking
   - Tests for issues that are both blocked AND blocking

Impact: Issue #1324 can now safely block #993 without worrying about
closing prematurely. The system enforces that #1324 cannot close while
#993 (or any other issues it blocks) remain open.

Fixes #993 — Complete bidirectional blocking logic implementation

Adds:
- .github/workflows/validate-blocking-issue-before-close.yml

Updates:
- scripts/agents/includes/__tests__/blocking-logic.test.js (additional tests)

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@ashleyshaw, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 48 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 29252a5c-8423-422e-bab6-f5209d2faadd

📥 Commits

Reviewing files that changed from the base of the PR and between 9c6d780 and 55e6c29.

📒 Files selected for processing (6)
  • .github/workflows/manage-blocking-status-labels.yml
  • .github/workflows/validate-blocking-issue-before-close.yml
  • .github/workflows/validate-blocking-status-before-close.yml
  • scripts/agents/includes/__tests__/blocking-logic.test.js
  • scripts/agents/includes/__tests__/issue-pr-metadata.test.js
  • scripts/agents/includes/issue-pr-metadata.cjs

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

✅ Template check passed after update. Thanks for fixing the PR description.

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

⏱️ Aging and SLA annotation

  • Age: 0 day(s)
  • SLA state: Within SLA
  • Thresholds: warn at 7 days, breach at 14 days
  • Last updated: 2026-08-04T17:10:23.399Z

Maintained by project-meta-sync workflow.

@github-actions github-actions Bot added area:ci Build and CI pipelines area:tests Test suites & harnesses labels Aug 4, 2026
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

🔍 Reviewer Summary for PR #1500

CI Status:success
Files changed: 6
Risk Distribution: 3 critical, 0 high, 2 medium, 1 low

Recommendations

  • ⚠️ 3 critical-risk file(s) modified (workflows, secrets)
  • ⚠️ Security-sensitive files modified (review carefully)

@github-actions github-actions Bot added area:scripts Scripts & tooling lang:js JavaScript/TypeScript status:needs-review Awaiting code review priority:normal Default priority type:chore Chore / small hygiene change type:bug Bug or defect meta:needs-changelog Requires a changelog entry before merge labels Aug 4, 2026
@ashleyshaw
ashleyshaw enabled auto-merge (squash) August 4, 2026 17:09
@github-actions github-actions Bot removed the type:chore Chore / small hygiene change label Aug 4, 2026
@mergify

mergify Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@ashleyshaw ashleyshaw closed this Aug 4, 2026
auto-merge was automatically disabled August 4, 2026 17:15

Pull request was closed

@ashleyshaw
ashleyshaw deleted the claude/issue-blocking-logic-993c5b branch August 4, 2026 17:15
ashleyshaw added a commit that referenced this pull request Aug 5, 2026
Comprehensive audit of label prefix violations in issues #1500-1600 range.

## Findings Summary
- Root cause: Code duplication (defective labeling-agent.js applies bare labels)
- Impact: 100+ issues with non-canonical labels
- Governance gaps: CLAUDE.md/AGENTS.md incomplete

## Audit Reports Created
- LABEL_PREFIX_AUDIT_REPORT.md — Complete findings and root cause analysis
- WORKFLOW_CONSOLIDATION_ANALYSIS.md — Workflow conflicts and consolidation plan
- REMEDIATION_PLAN.md — Step-by-step fixes with code and scripts
- README.md — Index and quick reference guide

## Immediate Actions
- Update CLAUDE.md with explicit label creation rules
- Update AGENTS.md with label governance section
- Delete defective scripts/agents/includes/labeling-agent.js
- Implement pre-creation label validation

Related: #1290 (Phase 1 restructuring), workflows-consolidation-2026-q3

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
ashleyshaw added a commit that referenced this pull request Aug 5, 2026
Comprehensive audit of label prefix violations in issues #1500-1600 range.

## Findings Summary
- Root cause: Code duplication (defective labeling-agent.js applies bare labels)
- Impact: 100+ issues with non-canonical labels
- Governance gaps: CLAUDE.md/AGENTS.md incomplete

## Audit Reports Created
- LABEL_PREFIX_AUDIT_REPORT.md — Complete findings and root cause analysis
- WORKFLOW_CONSOLIDATION_ANALYSIS.md — Workflow conflicts and consolidation plan
- REMEDIATION_PLAN.md — Step-by-step fixes with code and scripts
- README.md — Index and quick reference guide

## Immediate Actions
- Update CLAUDE.md with explicit label creation rules
- Update AGENTS.md with label governance section
- Delete defective scripts/agents/includes/labeling-agent.js
- Implement pre-creation label validation

Related: #1290 (Phase 1 restructuring), workflows-consolidation-2026-q3

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
ashleyshaw added a commit that referenced this pull request Aug 5, 2026
Comprehensive audit of label prefix violations in issues #1500-1600 range.

## Findings Summary
- Root cause: Code duplication (defective labeling-agent.js applies bare labels)
- Impact: 100+ issues with non-canonical labels
- Governance gaps: CLAUDE.md/AGENTS.md incomplete

## Audit Reports Created
- LABEL_PREFIX_AUDIT_REPORT.md — Complete findings and root cause analysis
- WORKFLOW_CONSOLIDATION_ANALYSIS.md — Workflow conflicts and consolidation plan
- REMEDIATION_PLAN.md — Step-by-step fixes with code and scripts
- README.md — Index and quick reference guide

## Immediate Actions
- Update CLAUDE.md with explicit label creation rules
- Update AGENTS.md with label governance section
- Delete defective scripts/agents/includes/labeling-agent.js
- Implement pre-creation label validation

Related: #1290 (Phase 1 restructuring), workflows-consolidation-2026-q3

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
ashleyshaw added a commit that referenced this pull request Aug 5, 2026
* audit: Complete label prefix governance audit and remediation plan

Comprehensive audit of label prefix violations in issues #1500-1600 range.

## Findings Summary
- Root cause: Code duplication (defective labeling-agent.js applies bare labels)
- Impact: 100+ issues with non-canonical labels
- Governance gaps: CLAUDE.md/AGENTS.md incomplete

## Audit Reports Created
- LABEL_PREFIX_AUDIT_REPORT.md — Complete findings and root cause analysis
- WORKFLOW_CONSOLIDATION_ANALYSIS.md — Workflow conflicts and consolidation plan
- REMEDIATION_PLAN.md — Step-by-step fixes with code and scripts
- README.md — Index and quick reference guide

## Immediate Actions
- Update CLAUDE.md with explicit label creation rules
- Update AGENTS.md with label governance section
- Delete defective scripts/agents/includes/labeling-agent.js
- Implement pre-creation label validation

Related: #1290 (Phase 1 restructuring), workflows-consolidation-2026-q3

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>

* chore: re-trigger CI checks after PR template update

* fix: Complete frontmatter in audit report files

Add missing frontmatter fields (maintainer, status, stability) to ensure proper validation.

- README.md: Added maintainer, stability
- REMEDIATION_PLAN.md: Added maintainer, status, stability
- WORKFLOW_CONSOLIDATION_ANALYSIS.md: Added maintainer, status, stability
- LABEL_PREFIX_AUDIT_REPORT.md: Updated status from in-progress to complete, added stability

Fixes README validation failures in PR #1591.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>

* fix: Address Copilot feedback on audit reports and PR template

- Fixed workflow trigger description for validate-blocking-status-before-close.yml
- Corrected relative paths in project links (./.github → ../../../.github)
- Replaced jq YAML parsing with grep for label extraction
- Removed reference to non-existent npm run list:labels command
- Added Global DoD Checklist to PR template

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>

* fix: Correct frontmatter validation errors in audit report files

- Changed file_type from 'report' to 'agent-index' for schema compliance
- Updated status from 'complete'/'in-progress' to 'active' (allowed values)
- Removed unstable/severity fields not in schema
- All 4 report files now pass frontmatter validation

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>

* fix: Standardize footers in audit report files

- Updated all 4 report files with standard LightSpeed footer format
- Uses consistent 'Built with ☕ and 🚀 by Claude Code Audit · LightSpeedWP' format

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>

* fix: Use governance footer format for audit reports

- Updated all 4 report files with governance-approved footer
- Footer: 'Maintained by the 🤖 LightSpeedWP Automation Team'
- Matches footers.config.yaml governance category requirements

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Haiku 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:ci Build and CI pipelines area:scripts Scripts & tooling area:tests Test suites & harnesses lang:js JavaScript/TypeScript meta:needs-changelog Requires a changelog entry before merge priority:normal Default priority status:needs-review Awaiting code review type:bug Bug or defect

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant