Make pv link idempotent#55
Merged
munezaclovis merged 5 commits intomainfrom Apr 2, 2026
Merged
Conversation
Make pv link update existing projects in place instead of erroring, preserving service bindings and databases.
2 tasks: Registry.Update() method, then link command update path.
Replaces an existing project entry by name, preserving array order. Returns error if project not found.
Re-linking preserves service bindings and databases, re-detects project type and PHP version, and re-runs the full automation pipeline. Shows 'Relinked' in success output.
…tests - Surface caddy/cert removal errors instead of silently discarding them - Replace Registry.Update() with UpdateWith() mutator to preserve untouched fields (Services, Databases) by default - Add TestLink_RelinkUpdatesPath for re-link with different path - Add project count assertion to TestLink_RelinkPreservesServices - Add TestUpdateWith_PreservesUntouchedFields
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
pv linknow updates an already-linked project in place instead of erroringChanges
internal/registry/registry.go— NewUpdate()method that replaces an existing entry by namecmd/link.go— Replace "already linked" error with update-in-place flowTest plan
Registry.Update()unit tests (existing, non-existent, order preservation)TestLink_RelinkPreservesServicesverifies end-to-end re-link with service preservationgofmtandgo vetclean