Commit Graph

28 Commits

Author SHA1 Message Date
peptiderepo
d417299e05 ci: update peptide-e2e reusable-workflow ref to peptide-repo org
Reusable workflow `uses:` refs do not follow GitHub transfer redirects.
Update owner string from peptiderepo to peptide-repo post org-migration.

Agent-Session: fix-e2e-ref-20260617
2026-06-17 11:34:13 +07:00
peptiderepo
6a288262c6 ci: update peptide-e2e reusable-workflow ref to peptide-repo org
Reusable workflow `uses:` refs do not follow GitHub transfer redirects.
Update owner string from peptiderepo to peptide-repo post org-migration.

Agent-Session: fix-e2e-ref-20260617
2026-06-17 11:34:11 +07:00
peptiderepo
a751a8f890 Adopt reusable CI standard + helpers split (#61) 2026-06-16 21:36:06 +07:00
peptiderepo
601768a1b1 ci(review): drop multi-model panel to Haiku-only (#60)
QA A/B decision 2026-06-12 (CEO-ratified): Haiku-only. Includes pre-existing front-page.php EOF-whitespace fix that was blocking PHPCS.

Agent-Session: cto-panel-merge-20260612
2026-06-12 21:55:09 +07:00
peptiderepo
69fd0f643f ci: adopt shared reusable deploy workflow (#59)
Replaces the per-repo staging/smoke/production jobs with one call to
peptiderepo/peptide-e2e/.github/workflows/deploy-app.yml (target_path=wp-content/themes/peptide-starter).
Validated end-to-end on the calculator pilot.

Agent-Session: cto rollout-reusable-deploy
2026-06-09 19:16:11 +07:00
peptiderepo
0a2a48a9f0 ci(audit): retry PR-association check (#58)
listPullRequestsAssociatedWithCommit is eventually-consistent after a squash
merge; the single immediate call intermittently flagged legit merges as
'direct push to main'. Now polls up to 5x/10s before opening an issue.

Agent-Session: cto audit-race-fix
2026-06-09 13:39:10 +07:00
peptiderepo
33faab7c4f ci: fix production SSH timeout — remove preflight verify step, add ConnectTimeout=30
The standalone SSH 'Verify deploy destination' step was causing consistent
connection timeouts (exit 255, ~2min hang) on production deploys. Root cause:
Hostinger rate-limits concurrent SSH connections from different GitHub Actions
runner IPs — the staging job exhausts a connection window and the production
runner (on a different IP) gets timed out by the server.

Fix:
- Remove the standalone SSH verify step that was always the first to time out
- Add ConnectTimeout=30 BatchMode=yes to ALL ssh/rsync commands so failures
  surface in 30s instead of the default 120s TCP timeout
- The plugin inventory pre/post check still guards against wrong-path deploys
  (the actual safety guarantee we care about from the 2026-04-23 incident)
- rsync itself will fail safely if the target path doesn't exist
2026-04-27 19:56:28 +00:00
peptiderepo
89a3ed66d3 ci: remove invalid continue-on-error from reusable workflow smoke job
Not valid on 'uses:' jobs — caused 0-job workflow failures. Theme prod
deploy already doesn't gate on smoke (needs: [validate, deploy-staging]).
Smoke remains informational.
2026-04-27 15:42:02 +00:00
peptiderepo
a7aad01af7 ci: add continue-on-error to smoke job
Smoke failures (e.g. Playwright infra issues) should not block reporting
a successful deploy as failed. Root cause of smoke failures fixed in
peptide-e2e@da79ee2 (explicit checkout in workflow_call context).
2026-04-27 15:38:35 +00:00
peptiderepo
3625c25655 fix: ci — remove empty ${{ }} expression from deploy.yml comment (YAML parse failure) 2026-04-26 05:27:04 +00:00
peptiderepo
e4bf5faf5b fix: ci — inline theme path in SSH verify step (was using undefined remote var)
The 'Verify deploy destination' step defined DEST on the runner then used
${DEST} inside an SSH command. The remote shell has no DEST variable, so
${DEST} expanded to empty → 'test -f /style.css' → always fails.

Fix: inline the full theme path using ${{ secrets.SSH_USERNAME }} which
the GitHub Actions runner expands to a literal string before the script
is sent to SSH. Remote shell receives a plain path with no variables.
2026-04-26 05:22:12 +00:00
peptiderepo
0cbeb91a77 ci: decouple production deploy from smoke gate
continue-on-error is not supported on reusable workflow (uses:) job calls —
the workflow was failing at setup with no jobs spawned.

Fix: remove smoke from deploy-production needs. Smoke tests still run in
parallel (for visibility) but production no longer waits on them. Re-add
smoke to needs once peptide-e2e suite is stable and exercising staging.
2026-04-26 05:12:27 +00:00
peptiderepo
2b25d7d872 ci: smoke gate — continue-on-error until peptide-e2e suite is wired
The smoke job calls peptiderepo/peptide-e2e which expects an e2e/ directory
that doesn't exist in this repo. Until that repo and its Playwright tests are
properly wired, a smoke failure must not block production deploy.

continue-on-error: true means tests still run (visible in Actions) but don't
gate the deploy. Remove this flag once the e2e suite reliably exercises the
staging environment.
2026-04-26 05:09:19 +00:00
peptiderepo
0cb4247b1a fix: ci — remove escaped $ in PIPESTATUS check (deploy.yml)
'test ${PIPESTATUS[0]} -eq 0' sends a literal backslash to bash, which
escapes the dollar sign and prevents variable expansion — test receives the
string '${PIPESTATUS[0]}' instead of an integer, causing exit code 2.

Fix: remove the backslash so bash expands PIPESTATUS correctly.
2026-04-26 05:02:23 +00:00
peptiderepo
f20a598bac ci: add staging step, smoke gate, concurrency block, deploy summary 2026-04-26 11:56:00 +07:00
peptiderepo
e3ab80f482 ci: standardize PHP matrix to 8.1/8.2/8.3 2026-04-26 11:55:58 +07:00
peptiderepo
fe161cf765 ci: add pre-deploy destination canary check + plugin inventory guard
Two safety nets to prevent rsync --delete wiping the wrong directory:
1. Pre-deploy: verify destination/style.css exists (proves it's a theme dir)
2. Post-deploy: compare active plugin count before and after — fail if any dropped

Addresses root cause of 2026-04-23 theme deploy incident.
2026-04-24 00:52:02 +07:00
peptiderepo
6956479df2 ci(cto-review): add app-map freshness check to QA gate (#12)
When a PR modifies the admin settings surface, file/class structure, or data flow, the QA reviewer now flags the PR as a MAJOR concern unless the PR description references an accompanying update to the CTO app-map at `Peptide Repo CTO/app-maps/<repo-slug>.md`.

The CTO workspace is a separate repo, so CI cannot verify the doc update mechanically — the reviewer inspects the PR description for an explicit mention.

Why: the CTO-level app-maps are the single-pane-of-glass reference that lets the CTO answer questions like 'which settings does this plugin expose?' without grepping the repo each time. Without a merge-gate prompt, these maps drift out of sync with the code.

Co-authored-by: peptiderepo <peptiderepo@users.noreply.github.com>
2026-04-22 18:33:34 +07:00
peptiderepo
3eb6c13bf0 ci(deploy): tolerate 403 on post-deploy health check (#10)
The peptide-starter-theme v1.5.2 release added
peptide_starter_is_cloudflare_peer() — a CF-peer IP validator that
correctly rejects direct-to-origin requests as non-Cloudflare traffic
with HTTP 403. The deploy workflow's post-deploy health check makes
exactly such a request from a GHA runner IP, so it now reliably
receives 403 even on successful deploys.

Two deploys today (peptide-starter-theme v1.5.2, prautoblogger Commit 1a)
both succeeded but reported workflow failure due to this. The actual
deploys (rsync + cache purge) ran clean; site verified HTTP 200 from
real traffic both times.

Fix: accept either 200 (normal healthy response) or 403 (validator
actively rejecting non-CF origin — itself a positive liveness signal)
in the health check. Reject only on 5xx, 4xx-other, or connection
failure.

Reverting this fix is correct only if we either (a) bypass the
validator for our own health-check user-agent, or (b) route the
health check through Cloudflare. Both are larger changes for a
later release.

Agent-Session: cowork-deploy-healthcheck-fix-20260415

Co-authored-by: peptiderepo <peptiderepo@users.noreply.github.com>
2026-04-15 20:17:24 +07:00
peptiderepo
000c21a9e8 feat(ci): add Neurometric PR-Summarizer as 4th QA voice (#9)
Neurometric markets a task-specialized PR-Summarizer SLM (Qwen3-4B +
specialist system prompt) on a free tier. Adding it as a 4th voice in
the existing A/B reviewer panel to see whether a specialized small
model catches things the 3 general-purpose voices miss.

The SLM does not honor OpenAI tool-calling, so it cannot return our
structured submit_review schema. Wired as a "prose voice":

- MODELS tuple gains a 6th provider_type field
  ("openrouter_tools" | "neurometric_prose")
- call_model() dispatches; new call_neurometric_prose() path hits
  api.neurometric.ai/v1 without tools, embeds raw markdown output,
  and infers verdict from keyword heuristic
- Render branch in PR comment marks the verdict as heuristic and
  notes tokens/cost are not tracked (free tier)
- Never the primary voice; heading still driven by Haiku

Also hardens the shared render path against models that omit the
optional 'summary' field (rev.get('summary') fallback).

Requires new repo secret NEUROMETRIC_API_KEY (already set on all four
peptiderepo repos). Voice self-skips with inline error if missing.

Agent-Session: cowork-neurometric-qa-voice-20260415

Co-authored-by: peptiderepo <peptiderepo@users.noreply.github.com>
2026-04-15 16:12:20 +07:00
peptiderepo
c960aee16d ci: reviewer cost cap + 3-model A/B harness (#5)
* ci: cost cap + 3-model A/B harness on CTO reviewer

Two enhancements to the PR reviewer:

1. Monthly spend cap: tracked in Repo Variables (CTO_REVIEW_MONTH,
   CTO_REVIEW_SPEND_CENTS, CTO_REVIEW_CAP_CENTS). Default cap $10/month.
   Auto-resets on month rollover. Posts a skip-comment on PRs when cap hit.

2. A/B harness: reviews every PR with 3 models in parallel
   (Claude Haiku 4.5, DeepSeek V3.1, Kimi K2 Thinking). Comment shows
   all 3 verdicts side-by-side so we can compare quality/cost on real
   PRs before picking a permanent default. Drop to 1 model by editing
   the MODELS list after A/B window closes.

Agent-Session: cowork-reviewer-ab-20260414

* ci: use CTO_ADMIN_TOKEN for repo variables + restore formal APPROVE/REQUEST_CHANGES

Default GITHUB_TOKEN cannot mutate Repository Variables (always 403).
Use a PAT-backed secret CTO_ADMIN_TOKEN for the budget counter steps.
Also restores formal APPROVE/REQUEST_CHANGES verdicts now that repo
setting can_approve_pull_request_reviews is enabled.

Agent-Session: cowork-reviewer-ab-20260414

* ci: address review feedback — per-model timeout + simpler cost math

- Per-model timeout of 60s so one hung model does not block siblings
- Simplify cost_cents math (cost_usd * 100 directly, no double-rounding)

Defer: fine-grained PAT for CTO_ADMIN_TOKEN (requires manual OAuth device flow).

Agent-Session: cowork-reviewer-ab-20260414

* ci: stop exposing CTO_ADMIN_TOKEN as env var (security cleanup)

Pass the PAT only via github-token param. continue-on-error on the
budget step so a missing/expired secret degrades gracefully instead
of failing the whole workflow.

Agent-Session: cowork-reviewer-ab-20260414
2026-04-14 17:35:12 +07:00
peptiderepo
80f573a94c ci: run PHPUnit in CI (tests exist, were never executed) (#2)
* ci: add PHPUnit workflow that runs the existing test suite

59 tests exist across 8 files but were never running in CI.
This adds a ci.yml with PHP Lint + PHPCS + PHPUnit against WP test
framework on a MySQL service.

Agent-Session: cowork-pr-theme-tests-20260414

* ci: vendor install-wp-tests.sh for the PHPUnit workflow

Standard WP-CLI scaffold script, lightly hardened. Kept in-repo
instead of curl-from-github so CI is reproducible.

Agent-Session: cowork-pr-theme-tests-20260414

* chore: retrigger CI after reviewer fix landed on main

Agent-Session: cowork-pr-theme-tests-20260414

* ci: install subversion before bootstrap (svn no longer preinstalled)

ubuntu-latest dropped svn from the default image. install-wp-tests.sh
still uses svn to fetch the WP test suite from develop.svn.wordpress.org.
Add a step to apt-install subversion before the bootstrap runs.

Agent-Session: cowork-pr-theme-tests-20260414

* ci: skip db creation in install-wp-tests.sh (MySQL service already created it)

Agent-Session: cowork-pr-theme-tests-20260414

* ci: WP_CORE_DIR needs trailing slash for ABSPATH substitution

The wp-tests-config.php substitution copies WP_CORE_DIR into ABSPATH
verbatim, then later WordPress concatenates wp-settings.php. Without
the trailing slash you get /tmp/wordpresswp-settings.php.

Agent-Session: cowork-pr-theme-tests-20260414
2026-04-14 17:07:14 +07:00
peptiderepo
59e51dae99 ci: fix CTO reviewer + harden deploy ssh-keyscan (#3)
* ci: post CTO review as COMMENT instead of APPROVE

GITHUB_TOKEN cannot formally approve PRs without a repo setting toggle.
Verdict is still prominent in the first line of the review body, and
the human merges based on reading it — no behavior loss.

Agent-Session: cowork-reviewer-fix-20260414

* fix(ci): ssh-keyscan failure no longer fails the deploy

ssh-keyscan was being called with set -e in effect and stderr suppressed,
so a single keyscan failure killed the entire deploy with no diagnostic
output. Since rsync/ssh use StrictHostKeyChecking=no, the known_hosts
entry is not load-bearing — making the keyscan best-effort is safe.
stderr is now captured to /tmp/keyscan.err and emitted as a warning so
future failures are debuggable.

Agent-Session: cowork-deploy-fix-20260414
2026-04-14 16:53:19 +07:00
peptiderepo
849ff674d7 ci: add review gate (tripwire audit + Claude auto-review via OpenRouter) (#1)
* ci: add main-push audit tripwire

Flags direct pushes to main that did not come from a merged PR.
Free-plan workaround since branch protection requires GitHub Pro.

* docs: add Git Workflow section to CONVENTIONS.md

Documents the PR-gated review process enforced at the agent layer.
Free-plan workaround since branch protection requires GitHub Pro.

* ci: add Claude-powered CTO PR review workflow

Auto-reviews every PR with Claude Haiku 4.5 and posts a structured
review (APPROVE / REQUEST_CHANGES / COMMENT). Does NOT auto-merge — a
human still clicks Merge. Requires ANTHROPIC_API_KEY secret on the repo.

* ci: switch CTO reviewer from Anthropic direct to OpenRouter

Reuses the OPENROUTER_API_KEY secret that already backs the other AI
plugins. Consolidates AI spend on one bill. Model: anthropic/claude-haiku-4.5.
2026-04-14 16:45:58 +07:00
peptiderepo
997f50b890 fix: use .phpcs.xml.dist config in CI instead of inline flags
The CI was overriding the project PHPCS config by passing
--standard=WordPress-Core directly. Now uses the project
.phpcs.xml.dist which includes exclusions for standard WP
patterns (class in functions.php).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-12 22:56:19 +07:00
peptiderepo
7226a08719 v1.3.2: security hardening, CI linting, test scaffold
- Add nonce + CSRF verification to newsletter form (footer.php)
- Add sanitize_callback to all 5 Customizer settings
- Add PHPCS (WordPress-Core) and JS syntax checks to CI pipeline
- Safeguard rsync --delete with dev-file excludes
- Scaffold PHPUnit tests (bootstrap, helpers, theme setup)
- Add composer.json, .phpcs.xml.dist, phpunit.xml
- Bump version to 1.3.2
- Update ARCHITECTURE.md and CHANGELOG.md

Addresses CTO audit findings: security (A- → A), testing (F → D+), CI/CD (C → B).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-12 22:49:06 +07:00
peptiderepo
878e360c96 fix: switch to rsync deploy for private repo 2026-04-08 09:35:44 +07:00
peptiderepo
9642066846 Initial commit: peptide-starter theme v1.3.1 2026-04-08 01:30:16 +07:00