Agents Builders

Worktree DB name overflow

Archived
worktree-db-name-overflow

Created

Jun 24, 07:40

Started

Jun 25, 04:22

Completed

Jun 25, 05:32

DevOps handoff

Type

Bug

Shape

backend

Worktree Slug

worktree-db-name-overflow

Repositories

mcritchie-studio

Release Train

Branch

feat/worktree-db-name-overflow

QA URL

Production URL

tooling worktree

Acceptance Criteria

  • Long-slug worktree DB names stay under 63 chars
  • db:test:prepare works in long-slug worktrees
  • Worktree DB naming reserves headroom under PG limit

Expected Test Plan

  • [unit] worktree_db_name bounds long slugs <=63, dev/test share base
  • [unit] fitting slug unchanged; truncation hash deterministic+unique
  • [integration] db:test:prepare provisions findable long-slug test DB

Checks Run

  • [unit] worktree_db_name bounds long slug; dev+test <=63 share base
  • [unit] fitting slug unchanged byte-for-byte (no churn)
  • [unit] truncation+hash deterministic and collision-resistant
  • [integration] db:test:prepare provisions findable long-slug test DB (CI-portable: derives PG creds)
  • [ci] test job GREEN run 28146747448 — 1565 runs, 0 failures, 4 skips (https://github.com/amcritchie/mcritchie-studio/actions/runs/28146747448)
  • [proof] regression executed on CI vs red run 28146111302: skips 4->4 unchanged, failures 1->0, +2 assertions reached (was fe_sendauth at connect)

Agent Context

Flagged by steffon during mascot-marker rework: the worktree dev DB name 'mcritchie_studio_development_mascot_marker_no_downgrade_fallback' is exactly at PostgreSQL's 63-char identifier limit and gets truncated inconsistently, so db:check_protected_environments / db:test:prepare can't find it and the full Rails suite + CI break in long-slug worktrees. (DB-less tests dodge it.) bin/agent-worktree's DB-naming scheme should hash/truncate long slugs to reserve headroom under 63 chars (and keep dev/test names consistent).

Stage Timeline

Who handled each stage, the time it took (measured), and the model / tokens / cost reported (best-effort) — plus who's on it right now. means the agent didn't report that metric.

  1. Created Designed
    N Nidoran♀
    Nidoran♀
    Model
    Duration
    Tokens
    Cost
    Completed Jun 24, 07:40 · 3 days ago
    api
  2. Designed Building
    N Nidoran♀
    Nidoran♀
    Model
    claude-opus-4-8
    Duration
    about 20 hours
    Tokens
    Cost
    Started Jun 24, 07:40
    Completed Jun 25, 03:58 · 2 days ago
    cli
  3. Building Submitted
    N Nidoran♀
    Nidoran♀
    Model
    claude-opus-4-8
    Duration
    8 minutes
    Tokens
    Cost
    Started Jun 25, 03:58
    Completed Jun 25, 04:06 · 2 days ago
    cli
  4. Submitted Blocked
    Model
    Duration
    7 minutes
    Tokens
    Cost
    Started Jun 25, 04:06
    Completed Jun 25, 04:13 · 2 days ago
    api
  5. Blocked Building
    N Nidoran♀
    Nidoran♀
    Model
    claude-opus-4-8
    Duration
    9 minutes
    Tokens
    1,729,255
    Cost
    ~$2.29
    Started Jun 25, 04:13
    Completed Jun 25, 04:22 · 2 days ago
    cli
  6. Building Submitted
    N Nidoran♀
    Nidoran♀
    Model
    claude-opus-4-8
    Duration
    6 minutes
    Tokens
    586,443
    Cost
    ~$0.68
    Started Jun 25, 04:22
    Completed Jun 25, 04:28 · 2 days ago
    cli
  7. Submitted Reviewed
    C Carl
    Carl primary
    J Jasper
    Jasper light
    Model
    claude-opus-4-8
    Duration
    2 minutes
    Tokens
    4,393,854
    Cost
    ~$6.51
    Started Jun 25, 04:28
    Completed Jun 25, 04:30 · 2 days ago
    cli
  8. Reviewed Assembled
    S Steffon
    Steffon
    Model
    Duration
    2 minutes
    Tokens
    Cost
    Started Jun 25, 04:30
    Completed Jun 25, 04:32 · 2 days ago
  9. Assembled Shipped
    A Avi
    Avi
    Model
    Duration
    about 1 hour
    Tokens
    Cost
    Started Jun 25, 04:32
    Completed Jun 25, 05:32 · 2 days ago
  10. Shipped Archived
    8
    81fad33e-98b5-4075-8ed6-d0efe6cb5804
    Model
    claude-opus-4-8
    Duration
    about 16 hours
    Tokens
    Cost
    Started Jun 25, 05:32
    Completed Jun 25, 21:16 · 1 day ago
    cli

Conversation

QA review feedback, agent handoffs, and follow-up notes for this task.

QA Feedback 2 days ago

CONDUCTOR CI-GATE BLOCK (both seniors APPROVED the code, but missed CI): the PR's own new [integration] test 'db:test:prepare for a long-slug worktree' FAILS on CI — PG::ConnectionBad / ActiveRecord::ConnectionNotEstablished 'fe_sendauth: no password supplied' connecting to ::1:5432. It passes locally only because dev Postgres uses socket/trust auth; the shelled-out 'bin/rails db:test:prepare' subprocess does NOT inherit CI's PG credentials (host/user/password). Lone failure: 1565 runs, 1 failure. The bounded_db_slug code fix itself is correct + collision-resistant (Carl+Jasper verified, 4 new + 31-file tests green locally) — ONLY the integration test is not CI-portable. FIX: pass the DB connection to the subprocess (export DATABASE_URL, or PGHOST/PGUSER/PGPASSWORD from ENV) before invoking db:test:prepare, OR skip the [integration] test when CI PG creds are absent (keep the [unit] length/collision tests, which are CI-safe). Confirm the 'test' CI job goes GREEN before resubmitting — verify on CI, not local. Also un-draft the PR.

QA Feedback avi 2 days ago

QA verdict: BLOCK (CI red). Core fix in bin/agent-worktree is CORRECT — verified the boundary math: the longest minted identifier (the _development_ name) lands at exactly 63 (never 64) for both mcritchie-studio and the shorter turf-monster prefix (max_len = 63 - prefix.length); fitting slugs pass through byte-for-byte (no churn); long slugs get a deterministic 8-hex SHA256 suffix; distinct long slugs sharing a 25-char prefix do NOT collide; dev/test share an identical base so db:test:prepare resolves. The 3 unit tests PASSED on CI. The block is ONE broken test, not the fix. DEFECT: the new [integration] 'db:test:prepare provisions a findable long-slug test DB' (test/commands/agent_worktree_test.rb ~L531-553) hardcodes credential-less connection strings — DATABASE_URL/TEST_DATABASE_URL = 'postgresql://localhost/<db>' and bare psql/dropdb with psql_env={PATH only}. On CI Postgres requires a password (CI sets DATABASE_URL=***localhost:5432), so the subprocess dies with 'fe_sendauth: no password supplied' BEFORE exercising the fix → 1 failure / 1565 runs (run 28146111302). It passes locally on trust-auth PG, which masked the gap. FIX: derive host/port/user/password from the CI-provided ENV['DATABASE_URL'] (URI.parse, swap only the database-name path segment) for both the db:test:prepare child env AND the trailing psql/dropdb (pass PGHOST/PGPORT/PGUSER/PGPASSWORD or a full conninfo) — or skip when ENV['DATABASE_URL'] is blank, but prefer deriving so the regression actually runs on CI. Re-run until the test job is green. Also update the stale claim — PR body + devops.checks_run say '[suite] ... 31 runs green' / 'CI green', but CI is red; correct that on resubmit. No rebase needed: branch is 0 behind origin/release with a clean merge-tree. PR left as DRAFT.

Sealed-bid sizing

Edit →

Alex (PM)

Avi (PO)

Dev

Actual