Skip to content

v0.2.1

Choose a tag to compare

@alexshapalov alexshapalov released this 11 Sep 02:14
· 10 commits to main since this release

Skill and documentation release. No behaviour change in the CLI itself.

Why this exists

Running a Rails test suite against a branch can destroy the real data the
branch was created to provide. One agent lost a branch's data to
db:schema:load; another came within one command of deleting ~18,500 rows and
stopped only because it checked first. The pgrun-branching skill said nothing
about any of it, so every agent had to rediscover it the hard way.

What the skill now warns about

  • fixtures :all truncates every fixture table before the first test runs.
    Branch roles are superusers, so foreign keys do not even slow it down.
  • maintain_test_schema! purges and reloads the schema when
    schema_migrations looks stale. This is what destroys a branch outright.
    Set config.active_record.maintain_test_schema = false for the run.
  • Parallel testing creates extra databases on the branch instance.
    parallelize(workers: :number_of_processors) makes <db>-0, <db>-1, … and
    loads schema.rb into each. Use PARALLEL_WORKERS=1.

None of that is a pgrun defect. It is Rails behaving normally against a
database that happens to hold real rows. The skill now says so, tells the agent
to surface the trade-off rather than decide alone, and states plainly that an
empty schema_migrations means a faulty branch to replace, never something to
repair by loading the schema.

Also

branch url prints DATABASE_URL=<url>, not a bare URL. The skill now shows
how to capture just the value, and points at pgrun branch exec as the better
path where it fits.

Existing installs: re-run pgrun skill install to pick up the new skill.