Repository navigation
feat: migrate the community GitLab plugin's data (0.5.x) - #6
Merged
Merged
Conversation
Migration 0004 carries over what com.gorlix.gitlab 0.5.x kept in its own schema: each project's access token becomes a project-scoped token connection in core, with its repositories, merge requests, task links and task branches. It mirrors the GitHub provider's migration and is a no-op when the old schema or core's git tables are absent; rerunning it creates nothing new. The old schema is left untouched. A migrated identity is completed on first use: its user is asked of GitLab, a webhook secret is generated, then its reach is classified. A token GitLab rejects asks to connect again, and a token the instance key cannot decrypt names ENCRYPTION_KEY. The old plugin's webhooks are recorded and each is deleted once the repository's new hook is registered, only if it still points at the old plugin; failures are best effort and only retryable ones are tried again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Community releases 0.5.0 and 0.5.1 already used the id com.paca.gitlab, so their tables are in this plugin's schema, and 0002 dropped them before anything could carry them over. 0002 now keeps them; 0004 gathers the rows of both releases (0.5.2's schema wins for a project found in both), carries them over and then drops the tables in this schema, as the GitHub provider does with its previous release's. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Rewrites "Upgrading from 0.5.x" for the migration: what is carried over and what is not, the order of the steps for 0.5.0/0.5.1 (same id) and 0.5.2 (com.gorlix.gitlab), what "Try again" does to the old webhooks, and how to back up the database first and roll back. The decryption error now names the instance's ENCRYPTION_KEY, which core hands every plugin. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
scripts/test-legacy-migration runs this plugin's migrations the way core does (one transaction each, SET LOCAL search_path) on Postgres 16 with core's git tables from a Paca checkout, and checks the upgrade from 0.5.2, the in-place upgrade from 0.5.0/0.5.1, both together, a rerun, a fresh install and a plugin-only database, plus the store's own SQL for completing an identity and finding its legacy hooks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gorlix
added a commit
to gorlix/paca
that referenced
this pull request
Oct 29, 2026
Repositories listed for a project now carry webhook_attempted, true when the audit log holds a webhook.register entry for them. One aggregated query per listing, no new migration. Refs Paca-AI#656. Repos carried over by the plugin migrations (Paca-AI/paca-plugin-gitlab#6) arrive without a webhook and without Paca ever having tried to register one. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
gorlix
added a commit
to gorlix/paca
that referenced
this pull request
Oct 29, 2026
When webhook_attempted is false the notice no longer says Paca couldn't register the webhook or suggests a permissions problem: it explains that none was registered yet and offers "Register webhook". After a failed try it falls back to the usual wording. New strings in all nine locales. Refs Paca-AI#656. Repos carried over by the plugin migrations (Paca-AI/paca-plugin-gitlab#6) are in this state. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
pikann
approved these changes
Oct 29, 2026
pikann
left a comment
There was a problem hiding this comment.
LGTM! Thank you for the contribution! 🚀
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.
Migrates the data of the community GitLab plugin (0.5.x) to Paca core, as discussed in Paca-AI/paca#649. Today an upgrade loses the project's token, its linked repositories and the task ↔ merge request / branch links. After this PR they come back as core Git data, the way the GitHub provider's
0002_git_provider.sqldoes it for its previous release.What changes
Migration
0004_migrate_community_plugin.sqlgit_identitiesplus itsgit_webhook_endpointsrow). Its repositories, merge requests, task links and task branches come with it:external_idis GitLab's numeric project id;com.paca.gitlab, so their tables are in this plugin's own schema.0002used to drop them before anything could read them. It now keeps them, and0004drops them after carrying the rows over, as the GitHub provider does.com.gorlix.gitlab, so its tables are inplugin_data_com_gorlix_gitlab. That schema is left untouched.ENCRYPTION_KEY, so they stay readable.0002is safe because no release of this plugin has shipped it yet.Completion on first use (
completeMigratedIdentity, mirrorscompleteMigratedTokenin the GitHub provider)GET /user) and a webhook secret is generated. Then the token's reach is classified, as for any unclassified identity.ENCRYPTION_KEY.Old webhooks
0004records them ingitlab_legacy_webhooks.EnsureWebhookhas registered the new hook ("Try again" on the repository), each old hook is read. It is deleted only if its URL is still the old plugin's (…/api/v1/plugins/com.gorlix.gitlab/projects/…/webhook). A hook that was pointed elsewhere is left alone, and the plugin logs a warning.EnsureWebhook:README: "Upgrading from 0.5.x" is rewritten. It covers:
pg_dumpand how to roll back.Testing
Checks.
go vet,go test -race,golangci-lint(0 issues) and thetinygowasip1 build pass.Unit tests with the fake GitLab cover:
Postgres.
scripts/test-legacy-migration/run.shruns the migrations the way core does on Postgres 16: one transaction per file,SET LOCAL search_path, and core's real000073/000076tables. It passes 65 of 65 checks:0004, a fresh install and a plugin-only database;Real upgrade on a copy of a development instance. The instance ran 0.5.0 on an older core. Its restored copy was upgraded in an isolated stack on core
master, with the GitHub provider installed too.Decisions
pg_dump -Fcand checked withpg_restore -l(432 TOC entries). Its SHA-256 and the restore command were noted next to it.Backup and rollback in production
The README now has these steps. In short, with the bundled Postgres of
deploy/docker-compose.prod.yml:With a managed database, use
pg_dump "$DATABASE_URL" -Fc. The dump holds the encrypted tokens, so keep it as private as the database. When upgrading from 0.5.2, installcom.paca.gitlabbefore removingcom.gorlix.gitlab.Known limits
handleanddisplay_namewhen a connection is created and never refreshes them, so they stay as the migration wrote them. The GitHub migration has the same limit. Reconnecting gives the full label.🤖 Generated with Claude Code