Skip to content

[PM-33319] Rename ty field of Unknown variant#125

Merged
Hinton merged 2 commits intobitwarden:mainfrom
1Password:fix-unknown-cred
Mar 10, 2026
Merged

[PM-33319] Rename ty field of Unknown variant#125
Hinton merged 2 commits intobitwarden:mainfrom
1Password:fix-unknown-cred

Conversation

@rbartlensky
Copy link
Contributor

@rbartlensky rbartlensky commented Mar 9, 2026

If we failed to deserialize a credential, serde's last attempt will be the Unknown variant. The Unknown variant currently requires the object to have a ty property, which in most cases isn't true because most providers will include a type property with their credential objects. With this rename we are ensuring that Unknown is correctly chosen if the object has a valid type property, and none of the other variants work out.

Note, this still won't handle cases where type is missing.

🎟️ Tracking

📔 Objective

I noticed that we fail to deserialize to unknown when a provider gets the format wrong. With this patch we are correctly deserializing to Unknown.

⏰ Reminders before review

  • Contributor guidelines followed
  • All formatters and local linters executed and passed
  • Written new unit and / or integration tests where applicable
  • Protected functional changes with optionality (feature flags)
  • Used internationalization (i18n) for all UI strings
  • CI builds passed
  • Communicated to DevOps any deployment requirements
  • Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team

🦮 Reviewer guidelines

  • 👍 (:+1:) or similar for great changes
  • 📝 (:memo:) or ℹ️ (:information_source:) for notes or general info
  • ❓ (:question:) for questions
  • 🤔 (:thinking:) or 💭 (:thought_balloon:) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion
  • 🎨 (:art:) for suggestions / improvements
  • ❌ (:x:) or ⚠️ (:warning:) for more significant problems or concerns needing attention
  • 🌱 (:seedling:) or ♻️ (:recycle:) for future improvements or indications of technical debt
  • ⛏ (:pick:) for minor or nitpick changes

If we failed to deserialize a credential, serde's last attempt will be
the Unknown variant. The Unknown variant currently requires the object
to have a `ty` property, which in most cases isn't true because most
providers will include a `type` property with their credential
objects. With this rename we are ensuring that Unknown is correctly
chosen if the object has a valid `type` property, and none of the
other variants work out.

Note, this still won't handle cases where `type` is missing.
@rbartlensky rbartlensky requested a review from a team as a code owner March 9, 2026 18:57
@bitwarden-bot
Copy link

Thank you for your contribution! We've added this to our internal tracking system for review.
ID: PM-33319
Link: https://bitwarden.atlassian.net/browse/PM-33319

Details on our contribution process can be found here: https://contributing.bitwarden.com/contributing/pull-requests/community-pr-process.

@bitwarden-bot bitwarden-bot changed the title Rename ty field of Unknown variant [PM-33319] Rename ty field of Unknown variant Mar 9, 2026
Hinton
Hinton previously approved these changes Mar 10, 2026
Copy link
Member

@Hinton Hinton left a comment

Choose a reason for hiding this comment

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

Nice, would you mind adding a note to the changelog?

@codecov
Copy link

codecov bot commented Mar 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@0e2028d). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #125   +/-   ##
=======================================
  Coverage        ?   63.30%           
=======================================
  Files           ?        5           
  Lines           ?      545           
  Branches        ?        0           
=======================================
  Hits            ?      345           
  Misses          ?      200           
  Partials        ?        0           

☔ 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.

@rbartlensky
Copy link
Contributor Author

Nice, would you mind adding a note to the changelog?

Sure can! Let me know if you're happy with the message

Copy link
Member

@Hinton Hinton left a comment

Choose a reason for hiding this comment

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

This looks great, thanks!

@Hinton Hinton merged commit 9de2f8c into bitwarden:main Mar 10, 2026
5 of 6 checks passed
@rbartlensky rbartlensky deleted the fix-unknown-cred branch March 10, 2026 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants