Skip to content

[PM-40199] feat: Add shared-folder alias routes to CiphersController - #8753

Open
aaronjordan wants to merge 5 commits into
mainfrom
aj/pm-40199-alias-routes-for-shared-folder-operations
Open

aaronjordan wants to merge 5 commits into
mainfrom
aj/pm-40199-alias-routes-for-shared-folder-operations

Conversation

@aaronjordan

@aaronjordan aaronjordan commented Oct 26, 2026 •

Copy link
Copy Markdown

🎟️ Tracking

https://bitwarden.atlassian.net/browse/PM-40199
https://bitwarden.atlassian.net/browse/PM-46444

📔 Objective

Adds /shared-folders, /shared-folders_v2, /shared-folders-admin and /bulk-shared-folders aliases that delegate to the existing collections handlers. I did not rename the already-obsolete POST methods as callers should be moving onto PUT for those already.

📸 Screenshots

Screenshot 2026-10-26 at 3 06 18 PM

@aaronjordan aaronjordan added the t:feature Change Type - Feature Development label Oct 26, 2026
@aaronjordan
aaronjordan marked this pull request as ready for review October 26, 2026 22:19
@aaronjordan
aaronjordan requested a review from a team as a code owner October 26, 2026 22:19
@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

🤖 Bitwarden Claude Code Review

Overall Assessment: REQUEST CHANGES

This PR adds /shared-folders alias routes to CiphersController. The existing collections handlers move into the new methods, and the legacy routes become [Obsolete] wrappers that forward to them and swap the response terms back. Request and response models gain SharedFolderIds with JsonIgnore(WhenWritingNull). Every constructor still initializes CollectionIds, so other endpoints that serialize these models are unaffected. The new routes keep the same authorization and lease-gate paths, but the test project will not compile with the new obsolete markers.

Code Review Details
  • ❌ : Test calls to the now-obsolete PutCollections_vNext and PostBulkCollections have no CS0618 suppression, which breaks the Api.Test build under TreatWarningsAsErrors (this includes the existing lease-gate tests)
    • test/Api.Test/Vault/Controllers/CiphersControllerTests.cs:218
    • test/Api.Test/Vault/Controllers/CiphersControllerTests.cs:234
    • test/Api.Test/Vault/Controllers/CiphersControllerTests.cs:3904
    • test/Api.Test/Vault/Controllers/CiphersControllerTests.cs:3943

@aaronjordan aaronjordan added the ai-review Request a Claude code review label Oct 26, 2026
@codecov

codecov Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 62.16216% with 28 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.49%. Comparing base (6f35199) to head (1ddda3c).

Files with missing lines Patch % Lines
src/Api/Vault/Controllers/CiphersController.cs 61.22% 18 Missing and 1 partial ⚠️
...c/Api/Vault/Models/Response/CipherResponseModel.cs 55.00% 9 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #8753   +/-   ##
=======================================
  Coverage   68.48%   68.49%           
=======================================
  Files        2750     2751    +1     
  Lines      117618   117677   +59     
  Branches    10781    10788    +7     
=======================================
+ Hits        80554    80601   +47     
- Misses      34524    34537   +13     
+ Partials     2540     2539    -1     

☔ 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

nikwithak
nikwithak previously approved these changes Nov 3, 2026
Comment on lines +1 to +2
// FIXME: Update this file to be null safe and then delete the line below
#nullable disable

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The FIXME comment above CipherBulkUpdateSharedFoldersRequestModel marks null-safety work as unfinished and leaves that deferral in production code.

Suggested change
// FIXME: Update this file to be null safe and then delete the line below
#nullable disable
#nullable disable
Details

✨ AI Reasoning
​The comment marks null-safety work as unfinished. It has no ticket reference or complete handoff plan, so it is a lingering deferral marker in production code.

Reply on this comment to give feedback or ignore the issue.
More info

@aaronjordan aaronjordan Nov 6, 2026 •

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This effectively clones the existing 'collections' file, so I'm not concerned about the new FIXME.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Ignored this finding.

@aaronjordan
aaronjordan requested review from a team as code owners November 6, 2026 22:35
@aaronjordan
aaronjordan marked this pull request as draft November 6, 2026 22:36
@aaronjordan
aaronjordan force-pushed the aj/pm-40199-alias-routes-for-shared-folder-operations branch from 7f25518 to b9cbab8 Compare November 6, 2026 22:37
Add /shared-folders, /shared-folders_v2, /shared-folders-admin (PUT+POST)
and /bulk-shared-folders aliases that delegate to the existing
collections handlers. Mark the legacy routes obsolete (retained for
backwards compatibility).
Make the shared-folders methods the primary implementations and turn the
legacy collections methods into obsolete stubs that forward to them.
Drop the shared-folders POST aliases, since the POST collections
endpoints are already deprecated in favor of PUT.
@aaronjordan
aaronjordan force-pushed the aj/pm-40199-alias-routes-for-shared-folder-operations branch from b9cbab8 to 1ddda3c Compare November 6, 2026 22:38
@aaronjordan
aaronjordan removed the request for review from a team November 6, 2026 22:39
@aaronjordan

aaronjordan commented Nov 6, 2026 •

Copy link
Copy Markdown
Author

TIL: the merge commit to sync up to main was the wrong decision.
rebased to avoid tagging half the company. 🙏

Also: added changes to address PM-46444, an extension of the initial ticket.

@aaronjordan
aaronjordan marked this pull request as ready for review November 6, 2026 22:40
SutProvider<CiphersController> sutProvider)
{
var response = await InvokeVNextAsync(id, userId, collectionId, sutProvider,
(sut, model) => sut.PutCollections_vNext(id, new CipherCollectionsRequestModel { CollectionIds = model }));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

❌ CRITICAL: Direct calls to the now-[Obsolete] PutCollections_vNext and PostBulkCollections raise CS0618, and TreatWarningsAsErrors turns that into an Api.Test build failure.

Details and fix

Directory.Build.props sets TreatWarningsAsErrors=true, and Api.Test.csproj only exempts CA1304. The obsolete legacy methods are called directly, with no suppression, at:

  • line 218: sut.PutCollections_vNext(...) (new)
  • line 234: sutProvider.Sut.PostBulkCollections(model) (new)
  • lines 3904 and 3943: sutProvider.Sut.PostBulkCollections(...) (existing tests, which break now that this PR marks PostBulkCollections obsolete)

These tests are meant to exercise the legacy routes, so wrap the calls the way this file already does elsewhere (see lines 1930 and 3423):

#pragma warning disable CS0618 // Deliberately exercising the legacy collections route.
(sut, model) => sut.PutCollections_vNext(id, new CipherCollectionsRequestModel { CollectionIds = model })
#pragma warning restore CS0618

Or point the lease-gate tests at lines 3904 and 3943 to PostBulkSharedFolders, since the legacy method now only forwards to it.

code-review

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Claude claims this is a false positive.

The Claude review's one finding is a false positive, so the REQUEST CHANGES verdict doesn't hold.

Claim: The tests call the now-obsolete PutCollections_vNext and PostBulkCollections without a CS0618 suppression. The review says this breaks the Api.Test build under TreatWarningsAsErrors.

Findings:

  • The calls are unsuppressed, as it says, but CS0618 is set to suggestion in .editorconfig:80. It never surfaces as a warning, so it can't be promoted to an error.
  • I forced a full recompile of Api.Test on the current head (1ddda3c). It built with 0 errors and 10 warnings, and all 10 are BWA0001, which the repo already exempts from TreatWarningsAsErrors.
  • The comment was posted on 2026-10-26 against an earlier commit. The PR has since been rebased and extended with PM-46444.
  • In CI, Lint and the Docker image builds have passed, apart from Admin and SeederApi, which were still pending when I checked. Run tests was also still pending, so that remains the last confirmation for this claim.

No change needed in response to this finding.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-review Request a Claude code review t:feature Change Type - Feature Development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants