Compare commits

..

7 Commits

Author SHA1 Message Date
peptiderepo
e147fcca84 ci: update deploy-health owner slug to peptide-repo org
Change const owner = 'peptiderepo' → 'peptide-repo' in deploy-health.yml.
This fixes the GitHub API owner ref after the user→org migration so the
monitor correctly queries repos under the peptide-repo org.

All uses:/repository: refs across the estate were already updated at migration
time — this was the sole remaining owner slug ref.

Agent-Session: claude/org-ref-fix-20260617
2026-06-17 06:57:53 +00:00
peptiderepo
696b4d8062 test(smoke): match real key token, not the sk-or- placeholder (#25)
The write-only security check in 08-pr-vision-admin.spec.ts asserted
page.content() does not contain 'sk-or-'. The password input for the
API key renders with placeholder="sk-or-…" (an ellipsis format hint
shown when the key is admin-managed). This placeholder contains the
literal string 'sk-or-' so the naive toContain assertion trips even
though value="" and no real key is in the page.

Fix: replace toContain('sk-or-') with toMatch(/sk-or-v1-[A-Za-z0-9]{20,}/).
A real OpenRouter key uses the format 'sk-or-v1-<20+ alnum chars>';
the placeholder ellipsis 'sk-or-…' never matches this pattern, so the
false-positive is eliminated. The assertion still catches any real key
accidentally rendered in server-side HTML.

The value="" assertion is unchanged and continues to guard the core
write-only invariant independently.

Agent-Session: fix-smoke-key-assertion-20260617

Co-authored-by: peptiderepo <bot@peptiderepo.com>
2026-06-17 13:07:56 +07:00
peptiderepo
3f63c0ce77 docs(smoke): note why playwright install omits --with-deps (#24)
OS deps are pre-installed on the self-hosted peptide-vps runner host.
--with-deps invokes apt-get which fails under the runner's NoNewPrivileges
sandbox hardening. Flag was already dropped in e00f777; this adds an
inline comment so the intent is self-documenting for future maintainers.

Agent-Session: smoke-no-withdeps-20260617

Co-authored-by: peptiderepo <peptiderepo@users.noreply.github.com>
2026-06-17 12:12:49 +07:00
peptiderepo
e00f777cdb fix(ci): drop --with-deps from playwright install on self-hosted runner (v1.7.2) (#23)
Drop --with-deps from npx playwright install chromium. The peptide-vps runner has OS deps pre-installed; --with-deps invokes apt-get blocked by NoNewPrivileges hardening. Binary-only install verified for ghrunner via SSH.

Agent-Session: smoke-playwright-nodeps-20260617
2026-06-17 11:51:33 +07:00
peptiderepo
35602d624f ci: fix peptide-e2e reusable-workflow org ref (peptiderepo→peptide-repo) (#22)
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:15:12 +07:00
peptiderepo
cae04721c7 ci: run deploy + smoke jobs on the self-hosted peptide-vps runner (#21)
Shared pipeline deploy-staging + deploy-production (deploy-app.yml) and the Playwright staging smoke (smoke.yml) now run on the org self-hosted runner [self-hosted, peptide-vps] from the VPS stable IP, fixing the Hostinger rotating-runner-IP throttle. CI/validate stay GitHub-hosted. v1.7.1.

QA: APPROVE-WITH-P2-NOTES (2026-06-17-e6f6b67); P2 = pre-existing stale peptiderepo/ owner refs (work via redirect, ref-cleanup batch).

Agent-Session: deploy-self-hosted-20260617
2026-06-17 11:04:59 +07:00
peptiderepo
4f574a3986 test(e2e): add smoke specs for Peptide News + PR Vision admin (#20)
* feat(e2e): add Peptide News admin smoke spec (07)

Covers dashboard (HTTP 200, no fatal, heading + summary cards + date filter),
settings (form present), articles, and LLM costs sub-pages.
Skip-if-absent guard on all tests: when plugin is not installed on the
environment, tests skip loudly instead of hard-failing.

Selectors sourced from:
  admin/class-pn-admin-menu.php  (slugs)
  admin/partials/dashboard.php   (.pn-summary-cards, .pn-date-filter, h1)

Agent-Session: claude/e2e-news-vision-admin-20260617

* feat(e2e): add PR Vision admin smoke spec (08)

Covers:
- Dashboard: HTTP 200, no fatal, h1 "PR Vision" heading visible
- Settings: page loads + API-key-manager card (#prv-key-card) present +
  status indicator (#prv-key-source-badge) visible
- Write-only invariant: #prv_api_key input has value="" (stored key never
  output); full page HTML asserted to not contain "sk-or-" prefix
- Costs (pr-vision-costs): loads without fatal
- Call Log (pr-vision-calls): loads without fatal

Skip-if-absent on every test: plugin absent or Settings page (v0.2.0
admin) not yet deployed => loud annotation + test.skip().

Selectors sourced from:
  includes/core/class-prv-admin-page.php      (h1 heading)
  includes/core/class-prv-key-manager-renderer.php (#prv-key-card,
    #prv-key-source-badge, #prv_api_key)
  includes/core/class-prv-settings-page.php   (MENU_SLUG)
  includes/core/class-prv-costs-page.php      (MENU_SLUG)
  includes/core/class-prv-call-log-page.php   (MENU_SLUG)

Agent-Session: claude/e2e-news-vision-admin-20260617

* chore(e2e): CHANGELOG 1.7.0 — Peptide News + PR Vision admin smoke specs

Agent-Session: claude/e2e-news-vision-admin-20260617

* chore(e2e): bump version to 1.7.0

Agent-Session: claude/e2e-news-vision-admin-20260617

* fix(e2e): guard-first ordering in specs 07+08 — skip before Invalid-plugin-page assert

In 07-peptide-news-admin (Articles + LLM Costs) and 08-pr-vision-admin
(Costs + Call Log), the hard expect(body).not.toContain('Invalid plugin page')
assertion fired BEFORE the isPluginAbsent() skip guard. If either plugin is
absent from staging, those tests would hard-fail — gating prod for all apps.

Fix: move isPluginAbsent() + test.skip() above the Invalid-plugin-page assert
in all four affected tests, mirroring the Dashboard/Settings guard-first pattern
already used in the same files.

- 07 Articles: skip guard now before Invalid plugin page check
- 07 LLM Costs: skip guard now before Invalid plugin page check
- 08 Costs: skip guard now before Invalid plugin page check
- 08 Call Log: skip guard now before Invalid plugin page check

Validated: npx playwright test --list lists all 38 tests cleanly.

Agent-Session: engineer-infra-e2e-guardfix-20260617

---------

Co-authored-by: peptiderepo <bot@peptiderepo.com>
2026-06-17 01:41:11 +07:00
7 changed files with 42 additions and 13 deletions

View File

@@ -5,7 +5,7 @@
#
# jobs:
# ci:
# uses: peptiderepo/peptide-e2e/.github/workflows/ci.yml@main
# uses: peptide-repo/peptide-e2e/.github/workflows/ci.yml@main
# with:
# tests: stubs # or wp-framework | brain-monkey | none
# has_js: false

View File

@@ -35,7 +35,7 @@ permissions:
jobs:
deploy-staging:
name: Deploy to Staging
runs-on: ubuntu-latest
runs-on: [self-hosted, peptide-vps]
environment: staging
steps:
- uses: actions/checkout@v4
@@ -72,7 +72,7 @@ jobs:
name: Smoke tests (staging)
needs: deploy-staging
if: ${{ inputs.run_smoke }}
uses: peptiderepo/peptide-e2e/.github/workflows/smoke.yml@main
uses: peptide-repo/peptide-e2e/.github/workflows/smoke.yml@main
secrets:
STAGING_WP_ADMIN_USER: ${{ secrets.STAGING_WP_ADMIN_USER }}
STAGING_WP_ADMIN_PASSWORD: ${{ secrets.STAGING_WP_ADMIN_PASSWORD }}
@@ -83,7 +83,7 @@ jobs:
# skipped smoke (run_smoke: false) still allows prod via the if-condition.
needs: [deploy-staging, smoke]
if: ${{ !cancelled() && needs.deploy-staging.result == 'success' && needs.smoke.result != 'failure' }}
runs-on: ubuntu-latest
runs-on: [self-hosted, peptide-vps]
environment: production
steps:
- uses: actions/checkout@v4

View File

@@ -22,7 +22,7 @@ jobs:
- uses: actions/github-script@v7
with:
script: |
const owner = 'peptiderepo';
const owner = 'peptide-repo';
const repos = [
'prautoblogger','peptide-repo-core','peptide-search-ai',
'peptide-news-plugin','peptide-reconstitution-calculator','peptide-starter-theme'

View File

@@ -32,14 +32,14 @@ on:
jobs:
smoke:
name: Playwright smoke suite
runs-on: ubuntu-latest
runs-on: [self-hosted, peptide-vps]
timeout-minutes: 15
steps:
- name: Checkout peptide-e2e (explicit — workflow_call defaults to caller repo)
uses: actions/checkout@v4
with:
repository: peptiderepo/peptide-e2e
repository: peptide-repo/peptide-e2e
ref: main
- name: Set up Node.js
@@ -53,7 +53,8 @@ jobs:
run: npm ci
- name: Install Playwright browsers
run: npx playwright install chromium --with-deps
# OS deps pre-installed on the self-hosted runner host; --with-deps needs sudo which the sandbox blocks
run: npx playwright install chromium
- name: Run smoke tests
env:

View File

@@ -1,5 +1,21 @@
# Changelog
## [1.7.2] - 2026-06-17
### Fixed
- **CI**: Drop `--with-deps` from `npx playwright install chromium` in `smoke.yml`.
The `peptide-vps` self-hosted runner has OS-level Playwright deps pre-installed by
root; `--with-deps` invokes `apt-get` which requires `sudo`, blocked by the runner's
`NoNewPrivileges=true` systemd hardening. Binary-only install works without
elevated privileges.## [1.7.1] - 2026-06-17
### Changed
- **CI/CD**: Switch `deploy-staging`, `deploy-production`, and `smoke` jobs from
`ubuntu-latest` (GitHub-hosted) to `[self-hosted, peptide-vps]` (org runner on
KVM8 VPS). This routes all Hostinger SSH/rsync traffic through our stable VPS IP,
fixing the Azure-region throttle that caused intermittent deploy failures.
Callers' CI/validate jobs are unaffected (remain on `ubuntu-latest`).
## [1.7.0] - 2026-06-17
### Added

View File

@@ -1,6 +1,6 @@
{
"name": "peptide-e2e",
"version": "1.7.0",
"version": "1.7.2",
"description": "Playwright smoke tests for peptiderepo.com (staging + production)",
"private": true,
"scripts": {

View File

@@ -34,7 +34,11 @@
* The stored OpenRouter key must NEVER appear in page source.
* #prv_api_key renders with value="" on every page load regardless of
* whether a key is stored. This spec asserts the empty value and asserts
* that known API key prefixes ("sk-or-") are absent from the full body.
* that no structurally valid key token (regex /sk-or-v1-[A-Za-z0-9]{20,}/)
* appears in the full body HTML. A regex is used instead of a naive
* toContain('sk-or-') to avoid a false-positive on the password input's
* placeholder="sk-or-…" attribute (the ellipsis is a format hint, not a
* token body, and won't match the regex).
*
* @see peptiderepo/pr-vision includes/core/class-prv-admin-page.php
* @see peptiderepo/pr-vision includes/core/class-prv-settings-page.php
@@ -170,10 +174,18 @@ test.describe('WP Admin - PR Vision Settings page (API-key-manager)', () => {
const inputValue = await keyInput.getAttribute('value');
expect(inputValue ?? '').toBe('');
// Security check: known OpenRouter key prefixes must not appear anywhere in
// the page HTML -- guards against accidental server-side leakage.
// Security check: a *real* OpenRouter key (format "sk-or-v1-<20+ alnum chars>")
// must not appear anywhere in the page HTML -- guards against accidental
// server-side leakage.
//
// NOTE: We use a regex rather than the naive toContain('sk-or-') to avoid
// a false-positive: the password input carries placeholder="sk-or-…"
// (an ellipsis format-hint, not a token body) which contains the literal
// string "sk-or-" but is NOT a leaked key. A regex that requires the
// "v1-" segment and at least 20 alphanumeric characters only matches a
// structurally valid key, so the placeholder never trips it.
const html = await page.content();
expect(html).not.toContain('sk-or-');
expect(html).not.toMatch(/sk-or-v1-[A-Za-z0-9]{20,}/);
});
});