fix(compose): make full stack boot — quote reserved "window" column + ship pydantic[email]#227
Merged
Merged
Conversation
Migration 041 declared a column named `window`, which is a reserved keyword in Postgres. The unquoted identifier caused a syntax error during `docker-entrypoint-initdb.d` execution, so the postgres container exited with code 3 and took the whole Compose stack down (the chronic "Compose Smoke" CI failure). Quote `"window"` everywhere it is used as an identifier: - migrations/041_attack_chains.sql: column def, CHECK, UNIQUE - endpoints/attack_chain.py: INSERT column list + ON CONFLICT target The `:window` bind parameter is unaffected. Verified by running the full migration set against postgres:16-alpine: init completes with no errors and the table, constraints, and RLS policy are created. Co-authored-by: Cursor <cursoragent@cursor.com>
The API imports `EmailStr` in the auth, passkeys, and tenants endpoints. `EmailStr` requires the optional `email-validator` package, which pydantic only pulls in through its `email` extra. Because `pyproject.toml` declared plain `pydantic`, neither the Poetry install nor the Dockerfile pip fallback shipped `email-validator`, so the container crashed on import with "email-validator is not installed" — taking down the whole Compose stack. Declare the extra in both install paths so the API boots. Co-authored-by: Cursor <cursoragent@cursor.com>
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
docker compose up — full stack(Compose Smoke) CI job had been chronically red, meaning the product could not actually boot end-to-end. Root-caused and fixed two independent, product-breaking bugs. The full-stack smoke job now passes (first green in a long time).Bug 1 — Postgres init crash (
aisoc-postgres exited (3))services/api/migrations/041_attack_chains.sqlusedwindow(a reserved keyword in Postgres) as an unquoted column name. Postgres refused to run the migration on container init:Because migrations are mounted into
/docker-entrypoint-initdb.d, this killed the DB container on startup and took the whole stack down.Fix: quote the identifier as
"window"everywhere it is used:CHECKconstraint, andUNIQUEconstraint in the migrationINSERT ... ON CONFLICTinservices/api/app/api/v1/endpoints/attack_chain.pyBug 2 — API container crash on import (
email-validator is not installed)app/api/v1/endpoints/auth.pyuses Pydantic'sEmailStr, which requires the optionalemail-validatorpackage.pydanticwas declared without the[email]extra, so neither the Poetry install nor the Dockerfile pip-fallback shipped it. Theaisoc-apicontainer crashed on import.Fix:
services/api/pyproject.toml:pydantic = { version = ">=2.7,<2.14", extras = ["email"] }services/api/Dockerfile: pip fallback now installspydantic[email]>=2.7,<2.14Test plan
docker compose up — full stackCI job passes (5m34s) — previously failingemail_validatorimportable afterpyproject.tomlchange041_attack_chains.sqlwithout syntax error