Addresses the two CodeRabbit findings on #2147:
- The scratch directory reaches sh -c as $0 and is quoted at the redirect, so a TMPDIR containing a space no longer sends the write to another path.
- A RUN instruction that writes an initializer must be a plain && chain. A || or ; in it fails the check, because the build could then succeed without the write. A new test appends || true and ; true.
🎯 Fix: 93 %
💥 Break: 1 %
💸 Tokens: –
⏱️ Velocity: –
🛡️ Security: 100 %
🏆 Score: 92
🚦 Gate: ✅ 90/5, tokens and velocity <= 100, security 100 %
Created-with: https://s.veen.world/skills
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A swarm gossip flap reset the seeder's postgres connection at structure.sql:454 (run 44198831443, OpenProject#0). psql loads structure.sql statement by statement with each statement committed, so the half-built schema stayed behind while schema_migrations was still missing, and every retry failed on collation "versions_name" already exists until the deploy gave up. The image now writes a Rails initializer, inside the existing precompile step, that sets structure_load_flags to --single-transaction: an interrupted load rolls back completely and the next attempt starts from an empty database. A unit test runs that step and checks the initializer it writes.
Security 63 % with operator approval: DS-0002 (no USER), DL4006 (Dockerfile:16, grape step without pipefail) and DS-0026 (no HEALTHCHECK) are already in main's Dockerfile; this change adds no finding.
🎯 Fix: 85 %
💥 Break: 5 %
💸 Tokens: –
⏱️ Velocity: –
🛡️ Security: 63 %
🏆 Score: 51
🚦 Gate: ⛔ fix 85 % < 90; security 63 % < 100: ask the operator before the commit
Created-with: https://s.veen.world/skills
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`deadline` is whole seconds from `date +%s`. A run that starts just
before a second boundary reaches the deadline after the first probe and
one `sleep 1`, so the gate correctly gives up after one probe while the
test demanded two. With a stubbed clock (1000, 1000, 1002) the gate
probes once and prints `deadline of 2s reached`. The deadline message
already proves the pending migration held the entrypoint back; require
at least one probe.
Reported by CodeRabbit on #979.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Swarm Nextcloud#3 on main 748189e890 (job 117182318941) wedged the
OpenProject schema: the convergence check gave up after 74 attempts
while the seeder kept exiting 1, first with
`relation "ar_internal_metadata" already exists` from its structure
load, then with `relation "announcements" already exists` on every
`db:migrate`.
The seeder (`docker/prod/seeder`) loads `db/structure.sql` through
psql, statement by statement, when `\dt` finds no relation. In swarm,
`depends_on` is ignored, so web and worker start alongside it and poll
`await_migrations.sh`. That gate called
`rails db:abort_if_pending_migrations`, which runs
`migration_context.open`, i.e. `Migrator.new`, whose constructor
executes `schema_migration.create_table` and
`internal_metadata.create_table` (Rails 8.0.4,
activerecord/lib/active_record/migration.rb:1430-1431). The seeder
saw an empty database at 05:33:20; by 05:33:38 the gate had created
`ar_internal_metadata`, the structure load aborted at line 255 with
everything alphabetically before it already committed, and every
later attempt took the migrate path into tables that already existed.
Probe with `rails db:migrate:status` instead. It aborts while
`schema_migrations` is missing and otherwise only reads the recorded
versions (database_tasks.rb:303, migration.rb:1318); the gate treats
any `down` row as pending.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>