Files
ZitPlane/tests/ci/README.md
T

9.5 KiB

tests/ci — Isolated Gitea verification tools

This folder contains CI-only source/lockfile checks and OIDC discovery smoke support. Run these through the approved .gitea/workflows/p05-ci.yml on a disposable Linux runner.

  • source_contract.py checks the narrow P05 source/package constraints and paths. It is not a typecheck or application test.
  • oidc_discovery.py checks ZITADEL readiness, OIDC discovery, JWKS and fail-closed issuer/JWKS negative fixtures on the disposable Docker network. It does NOT log in a user or check an authenticated callback.
  • account_negative.py checks that an anonymous Account Portal call returns 401 and that a protected page redirects to /signin. It does NOT create a test user or prove real login.
  • advisory_triage.py summarizes available npm/pnpm registry advisory JSON with IDs, ranges and fixes, without changing dependency versions.
  • compose.portless.override.yaml is CI-only, adds ports: !reset [] to clear P02's inherited Traefik host mapping. Run #83 failed because host 8080 was occupied; this post-run source correction is not CI-verified. Use both Compose files together and assert proxy.ports absent before startup. P02 dev Compose is unchanged.

No real credentials or production domains are used. Never print bootstrap PATs, admin secrets, session cookies or .env contents. Cleanup of disposable volumes is mandatory; never apply docker compose down -v to a user's non-CI stack.

  • backend_acceptance.sh (P05-CI-03) is the manual backend-only Gitea runner preflight, portless Compose gate, four-service readiness, disposable database restart persistence and OIDC/JWKS smoke. Refuses pre-existing fixed network/project/volumes.

  • backend_cleanup.sh (P05-CI-03) is the workflow's always() cleanup script. It tears down only a marked run-owned Compose project and verifies that no project containers, volumes or fixed network remain. Unverified cleanup is an explicit failure.

  • Run from .gitea/workflows/p05-backend-acceptance.yml only in isolated Gitea CI, not on a production Docker host or local developer PC. Run #86 PASS on 03fb589, including persistence and owned cleanup. No real user login/MFA E2E was run.

  • security_advisory_gate.py (P05-SEC-01) takes npm or pnpm registry audit JSON, rejects missing/errored/inconsistent metadata and requires zero Moderate/High/Critical findings. It is independent of the existing HIGH+ audit command and advisory_triage.py detailed advisory ID report. Gitea Run #87 proved Account audit 0 and Login audit 2 Moderate (glob, minimatch); strict Login gate correctly FAILED. Dedicated .gitea/workflows/p05-security-acceptance.yml is manual only; frozen installs/builds are CI-only and passed 1219/1219 Login unit regressions.

  • transitive_override_contract.py (P05-SEC-02) validates seven exact parent-scoped PNPM overrides, lock/importer consistency and absence of affected glob/minimatch versions. Run #88 failed in this helper before pnpm frozen install because its first regex also matched existing >= version-range override keys. Post-run regex restricted to >glob/>minimatch parent selectors, not CI-tested; next separately approved focused run required. The independent Run #88 live production advisory audit found 0 Moderate/High/Critical. Account jobs skipped as expected with login_only=true.

Add new CI checks and update MINIFEST.md, project/, docs/, and notes/ in the same approved phase.

P05-OIDC-08-A03: Run #104 / Job #220 FAILURE on 7954938fcee4d11c0b27751c7cf7abdcc64cd243: static Compose parse and five source zeros PASS; normalized deploy resources:{} + placement:{} on every service verified as empty, earlier DEPLOY_DISABLED blocker resolved, next SERVICE_SECRET_REFS rejects normalized service grants. All 40 source-defined negative fixtures NOT EXECUTED; workflow-safety and runner job cleanup PASS. No service startup, live secrets or public endpoints. Read production_contract/README.md and notes/P05-OIDC-08-A03.md; no rerun in A03.

P05-OIDC-08-A01 status: Run #102 / Job #218 FAILURE after Compose config PASS: safe diagnostics identified normalized null command/entrypoint for all five synthetic services; previous RUNTIME_BEHAVIOR blocker resolved, subsequent DEPLOY_DISABLED check FAIL, 25 original + four new runtime negative fixtures NOT EXECUTED. Manual-only safety step PASS, runner task cleanup observed; unchanged workflow and synthetic Compose. Exact next validator-only RCA in notes/P05-OIDC-08-A01.md. Never start the synthetic services.

P05-SEC-02-A01 final acceptance: Existing corrected transitive_override_contract.py successfully executed in Gitea Run #89 (exact seven parent selector and patched lock markers). Frozen PNPM install, Next Login standalone build, and Vitest 84/84 files/1219/1219 cases PASS. Separate production security_advisory_gate.py reports 0 Moderate/High/Critical, no suppressed findings. Two Account jobs intentionally skipped using login_only=true. No local test run; no real authenticated OIDC session/production deployment.

P05-OIDC-01 is the new CI-only directory tests/ci/oidc_e2e/: exact files and first-party instructions in README.md and MINIFEST.md inside that folder. It is triggered only via new manual .gitea/workflows/p05-oidc-acceptance.yml. run.sh protects numeric run ownership, starts no-host-port official ZITADEL Compose, provisions a real disposable client/human via official IAM_OWNER PAT and runs pinned Chromium with the original Login V2 and unmodified Account Portal. It expects real PKCE/state/nonce/callback/session positive and negative results. cleanup.sh runs even on failure and must prove removal of only owned test containers, volumes, database/bootstrap credentials. CI execution pending, not local tests or production proof.

P05-OIDC-01 Run #90 terminal: new oidc_e2e/ harness started the original ZITADEL/PG/Login/Traefik services healthy with no host-published port. The private namespace loopback sidecar was not ready, so the provisioner timed out before creating a disposable project, OIDC client/user or running any browser checks. No real OIDC accepted. Gitea always() cleanup fully removed all run-owned volumes/containers/credentials and passed. No second run. P05-OIDC-02 should add safe CI-only startup/health diagnostics and pin the forwarder image before another single acceptance run.

P05-OIDC-02 Run #91: Existing manual real-browser workflow with new CI-only forwarder source proved four healthy services, no host-published ports, private Traefik:80 Host: localhost:8080 HTTP 200 and prebuilt socat version/digest check PASS. But the private forwarding process exited immediately with code 1; actual client/user setup and browser/callback/session tests NOT RUN. always() cleanup verified absence of all run-owned state, PASS. No repeated run, no Auth.js or app edits. Preserve this exact evidence for a narrow P05-OIDC-03 startup diagnostic.

P05-OIDC-03: tests/ci/oidc_e2e/forwarder.py is an stdlib-only private 127.0.0.1 TCP relay. run.sh classifies pre-credential socat startup failures and, if needed, switches to the official Python image pinned by sha256 within a single isolated CI cycle; existing exact-owner cleanup and original OAuth/Browser tests unchanged. Do not treat forwarder readiness alone as real OIDC authentication acceptance.

P05-OIDC-06 login_image/ helpers: isolated frozen imported Login builder and local image, plus run-labeled image/builder/temp-context cleanup; original OIDC default mode unchanged with a narrow opt-in Compose overlay. Run #98 build PASS, OCI custom Login startup failed with entrypoint permission denied (exact mode UNKNOWN), custom browser NOT EXECUTED, dual cleanup PASS. New folder README.md and MINIFEST.md document exact files. No local developer build or production user.

P05-OIDC-06-A01 terminal: Existing CI-only login_image/build.sh now validates copied temporary entrypoint regular-file/shebang/mode, corrects an observed 644 executable-bit defect only in the disposable build context, and checks the final image with no-network default-user test -x. Gitea Run #99 SUCCESS on 7d6b6d0704b9e39bcb6e74257dadf0b64a19fc0f: imported custom Login image actually ran and completed full Chromium PKCE/Auth.js protected Account/session/negative/logout with exact run-owned cleanup PASS. No imported Login source/Dockerfile, browser/provision, Compose, original workflow or production change. See login_image/README.md, notes/P05-OIDC-06-A01.md.

P05-OIDC-08 production_contract/ (NEW): stdlib validate.py compares normalized Compose JSON with strict synthetic proposed HTTPS issuer/Account callback/Login/Console/API h2c Host/forwarding policy and 6 symbolic secret references, with 25 in-memory malformed fixtures and manual-workflow command allowlist. compose.ci.yaml has only synthetic.invalid images, zero replicas and internal network. Run #101 source 2ca1b4493bd47209d0c7eabf7453feaeb1f5174a: docker compose config --quiet PASS, normalized RUNTIME_BEHAVIOR failure occurred before 25 negative cases, workflow-safety PASS. No real service container or external production DNS/SSL. See production_contract/README.md and notes/P05-OIDC-08.md.