[PM-38329] policies stop converting policy data on every response - #8204
Conversation
…JsonConverter for Data property, enhancing null safety and JSON handling. Introduce RawJsonConverter utility for efficient raw JSON serialization/deserialization. Update related namespaces and remove unnecessary deserialization logic.
…ertions, improving JSON handling and readability. Introduce new tests for PolicyResponseModel and PolicyStatusResponseModel to ensure consistent serialization with legacy implementations. Add RawJsonConverterTests to validate raw JSON serialization/deserialization behavior.
🤖 Bitwarden Claude Code ReviewOverall Assessment: APPROVE Reviewed the switch of Code Review DetailsNo findings. The two open threads already have author responses explaining the intentional |
…policies with no stored data by serializing as "{}" instead of null. Update PolicyResponseModel to allow setting Data property. Introduce RawJsonSchemaFilter to adjust OpenAPI schema generation for properties using RawJsonConverter. Add tests for PolicyStatusResponseModel and RawJsonSchemaFilter to ensure correct serialization and schema behavior.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #8204 +/- ##
==========================================
- Coverage 68.57% 63.31% -5.27%
==========================================
Files 2401 2403 +2
Lines 104043 104069 +26
Branches 9426 9432 +6
==========================================
- Hits 71349 65888 -5461
- Misses 30341 35926 +5585
+ Partials 2353 2255 -98 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…PI generation. Enhance tests to verify correct schema behavior for properties with and without nullability. This ensures accurate representation of JSON types in generated schemas.
|
@r-tome I'm OOO shortly, can you please do this review given you created the ticket? Thanks! |
…data-on-every-response
r-tome
left a comment
There was a problem hiding this comment.
This looks good to me but I designed the solution so I tagged @jrmccannon to review it.
I feel like the comments/xmldoc are too Claude-y. Maybe retry using simplified technical english.
…ved serialization - Refactored PolicyStatusResponseModel and PolicyResponseModel to ensure consistent serialization behavior, preserving legacy wire format for policies with no stored data. - Updated unit tests to reflect changes in serialization logic, replacing legacy models with dictionary-based deserialization for accurate JSON output comparison. - Removed obsolete RawJsonConverterTests as they are no longer needed with the updated serialization approach.
…JSON object for missing data - Modified PolicyStatusResponseModel to return an empty JSON object instead of null when no data is stored, ensuring compatibility with policy-specific initialization logic. - Updated comments for clarity regarding serialization behavior. - Adjusted RawJsonConverter and RawJsonSchemaFilter documentation for improved understanding of JSON handling.
| }, | ||
| "Stripe.net": { | ||
| "type": "Transitive", | ||
| "resolved": "48.5.0", |
There was a problem hiding this comment.
Is this supposed to be here?
There was a problem hiding this comment.
Accident! Good catch!
…le projects - Upgraded various Microsoft.AspNetCore and Microsoft.Extensions packages to version 10.0.10 in the lock files for Commercial.Core, Commercial.Infrastructure.EntityFramework, Scim, Services.Pam, Sso, and test projects. - Ensured consistent dependency resolution and improved compatibility with the latest features and fixes in the updated packages.
jrmccannon
left a comment
There was a problem hiding this comment.
This is the opposite of what I meant.
…property - Changed the Data property in PolicyResponseModel from private to public set, enabling modification of the property after object instantiation. - This adjustment enhances flexibility in handling policy data within the response model.
…data-on-every-response
…data-on-every-response
jrmccannon
left a comment
There was a problem hiding this comment.
Thanks for all the clean up. One more thing would be to do a manual test of exporting the API spec to do one final gut check to make sure it outputs the spec correctly. These are used for the sdk api bindings so we should validate that to make sure things are breaking across projects.
QA round 3: rendering org names verbatim let mail clients linkify names that look like domains (e.g. "40167.Client.Org" became a link to http://40167.client.org/ in the provider payment method email). Insert a zero-width non-joiner after each "." and "@" via the new CoreHelpers.PreventEmailAutoLinking so the visible text is unchanged but the token no longer matches a domain. Handlebars encodes the character as ‌ in HTML parts; the text templates now use triple-stache for the name fields so the raw character (not the entity) lands in the plain-text part, matching the PM-42262 approach for text-part links.
* [PM-40167] feat: Update billing domain email copy
Refreshes subject lines and body copy for nine billing emails
(license, seat limits, provider payment method, and Families for
Enterprise sponsorship) per the PM-38898 terminology epic. Copy
ships in-place with no feature flag per product decision.
Also removes the unused offerAcceptanceDate parameter from
SendFamiliesForEnterpriseRemoveSponsorshipsEmailAsync, sanitizes
the sponsor org name in offer emails, and fixes the sponsorship
reverting text template referencing a nonexistent {{Date}} property.
* [PM-42261] fix: Address QA defects on billing domain emails
- PM-42261: render organization names verbatim in the seat limit,
Secrets Manager limit, and sponsorship offer email bodies instead of
applying [dot]/[at] substitution, matching the subject line
- PM-42262: point the provider payment method email at the
billing/payment-details route, update the help article anchor, and
render plain text links as bare URLs instead of HTML anchors or
HTML-encoded ampersands
- PM-42264: inherit BaseMailModel so the Secrets Manager machine
accounts limit email footer renders the copyright year
Also aligns sponsorship offer email test expectations with the
PM-41951 copy that shipped on main and won the merge conflict.
* [PM-42261] fix: Render organization names verbatim in remaining billing emails
QA round 2 found the same [dot] substitution in two more emails changed
by PM-40167: the Families sponsorship removal email and the self-host
license expired email. Render the organization name verbatim in both,
matching the earlier fix, and do the same for the provider payment
method email which had the identical latent issue. Handlebars {{ }}
interpolation still HTML-encodes the values.
* [PM-42261] fix: Stop mail clients auto-linking dotted organization names
QA round 3: rendering org names verbatim let mail clients linkify
names that look like domains (e.g. "40167.Client.Org" became a link to
http://40167.client.org/ in the provider payment method email). Insert
a zero-width non-joiner after each "." and "@" via the new
CoreHelpers.PreventEmailAutoLinking so the visible text is unchanged
but the token no longer matches a domain. Handlebars encodes the
character as ‌ in HTML parts; the text templates now use
triple-stache for the name fields so the raw character (not the
entity) lands in the plain-text part, matching the PM-42262 approach
for text-part links.
* Fix lint whitespace and restore SanitizeForEmail doc placement
The PreventEmailAutoLinking helper was inserted between SanitizeForEmail
and its XML summary, leaving the new method with two summaries and
SanitizeForEmail undocumented. Reorder so each method keeps its own
docs, and fix the missing indentation on the new CoreHelpers test.
🎟️ Tracking
https://bitwarden.atlassian.net/browse/PM-38329
📔 Objective
Stops converting the policy data on every response for policies