Skip to content

fix(infra): start postgres before sbt build in local-dev up/auto#6008

Merged
Yicong-Huang merged 1 commit into
apache:mainfrom
Yicong-Huang:fix/local-dev-jooq-order
Jun 29, 2026
Merged

fix(infra): start postgres before sbt build in local-dev up/auto#6008
Yicong-Huang merged 1 commit into
apache:mainfrom
Yicong-Huang:fix/local-dev-jooq-order

Conversation

@Yicong-Huang

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

bin/local-dev.sh up / auto were running sbt dist before postgres was reachable. common/dao's jooqGenerate sourceGenerator connects to postgres via JDBC at compile time; with no postgres the catch block in common/dao/build.sbt logs Continuing compilation with existing generated files... and returns Seq.empty. Because the generated jOOQ dir is not git-tracked, fresh checkouts have no fallback and the downstream Scala compile fails on missing Tables / Keys / etc.

Path Before After
cmd_up Build → Infra (infra_up + infra_ensure_db_schema) → Services Infra → Build → Services (minio/lakefs/litellm warm up in parallel with the build)
cmd_auto Scan → Build (no postgres precondition) → Bounce Scan → Build (calls new ensure_postgres_for_build) → Bounce

ensure_postgres_for_build is a new helper that starts only the postgres container (if it isn't already running) and applies the schema — minimal blast radius for cmd_auto, which by contract only touches what its scan flagged dirty.

Any related issues, documentation, discussions?

Closes #6007.

How was this PR tested?

  • bash bin/local-dev/tests/test_local_dev_sh.sh — 12/12 pass; added a static regression assertion Add Jinggang's HelloWorld file. #11 that scans cmd_up and cmd_auto and fails if any postgres-ready step (infra_ensure_db_schema / ensure_postgres_for_build) does not precede the first build_all / sbt -no-colors dist invocation. Verified red-then-green: before the source change the new assertion reports schema_at=1935 build_at=1903 for cmd_up and schema_at=0 build_at=2062 for cmd_auto.
  • bash -n bin/local-dev/main.sh — clean.
  • bin/local-dev.sh --help — unchanged usage.

Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Opus 4.7

common/dao's jooqGenerate sourceGenerator connects to postgres at
sbt-compile time. cmd_up ran build_all before infra_up + schema bootstrap,
and cmd_auto ran sbt dist with no postgres at all -- on fresh checkouts
(generated jooq dir is not git-tracked) the compile fails on missing
Tables/Keys/etc.

cmd_up now runs the Infra section before Build; cmd_auto calls a new
ensure_postgres_for_build helper (postgres-only, schema bootstrap) right
before the sbt step. Static regression assertion added to
test_local_dev_sh.sh.

Closes apache#6007
@github-actions

Copy link
Copy Markdown
Contributor

Automated Reviewer Suggestions

Based on the git blame history of the changed files, we recommend the following reviewers:

  • No candidates found from git blame history.

@Yicong-Huang Yicong-Huang requested a review from bobbai00 June 29, 2026 00:33
@bobbai00 bobbai00 added this pull request to the merge queue Jun 29, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 29, 2026
@Yicong-Huang Yicong-Huang added this pull request to the merge queue Jun 29, 2026
Merged via the queue into apache:main with commit 50d5206 Jun 29, 2026
20 checks passed
@Yicong-Huang Yicong-Huang deleted the fix/local-dev-jooq-order branch June 29, 2026 01:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bin/local-dev.sh up / auto: sbt build precedes infra_up, jOOQ codegen fails before postgres is ready

2 participants