Skip to content

[PM-44199] fix: Carry Send data field through API models - #3079

Closed
quexten wants to merge 1 commit into
sdlc/sdk-updatefrom
fix/send-data-field
Closed

quexten wants to merge 1 commit into
sdlc/sdk-updatefrom
fix/send-data-field

Conversation

@quexten

@quexten quexten commented Sep 29, 2026

Copy link
Copy Markdown
Contributor

🎟️ Tracking

https://bitwarden.atlassian.net/browse/PM-44199

Stacked on #2989 (SDK update to 8be9dbc, which adds Send.data).

📔 Objective

#2989 maps every Send with data: nil, and SendResponseModel / SendRequestModel have no data field, so an Item Send's data is dropped on sync and on every round trip (edit, key rotation).

  • Add SendDataModel { data: String?, encryptionVersion: Int? } to the response and request models; UpdateSendRequest carries it.
  • Map data both ways in BitwardenSdk+Tools.swift. SendItem.data is a structured SDK Cipher and the Swift bindings expose no JSON (de)serialization, so the cipher JSON goes through the existing CipherDetailsResponseModel mapping.

⚠️ Non-public API usage / limitations

  • Not lossless: re-serializing through client models drops SDK-only fields (localData, partialData) and any nested field the app models lack. A lossless fix needs the SDK to expose Cipher/SendItem JSON (de)serialization over UniFFI, or carry the raw string.
  • The SDK parses data.data with deny_unknown_fields. Top-level keys emitted are a subset of the SDK Cipher; nested models were not verified.
  • Item Sends still map to .unknown and are dropped in replaceSends (PM-41094), so this matters once Item support lands.

Related: bitwarden/sdk-internal#1535 (non-public API fields on encrypted models).

🧪 Testing

Tests written first and observed failing (3 failures), then passing: BitwardenSdkToolsTests (response mapping, round trip), UpdateSendRequestTests. Send/Sync/Repository test classes pass (137 tests). SwiftLint/SwiftFormat clean.

SDK 8be9dbc adds `data: SendItem?` to Send, but the Send API models had
no `data` field and every mapping hard-coded nil. An Item Send's data
was dropped on sync, persistence and update.

Add SendDataModel to the response and request models and map it both
ways. The API stores the item's cipher as an opaque JSON string; the
SDK exposes it only as a structured Cipher, so it is (de)serialized via
CipherDetailsResponseModel.
@github-actions github-actions Bot added app:password-manager Bitwarden Password Manager app context t:bug Change Type - Bug labels Sep 29, 2026
@codecov

codecov Bot commented Sep 29, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.44444% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.30%. Comparing base (7c69fa5) to head (268bcd3).

Files with missing lines Patch % Lines
...red/Core/Tools/Extensions/BitwardenSdk+Tools.swift 94.11% 2 Missing ⚠️
Additional details and impacted files
@@                 Coverage Diff                 @@
##           sdlc/sdk-update    #3079      +/-   ##
===================================================
+ Coverage            79.97%   82.30%   +2.32%     
===================================================
  Files                 1171     1048     -123     
  Lines                75846    68574    -7272     
===================================================
- Hits                 60657    56439    -4218     
+ Misses               15189    12135    -3054     

☔ View full report in Codecov by Harness.
📢 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.

@quexten quexten closed this Sep 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app:password-manager Bitwarden Password Manager app context t:bug Change Type - Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant