feat: implement soft-delete of extensions#1866
Open
gnugomez wants to merge 6 commits into
Open
Conversation
0cc6c78 to
699014a
Compare
Adds an explicit lifecycle state to ExtensionVersion (ACTIVE/INACTIVE/DELETED) alongside a lastUpdated timestamp. Backing migration V1_69 backfills the new columns from the existing active flag and current timestamp. State and lastUpdated form the foundation for soft-deleting extension versions.
Reads isActive() from state == ACTIVE and routes setActive() through setState(), keeping the persisted active column in sync as a mirror. This makes State the single source of truth so soft-delete (State.DELETED) can participate in the same get/set contract without breaking active-based queries.
Extracts baseExtensionVersionQuery() so all extension-version selects (full, latest-by-platform, and the remaining standalone selects) project the new state/active/lastUpdated columns, and centralizes mapping in toExtensionVersionFull(). Required so every code path reading ExtensionVersion will see state-based filtering once soft-delete lands.
setState() now throws IllegalStateException when attempting to move from DELETED back to ACTIVE or INACTIVE, guaranteeing soft-deletion is terminal and preventing accidental revival via setActive() (which also routes through setState). Adds entity-level tests covering the transitions.
Replaces entityManager.remove(ExtensionVersion) with setState(DELETED) in ExtensionService and AdminService so version deletions become recoverable soft-deletes. Adds: - countNonDeleted / countAllVersions and STATE != DELETED conditions in the JOOQ repo so existence checks and delete-all-versions logic skip tombstoned rows. - findVersion(...AndStateNot DELETED) variants and matching findVersionIncludingDeleted methods, used by publish to reject reuse of deleted coordinates with a clear error. - findBundled/Dependencies references filtered to non-DELETED, and findActiveVersionsSorted backed by an active=true index variant. - Scan-completion guard to never reactivate a DELETED version. - Similarity check switched to countAllVersions (the only call site that legitimately needs tombstoned rows included). Assisted-By: github:gpt-5.3-codex
699014a to
d67473a
Compare
gnugomez
commented
Jun 17, 2026
| } | ||
|
|
||
| entityManager.remove(extension); | ||
| search.removeSearchEntry(extension); |
Member
Author
There was a problem hiding this comment.
note: I'm removing this here since ExtensionService::updateExtension already removes the search entry if the active value is false
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.
Right now every time an extension version gets deleted we don't preserve a record in the database, we instead hard-delete it. This way we can keep track of it properly.
This PR is a follow-up of #1859