Skip to content

feat: add e2e-validated label for automated acceptance proof on PRs#91

Merged
jonit-dev merged 2 commits intomasterfrom
feat/e2e-validated-label
Mar 22, 2026
Merged

feat: add e2e-validated label for automated acceptance proof on PRs#91
jonit-dev merged 2 commits intomasterfrom
feat/e2e-validated-label

Conversation

@jonit-dev
Copy link
Copy Markdown
Owner

Summary

  • Adds e2e-validated GitHub label (green #0e8a16) that is automatically applied to PRs when QA tests pass, proving acceptance requirements are met
  • New validatedLabel field in IQaConfig (default: e2e-validated) — configurable via NW_QA_VALIDATED_LABEL env var
  • QA script now applies the label on passing outcome, removes it on issues_found/no_tests_needed
  • night-watch init syncs all Night Watch labels to GitHub (new step 11)
  • Dry-run output shows the validated label configuration

Changes

  • packages/core/src/board/labels.tse2e-validated added to NIGHT_WATCH_LABELS
  • packages/core/src/types.tsvalidatedLabel: string added to IQaConfig
  • packages/core/src/constants.tsDEFAULT_QA_VALIDATED_LABEL constant, updated DEFAULT_QA
  • packages/core/src/jobs/job-registry.tsvalidatedLabel extra field in QA job definition
  • packages/cli/src/commands/qa.ts — passes NW_QA_VALIDATED_LABEL, shows in dry-run table
  • scripts/night-watch-qa-cron.shensure_validated_label(), label add/remove per outcome, VALIDATED_PRS_CSV tracking in emit_result
  • packages/cli/src/commands/init.ts — step 11 syncs all Night Watch labels to GitHub

Test plan

  • yarn verify passes
  • New unit tests pass (14 added across labels.test.ts, job-registry.test.ts, qa.test.ts, init.test.ts)
  • Run night-watch qa --dry-run → "Validated Label: e2e-validated" appears in config table
  • Run night-watch init on a repo with GitHub remote → all Night Watch labels created including e2e-validated
  • After QA runs on a passing PR → e2e-validated label applied on GitHub
  • After QA runs on a failing PR → e2e-validated label removed

🤖 Generated with Claude Code

Test User and others added 2 commits March 21, 2026 22:51
Move completed PRDs to done/ folder:
- job-registry.md (Job Registry implementation)
- analytics-job.md (Analytics job implementation)
- fix-executor-streaming-output.md (Terminal streaming fix)
- fix-prd-execution-failures.md (Double rate-limit detection)
- open-source-readiness.md (OSS community files)
- remove-legacy-personas-and-filesystem-prd.md (Dead code cleanup)
- prd-provider-schedule-overrides.md (Provider schedule overrides)
- provider-agnostic-instructions.md (Instructions directory refactoring)
- night-watch/provider-aware-queue.md (Per-bucket concurrency)

Delete obsolete PRD:
- refactor-interaction-listener.md (packages/slack/ removed in commit 46637a0)

Add architecture docs:
- docs/architecture/job-registry.md (Job registry architecture)
- docs/architecture/analytics-job.md (Analytics job architecture)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Implements the E2E Validated Label PRD across 4 phases:

Phase 1 — Label Definition & Config:
- Add 'e2e-validated' (green #0e8a16) to NIGHT_WATCH_LABELS in labels.ts
- Add validatedLabel: string to IQaConfig in types.ts
- Add DEFAULT_QA_VALIDATED_LABEL constant and update DEFAULT_QA in constants.ts
- Add validatedLabel extra field to QA job definition in job-registry.ts
- Config normalization picks it up automatically via normalizeJobConfig

Phase 2 — QA Script Integration:
- Pass NW_QA_VALIDATED_LABEL env var from qa.ts buildEnvVars()
- Show Validated Label in qa --dry-run config table
- Read VALIDATED_LABEL in QA bash script with e2e-validated default
- Add ensure_validated_label() helper (idempotent gh label create --force)
- Apply label on 'passing' outcome, remove on 'issues_found'/'no_tests_needed'
- Track VALIDATED_PRS_CSV and include in emit_result and Telegram messages

Phase 3 — Init Label Sync:
- Add step 11 to night-watch init: sync all NIGHT_WATCH_LABELS to GitHub
- Skips gracefully when no GitHub remote or gh not authenticated
- Updates totalSteps from 13 to 14 and adds Label Sync to summary table

Phase 4 — Dry-Run & Summary Integration:
- Validated Label shown in qa --dry-run config table (merged into Phase 2)
- emit_result includes validated= field for all success/warning outcomes

Tests:
- packages/core/src/__tests__/board/labels.test.ts (new): e2e-validated presence
- packages/core/src/__tests__/jobs/job-registry.test.ts: validatedLabel extra field
- packages/cli/src/__tests__/commands/qa.test.ts: NW_QA_VALIDATED_LABEL env var
- packages/cli/src/__tests__/commands/init.test.ts: label sync preconditions

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

DiffGuard AI Analysis

AI Review Summary

🏆 Overall Score: 85/100

This PR implements the E2E Validated Label feature with solid documentation, comprehensive unit tests for the TypeScript/Node layer, and proper integration into the existing job registry and QA workflow. The main gaps are in bash script testing and missing integration tests for the new init label sync functionality.


✅ Key Strengths

  • Comprehensive PRD Documentation: The e2e-validated-label.md PRD is exceptionally detailed with clear phases, acceptance criteria, and implementation checklists.
  • Idempotent Label Operations: Uses gh label create --force and --add-label/--remove-label which are no-ops if already present/absent, preventing duplicate operations.
  • Registry-Driven Design: Properly extends the job registry with validatedLabel extra field, making the feature configurable and discoverable through existing patterns.
  • Configurable Label Name: validatedLabel defaults to e2e-validated but can be overridden via config or NW_QA_VALIDATED_LABEL env var.

⚠️ Areas for Improvement

  • Missing Init Label Sync Integration Tests: The tests in init.test.ts verify preconditions but don't test actual label sync execution when hasGitHubRemote && ghAuthenticated is true.
  • No Bash Script Tests: The QA script label logic (ensure_validated_label, label add/remove in case statement) has no automated tests despite being critical path.
  • Silent Label Creation Failures: In init.ts, label creation failures are silently swallowed with an empty catch block—consider logging at debug level for troubleshooting.

📋 Issues Found

Issue Type Issue Name Affected Components Description Impact/Severity
Testing Init label sync execution untested packages/cli/src/__tests__/commands/init.test.ts Tests verify preconditions but don't mock execSync to verify actual gh label create calls when conditions are met Medium
Testing Bash script label logic untested scripts/night-watch-qa-cron.sh Label application/removal logic in case statement has no bats tests Low
Maintainability Silent failure in label creation packages/cli/src/commands/init.ts:906-911 Empty catch block swallows errors from gh label create, making debugging harder Low

🔚 Conclusion

This is a well-designed and thoroughly documented feature implementation. The TypeScript layer has good test coverage, but the bash script changes and init label sync would benefit from additional test coverage. The feature is merge-ready, though adding integration tests for the init label sync would increase confidence.


Analyzed using z-ai/glm-5

@jonit-dev jonit-dev merged commit 104751f into master Mar 22, 2026
1 of 5 checks passed
jonit-dev added a commit that referenced this pull request Mar 25, 2026
)

* chore: organize PRDs and create architecture docs

Move completed PRDs to done/ folder:
- job-registry.md (Job Registry implementation)
- analytics-job.md (Analytics job implementation)
- fix-executor-streaming-output.md (Terminal streaming fix)
- fix-prd-execution-failures.md (Double rate-limit detection)
- open-source-readiness.md (OSS community files)
- remove-legacy-personas-and-filesystem-prd.md (Dead code cleanup)
- prd-provider-schedule-overrides.md (Provider schedule overrides)
- provider-agnostic-instructions.md (Instructions directory refactoring)
- night-watch/provider-aware-queue.md (Per-bucket concurrency)

Delete obsolete PRD:
- refactor-interaction-listener.md (packages/slack/ removed in commit 46637a0)

Add architecture docs:
- docs/architecture/job-registry.md (Job registry architecture)
- docs/architecture/analytics-job.md (Analytics job architecture)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat: add e2e-validated label for automated acceptance proof on PRs

Implements the E2E Validated Label PRD across 4 phases:

Phase 1 — Label Definition & Config:
- Add 'e2e-validated' (green #0e8a16) to NIGHT_WATCH_LABELS in labels.ts
- Add validatedLabel: string to IQaConfig in types.ts
- Add DEFAULT_QA_VALIDATED_LABEL constant and update DEFAULT_QA in constants.ts
- Add validatedLabel extra field to QA job definition in job-registry.ts
- Config normalization picks it up automatically via normalizeJobConfig

Phase 2 — QA Script Integration:
- Pass NW_QA_VALIDATED_LABEL env var from qa.ts buildEnvVars()
- Show Validated Label in qa --dry-run config table
- Read VALIDATED_LABEL in QA bash script with e2e-validated default
- Add ensure_validated_label() helper (idempotent gh label create --force)
- Apply label on 'passing' outcome, remove on 'issues_found'/'no_tests_needed'
- Track VALIDATED_PRS_CSV and include in emit_result and Telegram messages

Phase 3 — Init Label Sync:
- Add step 11 to night-watch init: sync all NIGHT_WATCH_LABELS to GitHub
- Skips gracefully when no GitHub remote or gh not authenticated
- Updates totalSteps from 13 to 14 and adds Label Sync to summary table

Phase 4 — Dry-Run & Summary Integration:
- Validated Label shown in qa --dry-run config table (merged into Phase 2)
- emit_result includes validated= field for all success/warning outcomes

Tests:
- packages/core/src/__tests__/board/labels.test.ts (new): e2e-validated presence
- packages/core/src/__tests__/jobs/job-registry.test.ts: validatedLabel extra field
- packages/cli/src/__tests__/commands/qa.test.ts: NW_QA_VALIDATED_LABEL env var
- packages/cli/src/__tests__/commands/init.test.ts: label sync preconditions

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Test User <test@test.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
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