mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-31 12:22:14 +03:00
Two independent bugs, not migration 126: 1. tests/unit/db-migration-runner.test.ts and tests/unit/migration-safety-abort-6260.test.ts: withNonTestEnvironment() only sanitized process.argv, not process.execArgv. #7359 made isAutomatedTestProcess() also scan execArgv (to catch `node --test`), so under the node:test runner execArgv always retains `--test` and the "simulate a non-test environment" helper became a no-op. The mass-migration safety-abort check (gated on !isTestEnvironment) never fired, migrations ran for real, and hit the hardcoded version-032 apikey-lifecycle special case against fixtures that never created api_keys — surfacing as "no such table: api_keys" instead of the expected MigrationSafetyAbortError. Fix: also strip test-token args from process.execArgv in the test helper. 2. tests/unit/db-core-init.test.ts: SCHEMA_SQL created idx_pc_auth_active_refresh on provider_connections(refresh_token) unconditionally, before ensureProviderConnectionsColumns() ran its column-healing pass — and that function never healed refresh_token in the first place. A legacy provider_connections table predating that column (simulated by the "max_concurrent column is healed" fixture) fails startup with "no such column: refresh_token" instead of healing. Fix: move the index into ensureProviderConnectionsColumns(), after adding a defensive refresh_token backfill.