Skip to content

Make pv link idempotent#55

Merged
munezaclovis merged 5 commits intomainfrom
feat/idempotent-link
Apr 2, 2026
Merged

Make pv link idempotent#55
munezaclovis merged 5 commits intomainfrom
feat/idempotent-link

Conversation

@munezaclovis
Copy link
Copy Markdown
Contributor

Summary

  • pv link now updates an already-linked project in place instead of erroring
  • Preserves service bindings (MySQL, Postgres, Redis, etc.) and databases from the existing entry
  • Re-detects project type and PHP version, re-runs the full automation pipeline
  • Shows "Relinked" in success output when updating an existing project

Changes

  • internal/registry/registry.go — New Update() method that replaces an existing entry by name
  • cmd/link.go — Replace "already linked" error with update-in-place flow
  • Tests updated to verify re-link preserves services and databases

Test plan

  • Registry.Update() unit tests (existing, non-existent, order preservation)
  • TestLink_RelinkPreservesServices verifies end-to-end re-link with service preservation
  • Full test suite passes
  • gofmt and go vet clean

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
@munezaclovis munezaclovis merged commit c10aa18 into main Apr 2, 2026
@munezaclovis munezaclovis deleted the feat/idempotent-link branch April 2, 2026 05:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant