Skip to content

feat: detach tokens from extension versions - #2065

Open
cstamas wants to merge 1 commit into
eclipse-openvsx:mainfrom
cstamas:detach-token-from-extension-version
Open

feat: detach tokens from extension versions#2065
cstamas wants to merge 1 commit into
eclipse-openvsx:mainfrom
cstamas:detach-token-from-extension-version

Conversation

@cstamas

@cstamas cstamas commented Aug 12, 2026

Copy link
Copy Markdown
Member

As future plans may want us to delete tokens, instead accumulate them and flag as deactivated.

Summary:

  • Added V1_72__ExtensionVersion_PublishedBy.sql migration: new published_by_id column (FK → user_data), backfilled from published_with_id, and changed the published_with_id FK to ON DELETE SET NULL.
  • Added publishedBy field to ExtensionVersion (mirroring the removedBy precedent), fixed a pre-existing bug where displayName was silently excluded from equals().
  • Repointed every read path (isVerified in LocalRegistryService/RelevanceService, toExtensionJson, OrphanNamespaceMigration) from getPublishedWith().getUser() to getPublishedBy().
  • Redesigned PublisherComplianceChecker to iterate by publisher instead of by token, so it stays correct once tokens are deleted.
  • Renamed/added/deleted JPA repository methods so no query joins through personal_access_token anymore.
  • Rewrote ~12 raw jOOQ joins across ExtensionVersionJooqRepository and AdminStatisticCalculationsRepository to join user_data directly via published_by_id.
  • Applied the migration through real Flyway (via a temporary git stash of the Java changes) and regenerated jOOQ code.
  • Updated all affected test fixtures and mocks.
  • Verified: 841 unit tests + 922 integration tests (Testcontainers Postgres) all pass, and a manual SQL check confirms deleting a personal_access_token row no longer errors and correctly nulls published_with_id while leaving published_by_id intact.

Note: Known follow-up (out of scope): FixTargetPlatformsJobRequestHandler still republishes using the original token and would NPE if that token were ever deleted — this is a pre-existing gap in the publish pipeline's identity model, not introduced by this change.

As future plans may want us to delete tokens, instead accumulate them
and flag as deactivated.

Summary:
- Added V1_72__ExtensionVersion_PublishedBy.sql migration: new published_by_id column (FK → user_data), backfilled from published_with_id, and changed the published_with_id FK to ON DELETE SET NULL.
- Added publishedBy field to ExtensionVersion (mirroring the removedBy precedent), fixed a pre-existing bug where displayName was silently excluded from equals().
- Repointed every read path (isVerified in LocalRegistryService/RelevanceService, toExtensionJson, OrphanNamespaceMigration) from getPublishedWith().getUser() to getPublishedBy().
- Redesigned PublisherComplianceChecker to iterate by publisher instead of by token, so it stays correct once tokens are deleted.
- Renamed/added/deleted JPA repository methods so no query joins through personal_access_token anymore.
- Rewrote ~12 raw jOOQ joins across ExtensionVersionJooqRepository and AdminStatisticCalculationsRepository to join user_data directly via published_by_id.
- Applied the migration through real Flyway (via a temporary git stash of the Java changes) and regenerated jOOQ code.
- Updated all affected test fixtures and mocks.
- Verified: 841 unit tests + 922 integration tests (Testcontainers Postgres) all pass, and a manual SQL check confirms deleting a personal_access_token row no longer errors and correctly nulls published_with_id while leaving published_by_id intact.

Note: Known follow-up (out of scope): FixTargetPlatformsJobRequestHandler still republishes using the original token and would NPE if that token were ever deleted — this is a pre-existing gap in the publish pipeline's identity model, not introduced by this change.

@autumnfound autumnfound left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Covers data migration, new field, and looks to cover all cases where the PAT was used in joins. We also have the index I'd expect for the field to keep the lookups zippy!

@cstamas
cstamas marked this pull request as ready for review August 14, 2026 12:13
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.

2 participants