Skip to content

[O2B-1635] Improve start sequence of server to help with big migrations and data integrity - #2278

Merged
graduta merged 6 commits into
mainfrom
improv/O2B-1635/wait-for-migration-to-end-on-startup-server
Oct 22, 2026
Merged

graduta merged 6 commits into
mainfrom
improv/O2B-1635/wait-for-migration-to-end-on-startup-server

Conversation

@graduta

@graduta graduta commented Oct 22, 2026

Copy link
Copy Markdown
Member

I have a JIRA ticket

  • branch and/or PR name(s) include(s) JIRA ID
  • issue has "Fix version" assigned
  • issue "Status" is set to "In review"
  • PR labels are selected

Notable changes for users:

  • N/A

Notable changes for developers:

  • the server will not be started as to not accept any requests to update data until the migrations are done

Changes made to the database:

  • N/A

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new regression suite is not registered in the parallel unit-test entry point used by CI.

1 open issue
What changed in this PR

This PR delays application startup until database preparation and migrations finish, preventing servers and background services from accessing data during migrations.

Changes:

  • Adds a start() method that awaits database preparation before running the application.
  • Updates the entry point to use start() and exit if database preparation fails.
  • Adds regression tests for delayed startup and database preparation failure.
File Description
test/​lib/​application.test.js Adds tests for migration-gated startup.
test/​index.js Registers the application startup suite.
lib/​main.js Uses ordered startup and exits on preparation failure.
lib/​application.js Adds the database-first startup method.

Review effort: Balanced

Comment thread test/lib/application.test.js
@codecov

codecov Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 46.46%. Comparing base (2249a99) to head (d441e5b).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2278      +/-   ##
==========================================
+ Coverage   46.45%   46.46%   +0.01%     
==========================================
  Files        1054     1054              
  Lines       17379    17384       +5     
  Branches     3165     3166       +1     
==========================================
+ Hits         8073     8078       +5     
  Misses       9306     9306              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

graduta and others added 5 commits October 22, 2026 14:21
…rver' of github.com:AliceO2Group/Bookkeeping into improv/O2B-1635/wait-for-migration-to-end-on-startup-server
… for migrations

Add useApplication test helper calling application.start() (migrations before anything else)
and use it in every test script instead of run() followed by connectDatabase().

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@graduta
graduta merged commit f47ca31 into main Oct 22, 2026
25 of 26 checks passed
@graduta
graduta deleted the improv/O2B-1635/wait-for-migration-to-end-on-startup-server branch October 22, 2026 13:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants