CI: one pipeline to the CI standard: PHP 8.4 lint, audits, scans, API and MCP tests (#136) #139

Open
jared wants to merge 3 commits from ci-standard into development
pull from: ci-standard
Owner

Part of #136: brings Tinker's CI up to the shared CI standard, which is modelled on Pulse and Thor.

Stacked on #120 (UI tests) and #137 (the symfony/http-client bump). Only the last commit, CI: one pipeline…, is new here. Once those two merge I'll rebase onto development, and this PR will show just that commit.

What changes

ci.yml replaces lint.yml and security.yml. Deploys now wait for every check; before, they waited for lint only.

Job What it checks Before
Lint php -l on every file under PHP 8.4; check_requirements.php; phpcs 4.0.4 (pinned, SHA-256 checked); eslint 8.57.1 from a lockfile, with --max-warnings=66 (today's count, so warnings can only go down) phpcs from the abandoned squizlabs URL (unpinned); npm install eslint@8; PHP from whatever the image had
Security composer validate --strict; composer audit --locked --abandoned=fail; npm audit (high) and npm audit signatures for the test tooling nothing
Scan gitleaks over the full history (#134); actionlint; shellcheck; zizmor; semgrep with p/javascript, p/secrets and p/security-audit added to p/php + p/owasp-top-ten semgrep only (unpinned)
API and MCP Fresh MariaDB, migrations, seed and fixtures, then: MCP tools (30 checks: comment edit and delete permissions, hidden tickets, nested replies, links) and the Bearer API contract (132 checks: dedup by key and title, escalation, the reopen window under all three Workflow Designer setups, recurrence chains, concurrent creates, ?dedup_key= lookup, the source filter, the link API) nothing; these were local checks in #121, #124 and #131
UI (playwright) and UI screenshots as in #120
PHP warnings gate (API and UI jobs) fails if the server log has any PHP warning, notice or deprecation. #130's warnings were logged while every page still rendered nothing
Notify Matrix alert on any failure on main/development or in the weekly run, and on every deploy lint failures only

Also:

  • every job has a timeout;
  • runs are grouped per ref, and superseded PR runs are cancelled;
  • deploys queue and are never cancelled mid-way;
  • the weekly run re-audits and re-scans;
  • ${{ }} values reach scripts only through env, as zizmor wants.

What the new checks found

  • composer audit:
    • six advisories in symfony/http-client 7.4.19, which prod runs. Fixed by #137.
    • mcp/sdk 0.8.1, GHSA-f4rf-6ghj-mhr6 (low): only the SDK's /token and /register OAuth proxy endpoints are affected, and Tinker uses neither. It's ignored in composer.json with that reason, and the 0.9 upgrade (breaking auth API) is #138.
  • gitleaks, 527 commits, all branches: 5 findings, all the literal Bearer YOUR_API_KEY placeholder on the API keys help page. That's allowlisted in .gitleaks.toml for that file only. No real secret was ever committed.
  • semgrep with the extra packs, phpcs 4.0.4, zizmor and actionlint: clean.

Not in this PR

  • The em/en dash check is the standard's house-style rule, but 457 dashes in 75 files remain until #118 (resync the vendored web_template, clean up Tinker's files). I'll add it with #118.
  • A verified deploy:
    • signed {ref, sha, ts};
    • a server-side script that deploys exactly that sha and rolls back;
    • a /health endpoint reporting the sha, which CI waits for.
    • The deploy scripts on CT 132 still git reset to the branch head and ignore the payload. That needs server changes with your OK, so it's a follow-up under #136.

⚠ Before merging: branch protection

main has required status checks named after the old jobs, e.g. Lint / PHP (phpcs PSR-12) (pull_request). Those never report again after this, so a release PR to main would wait forever. Update the required checks to the new names before the next development → main release:

  • CI / Lint (PHP 8.4, phpcs, eslint) (pull_request)
  • CI / Security (composer and npm audit) (pull_request)
  • CI / Scan (secrets, workflows, shell, patterns) (pull_request)
  • CI / API and MCP (PHP 8.4, MariaDB) (pull_request)
  • CI / UI (playwright) (pull_request)

Verified locally

  • API and MCP: stack.sh, then fixtures.php, mcp_test.php and test_api.py against a fresh database: 30/30 and 132/132, with no PHP warnings in the server log.
  • The warnings gate: it catches all 6 lines in a server log from before #130's fix, and nothing in clean logs.
  • Each check, pinned version, run locally:
    • gitleaks 8.30.1: clean, with the allowlist;
    • actionlint 1.7.12 and zizmor 1.32.0 on ci.yml: clean;
    • semgrep 1.184.0 with the new packs: 0 findings;
    • phpcs 4.0.4: clean;
    • eslint: 0 errors, 66 warnings;
    • composer validate --strict and composer audit --abandoned=fail: pass;
    • shellcheck on all scripts: clean.
  • php -l and check_requirements.php: pass locally (PHP 8.2). CI runs them on 8.4.

🤖 Generated with Claude Code

Part of #136: brings Tinker's CI up to the shared [CI standard](https://wiki.lotusguild.org/Infrastructure/ci-standard), which is modelled on Pulse and Thor. **Stacked on #120 (UI tests) and #137 (the symfony/http-client bump).** Only the last commit, `CI: one pipeline…`, is new here. Once those two merge I'll rebase onto `development`, and this PR will show just that commit. ## What changes `ci.yml` replaces `lint.yml` and `security.yml`. **Deploys now wait for every check**; before, they waited for lint only. | Job | What it checks | Before | |---|---|---| | **Lint** | `php -l` on every file under **PHP 8.4**; `check_requirements.php`; phpcs 4.0.4 (pinned, SHA-256 checked); eslint 8.57.1 from a lockfile, with `--max-warnings=66` (today's count, so warnings can only go down) | phpcs from the abandoned squizlabs URL (unpinned); `npm install eslint@8`; PHP from whatever the image had | | **Security** | `composer validate --strict`; `composer audit --locked --abandoned=fail`; npm audit (high) and `npm audit signatures` for the test tooling | nothing | | **Scan** | gitleaks over the **full history** (#134); actionlint; shellcheck; zizmor; semgrep with `p/javascript`, `p/secrets` and `p/security-audit` added to `p/php` + `p/owasp-top-ten` | semgrep only (unpinned) | | **API and MCP** | Fresh MariaDB, migrations, seed and fixtures, then: **MCP tools** (30 checks: comment edit and delete permissions, hidden tickets, nested replies, links) and the **Bearer API contract** (132 checks: dedup by key and title, escalation, the reopen window under all three Workflow Designer setups, recurrence chains, concurrent creates, `?dedup_key=` lookup, the source filter, the link API) | nothing; these were local checks in #121, #124 and #131 | | **UI (playwright)** and **UI screenshots** | as in #120 | | | **PHP warnings gate** (API and UI jobs) | fails if the server log has any PHP warning, notice or deprecation. #130's warnings were logged while every page still rendered | nothing | | **Notify** | Matrix alert on any failure on `main`/`development` or in the weekly run, and on every deploy | lint failures only | Also: - every job has a timeout; - runs are grouped per ref, and superseded PR runs are cancelled; - deploys queue and are never cancelled mid-way; - the weekly run re-audits and re-scans; - `${{ }}` values reach scripts only through `env`, as zizmor wants. ## What the new checks found - **`composer audit`:** - six advisories in `symfony/http-client` 7.4.19, which prod runs. Fixed by **#137**. - `mcp/sdk` 0.8.1, GHSA-f4rf-6ghj-mhr6 (low): only the SDK's `/token` and `/register` OAuth proxy endpoints are affected, and Tinker uses neither. It's ignored in `composer.json` with that reason, and the 0.9 upgrade (breaking auth API) is **#138**. - **gitleaks, 527 commits, all branches:** 5 findings, all the literal `Bearer YOUR_API_KEY` placeholder on the API keys help page. That's allowlisted in `.gitleaks.toml` for that file only. **No real secret was ever committed.** - **semgrep with the extra packs, phpcs 4.0.4, zizmor and actionlint:** clean. ## Not in this PR - **The em/en dash check** is the standard's house-style rule, but 457 dashes in 75 files remain until **#118** (resync the vendored web_template, clean up Tinker's files). I'll add it with #118. - **A verified deploy:** - signed `{ref, sha, ts}`; - a server-side script that deploys exactly that sha and rolls back; - a `/health` endpoint reporting the sha, which CI waits for. - The deploy scripts on CT 132 still `git reset` to the branch head and ignore the payload. That needs server changes with your OK, so it's a follow-up under #136. ## ⚠ Before merging: branch protection `main` has required status checks named after the old jobs, e.g. `Lint / PHP (phpcs PSR-12) (pull_request)`. Those never report again after this, so a release PR to `main` would wait forever. **Update the required checks to the new names before the next `development` → `main` release:** - `CI / Lint (PHP 8.4, phpcs, eslint) (pull_request)` - `CI / Security (composer and npm audit) (pull_request)` - `CI / Scan (secrets, workflows, shell, patterns) (pull_request)` - `CI / API and MCP (PHP 8.4, MariaDB) (pull_request)` - `CI / UI (playwright) (pull_request)` ## Verified locally - **API and MCP:** `stack.sh`, then `fixtures.php`, `mcp_test.php` and `test_api.py` against a fresh database: **30/30 and 132/132**, with no PHP warnings in the server log. - **The warnings gate:** it catches all 6 lines in a server log from before #130's fix, and nothing in clean logs. - **Each check, pinned version, run locally:** - gitleaks 8.30.1: clean, with the allowlist; - actionlint 1.7.12 and zizmor 1.32.0 on `ci.yml`: clean; - semgrep 1.184.0 with the new packs: 0 findings; - phpcs 4.0.4: clean; - eslint: 0 errors, 66 warnings; - `composer validate --strict` and `composer audit --abandoned=fail`: pass; - shellcheck on all scripts: clean. - **`php -l` and `check_requirements.php`:** pass locally (PHP 8.2). CI runs them on 8.4. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
jared added 3 commits 2026-11-29 00:20:45 -05:00
Add Playwright UI tests and before/after screenshots to CI
Lint / UI screenshots (before/after) (push) Skipped
Lint / JS (eslint) (push) Successful in 16s
Lint / PHP (phpcs PSR-12) (push) Successful in 40s
Lint / PHP requirements (version + extensions) (push) Successful in 50s
Security / PHP Security (semgrep) (push) Successful in 2m43s
Lint / UI (playwright) (push) Successful in 3m41s
Lint / Deploy (push) Skipped
Lint / Notify on failure (push) Skipped
Lint / PHP (phpcs PSR-12) (pull_request) Successful in 42s
Lint / JS (eslint) (pull_request) Successful in 29s
Lint / PHP requirements (version + extensions) (pull_request) Successful in 1m29s
Lint / UI (playwright) (pull_request) Successful in 3m45s
Lint / Deploy (pull_request) Skipped
Lint / Notify on failure (pull_request) Skipped
Security / PHP Security (semgrep) (pull_request) Successful in 1m57s
Lint / UI screenshots (before/after) (pull_request) Successful in 5m28s
006b7ef7bc
New UI (playwright) job: PHP and MariaDB inside the Playwright image, a
seeded instance (tests/ui/stack.sh, synthetic data only) and 21 tests:
every main page loads with no page errors, console errors or failed
requests, description and comment markdown render safely (#114), and
pages fit a phone screen. Deploys now wait for it.

New UI screenshots (before/after) job: for PRs that change assets/ or
views/, runs the base branch and the PR side by side with the same data
and uploads one side-by-side PNG per page and view (dark, light, phone).
Modelled on Pulse's ui and ui-screenshots jobs.

Fixes found while building it:
- migrate.php split statements on semicolons inside -- comments, so 001
  and 003 failed on a fresh database.
- API endpoints applied rate limiting before loading config, so
  RATE_LIMIT_DEFAULT/RATE_LIMIT_API from .env and TRUSTED_PROXIES were
  ignored there: every user behind the proxy shared one per-IP bucket.
  The limiter now loads config itself; the per-IP limits are configurable
  (RATE_LIMIT_IP, RATE_LIMIT_IP_API) with unchanged defaults.
- The avatar error fallback was registered in the footer, after the
  header avatar, so a fast 404 left a broken image instead of initials.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
composer audit reports six advisories against symfony/http-client
7.4.19, fixed in 7.4.23/7.4.24: CVE-2026-121971, CVE-2026-123119,
CVE-2026-133750, CVE-2026-133757, CVE-2026-133758, CVE-2026-134792
(credentials sent to other origins, cached responses shared between
users, DNS rebinding past NoPrivateNetworkHttpClient, proxy chosen by a
request header). The MCP endpoint uses the client to fetch Authelia's
OIDC discovery and JWKS.

`composer update symfony/http-client --with-dependencies` (platform PHP
8.2, as composer.json sets): http-client 7.4.25, http-client-contracts,
service-contracts and deprecation-contracts 3.8.1, polyfill-php83 1.43.0.
composer.json is unchanged (^7.3 already allows it); deploys run
composer install from the lock.

Found by the composer audit step being added to CI (#136).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
CI: one pipeline to the CI standard: PHP 8.4 lint, audits, scans, API and MCP tests (#136)
CI / Lint (PHP 8.4, phpcs, eslint) (pull_request) Successful in 1m17s
CI / Scan (secrets, workflows, shell, patterns) (pull_request) Successful in 1m58s
CI / API and MCP (PHP 8.4, MariaDB) (pull_request) Successful in 1m56s
CI / UI (playwright) (pull_request) Successful in 2m10s
CI / Security (composer and npm audit) (pull_request) Successful in 1m42s
CI / Deploy (pull_request) Skipped
CI / Notify (pull_request) Skipped
CI / UI screenshots (before/after) (pull_request) Successful in 5m3s
8e57233f92
Replaces lint.yml and security.yml with .gitea/workflows/ci.yml, following
the shared CI standard (wiki: Infrastructure/ci-standard, modelled on
Pulse and Thor). Deploys now wait for every check.

Jobs:
- Lint: php -l on every file and scripts/check_requirements.php under
  PHP 8.4 (node:22-trixie, Debian 13's packages, as on CT 132); phpcs
  4.0.4 pinned with SHA-256 (was the abandoned squizlabs build, unpinned);
  eslint 8.57.1 from tests/lint/ (lockfile, was `npm install eslint@8`)
  with --max-warnings=66, today's count, so warnings can only go down.
- Security: composer validate --strict, composer audit --locked
  --abandoned=fail, npm audit (high) and audit signatures for the test
  tooling. The audit found symfony/http-client advisories (fixed by the
  lock bump, #137) and mcp/sdk GHSA-f4rf-6ghj-mhr6, ignored with its
  reason in composer.json until #138 (Tinker uses neither affected
  middleware).
- Scan: gitleaks over the full history (#134; the five findings in 527
  commits were the YOUR_API_KEY placeholder on the API keys page,
  allowlisted for that file only in .gitleaks.toml), actionlint,
  shellcheck, zizmor, and semgrep with p/javascript, p/secrets and
  p/security-audit added to the existing packs (no new findings).
- API and MCP: fresh MariaDB, migrations, seed, fixtures; then
  tests/api/mcp_test.php (MCP comment and link tools, 30 checks) and
  tests/api/test_api.py (the Bearer API contract automated reporters
  rely on, 132 checks: dedup by key and title, escalation, the reopen
  window under three Workflow Designer setups, recurrence chains,
  concurrent creates, lookup by dedup_key, source filter, link API).
  These were the local checks of #124/#131 and #121/#124.
- UI and UI screenshots as before (#120).
- API and UI fail on any PHP warning, notice or deprecation in the
  server log (tests/ci/php-warnings.sh): #130's warnings logged while
  every page still rendered.
- Every job has a timeout; runs are grouped per ref; deploys queue and
  are never cancelled; the weekly run re-audits and re-scans.
- Notify: Matrix alert on any failure on a deploy branch or in the
  weekly run, and on every deploy (was: lint failures only).

tests/ui/setup.sh moves to tests/ci/setup.sh (the lint, audit and API
jobs use it too) and takes WITH_DB=0 and EXTRA_PKGS.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Some checks are pending
CI / Lint (PHP 8.4, phpcs, eslint) (pull_request) Successful in 1m17s
CI / Scan (secrets, workflows, shell, patterns) (pull_request) Successful in 1m58s
CI / API and MCP (PHP 8.4, MariaDB) (pull_request) Successful in 1m56s
CI / UI (playwright) (pull_request) Successful in 2m10s
CI / Security (composer and npm audit) (pull_request) Successful in 1m42s
CI / Deploy (pull_request) Skipped
CI / Notify (pull_request) Skipped
CI / UI screenshots (before/after) (pull_request) Successful in 5m3s
Lint / JS (eslint) (push)
Required
Lint / PHP (phpcs PSR-12) (push)
Required
Lint / PHP requirements (version + extensions) (push)
Required
Security / PHP Security (semgrep) (push)
Required
Some required checks are missing.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin ci-standard:ci-standard
git checkout ci-standard
Sign in to join this conversation.