feat: Repair lockfile state inconsistencies on startup when enforcement is disabled
Problem
When REGISTRY_FF_ENFORCE_LOCKFILES is disabled (the default), lockfile management is skipped entirely. This leaves migrated instances with incorrect lockfile states after the metadata database migration:
-
filesystem-in-uselockfile remains present when it should be removed after import -
database-in-uselockfile is missing when it should exist - Both lockfiles may be present simultaneously
Solution
Implement automatic lockfile state repair on startup that:
- Removes
filesystem-in-uselockfile when it exists but shouldn't (post-import scenarios) - Creates
database-in-uselockfile when it's missing but should exist - Deletes the extra lockfile when both are present, based on configuration
These repairs only execute when the feature flag is disabled, as that's the only scenario where these inconsistencies can occur. Instances with the flag already enabled either have correct states or have been manually repaired.
Related
Edited by Hayley Swimelar