Fix three gaps in the dev base on a stable branch

Three fixes for the dev base on a stable branch, one commit each.

Closes #17 (closed)

  • Gitaly's go.mod is read at the tag a stable branch pins. up --base dev --gitlab-version <N>-stable-ee stopped at its Gitaly step. On a stable branch GITALY_SERVER_VERSION holds a release such as 19.3.3, where the default branch holds a commit SHA. Gitaly tags that release v19.3.3, so the files API answered 404 for go.mod at the bare value. dev-gitaly-go.sh now applies the rule TestEnv checks Gitaly out by, Gitlab::TaskHelpers#get_version: a v before a bare release or release candidate, any other value unchanged.
  • PostgreSQL runs at the major the cloned ref's CI pins. The bootstrap installed the operating system's default server, PostgreSQL 18, while the build image's pg_dump is built for the ref's PG_VERSION, 17 on 19-3-stable-ee and 19-4-stable-ee. pg_dump refuses a newer server, so db:migrate migrated and then aborted in its schema dump. A PostgreSQL 18 dump also names NOT NULL constraints that the committed structure.sql does not, so it never matched the file. The bootstrap now reads PG_VERSION with the resolver it already uses for DEFAULT_CI_IMAGE (dev-ci-image.sh --var PG_VERSION) and installs the operating system's postgresql<major>-server and -contrib. When the ref gives no major or the operating system packages none, it keeps the default and says FALLBACK. It warns when the image's pg_dump is older than the server, and just drift-check asserts the variable resolves.
  • Development has databases of its own. config/database.yml made development an alias of test (development: *test), so a RAILS_ENV=development db:migrate stamped the test databases environment=development. Rails refuses to purge a database last used by another environment, so the next spec run's maintain_test_schema! could not reload structure.sql, and the specs ran on whatever schema the migrate left. Development now has gitlabhq_development, gitlabhq_development_ci, gitlabhq_development_sec and gitlabhq_geo_development, loaded by the unnamed db:create db:schema:load with SKIP_TEST_DATABASE=true, which covers Geo and leaves test alone. The named db:schema:load:geo would purge test's Geo database in any environment, so the bootstrap does not call it. config/database.yml carries no YAML alias, since scripts/db_tasks does not parse one.

How a spec run reloads the test databases

sequenceDiagram
    participant M as RAILS_ENV=development db:migrate
    participant D as gitlabhq_development
    participant S as db/structure.sql
    participant R as rspec: maintain_test_schema!
    participant T as gitlabhq_test
    M->>D: migrate, record environment=development
    M->>S: dump the new schema
    R->>S: read, changed since test's last load
    R->>T: purge, then load db/structure.sql
    Note over D,T: before: development was test under another name<br/>so the migrate stamped gitlabhq_test environment=development<br/>and Rails refused the purge

What the simulation showed

A dev base built from this branch on 19-3-stable-ee, moved to 19-4-stable-ee for the last check, and torn down afterwards.

The checks, each with its control
check result control
up --base dev --gitlab-version 19-3-stable-ee finished in about 13 minutes with no manual step: Gitaly at v19.3.3 needs Go 1.25.0, then postgresql: server 17.11, the image's pg_dump 17.11, PG_VERSION 17, and no FALLBACK before: up stopped at the Gitaly step, the files API answering 404 for ref=19.3.3
RAILS_ENV=development rake db:migrate, then db:schema:dump both exit 0, db/structure.sql is rewritten, git diff --exit-code db/structure.sql exits 0, and git status is empty before, on PostgreSQL 18.6: the migrate's dump aborted with server version mismatch, and a pg_dump 18 dump differed from the committed file on about 2,570 CONSTRAINT <name> NOT NULL lines
a scratch development migration adding a column, then rm -rf tmp/run/gitaly-*; bundle exec rspec spec/models/appearance_spec.rb after the migrate, the column is in gitlabhq_development only and test still reads environment=test. The spec run reloads test from the dumped structure.sql, test gains the column, and the file gives 65 examples, 0 failures, 4 pending before: the migrate stamped the shared databases development, and the reload was refused
the clone moved to 19-4-stable-ee at c048f25e, then package_ingestion_task_spec.rb Gitaly at v19.4.1 needs Go 1.25.10, then 6 examples, 0 failures, and :74 alone twice more, 1 example, 0 failures each on PostgreSQL 18.6 the same commit failed :74. Its pluck has no ORDER BY, and the rows came back in another order. No major promises that order, 17 included

just ci passes. Its offline self-test covers:

  • the v rule for a release, a release candidate and a SHA
  • --var on a fixture tree and through the files API
  • the PostgreSQL install and its fallback
  • a database file with two environments, no shared database, no alias, and the unnamed load

Reverting the v rule, the --var read or the split database file each turns its section red.

Claude Code wrote this change, its tests and this description, and ran the checks above in a simulated environment. Each commit carries the AI-Assisted: yes and AI-Tools: Claude Code trailers that CONTRIBUTING.md asks for.

Merge request reports

Loading
Loading