Skip to content

👷 ci: add PR quality gates, commit message enforcement, and QA ICU fix#4515

Merged
Ostico merged 26 commits intodevelopfrom
ci/pr-quality-gates
Apr 28, 2026
Merged

👷 ci: add PR quality gates, commit message enforcement, and QA ICU fix#4515
Ostico merged 26 commits intodevelopfrom
ci/pr-quality-gates

Conversation

@Ostico
Copy link
Copy Markdown
Contributor

@Ostico Ostico commented Apr 20, 2026

Summary

Add PR quality gates (template + CI enforcement), conventional-commit message checks, and PHPStan hardening.

The QA ICU bug fix that was originally bundled here has been merged separately via PR #4513.

Type

  • feat — new user-facing feature
  • fix — bug fix
  • refactor — restructure without behavior change
  • chore — build, deps, config, docs
  • perf — performance improvement
  • test — test coverage

Changes

File Change
.github/PULL_REQUEST_TEMPLATE.md Structured PR checklist template
.github/workflows/pr-readiness-check.yml GitHub Actions workflow enforcing template completeness
.github/scripts/pr-readiness-check.js Validation logic (40 tests)
.github/scripts/pr-readiness-check.test.js Test suite for PR readiness validator
.github/workflows/commit-message-check.yml Conventional-commit enforcement (strict PR title, relaxed commits)
.github/scripts/commit-message-check.js Validation logic with requireEmoji option (53 tests)
.github/scripts/commit-message-check.test.js Test suite for commit message validator
phpstan.neon Enable @throws checking rules, exclude APIDoc.php build artifact with (?)
phpstan-baseline.neon Regenerated for new @throws rules
phpstan-throws-backlog.txt Track @throws PHPStan backlog items
jest.config.js Exclude .github/ from Jest test discovery

Testing

  • vendor/bin/phpunit --exclude-group=ExternalServices --no-coverage passes
  • ./vendor/bin/phpstan passes (0 errors, with baseline)
  • New tests added for changed behavior
  • Regression tests added for bug fixes
PHPUnit: 2118/2118 OK (17690 assertions)
PHPStan: 0 errors
Node tests: 93/93 (40 PR readiness + 53 commit message)

AI Disclosure

  • No AI tools were used in this PR
  • AI tools were used — details below

Sisyphus (Claude claude-opus-4-6), GitHub Copilot

Notes

This PR was originally combined with the QA ICU bug fix for locked segments. That fix has been merged independently via PR #4513. This PR now contains only CI/infrastructure changes.

Ostico and others added 12 commits April 20, 2026 19:11
- regenerate phpstan-baseline.neon to absorb 726 pre-existing
  @throws violations across 275 files
- add phpstan-throws-backlog.txt listing all files to fix
  sequentially
- create `.github/PULL_REQUEST_TEMPLATE.md` to standardize pull request descriptions
- add `.github/workflows/pr-readiness-check.yml` GitHub Action to validate mandatory checklist
- implement checklist validation logic in `.github/scripts/pr-readiness-check.js`
- include comprehensive unit tests in `.github/scripts/pr-readiness-check.test.js`

Signed-off-by: domenico <domenico@translated.net>
- update instructions to only require naming the AI agent/tool used
- adjust example to remove implementation + test generation details

🐛 fix(pr-checks): ensure comments are fully removed in section validation

- implement loop to repeatedly strip nested HTML comments in `pr-readiness-check.js`

🔧 chore(tests): exclude `.github/scripts` from jest transformations

- update `jest.config.js` to add `.github/scripts/` to `transformIgnorePatterns`

Signed-off-by: domenico <domenico@translated.net>
- add testPathIgnorePatterns to jest.config.js so Jest does not pick up
  CI validation scripts that use Node built-in test runner
- add lib/View/APIDoc.php and lib/View/templates/_APIDoc.php to
  excludePaths in phpstan.neon (webpack build artifacts)
- remove 5 stale baseline entries referencing excluded files
- APIDoc.php is a webpack build artifact that may not exist in CI
- append (?) to its excludePaths entry so PHPStan tolerates absence
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
- validate PR title (required gate) and commit messages (hygiene gate)
  against emoji-prefixed conventional-commit spec
- add commit-message-check.js with emoji↔type map, VS16 normalization,
  format/length/case/period validation, merge-commit skip
