v4-migrator: Populate PERMISSION table in bootstrap phase#6221
Conversation
Signed-off-by: nscuro <nscuro@protonmail.com>
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 0 |
| Duplication | 4 |
🟢 Coverage ∅ diff coverage · +0.00% coverage variation
Metric Results Coverage variation ✅ +0.00% coverage variation (-1.00%) Diff coverage ✅ ∅ diff coverage (70.00%) Coverage variation details
Coverable lines Covered lines Coverage Common ancestor commit (21326bf) 41687 35860 86.02% Head commit (3562f9d) 41687 (+0) 35862 (+2) 86.03% (+0.00%) Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch:
<coverage of head commit> - <coverage of common ancestor commit>Diff coverage details
Coverable lines Covered lines Diff coverage Pull request (#6221) 0 0 ∅ (not applicable) Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified:
<covered lines added or modified>/<coverable lines added or modified> * 100%
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
There was a problem hiding this comment.
Pull request overview
This PR fixes v4-migrator resumability (issue #6217) by ensuring the v5 PERMISSION table is populated during the bootstrap phase, so load can be re-run successfully even when transform is skipped during recovery.
Changes:
- Introduce
PermissionCatalogand invoke it frombootstrapto seed the full v5 permission catalog idempotently. - Remove permission seeding from the
PERMISSIONtable’s transform SQL and update related documentation/comments. - Add/extend integration tests to cover bootstrapping permission seeding and the documented “re-bootstrap + re-run load” recovery flow.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| support/v4-migrator/src/main/java/org/dependencytrack/v4migrator/PermissionCatalog.java | Centralizes the v5 PERMISSION seed SQL for use during bootstrap. |
| support/v4-migrator/src/main/java/org/dependencytrack/v4migrator/cli/BootstrapCommand.java | Seeds the v5 permission catalog immediately after applying Flyway during bootstrap. |
| support/v4-migrator/src/main/java/org/dependencytrack/v4migrator/TableRegistry.java | Updates PERMISSION transform to rely on an already-seeded v5 permission catalog (builds permission_name_map only). |
| support/v4-migrator/src/main/java/org/dependencytrack/v4migrator/preflight/Preflight.java | Clarifies that bootstrap-populated seed data (permissions) is allowed when checking target emptiness. |
| support/v4-migrator/src/test/java/org/dependencytrack/v4migrator/testsupport/V5TargetContainer.java | Aligns test container setup with real bootstrap behavior by using PermissionCatalog.seed. |
| support/v4-migrator/src/test/java/org/dependencytrack/v4migrator/BootstrapIT.java | Verifies bootstrap both applies Flyway head and seeds PERMISSION, and remains idempotent. |
| support/v4-migrator/src/test/java/org/dependencytrack/v4migrator/UsersPermissionsIT.java | Adds regression coverage for resuming load after permission reset/reseed (issue #6217). |
Description
Populates
PERMISSIONtable inbootstrapphase of v4-migrator.Addressed Issue
Fixes #6217
Additional Details
Docs PR: DependencyTrack/docs#117
Checklist
This PR implements an enhancement, and I have provided tests to verify that it works as intendedThis PR introduces changes to the database model, and I have updated the migration changelog accordinglyThis PR is a substantial change (per the ADR criteria), and I have added an ADR underdocs/adr/