Repository navigation
fix: validate merged profiles on PATCH - #1404
Open
sinchubhat wants to merge 1 commit into
Open
sinchubhat wants to merge 1 commit into
sinchubhat wants to merge 1 commit into
Conversation
5 tasks
5 tasks
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1404 +/- ##
==========================================
+ Coverage 62.32% 62.46% +0.14%
==========================================
Files 159 159
Lines 13435 13452 +17
==========================================
+ Hits 8373 8403 +30
+ Misses 5062 5049 -13 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
sinchubhat
force-pushed
the
issue1261-console-4.1.1
branch
from
November 12, 2026 05:22
fe6d9a9 to
ad76e98
Compare
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The affected PATCH integration assertions still expect outdated validation errors and will fail until aligned with the merged-profile validation behavior.
1 open issue
What changed in this PR
This PR addresses the profile PATCH validation gap tracked in #1261 by validating merged profile state before persistence, while preserving valid partial updates that omit passwords.
Changes:
- Reuses profile validators across HTTP binding and use-case validation.
- Checks merged PATCH profiles against field constraints and password requirements.
- Adds regression coverage for invalid updates and preserved stored values.
| File | Description |
|---|---|
internal/usecase/profiles/usecase.go |
Validates merged profiles and shares password-required checks. |
internal/usecase/profiles/usecase_test.go |
Tests merged-state validation and password-preserving updates. |
internal/entity/dto/v1/profile.go |
Centralizes registration of profile validators. |
internal/entity/dto/v1/profile_test.go |
Tests shared validator registration and constraints. |
internal/controller/httpapi/v1/profiles.go |
Uses the shared validator registration helper. |
internal/controller/httpapi/v1/profiles_test.go |
Tests PATCH rejection responses and route validator registration. |
Review effort: Balanced
sinchubhat
force-pushed
the
issue1261-console-4.1.1
branch
from
November 12, 2026 06:29
ad76e98 to
eb0b071
Compare
sinchubhat
marked this pull request as ready for review
November 12, 2026 06:38
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.

Addresses #1261
Addresses Point No 1 of 4.1 Console defects https://github.com/device-management-toolkit/console/wiki/ConsoleRPS-vs-StandaloneRPS-API--Gap-Analysis
Create test data
Output:
Output:
Test PATCH
Each of these should return 400:
Invalid activation
Output:
Weak password
Output:
Output:
ACM without a MEBx password
Output:
DHCP cannot be disabled while the profile has Wi-Fi links
Expected: 400
Output:
A valid partial update without a password should return 200:
Output:
Check persisted state:
Clean up
Output:
HTTP/2 204 content-type: application/json; charset=utf-8 x-content-type-options: nosniff date: Thu, 12 Nov 2026 04:17:23 GMTOutput:
HTTP/2 204 content-type: application/json; charset=utf-8 x-content-type-options: nosniff date: Thu, 12 Nov 2026 04:17:38 GMTCreate a CCM profile, then PATCH it to ACM without a MEBx password. The PATCH should return 400.
Create CCM profile: expect 201
Output:
PATCH to ACM without MEBx password: expect 400
Output:
Clean up: expect 204
Output:
HTTP/2 204 content-type: application/json; charset=utf-8 x-content-type-options: nosniff date: Thu, 12 Nov 2026 04:29:30 GMT