- add 35 unit tests covering all 12 types, edge cases, and error
  collection
- bypass via `commit-message-exception` label
- add requireEmoji option (default true) to validateCommitMessage so
  PR title stays strict while commit messages accept emoji-less
  conventional-commit format (e.g. "docs(qa): ...")
- auto-skip GitHub web UI patterns (Update/Create/Delete/Rename) in
  relaxed mode
- update workflow to pass requireEmoji: false for commit-messages job
- add 18 new tests for relaxed mode and isGitHubWebEdit (53 total)
Copilot AI review requested due to automatic review settings April 20, 2026 17:13
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR strengthens PR/commit quality gates in CI and fixes ICU MessageFormat validation during project creation so ICU inconsistencies are caught earlier.

Changes:

  • Add ICU detection to QAProcessor (gated by project ICU metadata) and share ICU detection logic via ICUSourceSegmentDetector.
  • Introduce PR template + GitHub Actions workflows for PR readiness checklist enforcement and conventional-commit validation (PR title + commits).
  • Harden PHPStan configuration for @throws correctness and adjust Jest config to ignore .github/ scripts.

Reviewed changes

Copilot reviewed 15 out of 17 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/unit/Model/ProjectCreation/TestableQAProcessor.php Update test subclass to capture ICU comparator/flag passed into createQA().
tests/unit/Model/ProjectCreation/QAProcessorTest.php Add unit tests covering ICU-enabled/disabled paths and a broken-target validation case.
lib/Utils/LQA/ICUSourceSegmentDetector.php New shared utility to decide whether a source segment contains valid ICU patterns.
lib/Utils/LQA/ICUSourceSegmentChecker.php Refactor to delegate ICU detection to the shared detector.
lib/Model/ProjectCreation/QAProcessor.php Add ICU detection/comparator wiring into QA creation during project creation processing.
lib/Model/ProjectCreation/ProjectManager.php Pass project ICU-enabled metadata into QAProcessor.
phpstan.neon Enable stricter @throws checks and exclude API doc artifacts.
phpstan-throws-backlog.txt Add tracking list for incremental @throws cleanup work.
jest.config.js Ignore .github/ paths for Jest test discovery/transforming.
.github/workflows/pr-readiness-check.yml Add workflow to enforce PR template checklist + run node tests for the validator.
.github/workflows/commit-message-check.yml Add workflow to enforce conventional-commit PR titles + validate commit subjects.
.github/scripts/pr-readiness-check.js Implement PR checklist validator logic.
.github/scripts/pr-readiness-check.test.js Add node:test coverage for PR checklist validator.
.github/scripts/commit-message-check.js Implement conventional-commit validator with emoji/type mapping and relaxed mode.
.github/scripts/commit-message-check.test.js Add node:test coverage for commit message validator.
.github/PULL_REQUEST_TEMPLATE.md Add structured PR checklist template used by the readiness gate.

Comment thread tests/unit/Model/ProjectCreation/TestableQAProcessor.php
Comment thread phpstan.neon
Comment thread .github/scripts/commit-message-check.js
Copilot AI review requested due to automatic review settings April 21, 2026 13:33
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 11 changed files in this pull request and generated 5 comments.

Comment thread phpstan.neon
Comment thread .github/workflows/pr-readiness-check.yml
Comment thread .github/workflows/commit-message-check.yml
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '24'
Copy link

Copilot AI Apr 21, 2026

Choose a reason for hiding this comment

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

