feat: Add DB migration validation workflow for nightly builds
Description
Implements automated database migration validation workflow for Langflow nightly builds.
This addresses the critical blocker identified by the QA team for ensuring safe database migrations when upgrading from stable to nightly versions in production deployments.
Changes
New Workflow: db-migration-validation.yml
Comprehensive automated testing for database migrations with two independent scenarios:
Scenario 1: pip/venv Migration
- Installs latest stable
langflow[postgresql]via uv pip - Initializes PostgreSQL database with stable version
- Creates witness test data (flows and credentials)
- Upgrades to
langflow-nightly[postgresql]in same environment - Validates successful startup and data persistence
Scenario 2: Docker Compose Migration
- Starts
langflowai/langflow:latestwith PostgreSQL - Creates witness test data via API
- Stops Langflow container (keeps PostgreSQL volume)
- Swaps to
langflowai/langflow-nightly:latestusing same volume - Validates successful startup and data persistence
Integration with Nightly Build
Modified .github/workflows/nightly_build.yml:
- Added
db-migration-validationjob that runs after successful Docker build - Updated Slack notifications to include migration test results
- Automatic execution on every nightly build
Documentation
Added comprehensive guide at docs/docs/Deployment/db-migration-validation.md:
- Implementation details and test scenarios
- Environment configuration and success criteria
- Monitoring and troubleshooting guidelines
- Next steps and maintenance procedures
Key Features
- ✅ Validates data persistence across migrations (witness flows)
- ✅ Tests both pip/venv and Docker deployment methods
- ✅ Comprehensive error logging and artifact collection
- ✅ Slack notifications with detailed results
- ✅ Runs daily at 3:00 AM UTC (after nightly builds)
- ✅ Manual trigger capability for testing
Testing
Both migration scenarios must pass for the workflow to succeed:
- Langflow starts successfully after migration
- Health check endpoint responds (200 OK)
- Witness flows are retrievable via API
- No database errors in logs
On failure, the workflow:
- Captures all relevant logs (Langflow, Docker, PostgreSQL)
- Saves API responses and flow data
- Uploads artifacts to GitHub Actions (7-day retention)
- Sends detailed Slack notification with failure reason
Files Changed
.github/workflows/db-migration-validation.yml(new, 449 lines).github/workflows/nightly_build.yml(modified, +8 lines)docs/docs/Deployment/db-migration-validation.md(new, 164 lines)
Checklist
- [x] Workflow implements both required migration scenarios
- [x] Data persistence validation included
- [x] Integrated into nightly build pipeline
- [x] Comprehensive error handling and logging
- [x] Slack notifications configured
- [x] Documentation added
- [ ] Manual test execution (to be done after PR approval)
Next Steps
- Review and approve PR
- Merge to
release-1.10.0 - Manual trigger to validate workflow execution
- Monitor first automatic run in production
- Address any issues discovered during initial runs
Summary by CodeRabbit
Release Notes
-
Improvements
- Implemented automated validation of database migrations to ensure data integrity during upgrades between stable and nightly releases, covering both pip-based and Docker-based deployment methods.
-
Documentation
- Added documentation for the database migration validation workflow and its integration into the nightly release process.
✅ Test Coverage Advisor
No source changes detected without accompanying tests. Thanks for keeping coverage up! 🎉
Advisory check only — never blocks merge.
Build successful! :white_check_mark: Deploying docs draft. Deploy successful! View draft
[!IMPORTANT]
Review skipped
Auto incremental reviews are disabled on this repository.
Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID:
8f7418ef-4930-4815-ac00-35696822a5bbYou can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
- [ ] 🔍 Trigger review
Walkthrough
Adds a new GitHub Actions workflow that validates database migrations when upgrading Langflow from stable to nightly versions. The workflow tests migration persistence via two execution paths (pip/venv and Docker Compose), creates and recovers witness test data across the upgrade, and reports results to Slack. Integration into nightly build and comprehensive documentation are included.
Changes
Database Migration Validation Workflow
| Layer / File(s) | Summary |
|---|---|
DB Migration Validation Workflow Core .github/workflows/db-migration-validation.yml |
Defines workflow triggers (workflow_call, workflow_dispatch, cron schedule) and global config. Implements migration-pip-venv job using a Postgres service: provisions venv with stable package, initializes DB, creates witness flow via API, upgrades to nightly, runs migrations, verifies witness persistence, and uploads logs/artifacts on failure. Implements migration-docker-compose job: generates Compose file for stable, creates witness data, replaces image tag to nightly, verifies persistence across upgrade, and cleans up resources. Adds notify-results job that aggregates both migration job results and sends Slack message with status and nightly tag. |
Nightly Build Workflow Integration .github/workflows/nightly_build.yml |
Adds db-migration-validation job that calls the validation workflow after nightly release succeeds, passing the nightly Docker tag and secrets. Updates slack-notification job to depend on migration validation results and extends the failure-notification condition to trigger when db-migration-validation fails, setting FAILED_JOB accordingly. |
Documentation and Implementation Guide docs/docs/Deployment/db-migration-validation.md |
Documents the new workflow's purpose, two parallel migration test scenarios (pip/venv and Docker Compose), integration into nightly CI (daily cron, manual trigger, post-release), key behaviors (data persistence, logging, Slack alerts), required secrets/environment variables, success criteria (startup, health checks, witness-flow recovery, no DB errors), failure handling (log/artifact uploads), manual execution instructions, and monitoring/branch context. |
Sequence Diagram(s)
sequenceDiagram
participant Witness as Test Harness
participant Stable as Stable Langflow
participant Nightly as Nightly Langflow
participant DB as PostgreSQL
participant API as Migration API
participant Slack as Slack Webhook
Witness->>Stable: Start with stable version
Stable->>DB: Initialize database
Witness->>API: Create witness flow (test data)
DB->>DB: Witness flow persisted
Witness->>Nightly: Upgrade to nightly version
Nightly->>DB: Execute pending migrations
Witness->>API: Verify witness flow exists
API->>DB: Query restored data
Witness->>Slack: Report success/failure + status
Estimated code review effort
🎯 3 (Moderate) | ⏱️ ~25 minutes
[!IMPORTANT]
Pre-merge checks failed
Please resolve all errors before merging. Addressing warnings is optional.
❌ Failed checks (1 error, 1 warning)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Test Coverage For New Implementations | ❌ Error | PR adds new GitHub Actions workflow and modifies nightly_build.yml but includes NO unit/integration test files (test_*.py) following project conventions. | Add unit/integration tests (test_*.py files) under src/backend/tests/ for the migration validation functionality added in this PR. |
| Test Quality And Coverage | ⚠️ Warning | PR adds 454-line GitHub Actions workflow with two migration test scenarios but no dedicated pytest/integration tests. Migration validation uses inline shell/curl scripts not formally tested. | Add pytest-based tests or integration test scripts verifying migration workflow logic, or document why GitHub Actions workflow testing is the primary test strategy for this CI/CD code. |
✅ Passed checks (7 passed)
| Check name | Status | Explanation |
|---|---|---|
| Docstring Coverage | ✅ Passed | No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. |
| Linked Issues check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
| Test File Naming And Structure | ✅ Passed | PR adds only GitHub Actions workflows and documentation, not test files; check is not applicable to this PR. |
| Excessive Mock Usage Warning | ✅ Passed | PR adds integration workflows using real PostgreSQL and Docker services, not test files with mocks. The custom check for mock usage is not applicable. |
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check | ✅ Passed | The title accurately describes the main change: adding a new GitHub Actions workflow for validating database migrations in nightly builds, which is the primary objective of this pull request. |
✨ Finishing Touches
🧪 Generate unit tests (beta)
- [ ] Create PR with unit tests
- [ ] Commit unit tests in branch
LE-1259-db-migration-validation
[!WARNING]
Review ran into problems
🔥 Problems
Git: Failed to clone repository. Please run the
@coderabbitai full reviewcommand to re-trigger a full review. If the issue persists, setpath_filtersto include or exclude specific files.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands and usage tips.
Build successful! :white_check_mark: Deploying docs draft. Deploy successful! View draft
@ogabrielluiz - I've addressed all your review feedback:
Workflow fixes (9 issues):
- ✅ Now uses actual nightly tag from
create-nightly-tagoutput instead of hardcoded:latest - ✅ Wired
POSTGRES_VERSIONenv var into postgres service image - ✅ Removed unnecessary checkout steps from both migration jobs
- ✅ Fixed step name from "Create witness flow and credentials" to "Create witness flow"
- ✅ Added
-fflag to curl commands for fail-fast behavior - ✅ Added flow creation verification with error handling
- ✅ Fixed version extraction logic to test actual nightly build
- ✅ Removed deprecated
versionfield from docker-compose files - ✅ Removed duplicate Slack notification job
Documentation fix:
- ✅ Removed
docs/docs/Deployment/db-migration-validation.md- you're right, it was implementation notes not user-facing docs
All changes pushed in commits 9228d833ea and c262a67043.
Ready for re-review! 🚀
Codecov Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 56.17%. Comparing base (e9514f5) to head (f37d365).
:warning: Report is 4 commits behind head on release-1.10.0.
Additional details and impacted files
@@ Coverage Diff @@
## release-1.10.0 #13249 +/- ##
==================================================
- Coverage 56.45% 56.17% -0.28%
==================================================
Files 2208 2212 +4
Lines 209281 210206 +925
Branches 29701 32602 +2901
==================================================
- Hits 118158 118093 -65
- Misses 89762 90752 +990
Partials 1361 1361
| Flag | Coverage Δ | |
|---|---|---|
| backend | 61.59% <ø> (+0.06%) |
:arrow_up: |
| frontend | 55.82% <ø> (-0.44%) |
:arrow_down: |
| lfx | 52.20% <ø> (-0.01%) |
:arrow_down: |
Flags with carried forward coverage won't be shown. Click here to find out more. see 247 files with indirect coverage changes
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
- :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.