dx(platform): bake synthetic preview seed fixture as rolling release#13575
dx(platform): bake synthetic preview seed fixture as rolling release#13575ntindle wants to merge 2 commits into
Conversation
Add a GitHub Actions workflow that generates a fully synthetic preview-DB seed fixture against a throwaway pgvector Postgres container and publishes it as a rolling release asset (tag: preview-seed-fixture) with a manifest. The workflow holds no cloud credentials and has no read path to any real database: data is Faker-synthetic plus the already-public marketplace agent exports checked into autogpt_platform/backend/agents/. Runs prisma migrate deploy, then the four seeders (test_data_creator required; load-store-agents, e2e_test_data GoTrue-less fallback, and test_data_updater best-effort with loud warnings), then pg_dumps the platform schema (incl. _prisma_migrations) as a gzipped custom-format archive alongside a manifest.json. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Wj2E4V37tKjiGsXafYKDuk
WalkthroughThe new workflow builds a synthetic Platform preview database, seeds and validates it, creates reproducible fixture artifacts, and publishes them to a rolling GitHub release. ChangesPreview seed fixture bake
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant GitHubActions
participant PostgresService
participant SeedScripts
participant GitHubRelease
GitHubActions->>PostgresService: Apply Prisma migrations
GitHubActions->>SeedScripts: Run seed scripts
SeedScripts->>PostgresService: Insert preview data
GitHubActions->>PostgresService: Validate users and export dump
GitHubActions->>GitHubRelease: Upload dump and manifest
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit c7f6de4. Configure here.
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (3)
.github/workflows/platform-preview-seed-fixture.yml (3)
15-21: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueTrigger paths omit agent-export and dependency changes.
The push filter covers
migrations/**andtest/**but notautogpt_platform/backend/agents/**(referenced by theload-store-agentsseeder/dump comments) orpyproject.toml/poetry.lock. Changes there won't rebake the fixture until the weekly cron fires, so the published fixture can lag behind marketplace-export or dependency updates for up to a week.Suggested path additions
paths: - "autogpt_platform/backend/migrations/**" - "autogpt_platform/backend/test/**" + - "autogpt_platform/backend/agents/**" + - "autogpt_platform/backend/pyproject.toml" + - "autogpt_platform/backend/poetry.lock" - ".github/workflows/platform-preview-seed-fixture.yml"🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.github/workflows/platform-preview-seed-fixture.yml around lines 15 - 21, Update the push path filters in the workflow trigger to include autogpt_platform/backend/agents/** and the repository dependency manifests pyproject.toml and poetry.lock, while preserving the existing migration, test, and workflow paths.
53-54: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valuePin the Postgres service image to a specific tag/digest.
pgvector/pgvector:pg15is a floating tag; an upstream update could silently change the pgvector/pg_trgm build baked into every future run, undermining the reproducibility goal of a "baked" fixture (manifest tiesbaked_at/dev_sha/migration_headto a commit, but not to the exact Postgres image).🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.github/workflows/platform-preview-seed-fixture.yml around lines 53 - 54, Update the postgres service image configuration to use an immutable, specific image tag or digest instead of the floating pgvector/pgvector:pg15 tag. Preserve the PostgreSQL 15 and required pgvector/pg_trgm extensions while ensuring future workflow runs resolve the exact same image.
123-142: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueRepeated best-effort-seeder boilerplate.
The
|| { echo "::warning..."; exit 0; }pattern is duplicated across the three best-effort seeder steps. Since this is static YAML with only three repeats and the explicit warning message is intentional, this is optional — but a step-levelcontinue-on-error: trueplus a single follow-up "report failures" step would avoid the copy-pasted block if you want less duplication.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.github/workflows/platform-preview-seed-fixture.yml around lines 123 - 142, The three seeder steps—“Seed: load-store-agents,” “Seed: e2e_test_data,” and “Seed: test_data_updater”—duplicate best-effort failure handling. If reducing duplication, replace each inline `|| { ... }` block with step-level `continue-on-error: true`, then add one follow-up step that reports which seeders failed while preserving workflow continuation and warning behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/platform-preview-seed-fixture.yml:
- Around line 86-87: Update the actions/checkout step in the platform preview
seed fixture workflow to set persist-credentials to false. Keep the existing
checkout behavior and explicitly supplied GH_TOKEN for the release step
unchanged.
---
Nitpick comments:
In @.github/workflows/platform-preview-seed-fixture.yml:
- Around line 15-21: Update the push path filters in the workflow trigger to
include autogpt_platform/backend/agents/** and the repository dependency
manifests pyproject.toml and poetry.lock, while preserving the existing
migration, test, and workflow paths.
- Around line 53-54: Update the postgres service image configuration to use an
immutable, specific image tag or digest instead of the floating
pgvector/pgvector:pg15 tag. Preserve the PostgreSQL 15 and required
pgvector/pg_trgm extensions while ensuring future workflow runs resolve the
exact same image.
- Around line 123-142: The three seeder steps—“Seed: load-store-agents,” “Seed:
e2e_test_data,” and “Seed: test_data_updater”—duplicate best-effort failure
handling. If reducing duplication, replace each inline `|| { ... }` block with
step-level `continue-on-error: true`, then add one follow-up step that reports
which seeders failed while preserving workflow continuation and warning
behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 4db50c9f-b8d1-48eb-9a61-3e39caa11e00
📒 Files selected for processing (1)
.github/workflows/platform-preview-seed-fixture.yml
📜 Review details
⏰ Context from checks skipped due to timeout. (3)
- GitHub Check: Check PR Status
- GitHub Check: Analyze (python)
- GitHub Check: Analyze (typescript)
🧰 Additional context used
🪛 Betterleaks (1.6.1)
.github/workflows/platform-preview-seed-fixture.yml
[high] 83-83: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
🪛 Checkov (3.3.8)
.github/workflows/platform-preview-seed-fixture.yml
[medium] 72-73: Basic Auth Credentials
(CKV_SECRET_4)
🪛 zizmor (1.26.1)
.github/workflows/platform-preview-seed-fixture.yml
[warning] 86-87: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false
(artipacked)
🔇 Additional comments (1)
.github/workflows/platform-preview-seed-fixture.yml (1)
89-121: LGTM!Also applies to: 150-160, 182-204, 207-228
…ling tag Review findings on #13575: (1) schedule/dispatch runs execute from the default branch (master) — checkout now pins ref: dev and DEV_SHA comes from git rev-parse of the checkout, not GITHUB_SHA, so the fixture can never silently bake master's schema; (2) persist-credentials: false — only the release step needs a token, via env; (3) the rolling release tag is retargeted at the baked dev commit on every update so release metadata matches the published assets. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Wj2E4V37tKjiGsXafYKDuk

Why / What / How
Why. Preview environments today boot with an empty database, so a PR's own migrations run against zero rows. That hides the failures that actually bite in production:
NOT NULLcolumns added without a default, newUNIQUEconstraints that collide on real data, and backfill/UPDATEmigrations that only misbehave when there are rows to touch. We want previews to restore a populated database before the PR's migrations run, so those migrations are exercised against realistic data and fail in the preview instead of in prod. Batch/rollup previews (many approved PRs deployed together) benefit the most, since they stack multiple untested migrations onto one database.This PR builds the bake half: a workflow that produces the fixture. The restore half (wiring previews to download and load it) is a follow-up infra-repo PR.
What. A new workflow
.github/workflows/platform-preview-seed-fixture.ymlthat:devtouchingbackend/migrations/**,backend/test/**, or the workflow file; a weeklyschedulebackstop; andworkflow_dispatch. Aconcurrencygroup coalesces overlapping bakes.pgvector/pgvector:pg15service container (matches the platform's real Postgres major version —supabase/postgres:15.8.x— and provides thevectorextension the docs-embedding migrations need plus thepg_trgmcontrib module).prisma generate+prisma migrate deployagainst the container using?schema=platform.pg_dumps theplatformschema (custom format, gzipped) and writes amanifest.json, and publishes both as assets on a rolling release taggedpreview-seed-fixture.How.
test_data_creator.py(required — a failure fails the bake), thenload-store-agents,e2e_test_data.py, andtest_data_updater.py(best-effort — each failure emits a loud::warning::but does not abort the bake, per "tolerate soft-failures but require test_data_creator").e2e_test_data.pybuilds a Supabase client unconditionally (supabase-pyraises on an empty URL), so a truly empty Supabase config aborts it before its per-user fallback can run. It does have a documented fallback to raw synthetic UUIDs when the GoTrue admin call fails. The minimal adaptation is to pointSUPABASE_URL/SUPABASE_SERVICE_ROLE_KEYat a dead localhost port: the client constructs, theauth.admin.create_usercall fails, and every user falls back to a raw UUID. Verified locally: 15/15 users hit the fallback path.pg_dump --format=custom -Z0 --schema=platform | gzip— theplatformschema only, schema and data, includingplatform._prisma_migrationsso the restore side only replays a PR's delta migrations.-Z0disables pg_dump's internal compression so the outergzipis the single compressor (restore =gunzip -c fixture.dump.gz | pg_restore).pg_dump/psqlrun inside the service container viadocker execso the client version always matches the server (the runner's bundled client can lag the server major and refuse the dump — confirmed: the local host client is pg14 and aborts against a pg15 server).manifest.json = { baked_at, dev_sha, migration_head }, wherebaked_atcomes fromgit logof the checked-out commit (not wall-clock) andmigration_headis the last applied migration name read from_prisma_migrations.preview-seed-fixturerelease (gh release create/edit+upload --clobber);GITHUB_TOKENwithcontents: writesuffices on this public repo. Release notes are one paragraph including the security invariant.🔒 Security invariant
This workflow holds NO cloud credentials and has NO read path to any real database. It runs entirely against a disposable Postgres service container. The fixture contains only Faker-generated synthetic rows plus the already-public marketplace agent exports already checked into
autogpt_platform/backend/agents/. The Supabase env it sets is a dummy, unreachablehttp://localhost:54321with a non-secret placeholder key — it cannot reach any real auth backend. No production data is ever touched, read, or dumped.How the restore side consumes it (follow-up infra PR)
A preview's DB provisioning will: (1) ensure the
vectorextension exists (create theextensionsschema +CREATE EXTENSION vector, since the fixture isplatform-only), (2)gunzip -c fixture.dump.gz | pg_restoreinto a fresh DB, (3) then run the PR'sprisma migrate deploy— which, because the restored_prisma_migrationsalready records the baked migrations, applies only the PR's new migrations against the populated tables.Changes 🏗️
.github/workflows/platform-preview-seed-fixture.yml(bake + publish workflow). No application code,.env.default, ordocker-compose.ymlchanges.Checklist 📋
For configuration changes:
.env.defaultis updated or already compatible with my changes (no change needed — the workflow sets its own throwaway env)docker-compose.ymlis updated or already compatible with my changes (no change — uses a GHA service container)Test plan
actionlint(with embedded shellcheck) passes on the workflow.pgvector/pgvector:pg15container:prisma migrate deployapplied all migrations;test_data_creatorsucceeded (116 users);load-store-agentsloaded 17 agents;e2e_test_datacompleted with the GoTrue-less raw-UUID fallback firing for all 15 users;test_data_updaterapplied its mutations (it then errors in a pre-existing report-onlyKeyError('agentGraphId'), which is tolerated as a soft failure — pre-existing ondev, unrelated to this workflow).pg_dumpproduced a valid custom-format archive (67TABLE DATA+ 6 materialized views,_prisma_migrationsincluded), ~4.9 MB gzipped;manifest.jsonpopulated withbaked_at/dev_sha/migration_head.devpublishes/updates thepreview-seed-fixturerelease (verified post-merge).🤖 Generated with Claude Code
https://claude.ai/code/session_01Wj2E4V37tKjiGsXafYKDuk
Note
Low Risk
CI-only change with no app code or production DB access; main risk is publishing a bad or empty fixture, which the workflow guards with user-count and migration-head checks.
Overview
Adds
.github/workflows/platform-preview-seed-fixture.yml, which bakes a fully synthetic populatedplatformPostgres fixture for preview DBs (restore wiring is a follow-up). It runs on eligibledevpushes, a weekly schedule, andworkflow_dispatch, with concurrency so overlapping bakes cancel.The job uses a throwaway
pgvector/pgvector:pg15service,prisma migrate deploy, then seeders (test_data_creatorrequired;load-store-agents,e2e_test_data,test_data_updatersoft-fail with warnings).e2e_test_datais driven via unreachable localhost Supabase env so GoTrue failures use the existing raw-UUID fallback—no cloud DB or real credentials.It
pg_dumps theplatformschema (custom format, gzipped, including_prisma_migrations), writesmanifest.json(baked_at,dev_sha,migration_head), and publishesfixture.dump.gz+ manifest to the rollingpreview-seed-fixtureGitHub release. Checkout is pinned todevso scheduled runs don’t bake the default branch schema.Reviewed by Cursor Bugbot for commit 0646c6c. Bugbot is set up for automated code reviews on this repo. Configure here.