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-use lockfile remains present when it should be removed after import
  • database-in-use lockfile is missing when it should exist
  • Both lockfiles may be present simultaneously

Solution

Implement automatic lockfile state repair on startup that:

  1. Removes filesystem-in-use lockfile when it exists but shouldn't (post-import scenarios)
  2. Creates database-in-use lockfile when it's missing but should exist
  3. 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.

Edited by Hayley Swimelar