Skip to content

43962 vpp managed config migration - #44435

Merged
jkatz01 merged 4 commits into
mainfrom
43962-vpp-managed-config-migration
Apr 29, 2026
Merged

43962 vpp managed config migration#44435
jkatz01 merged 4 commits into
mainfrom
43962-vpp-managed-config-migration

Conversation

@jkatz01

@jkatz01 jkatz01 commented Apr 29, 2026

Copy link
Copy Markdown
Member

Related issue: Resolves #43962
Adds two tables: vpp_app_configurations and in_house_app_configurations
vpp_app_configurations has team_id unsigned not nullable, rather than team_id nullable + global_or_team_id. This is following the pattern in software_title_display_names and software_title_icons, since software installers are team only and cannot be global. android_app_configurations uses team_id + global_or_team_id but that seems to be unnecessary.
in_house_app_configurations keys on in_house_app_id only — the parent in_house_apps row already pins the team and platform.
Both use MEDIUMTEXT to store the XML configuration.

Checklist for submitter

If some of the following don't apply, delete the relevant line.

Database migrations

  • Checked schema for all modified table for columns that will auto-update timestamps during migration.
  • Confirmed that updating the timestamps is acceptable, and will not cause unwanted side effects.
  • Ensured the correct collation is explicitly set for character columns (COLLATE utf8mb4_unicode_ci).

Summary by CodeRabbit

  • Chores
    • Added database tables for storing VPP and in-house app configurations, organized by team/platform with automatic cleanup when parent apps are deleted.
  • Tests
    • Added migration tests to validate config storage fidelity, uniqueness and platform-specific constraints, foreign-key enforcement, and cascade-delete behavior.

@codecov

codecov Bot commented Apr 29, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.00000% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 66.77%. Comparing base (a59f1fd) to head (0eb6385).
⚠️ Report is 11 commits behind head on main.

Files with missing lines Patch % Lines
...les/20260429180725_CreateTableAppConfigurations.go 85.00% 4 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #44435      +/-   ##
==========================================
+ Coverage   66.75%   66.77%   +0.01%     
==========================================
  Files        2633     2634       +1     
  Lines      211736   211791      +55     
  Branches     9387     9387              
==========================================
+ Hits       141354   141433      +79     
+ Misses      57541    57524      -17     
+ Partials    12841    12834       -7     
Flag Coverage Δ
backend 68.55% <85.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jkatz01
jkatz01 marked this pull request as ready for review April 29, 2026 20:08
@jkatz01
jkatz01 requested a review from a team as a code owner April 29, 2026 20:08

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.

Tip: disable this comment in your organization's Code Review settings.

@qodo-code-review

Copy link
Copy Markdown
ⓘ You've reached your Qodo monthly free-tier limit. Reviews pause until next month — upgrade your plan to continue now, or link your paid account if you already have one.

@coderabbitai

coderabbitai Bot commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

Walkthrough

Adds a MySQL migration that creates two configuration tables: vpp_app_configurations and in_house_app_configurations. vpp_app_configurations stores VPP app configurations with columns for application_id, team_id, platform, configuration, microsecond created_at/updated_at, a composite unique index (team_id, application_id, platform), and a composite foreign key (application_id, platform)vpp_apps(adam_id, platform) with ON DELETE CASCADE. in_house_app_configurations stores in-house app configurations keyed by in_house_app_id with a unique index and FK to in_house_apps(id) ON DELETE CASCADE. A test exercises migration, constraints, and cascade deletes; schema.sql and migration metadata are updated.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR deviates from the linked issue's stated recommendation: it creates a combined vpp_app_configurations table with a platform column instead of separate per-platform ios_app_configurations and ipados_app_configurations tables as explicitly recommended in issue #43962. Either align with the issue's recommendation to create separate per-platform tables, or update the issue to document why the combined table approach was chosen instead.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title "43962 vpp managed config migration" directly references the issue number and describes the core change: adding VPP managed configuration migration.
Description check ✅ Passed The description covers the key changes (two new tables), design decisions (team-only vs global_or_team_id), and addresses database migration checklist items for timestamps and collation.
Out of Scope Changes check ✅ Passed All changes are directly scoped to the migration requirement: two new configuration tables, migration test, and schema.sql updates. No unrelated changes are present.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 43962-vpp-managed-config-migration

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@server/datastore/mysql/migrations/tables/20260429180725_CreateTableAppConfigurations.go`:
- Around line 34-49: The uniqueness/indexing is wrong:
in_house_app_configurations has UNIQUE KEY idx_in_house_app_config_team_app
(team_id, in_house_app_id) which allows duplicate in_house_app_id across teams
and does not ensure team_id matches the parent in_house_apps row; fix by either
making the config keyed by the app row itself (replace the unique index with
UNIQUE (in_house_app_id)) or enforce referential integrity by adding a composite
foreign key that ties (in_house_app_id, team_id) to a corresponding UNIQUE or
PRIMARY KEY on in_house_apps (id, team_id) and keep
idx_in_house_app_config_team_app accordingly; update the migration DDL around
in_house_app_configurations, idx_in_house_app_config_team_app, and
fk_in_house_app_configurations to implement one of these options so stored
team_id cannot diverge from the parent in_house_apps row.
- Around line 13-29: The vpp_app_configurations table is currently only
constrained to vpp_apps via the fk_vpp_app_configurations_app foreign key
(application_id, platform), allowing any team_id to attach configs; update the
schema so the row is owned by the team-scoped relation instead: modify or add a
foreign key that references the team-scoped VPP relation (vpp_apps_teams) using
the composite key including team_id, application_id and platform (e.g. FOREIGN
KEY (team_id, application_id, platform) REFERENCES vpp_apps_teams (team_id,
application_id, platform) ON DELETE CASCADE), and keep or adjust the UNIQUE KEY
idx_vpp_app_config_team_app_platform as needed; ensure the referenced column
names match vpp_apps_teams and remove or replace the existing
fk_vpp_app_configurations_app constraint accordingly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: fa32680d-5c24-454e-8716-7f19183d8c96

📥 Commits

Reviewing files that changed from the base of the PR and between a59f1fd and 3ec1c9f.

📒 Files selected for processing (3)
  • server/datastore/mysql/migrations/tables/20260429180725_CreateTableAppConfigurations.go
  • server/datastore/mysql/migrations/tables/20260429180725_CreateTableAppConfigurations_test.go
  • server/datastore/mysql/schema.sql

The parent in_house_apps row already pins one team_id and platform via
its own columns, so storing team_id on the config table was denormalized
and let team_id diverge from the parent.

The unique key now keys on in_house_app_id alone (one config per app
row), and the team_id column is gone entirely. Test asserts the duplicate
in_house_app_id is rejected.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@server/datastore/mysql/schema.sql`:
- Around line 3108-3120: The schema creates a single vpp_app_configurations
table with a platform discriminator and a foreign key to vpp_apps (adam_id,
platform), but the design requirement mandates separate scoped storage for iOS
and iPadOS rather than a shared table; split the single table into two explicit
tables (e.g., vpp_app_configurations_ios and vpp_app_configurations_ipados) or
otherwise scope rows by separate tables, remove the platform column and adjust
constraints and keys (replace UNIQUE KEY idx_vpp_app_config_team_app_platform
and FK fk_vpp_app_configurations_app) so each new table references the correct
vpp_apps entry (by adam_id and its fixed platform) and enforce ON DELETE CASCADE
per-table to match the objective and avoid migration churn.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 36373be9-5e7d-4533-a878-1204334ca547