Pinning actions/setup-node to node-version: '24' may make this workflow brittle if that runtime isn’t available on all GitHub-hosted runners yet. If the scripts don’t require Node 24-specific features, consider using an LTS selector (e.g. lts/*) or the repo’s standard Node version to reduce CI breakage risk.

Suggested change
node-version: '24'
node-version: 'lts/*'

Copilot uses AI. Check for mistakes.
Comment thread .github/workflows/commit-message-check.yml
…callers

Declare checked exceptions on all methods using Database::transaction(),
which re-throws \Throwable on rollback. Remove 2 stale baseline entries
now covered by the broader @throws declaration.
- run PHPUnit with Xdebug coverage on pull requests
- invoke ostico/test-guard@v1.0.1 with 80% coverage threshold
- enable AI-powered test adequacy analysis
Copilot AI review requested due to automatic review settings April 22, 2026 08:36
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 15 out of 17 changed files in this pull request and generated 4 comments.

Comment on lines +12 to +14
pull-requests: write
checks: write
models: read
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

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

Workflow-level permissions are widened to pull-requests: write, checks: write, and models: read for all runs (including pushes). Since job-level permissions in _ci-cd.yml already scope most jobs to contents: read, consider keeping the workflow-level ceiling minimal (e.g., contents: read) and moving the elevated permissions to a separate PR-only workflow (or otherwise ensuring only PR runs can ever inherit them). This reduces the blast radius if new jobs are added later without explicit permissions:.

Suggested change
pull-requests: write
checks: write
models: read

Copilot uses AI. Check for mistakes.
Comment thread .github/workflows/aws_prod.yml
Comment thread lib/Utils/AsyncTasks/Workers/Analysis/FastAnalysis.php
Comment thread lib/Utils/AsyncTasks/Workers/Analysis/FastAnalysis.php
Ostico added 2 commits April 23, 2026 12:50
- Add Clover reporter to Jest so it writes js-coverage/clover.xml
- Extract both PHP and JS coverage from test container
- Pass both files to test-guard via YAML block scalar
@matecat matecat deleted a comment from github-actions Bot Apr 23, 2026
@matecat matecat deleted a comment from github-actions Bot Apr 23, 2026
@matecat matecat deleted a comment from github-actions Bot Apr 23, 2026
@matecat matecat deleted a comment from github-actions Bot Apr 23, 2026
@matecat matecat deleted a comment from github-actions Bot Apr 23, 2026
@matecat matecat deleted a comment from github-actions Bot Apr 23, 2026
@matecat matecat deleted a comment from github-actions Bot Apr 23, 2026
@github-actions
Copy link
Copy Markdown

🧪 Test-Guard Report

✅ PASS — All changed source files have adequate test coverage.

Coverage Analysis: ❌ FAIL

No changed source files found in coverage report (threshold: 80%)

File Verdict Reason
.github/scripts/commit-message-check.js ❌ fail not in coverage report
.github/scripts/pr-readiness-check.js ❌ fail not in coverage report
lib/Model/DataAccess/Database.php ❌ fail not in coverage report
lib/Utils/AsyncTasks/Workers/Analysis/FastAnalysis.php ❌ fail not in coverage report

Test File Matching: ❌ FAIL

File matching: 2 pass, 1 warning, 1 fail

File Verdict Reason
.github/scripts/commit-message-check.js ✅ pass Test file modified in PR: .github/scripts/commit-message-check.test.js
.github/scripts/pr-readiness-check.js ✅ pass Test file modified in PR: .github/scripts/pr-readiness-check.test.js
lib/Model/DataAccess/Database.php ❌ fail No matching test file found
lib/Utils/AsyncTasks/Workers/Analysis/FastAnalysis.php ⚠️ warning Test file exists (tests/unit/TestMyMemory/FastAnalysisTest.php) but was not modified in this PR

Per-File Evaluation: ✅ PASS

Evaluated 4 files: 2 via AI (2 batches), 2 via shortcuts.

File Verdict Reason
lib/Model/DataAccess/Database.php ⏭️ skip shortcut → trivial change (whitespace/comments only)
lib/Utils/AsyncTasks/Workers/Analysis/FastAnalysis.php ⏭️ skip shortcut → trivial change (whitespace/comments only)
.github/scripts/commit-message-check.js ✅ pass Comprehensive tests cover emoji mapping, validation rules, edge cases, and error messages.
.github/scripts/pr-readiness-check.js ✅ pass Tests cover checklist validation, AI disclosure, migration notes, and edge cases.

Result: ✅ PASS

@matecat matecat deleted a comment from github-actions Bot Apr 24, 2026
@matecat matecat deleted a comment from github-actions Bot Apr 24, 2026
@matecat matecat deleted a comment from github-actions Bot Apr 24, 2026
@matecat matecat deleted a comment from github-actions Bot Apr 24, 2026
@matecat matecat deleted a comment from github-actions Bot Apr 24, 2026
@Ostico Ostico merged commit 2f7d04a into develop Apr 28, 2026
43 of 48 checks passed
@Ostico Ostico deleted the ci/pr-quality-gates branch April 28, 2026 08:55
Ostico added a commit that referenced this pull request Apr 28, 2026
👷 ci: add PR quality gates, commit message enforcement, and QA ICU fix
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.

4 participants