Skip to content

Migrate folder create and edit #340

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 26 commits into
base: main
Choose a base branch
from
Open

Migrate folder create and edit #340

wants to merge 26 commits into from

Conversation

Hinton
Copy link
Member

@Hinton Hinton commented Jul 1, 2025

🎟️ Tracking

📔 Objective

Fully migrate folder create and edit to the SDK to demonstrate the repository and api capabilities.

⏰ 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

Copy link
Contributor

github-actions bot commented Jul 1, 2025

Logo
Checkmarx One – Scan Summary & Details9918ab42-8c29-489a-8d3a-3cce92b3014f

Great job, no security vulnerabilities found in this Pull Request

Copy link

codecov bot commented Jul 1, 2025

Codecov Report

Attention: Patch coverage is 81.25000% with 69 lines in your changes missing coverage. Please review.

Project coverage is 72.12%. Comparing base (d5c0dc5) to head (46979ef).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
crates/bitwarden-vault/src/folder/folder_client.rs 0.00% 48 Missing ⚠️
crates/bitwarden-test/src/repository.rs 57.14% 15 Missing ⚠️
crates/bitwarden-wasm-internal/src/platform/mod.rs 0.00% 4 Missing ⚠️
crates/bitwarden-vault/src/folder/create.rs 99.13% 1 Missing ⚠️
crates/bitwarden-vault/src/folder/edit.rs 99.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #340      +/-   ##
==========================================
+ Coverage   71.63%   72.12%   +0.48%     
==========================================
  Files         239      244       +5     
  Lines       19354    19853     +499     
==========================================
+ Hits        13865    14318     +453     
- Misses       5489     5535      +46     

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

Base automatically changed from arch/client-managed-tokens to main July 3, 2025 07:56
@Hinton Hinton marked this pull request as ready for review July 3, 2025 12:17
@Hinton Hinton requested review from a team as code owners July 3, 2025 12:17
Copy link

sonarqubecloud bot commented Jul 3, 2025

Copy link
Member

@dani-garcia dani-garcia left a comment

Choose a reason for hiding this comment

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

Looks pretty good to me, just some small comments

bitwarden-sm = { path = "bitwarden_license/bitwarden-sm", version = "=1.0.0" }
bitwarden-ssh = { path = "crates/bitwarden-ssh", version = "=1.0.0" }
bitwarden-state = { path = "crates/bitwarden-state", version = "=1.0.0" }
bitwarden-test = { path = "crates/bitwarden-test", version = "=1.0.0" }
bitwarden-threading = { path = "crates/bitwarden-threading", version = "=1.0.0" }
Copy link
Member

Choose a reason for hiding this comment

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

I thought we were running cargo sort to check the order here, I wonder how these went through initially


#[cfg_attr(feature = "wasm", wasm_bindgen)]
impl FoldersClient {
#[allow(missing_docs)]
Copy link
Member

Choose a reason for hiding this comment

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

Can we add some docs to these functions?

let folder: Folder = resp.try_into()?;

repository
.set(require!(folder.id).to_string(), folder.clone())
Copy link
Member

Choose a reason for hiding this comment

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

You could slightly simplify this by using the provided folder id:

Suggested change
.set(require!(folder.id).to_string(), folder.clone())
.set(folder_id.to_string(), folder.clone())

Should we also add a debug assert to make sure the id returned by the api matches the provided one?

debug_assert_eq!(folder_id, &folder.id.to_string());

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.

2 participants