📥 Commits

Reviewing files that changed from the base of the PR and between 3ec1c9f and 0eb6385.

📒 Files selected for processing (3)
  • server/datastore/mysql/migrations/tables/20260429180725_CreateTableAppConfigurations.go
  • server/datastore/mysql/migrations/tables/20260429180725_CreateTableAppConfigurations_test.go
  • server/datastore/mysql/schema.sql
🚧 Files skipped from review as they are similar to previous changes (1)
  • server/datastore/mysql/migrations/tables/20260429180725_CreateTableAppConfigurations.go

Comment on lines +3108 to +3120
CREATE TABLE `vpp_app_configurations` (
`id` int unsigned NOT NULL AUTO_INCREMENT,
`application_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`team_id` int unsigned NOT NULL,
`platform` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`configuration` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
`updated_at` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
PRIMARY KEY (`id`),
UNIQUE KEY `idx_vpp_app_config_team_app_platform` (`team_id`,`application_id`,`platform`),
KEY `fk_vpp_app_configurations_app` (`application_id`,`platform`),
CONSTRAINT `fk_vpp_app_configurations_app` FOREIGN KEY (`application_id`, `platform`) REFERENCES `vpp_apps` (`adam_id`, `platform`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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.

⚠️ Potential issue | 🟠 Major

Schema design conflicts with the stated iOS/iPadOS storage decision.

This introduces a single vpp_app_configurations table with a platform discriminator, but the linked objective explicitly calls for iOS and iPadOS to be scoped separately (not a shared table + platform). Merging this as-is risks immediate follow-up migration churn and downstream contract mismatch.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@server/datastore/mysql/schema.sql` around lines 3108 - 3120, The schema
creates a single vpp_app_configurations table with a platform discriminator and
a foreign key to vpp_apps (adam_id, platform), but the design requirement
mandates separate scoped storage for iOS and iPadOS rather than a shared table;
split the single table into two explicit tables (e.g.,
vpp_app_configurations_ios and vpp_app_configurations_ipados) or otherwise scope
rows by separate tables, remove the platform column and adjust constraints and
keys (replace UNIQUE KEY idx_vpp_app_config_team_app_platform and FK
fk_vpp_app_configurations_app) so each new table references the correct vpp_apps
entry (by adam_id and its fixed platform) and enforce ON DELETE CASCADE
per-table to match the objective and avoid migration churn.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@jkatz01
jkatz01 merged commit c158f91 into main Apr 29, 2026
48 checks passed
@jkatz01
jkatz01 deleted the 43962-vpp-managed-config-migration branch April 29, 2026 21:47
jkatz01 added a commit that referenced this pull request May 4, 2026
Migration #44435 dropped team_id from in_house_app_configurations (the
parent in_house_apps row already pins team and platform). Updates the
five in-house datastore methods, the four interface signatures, and the
regenerated mocks to match.
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.

IOSMAC: Create iOS/iPadOS managed app config tables

2 participants