Skip to content

Fix CLI entry and Legacy DB Upgrade - #1358

Closed
backryun wants to merge 5 commits into
cheaper-inference:mainfrom
backryun:codex/fix-cli-entry-and-legacy-db-upgrade
Closed

backryun wants to merge 5 commits into
cheaper-inference:mainfrom
backryun:codex/fix-cli-entry-and-legacy-db-upgrade

Conversation

@backryun

@backryun backryun commented Apr 17, 2026 •

Copy link
Copy Markdown
Contributor

I found a bug when I installed on windows by npm.
version 3.6.7
But there is a problem about DB, so I fixed that problem.

This pull request introduces a significant improvement to the database migration safety checks by inferring the physical schema version directly from the database, allowing for more robust handling of pending migrations and preventing accidental data loss. Additionally, it updates references and packaging policies to reflect the renaming of the main CLI entry point from bin/omniroute.ts to bin/omniroute.mjs across the codebase and tests.

Database migration safety and testing improvements:

  • Added logic in migrationRunner.ts to infer the physical schema version from existing tables, allowing the migration runner to distinguish between legitimate upgrades and potential data loss scenarios. This includes new sentinel definitions, detection functions, and revised safety checks to allow or abort large pending migration sets based on the detected schema baseline. [1] [2] [3]
  • Expanded unit tests in db-migration-runner.test.ts to verify the new schema inference logic, including scenarios where migrations are allowed or aborted based on the physical schema, and added utility functions for test setup. [1] [2]

CLI entry point and packaging updates:

  • Updated all references to the CLI entry point from bin/omniroute.ts to bin/omniroute.mjs in package.json, artifact policy scripts, and tests to ensure consistency and correct packaging. [1] [2] [3] [4] [5] [6] [7]

Minor code quality improvements:

  • Minor formatting and assertion improvements in test files for clarity and consistency. [1] [2]

These changes collectively enhance the reliability of database migrations, ensure proper CLI packaging, and improve test coverage and clarity.

Node refuses to strip TypeScript from files under node_modules, so the published omniroute CLI could fail before startup on global installs.

Replace the packaged bin entry with omniroute.mjs, add a runtime-support bridge, and update pack-artifact coverage so the published tarball keeps the executable files reviewers should expect.
The mass-migration safety abort was firing on real 001-era databases because startup pre-seeding made them look like an existing DB with too many pending migrations.

Infer the baseline from physical schema sentinels before aborting, keep blocking suspicious tracking-loss cases, and cover both paths with focused migration-runner tests.
@backryun
backryun requested a review from diegosouzapw as a code owner April 17, 2026 01:59
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@backryun backryun changed the title fix cli entry and legacy db upgrade Fix CLI entry and Legacy DB Upgrade Apr 17, 2026
@diegosouzapw

Copy link
Copy Markdown
Collaborator

Thanks for this contribution! 🎉 The CLI runner split and migration engine decoupling have been integrated into the release/v3.6.8 branch and will ship in the next release. Appreciate the effort!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants