Skip to content

v4-migrator: Populate PERMISSION table in bootstrap phase#6221

Merged
nscuro merged 1 commit into
DependencyTrack:mainfrom
nscuro:issue-6217
Jun 1, 2026
Merged

v4-migrator: Populate PERMISSION table in bootstrap phase#6221
nscuro merged 1 commit into
DependencyTrack:mainfrom
nscuro:issue-6217

Conversation

@nscuro
Copy link
Copy Markdown
Member

@nscuro nscuro commented Jun 1, 2026

Description

Populates PERMISSION table in bootstrap phase of v4-migrator.

Addressed Issue

Fixes #6217

Additional Details

Docs PR: DependencyTrack/docs#117

Checklist

  • I have read and understand the contributing guidelines
  • This PR fixes a defect, and I have provided tests to verify that the fix is effective
  • This PR implements an enhancement, and I have provided tests to verify that it works as intended
  • This PR introduces changes to the database model, and I have updated the migration changelog accordingly
  • This PR introduces new or alters existing behavior, and I have updated the documentation accordingly
  • This PR is a substantial change (per the ADR criteria), and I have added an ADR under docs/adr/

Signed-off-by: nscuro <nscuro@protonmail.com>
@nscuro nscuro added this to the 5.0 milestone Jun 1, 2026
Copilot AI review requested due to automatic review settings June 1, 2026 12:01
@nscuro nscuro added the defect Something isn't working label Jun 1, 2026
@owasp-dt-bot
Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@codacy-production
Copy link
Copy Markdown

codacy-production Bot commented Jun 1, 2026

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 4 duplication

Metric Results
Complexity 0
Duplication 4

View in Codacy

🟢 Coverage ∅ diff coverage · +0.00% coverage variation

Metric Results
Coverage variation +0.00% coverage variation (-1.00%)
Diff coverage diff coverage (70.00%)

View coverage diff in Codacy

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.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 PermissionCatalog and invoke it from bootstrap to seed the full v5 permission catalog idempotently.
  • Remove permission seeding from the PERMISSION table’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).

@nscuro nscuro merged commit fb49cf2 into DependencyTrack:main Jun 1, 2026
18 of 19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

defect Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

v4-migrator: migration cannot be resumed if load step fails

3 participants