Skip to content

QA-2420: add OrganizationCardCipherScene to the seeder - #8294

Merged
awiester-bw merged 1 commit into
mainfrom
QA-2420-seeder-org-card-cipher-scene
Sep 2, 2026
Merged

QA-2420: add OrganizationCardCipherScene to the seeder#8294
awiester-bw merged 1 commit into
mainfrom
QA-2420-seeder-org-card-cipher-scene

Conversation

@awiester-bw

Copy link
Copy Markdown
Contributor

🎟️ Tracking

QA-2420: https://bitwarden.atlassian.net/browse/QA-2420

📔 Objective

The seeder can create org-owned login ciphers but has no way to create an org-owned card cipher; card seeding exists user-side only. This blocks per-test seeding for the org ClientEvents card tests, whose cases view and edit a card in an org collection and need one already seeded. This adds OrganizationCardCipherScene, mirroring UserCardCipherScene for the card fields and OrganizationLoginCipherScene for owner resolution and collection-aware persistence: it resolves the org, encrypts the card with the org key (OrganizationId set, UserId null), and writes it to the requested collections through CreateAsync(cipher, collectionIds). CardCipherSeeder already produces an org-key card, so it is unchanged. The reflection-based scene registration picks the scene up automatically by class name.

Includes a factory unit test that seeds an org card with a generated org key and asserts ownership (Card type, OrganizationId set, UserId null) plus per-field decryption back to plaintext with the org key. Verified by a passing build (0 errors) and the code-review and security-review agent passes.

@awiester-bw awiester-bw added the t:misc Change Type - ¯\_(ツ)_/¯ Prefer using other type labels label Aug 31, 2026
@codecov

codecov Bot commented Aug 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 63.76%. Comparing base (2142748) to head (fd0eea4).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8294      +/-   ##
==========================================
- Coverage   63.77%   63.76%   -0.01%     
==========================================
  Files        2470     2470              
  Lines      105918   105918              
  Branches     9596     9596              
==========================================
- Hits        67544    67543       -1     
- Misses      36054    36055       +1     
  Partials     2320     2320              

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

@awiester-bw
awiester-bw force-pushed the QA-2420-seeder-org-card-cipher-scene branch 2 times, most recently from 1c3a2cf to f020dcf Compare August 31, 2026 21:42
@theMickster theMickster added the ai-review Request a Claude code review label Sep 1, 2026
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

🤖 Bitwarden Claude Code Review

Overall Assessment: APPROVE

Re-reviewed after the force-push; the changeset is now a single new file, util/Seeder/Scenes/OrganizationCardCipherScene.cs. The scene matches OrganizationLoginCipherScene for org lookup, null-check, and CreateAsync(cipher, collectionIds) persistence, and UserCardCipherScene for card field construction — OrganizationId is set with UserId null, and the org key is the only key passed to CardCipherSeeder.Create, so no plaintext vault data reaches the database. Notes and Reprompt travel the same CipherSeedCipherViewDtoEncryptedCipherDto → entity path the pipeline fixtures already use, and reading cipher.Id after CreateAsync is correct because SetNewId() mutates the same instance before the insert. The previously flagged CardCipherSeederTests.cs was removed at the reviewer's request, so that thread is resolved; scene registration is reflection-based and no Seeder doc catalogs individual cipher scenes, so neither DI nor docs need updating.

Code Review Details

No findings.

Comment thread test/SeederApi.IntegrationTest/Factories/CardCipherSeederTests.cs Outdated

@theMickster theMickster left a comment

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.

The Claude Code Comment here is the one fix to the PR that we should make. Otherwise, I'm good with the code.

Comment thread test/SeederApi.IntegrationTest/Factories/CardCipherSeederTests.cs Outdated
Adds a standalone OrganizationCardCipherScene that seeds an org-owned card cipher encrypted with the org key and assigned to the requested collections, mirroring UserCardCipherScene for card fields and OrganizationLoginCipherScene for owner resolution and collection-aware persistence. CardCipherSeeder is unchanged. Includes a factory unit test asserting org ownership and per-field org-key decryption.
@awiester-bw
awiester-bw force-pushed the QA-2420-seeder-org-card-cipher-scene branch from f020dcf to fd0eea4 Compare September 2, 2026 13:24
@awiester-bw
awiester-bw merged commit ed4856e into main Sep 2, 2026
51 checks passed
@awiester-bw
awiester-bw deleted the QA-2420-seeder-org-card-cipher-scene branch September 2, 2026 14:50
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:misc Change Type - ¯\_(ツ)_/¯ Prefer using other type labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants