FORGE-89: non-required CI job running the API database suites on D1 #727

Merged
gmackie merged 1 commit from FORGE-89-d1-ci-lane into main 2026-10-12 06:44:02 +00:00
Owner

FORGE-89 (D1 Phase 4), step 3 of 5. Stacked on #725 (and #721); review the top commit, a 24-line ci.yml change.

What

A new, separate database-d1 job in .forgejo/workflows/ci.yml:

  • pnpm --filter @forgegraph/api test:d1: the API DB-backed suites on an in-process D1 (Miniflare/workerd) with the generated SQLite schema, skipping the files in packages/api/d1-known-failures.txt. It fails only on a regression outside that list.
  • A non-blocking step (continue-on-error) running test:d1:known, which prints a ::warning:: for any listed file that now passes, so FORGE-88 (Phase 3) can shrink the list.

Not required: the job is not in the ci aggregate's needs, and main's branch protection requires only CI / ci (pull_request) and CI / gitleaks (pull_request), so it never gates a merge. The Postgres database job and its service are untouched.

Layout: kept minimal and self-contained for FORGE-68 (thread fca1d249 owns ci.yml's job layout and runner routing). It uses the shared pnpm-install action and runs-on: cloudflare, because it needs no services and should not take a forgegraph-worker node slot from required jobs. If the Containers executor can't run workerd, moving it to [forgegraph-ci, forgegraph-worker] is a one-line change.

Verification

  • node scripts/test-workflow-yaml.mjs: all 10 workflow files parse.
  • Locally: test:d1 24 files / 136 passed / 0 failed; test:d1:known 20 listed, 0 now passing.
  • CI evidence: the database-d1 job result on this PR's head.

🤖 Generated with Claude Code

FORGE-89 (D1 Phase 4), step 3 of 5. **Stacked on #725** (and #721); review the top commit, a 24-line `ci.yml` change. ## What A new, separate `database-d1` job in `.forgejo/workflows/ci.yml`: - `pnpm --filter @forgegraph/api test:d1`: the API DB-backed suites on an in-process D1 (Miniflare/workerd) with the generated SQLite schema, skipping the files in `packages/api/d1-known-failures.txt`. It fails only on a regression outside that list. - A non-blocking step (`continue-on-error`) running `test:d1:known`, which prints a `::warning::` for any listed file that now passes, so FORGE-88 (Phase 3) can shrink the list. **Not required**: the job is not in the `ci` aggregate's `needs`, and main's branch protection requires only `CI / ci (pull_request)` and `CI / gitleaks (pull_request)`, so it never gates a merge. The Postgres `database` job and its service are untouched. Layout: kept minimal and self-contained for FORGE-68 (thread fca1d249 owns ci.yml's job layout and runner routing). It uses the shared `pnpm-install` action and `runs-on: cloudflare`, because it needs no services and should not take a forgegraph-worker node slot from required jobs. If the Containers executor can't run workerd, moving it to `[forgegraph-ci, forgegraph-worker]` is a one-line change. ## Verification - `node scripts/test-workflow-yaml.mjs`: all 10 workflow files parse. - Locally: `test:d1` 24 files / 136 passed / 0 failed; `test:d1:known` 20 listed, 0 now passing. - CI evidence: the `database-d1` job result on this PR's head. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
FORGE-89: generated sqlite-core (D1) schema with a DDL parity test
All checks were successful
CI / gitleaks (pull_request) Successful in 12s
CI / go (pull_request) Successful in 1m24s
CI / storybook (pull_request) Successful in 1m55s
CI / web-build (pull_request) Successful in 2m41s
CI / checks (pull_request) Successful in 2m51s
CI / database (pull_request) Successful in 3m13s
CI / unit-web (pull_request) Successful in 5m15s
CI / unit-api (pull_request) Successful in 6m14s
forgegraph/ci CI passed
CI / ci (pull_request) Successful in 41s
4d40c5ac0b
Adds packages/db/src/schema-sqlite/, a drizzle sqlite-core schema for all 142
tables, generated from the Postgres schema's drizzle metadata by
packages/db/scripts/generate-sqlite-schema.ts (pnpm --filter @forgegraph/db
db:sqlite:generate). Translation follows the D1 design doc: pgEnum -> text +
CHECK built from the shared @forgegraph/db/enums arrays, json/jsonb/arrays ->
text json typed as the pg column, timestamptz -> integer timestamp_ms with an
epoch-ms SQL default, boolean -> integer boolean, serial seq -> integer +
deployment_event_seq_unique_idx (FORGE-85), partial/expression indexes,
checks (btrim -> trim) and FK actions kept. Relations are generated too.

schema-sqlite/ddl.ts produces the DDL via drizzle-kit and makes every table
STRICT; the D1 test lane and the Phase 5 baseline reuse it. parity.test.ts
fails when the generated files are stale and compares the DDL that SQLite
actually builds (PRAGMA table_info / index_list / foreign_key_list) against
the Postgres metadata: tables, columns, types, nullability, defaults, PKs,
unique columns, FKs and actions, indexes incl. partial/expression, checks.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
FORGE-89: in-process D1 test database (FG_TEST_DB=d1) with a transaction guard
All checks were successful
CI / gitleaks (pull_request) Successful in 20s
CI / go (pull_request) Successful in 1m7s
CI / unit-api (pull_request) Successful in 4m12s
CI / storybook (pull_request) Successful in 2m42s
CI / web-build (pull_request) Successful in 2m54s
CI / checks (pull_request) Successful in 2m58s
CI / unit-web (pull_request) Successful in 6m6s
CI / database (pull_request) Successful in 4m5s
CI / ci (pull_request) Successful in 58s
0142c748d9
FG_TEST_DB=d1 runs the API's DB-backed suites against Cloudflare's own D1
implementation in workerd (Miniflare) instead of Postgres, behind the
existing helpers: database-test-config.ts generates the STRICT SQLite DDL
(@forgegraph/db/schema-sqlite/ddl) once per run and aliases
@forgegraph/db/schema to the generated sqlite-core schema, and
createTestDb() returns a drizzle d1 client over a shared Miniflare D1.

Every statement passes a guard that rejects BEGIN/COMMIT/ROLLBACK/
SAVEPOINT/RELEASE/END, because remote D1 rejects them with error 7500 and
local D1 versions differ. db.transaction() therefore fails on this lane.

d1-known-failures.txt lists the 20 test files that do not pass on D1 yet
(transactions, Postgres-only SQL, >100 bound parameters); test:d1 skips them
and is green, test:d1:known runs only them and reports any that now pass.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
FORGE-89: non-required CI job running the API database suites on D1
Some checks failed
CI / gitleaks (pull_request) Successful in 19s
CI / unit-api (pull_request) Successful in 4m44s
CI / go (pull_request) Failing after 1m22s
CI / unit-web (pull_request) Successful in 5m14s
CI / storybook (pull_request) Successful in 2m0s
CI / web-build (pull_request) Successful in 2m16s
CI / checks (pull_request) Successful in 2m40s
CI / database (pull_request) Successful in 3m8s
forgegraph/ci CI failed
CI / ci (pull_request) Failing after 54s
CI / database-d1 (pull_request) Successful in 8m13s
52de7d7a06
Adds a separate database-d1 job to ci.yml: pnpm --filter @forgegraph/api
test:d1 (known failures skipped) on the cloudflare executor, plus a
non-blocking step that reports d1-known-failures.txt entries that now pass.
It is not in the ci job's needs and not a protected status context, so it
never gates merges; the Postgres database lane stays required.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
gmackie force-pushed FORGE-89-d1-ci-lane from 52de7d7a06
Some checks failed
CI / gitleaks (pull_request) Successful in 19s
CI / unit-api (pull_request) Successful in 4m44s
CI / go (pull_request) Failing after 1m22s
CI / unit-web (pull_request) Successful in 5m14s
CI / storybook (pull_request) Successful in 2m0s
CI / web-build (pull_request) Successful in 2m16s
CI / checks (pull_request) Successful in 2m40s
CI / database (pull_request) Successful in 3m8s
forgegraph/ci CI failed
CI / ci (pull_request) Failing after 54s
CI / database-d1 (pull_request) Successful in 8m13s
to bb0d6ce220
All checks were successful
CI / gitleaks (pull_request) Successful in 20s
CF executor smoke / smoke (pull_request) Successful in 23s
CI / unit-api (pull_request) Successful in 2m18s
CI / unit-web (pull_request) Successful in 4m7s
CI / database-d1 (pull_request) Successful in 6m56s
CI / storybook (pull_request) Successful in 1m59s
CI / go (pull_request) Successful in 1m12s
CI / checks (pull_request) Successful in 2m51s
CI / database (pull_request) Successful in 3m29s
CI / web-build (pull_request) Successful in 3m58s
forgegraph/ci CI passed
CI / ci (pull_request) Successful in 48s
2026-10-12 06:23:28 +00:00
Compare
Sign in to join this conversation.
No description provided.