ci: run integration tests on PRs + repair the suite (108/108) #54

Merged
shad0w merged 5 commits from ci/integration-tests into master 2026-06-21 06:56:29 +00:00
Owner

What & why

pnpm test:integration was never run in CI, and the suite had quietly rotted against the app. This branch repairs it to 108/108 green and wires it into PR checks against an isolated, ephemeral Postgres.

Test suite repairs (it failed in a clean env before this)

  • Stale seed refs: MV Ocean Pride / MV Sea Breeze / TECH-OPS → current seed entities.
  • Line-item field drift: helper set lineItems[i].description, but createPo keys the loop on lineItems[i].name → every PO-creating test produced zero line items. Fixed the helper.
  • Vendor gating: approval now requires an assigned vendor; lifecycle setups (approval/payment/receipt) attach the seeded verified vendor before approving.
  • Cleanup cascade: POAction and Receipt have no onDelete: Cascade, so deletePo* now removes them before the PO.
  • import-api fixture: committed to App/tests/fixtures/Sample_PO.xlsx (was an absolute path to a non-existent dir).
  • Behavioural drift: resubmit uses intent: "resubmit"; the payment "wrong permission" test uses TECHNICAL (MANAGER now holds process_payment); the unverified-vendor test creates a genuinely code-less vendor; products-search code assertion .every.some.

CI

New integration job in pr-checks.yml: throwaway postgres:16 on a random host port (isolated from prod / pelagia_test / staging), migrate deploydb:seedpnpm test:integration. Container torn down via an EXIT trap.

Verification

Locally, against a fresh migrated + seeded DB: 108/108 integration tests pass; pnpm type-check clean.

🤖 Generated with Claude Code

## What & why `pnpm test:integration` was never run in CI, and the suite had quietly rotted against the app. This branch repairs it to 108/108 green and wires it into PR checks against an isolated, ephemeral Postgres. ## Test suite repairs (it failed in a clean env before this) - **Stale seed refs**: `MV Ocean Pride` / `MV Sea Breeze` / `TECH-OPS` → current seed entities. - **Line-item field drift**: helper set `lineItems[i].description`, but `createPo` keys the loop on `lineItems[i].name` → every PO-creating test produced zero line items. Fixed the helper. - **Vendor gating**: approval now requires an assigned vendor; lifecycle setups (approval/payment/receipt) attach the seeded verified vendor before approving. - **Cleanup cascade**: `POAction` and `Receipt` have no `onDelete: Cascade`, so `deletePo*` now removes them before the PO. - **import-api fixture**: committed to `App/tests/fixtures/Sample_PO.xlsx` (was an absolute path to a non-existent dir). - **Behavioural drift**: resubmit uses `intent: "resubmit"`; the payment "wrong permission" test uses TECHNICAL (MANAGER now holds `process_payment`); the unverified-vendor test creates a genuinely code-less vendor; products-search code assertion `.every` → `.some`. ## CI New `integration` job in `pr-checks.yml`: throwaway `postgres:16` on a random host port (isolated from prod / `pelagia_test` / staging), `migrate deploy` → `db:seed` → `pnpm test:integration`. Container torn down via an EXIT trap. ## Verification Locally, against a fresh migrated + seeded DB: **108/108 integration tests pass**; `pnpm type-check` clean. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
shad0w added 3 commits 2026-06-20 21:11:19 +00:00
The integration suite had rotted against the app. Systematic fixes:
- seed refs: MV Ocean Pride/Sea Breeze/TECH-OPS → current seed entities
- helper appendLineItem set lineItems[i].description; createPo now keys on
  lineItems[i].name → zero line items. Fixed to .name.
- vendor gating: lifecycle setups (approval/payment/receipt) now attach the
  seeded verified vendor before approval.
- cleanup: POAction has no onDelete:Cascade, so deletePo(sByTitle) now removes
  POAction rows before the PO.
- import-api: fixture committed to tests/fixtures/Sample_PO.xlsx (was an
  absolute path to a non-existent dir).
- products-search: code search assertion .every → .some (search spans fields).

11 failures remain (behavioral drift — separate commit).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- resubmit: updatePo distinguishes intent "resubmit" (from EDITS_REQUESTED)
  from "submit" (from DRAFT); test now sends "resubmit" (makePoForm widened).
- payment: MANAGER now holds process_payment, so the "wrong permission"
  negative test uses TECHNICAL (which lacks it).
- vendor: provideVendorId rejects on a missing vendorId *code*; seeded
  unverified vendors carry codes, so create a genuinely code-less vendor.

Full integration suite: 108/108 passing.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
ci: run integration tests on PRs (ephemeral Postgres)
All checks were successful
PR checks / checks (pull_request) Successful in 31s
PR checks / integration (pull_request) Successful in 37s
991b7ca5dd
Adds an `integration` job to PR checks: spins up a throwaway postgres:16
container on a random host port (isolated from prod / pelagia_test / staging),
applies migrations, dev-seeds, and runs `pnpm test:integration` (108 tests).
Container is always torn down via an EXIT trap.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
shad0w added 1 commit 2026-06-20 21:14:53 +00:00
Merge branch 'master' into ci/integration-tests
All checks were successful
PR checks / checks (pull_request) Successful in 31s
PR checks / integration (pull_request) Successful in 26s
9e787fd15f
shad0w force-pushed ci/integration-tests from 9e787fd15f to 991b7ca5dd 2026-06-20 21:15:02 +00:00 Compare
shad0w added 1 commit 2026-06-20 21:15:07 +00:00
Merge branch 'master' into ci/integration-tests
All checks were successful
PR checks / checks (pull_request) Successful in 31s
PR checks / integration (pull_request) Successful in 26s
9e787fd15f
shad0w added 1 commit 2026-06-21 06:56:14 +00:00
Merge branch 'master' into ci/integration-tests
All checks were successful
PR checks / checks (pull_request) Successful in 33s
PR checks / integration (pull_request) Successful in 26s
058ba1d12e
shad0w merged commit a197b966b1 into master 2026-06-21 06:56:29 +00:00
Sign in to join this conversation.
No description provided.