Skip to content

Start configurable CI/CD policy and safer database releases - #114

Draft
agreenspan wants to merge 5 commits into
mainfrom
codex/cicd-policy-proposal
Draft

agreenspan wants to merge 5 commits into
mainfrom
codex/cicd-policy-proposal

Conversation

@agreenspan

@agreenspan agreenspan commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Template deployment choices are currently scattered across init and provider settings, and Vercel's main-only configuration still permits unspecified branches. This draft starts a committed delivery policy and fixes the branch allowlist for web, admin and superadmin.

Implemented:

  • Typed, validated cicd.config.ts with automatic main deployment policy, independent PR/draft auto/manual settings, staging on/off, a nonnegative merge-approval count, and optional bot approvals.
  • Interactive init Delivery page and headless --section=cicd settings. Init and shell environment selection use the same effective staging configuration.
  • Pure delivery and approval evaluators, a plan-only CLI, and a GitHub workflow that checks this policy code without deployment secrets.
  • Database release selects schema-push or migrations explicitly, never adds --accept-data-loss, refuses missing/conflicting migration history, and stops on schema/seed failures. No migration baseline or database mutation is performed by this PR.

This is the first implementation slice, not a complete deployment system. Cloud deployment/teardown execution, resource reconciliation, remote approval enforcement and the DevOps dashboard remain pending in docs/CICD-PROPOSAL.md. The planner explicitly reports plan-only output; changing policy does not claim to apply GitHub or cloud settings.

Validation:

  • bun run check:cicd: passes (typecheck, 15 tests, 64 assertions).
  • Actual init:agent --section=cicd command: passes.
  • Repository lint and shell syntax checks: pass (existing lint warnings).
  • Minimatch checks verify main remains enabled while feature, staging and bot branches are denied in all three Vercel configurations.
  • Independent adversarial review found and verified fixes for staging-secret selection and configuration-dependent test fixtures; follow-up review reports no remaining findings in this slice.
  • GitHub CI/CD policy checks: passes on the PR head.
  • Full bun run check: fails at three frontend tests (252 pass, 3 fail): signup verification rendering, logout rendering (React.act is not a function), and live-query subscription. These failures also reproduce running the UI suite separately.
  • Standalone init-wide TypeScript check reports errors in the existing Infisical/encryption import path; the scoped check includes the new init view and passes.

No merge or deployment is requested by this draft. No cloud resources or repository protection settings have been modified.

arongreenspan and others added 3 commits September 21, 2026 13:21
Seeding ran unconditionally on every release, for both strategies. The email
template and component seeds are non-prime and not createOnly, so each
production deploy silently reverted every template edited through the admin UI.
Now gated on database.seedOnRelease, written explicitly as false in
cicd.config.ts rather than left to a schema default — seeding production should
be visible in the config, not inherited.

db:push:force used `[ ... ] && push || echo`, which printed its refusal and
exited 0, so any `db:push:force && <next>` chain continued as though the push
had succeeded. Now an if/else that exits 1. Verified with ENV=prod.

restore.sh sources .env.local, which only sets the keys that file defines, so an
ambient DATABASE_URL wins in a fresh clone or an inherited shell — and
pg_restore --clean DROPs every object in the target. Refuses non-local targets,
and refuses an unset URL rather than falling through.

prisma.config.ts migrate.url() now reads MIGRATE_DATABASE_URL, falling back to
DATABASE_URL, so schema changes can use the owning role while services run as a
role that cannot drop or truncate.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
arongreenspan and others added 2 commits September 24, 2026 02:27
…itch; drop fixed-value policy keys

- database.seedOnRelease defaults to true. The non-prime seeds carry system
  data production needs (3 cron jobs, 2 email components, 3 email templates);
  with seeding off a fresh deploy silently had none. Seed failure still stops
  the release. databaseReleaseCommands takes seeding explicitly.
- database.strategy now decides schema behavior everywhere: setup.sh reads it
  (scripts/cicd/databaseStrategy.ts) instead of project.config launched, and
  scripts/checkLaunched.ts is gone. Launch requires a committed migration
  baseline and sets strategy=migrations before flipping launched, which now
  only records that launch ran. The schema-push/migrations mismatch error names
  the command that fixes it.
- production.deploy, pullRequests.cleanupOnClose and checks were literal-only
  settings nothing read; they are invariants, documented as such.
- zod range matches the rest of the repo (^4.3.6).
- Merged origin/main (NODE_ENV test pin, CI rule fix).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants