Skip to content

Tower: extract runGlobalMigrations(db) so migration tests drive the real production runner #1476

Description

@mohidmakhdoomi

What

The global.db migration tests exercise a faithful replica of the production migration block, not the real runner. The production migrations live inside the private ensureGlobalDatabase path, so tests can't drive them directly — they re-declare the same statements and assert on the replica, with source guards pinning the exact production SQL so the two can't silently diverge.

Extract the migration block into a standalone runGlobalMigrations(db) that both ensureGlobalDatabase and the tests call, so migration tests drive the real production runner instead of a copy.

Why

A replica test proves "this SQL does what we think", not "the SQL that actually ships does what we think" — the two are kept in sync by hand + a source guard, which is a maintenance tax and a latent drift risk every time a migration is added (v15 → v16 → v17 already, and growing). A single extracted runner collapses that to one source of truth the tests can call directly.

Notes

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area/towerArea: Tower server / agent farm CLI

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions