Skip to content

agent/qa: Add mandatory pre-PR quality gate enforcement #258

@rjmurillo-bot

Description

@rjmurillo-bot

@

Context

PR #249 analysis showed QA agent involvement AFTER PR opening, not before. All 7 P0-P1 bugs could have been caught with pre-PR quality gates.

Evidence:

  • QA runs post-implementation (lines 62-75 in qa.md show "Code quality gates checklist")
  • No pre-PR gate enforcement
  • Reactive validation only

Problem

The qa agent (482 lines) has quality standards but no enforcement mechanism BEFORE PR creation:

Has:

  • Code quality gates checklist (lines 62-75)
  • Risk-based testing (lines 98-114)
  • Test quality standards (lines 77-84)

Missing:

  • Pre-PR quality gate enforcement
  • CI environment testing requirement
  • Fail-safe pattern verification
  • Test parameter alignment validation

Proposed Solution

Add Pre-PR Quality Gate section to src/claude/qa.md before "Test Strategy Development" section.

New Section

## Pre-PR Quality Gate (MANDATORY)

**BLOCKING**: QA agent MUST validate quality BEFORE PR creation. This prevents quality issues from reaching review.

### Pre-PR Validation Protocol

When invoked by orchestrator with "pre-PR validation" intent:

#### Step 1: Run CI Environment Tests
```bash
# Simulate CI environment locally
export GITHUB_ACTIONS=true
export CI=true

# Run full test suite with CI flags
dotnet test --configuration Release /p:ContinuousIntegrationBuild=true

# Verify all tests pass
if [ $? -ne 0 ]; then
  echo "[FAIL] Tests failed in CI mode - BLOCKING"
  exit 1
fi

Step 2: Verify Fail-Safe Patterns

- [ ] Exit code validation present (grep for LASTEXITCODE checks)
- [ ] Error handling defaults to fail-closed
- [ ] Security defaults to most restrictive
- [ ] Protected branch scenarios tested

Step 3: Test-Implementation Alignment

- [ ] Test parameters match production signatures
- [ ] No parameter drift between tests and implementation
- [ ] All production code paths have test coverage
- [ ] Edge cases covered (null, empty, boundaries)

Step 4: Quality Gate Evidence

Generate evidence file: .agents/qa/pre-pr-validation-[feature].md

# Pre-PR Quality Validation: [Feature]

## Test Results
- **CI Mode Tests**: [PASS] 101/101 tests passed
- **Coverage**: [PASS] 85% line coverage (target: 80%)
- **Fail-Safe Checks**: [PASS] 3/3 shell commands have LASTEXITCODE validation
- **Test Alignment**: [PASS] 12/12 test parameters match implementation

## Quality Gate Verdict
[APPROVED] All quality gates passed. Safe to create PR.

## Evidence
- Test run: `dotnet test` output attached
- Coverage report: coverage.xml
- Fail-safe audit: grep results for LASTEXITCODE

Handoff to Orchestrator

After validation:

**Pre-PR Validation Complete**
- Status: [APPROVED / BLOCKED]
- Blocking Issues: [N]
- Recommendations: [Next steps]

If BLOCKED, orchestrator routes back to implementer for fixes.
If APPROVED, orchestrator authorizes PR creation.


## Acceptance Criteria

- [ ] New "Pre-PR Quality Gate" section added to src/claude/qa.md
- [ ] Section positioned before "Test Strategy Development"
- [ ] 4-step validation protocol included
- [ ] Evidence template provided
- [ ] Handoff to orchestrator documented
- [ ] Section marked as MANDATORY/BLOCKING

## Impact

**Before**: QA runs after PR opened, bugs found in review
**After**: QA validates before PR, bugs caught pre-review

**Based on PR #249**: Would have caught all 7 P0-P1 bugs before PR creation

## Related

- PR #249: All bugs were test-detectable
- Skill-PR-Val-002: Fail-safe verification (94% atomicity)
- Skill-PR-Val-003: Test alignment (92% atomicity)
@

Metadata

Metadata

Assignees

Labels

agent-implementerCode implementation agentagent-orchestratorTask coordination agentagent-qaTesting and verification agentagent-securitySecurity assessment agentarea-infrastructureBuild, CI/CD, configurationarea-skillsSkills documentation and patternsarea-workflowsGitHub Actions workflowsbugSomething isn't workingdocumentationImprovements or additions to documentationenhancementNew feature or requestpriority:P1Important: Affects user experience significantly, high business value

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions