Implement database-aware revert optimization to prevent processing undeployed modules #225
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implement database-aware revert optimization to prevent processing undeployed modules
Summary
This PR implements a significant performance optimization for the recursive revert functionality in LaunchQL. Previously, when using
lql revert --recursive, the system would process ALL modules in the workspace regardless of whether they were ever deployed, leading to unnecessary file operations, database queries, and confusing "skipping" messages.The optimization adds database-aware filtering that queries the
launchql_migrate.changestable to determine which modules are actually deployed, then filters the workspace extension list to only include those modules before processing.Key Changes:
getDeployedModules()method to query deployment status fromlaunchql_migrate.changestableresolveWorkspaceExtensionDependencies()async with optional deployment filtering viafilterDeployedparameterrevert()method to use database filtering whenrecursive=truedeploy()andverify()methods to handle async dependency resolutionREVERT.mddocumentationReview & Testing Checklist for Human
lql revert --recursive, verify only deployed modules are processed (no "skipping" messages for undeployed modules)launchql_migrateschema doesn't exist (fresh database) - should gracefully fall back to current behavior without crashingdeployandverifyoperations still work correctly after makingresolveWorkspaceExtensionDependencies()asyncNotes
Potential Risk Areas:
launchql_migrate.changestable structure - could fail if schema changesresolveWorkspaceExtensionDependencies()changed from sync to async - potential breaking change for any external callersLaunchQLMigrateclients created but may not be explicitly closedSession Info:
The implementation leverages existing database infrastructure and follows established patterns in the codebase. Error handling includes graceful fallback when database schema doesn't exist. TypeScript compilation passes and core test structure is preserved.