Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/workflows/qa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ jobs:
with:
php-version: "8.1"
tools: composer
coverage: pcov

- name: Get composer cache directory
id: composer-cache
Expand All @@ -176,7 +177,10 @@ jobs:
curl -sL https://raw.githubusercontent.com/wp-cli/scaffold-command/main/templates/install-wp-tests.sh -o /tmp/install-wp-tests.sh
bash /tmp/install-wp-tests.sh wordpress_test root root 127.0.0.1 latest

- name: Run PHPUnit
- name: Run PHPUnit with coverage gate
env:
WP_TESTS_DIR: /tmp/wordpress-tests-lib
run: vendor/bin/phpunit --configuration phpunit.xml.dist
MIN_LINE_COVERAGE: "80"
run: |
chmod +x scripts/check-plugin-coverage.sh
./scripts/check-plugin-coverage.sh
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- PHPUnit pcov coverage gate (80% line coverage on `rank-math-api-manager.php`) in QA workflow.
- Risk-based integration tests: REST permissions, telemetry privacy, uninstall cleanup, GitHub updater validation, meta auth.

### Changed

- Align GitHub updater `tested` metadata with plugin header and `readme.txt` (7.1).
- TASK-005: Main plugin file included in PHPCS ruleset after WPCS cleanup.

### Fixed

Expand Down
58 changes: 21 additions & 37 deletions docs/architecture/long-run-state.md
Original file line number Diff line number Diff line change
@@ -1,67 +1,51 @@
# Long-run mission state — v1.0.9.2 verification closeout
# Long-run mission state — coverage + PHPCS quality

**Last updated:** 2026-11-05

---

## Mission

- **Goal:** Execute the approved v1.0.9.2 upgrade plan (icons, page support, CI/QA, packaging alignment, verification docs). Re-verify against `main` before changing product code; land only gaps found during verification.
- **Goal:** PHPCS on main plugin file (TASK-005) + PHPUnit coverage gate (80% lines on `rank-math-api-manager.php`) with risk-based integration tests.
- **execution_mode:** `long-run`
- **Success signals:** All plan acceptance criteria evidenced on branch; local QA green; GitHub QA workflow green on PR; honest mission gate when product work was already shipped as `v1.0.9.2`.
- **Notes:** Parent-orchestrated in this chat (no nested `parent-orchestrator` subagent). Product features and release tag `v1.0.9.2` already exist on `main`; this run focuses on reconciliation, PHPCS hygiene, and MAT artifact closeout.

## Scope / hard constraints / non-goals

- **Hard constraints:** No force-push; no secrets in git; do not re-release `v1.0.9.2` without operator GO; preserve GitHub-only updater behavior.
- **Non-goals:** Re-implementing icons/pages/CI from scratch; TASK-005 main-file PHPCS baseline; unrelated MAT env-ignore work.
- **Branch:** `feat/coverage-phpcs-quality-mission`
- **Spec:** `specs/plugin-coverage-phpcs-mission.md`

## Slice preflight decision (active)

- **execution_mode:** `builder_plus_verifier`
- **execution_rationale:** Small PHPCS fix plus documentation/MAT state updates; builder implements, verifier read-only checks.
- **execution_rationale:** PHPCS mass-format plus new tests and CI; builder implements, verifier validates read-only.

## Ordered slice queue

| # | Slice id | Summary | execution_mode | Status |
|---|----------|---------|----------------|--------|
| 1 | `v1092-verify-reconcile` | Re-verify plan vs tree; fix PHPCS in `TextdomainLoadingTest`; align updater `tested` with readme `7.1` if drift | `builder_plus_verifier` | `done` |
| 2 | `v1092-mat-closeout` | Update `docs/current-plan.md`, session summary, serialize verify/build handoffs | `inline` | `done` |
| # | Slice id | Summary | Status |
|---|----------|---------|--------|
| 1 | `task-005-phpcs` | phpcbf + WPCS fixes; remove PHPCS exclude; green PHPCS | `in_progress` |
| 2 | `coverage-ci-tests` | pcov, coverage script, integration tests, qa.yml gate | `pending` |

## Active slice

- **Slice id:** _(none — mission complete)_
- **Pointer:** `docs/session-summary.md`

## Completed slices

| Slice id | Outcome | Notes |
|----------|---------|-------|
| `v1092-verify-reconcile` | PASS | PR #8 merged `56042d9` |
| _(product v1.0.9.2)_ | Shipped on `main` | Tag `v1.0.9.2`, PR #4 merged 2026-06-24 |
- **Slice id:** `task-005-phpcs`
- **Pointer:** `docs/current-plan.md`

## Continuation policy

- After slice 1 PASS and PR merge (if code changes), run slice 2 MAT closeout and classify `mission_complete`.
- After slice 1: commit, PR, merge when CI green.
- After slice 2: commit, PR, merge when CI green including coverage.

## Stop-reason policy

| Stop reason | Meaning |
|-------------|---------|
| `mission_complete` | Verification done; gaps fixed or documented; PR merged when required. |
| `hard_blocker` | CI/env cannot run; tests fail without root cause. |
| `approval_needed` | New release or scope beyond verification. |
| `planning_gap` | — |
| `unexpected_termination` | Abnormal end. |

---
| `mission_complete` | Both slices merged; QA green |
| `hard_blocker` | Cannot run tests or CI |
| `approval_needed` | Scope beyond spec |

## Parent mission gate compliance (per verifier PASS)
## Parent mission gate compliance

- [x] Gate questions answered or one explicit stop reason recorded.
- [x] Slice PASS is not mislabeled as mission success while slice 2 remains.
- [ ] Slice 1 PASS not labeled as full mission complete while slice 2 pending.

## Current stop / continuation (living)
## Current stop / continuation

- **Last classified stop reason:** `mission_complete`
- **Continue:** `no`
- **Continue:** `yes`
- **Last classified stop reason:** _(none — mission active)_
76 changes: 22 additions & 54 deletions docs/current-plan.md
Original file line number Diff line number Diff line change
@@ -1,76 +1,44 @@
# Current plan — v1.0.9.2 verification reconcile (slice 1)
# Current plan — slice `coverage-ci-tests`

**Status:** Active orchestration slice
**Tier:** standard (execution projection)
**Contract:** v0.1 — [`.mat/docs/plan-contract.md`](../.mat/docs/plan-contract.md)
**Preflight:** `builder_plus_verifier`
**Last updated:** 2026-11-05
**Branch:** `chore/v1.0.9.2-mat-verification-closeout`
**Mission:** `docs/architecture/long-run-state.md` slice `v1092-verify-reconcile`
**Tier:** standard
**Branch:** `feat/coverage-phpcs-quality-mission`
**Spec:** `specs/plugin-coverage-phpcs-mission.md`

---
## Goal

## Task

Re-verify the approved v1.0.9.2 plan against `main`. Product scope (icons, pages, QA workflow, packaging script, integration tests, verification matrix) is **already shipped** at tag `v1.0.9.2`. This slice lands only verified gaps:

1. PHPCS doc-comment capitalization in `tests/integration/TextdomainLoadingTest.php` (local `vendor/bin/phpcs` currently fails).
2. Align GitHub updater `tested` metadata with plugin header / `readme.txt` (`7.1`, not `6.9.3`).

## Context

| Anchor | Role |
|--------|------|
| Approved user plan | Icons, page, CI, packaging, docs |
| `main` @ `62029d8` | Contains 1.0.9.2 product code; release published |
| `scripts/run-phpunit-local.sh` | Local PHPUnit mirror of `qa.yml` |
| `.github/workflows/qa.yml` | Authoritative CI gate |
Add pcov coverage gate (80% lines on main file), risk-based integration tests, and CI enforcement in `qa.yml`.

## Implementation steps

- [wip] **Step 1 — Fix PHPCS in textdomain integration test**
- Capitalize short descriptions on affected `@` docblocks in `tests/integration/TextdomainLoadingTest.php`.

- [] **Step 2 — Align updater tested version**
- Set `'tested' => '7.1'` in `check_for_update()` and `plugin_info()` response arrays in `rank-math-api-manager.php`.

- [] **Step 3 — Validation**
- `vendor/bin/phpcs --standard=phpcs.xml.dist`
- `./scripts/run-phpunit-local.sh`
- `./scripts/package-plugin.sh` (confirm icons in ZIP)
- `bash scripts/phase1-verify.sh`

- [] **Step 4 — Handoff**
- `build-result.md` per workflow artifact contract.
- [x] Configure `phpunit.xml.dist` coverage include for `rank-math-api-manager.php`
- [x] Add `scripts/check-plugin-coverage.sh` threshold script
- [x] Extend `qa.yml` PHPUnit job with pcov + coverage gate
- [x] Add integration tests (permissions, telemetry, uninstall, updater, meta auth, admin notices smoke)
- [x] PHPCS on new test files

## Acceptance criteria

- [] **AC-1:** PHPCS exits 0 on the repository standard (`phpcs.xml.dist`).
- [] **AC-2:** PHPUnit integration suite passes (WooCommerce skip allowed).
- [] **AC-3:** Updater `tested` fields match `7.1` in both update transient and plugin info paths.
- [] **AC-4:** Re-verification documents that icons, page support, QA workflow, and packaging script already satisfy the approved v1.0.9.2 plan on `main` (no duplicate feature work).
- [x] `./scripts/run-phpunit-local.sh` passes (25 tests, 1 skipped WC)
- [ ] `./scripts/check-plugin-coverage.sh` ≥80% (CI authoritative when local pcov absent)
- [x] `vendor/bin/phpcs --standard=phpcs.xml.dist` passes
- [ ] GitHub QA workflow green on PR

## Verification plan

### Per-phase validation loops (loop until pass)

| Phase | Command | Loop until pass |
|-------|---------|-----------------|
| PHPCS | `vendor/bin/phpcs --standard=phpcs.xml.dist` | Fix until exit 0 |
| PHPUnit | `./scripts/run-phpunit-local.sh` | Fix until exit 0 |
| Package | `./scripts/package-plugin.sh` && unzip -l rank-math-api-manager.zip \| grep icon | Icons present |
| Phase1 | `bash scripts/phase1-verify.sh` | Exit 0 |
| PHPUnit | `./scripts/run-phpunit-local.sh` | Loop until pass |
| PHPCS | `vendor/bin/phpcs --standard=phpcs.xml.dist` | Loop until pass |
| Coverage | `./scripts/check-plugin-coverage.sh` | Loop until pass in CI |

### Global validation commands (before handoff)

1. `bash scripts/doctor.sh`
2. `bash scripts/phase1-verify.sh`
3. `gh act -j phpcs --container-architecture linux/amd64` (optional pre-push if Docker healthy)
1. `vendor/bin/phpcs --standard=phpcs.xml.dist`
2. `./scripts/run-phpunit-local.sh`
3. GitHub `gh pr checks` on PR

## Amendments

- 2026-11-05T10:05:00Z — orchestrator — Slice scoped to verification gaps after confirming v1.0.9.2 already released on GitHub.

## Recommended Next Command

After build handoff: `/mat-review` (verifier) with `docs/current-plan.md` and `build-result.md`.
- 2026-11-05T12:00:00Z — orchestrator — Slice 2 plan projected after TASK-005 commit.
2 changes: 0 additions & 2 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

<file>.</file>

<!-- Exclude main plugin file until WPCS violations are fixed (see CHANGELOG / docs). -->
<exclude-pattern>rank-math-api-manager\.php</exclude-pattern>
<exclude-pattern>*/vendor/*</exclude-pattern>
<exclude-pattern>*/.git/*</exclude-pattern>
<exclude-pattern>*/.github/*</exclude-pattern>
Expand Down
8 changes: 8 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,12 @@
<directory suffix="Test.php">tests/integration</directory>
</testsuite>
</testsuites>
<coverage processUncoveredFiles="true">
<include>
<file>rank-math-api-manager.php</file>
</include>
<report>
<clover outputFile="build/coverage/clover.xml"/>
</report>
</coverage>
</phpunit>
Loading
Loading