Skip to content

PM-39866 - Enhance seeder to seed archive and deleted ciphers#7923

Open
theMickster wants to merge 2 commits into
mainfrom
seeder/add-archive-and-deleted-items
Open

PM-39866 - Enhance seeder to seed archive and deleted ciphers#7923
theMickster wants to merge 2 commits into
mainfrom
seeder/add-archive-and-deleted-items

Conversation

@theMickster

@theMickster theMickster commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

🎟️ Tracking

PM-39866

📔 Objective

Adds archive and delete lifecycle-state generation to the Seeder's density-driven cipher pipeline for both personal and organizational vaults. New DensityProfile rate + ceiling fields drive the feature similar to the pre-existing properties. Altered the LoginCipherScene.cs to handle archived ciphers.

🧪 Testing

Expand for details

End-to-end via the SeederApi scenes

Drove the SeederApi /seed endpoint end-to-end to build a full account graph and confirm the new
archive/delete request flags flow through the scene → factory → encrypted-entity path:

  • SingleUserScene + SingleOrganizationScene / OrganizationUserScene — create the
    user, the org, and org membership.
  • UserLoginCipherScene and OrganizationLoginCipherScene with Archived: true and
    Deleted: true — create archived and deleted login ciphers in both the personal and org
    vaults. Archived writes the per-user Archives JSON via CipherComposer.BuildArchivesJson
    (same shape as Cipher_Archive.sql); Deleted stamps DeletedDate.
  • Various cipher types via UserCardCipherScene, UserIdentityCipherScene,
    UserSecureNoteCipherScene, UserBankAccountCipherScene, UserDriversLicenseCipherScene,
    UserPassportCipherScene, UserSshKeyCipherScene — confirm the mixed-type creation path still
    seeds and encrypts correctly alongside the archived/deleted login ciphers.

Confirmed the seeded archived/deleted login ciphers surface correctly in the web-vault UI (Archive
and Trash tabs) when logged in as the seeded user and org owner.

Live preset seed + SQL verification

Seeded Scale presets via dotnet run -- preset --name scale.<name> --mangle and queried
[dbo].[Cipher] directly (verification.md Q9 + Q11) for each. Every count landed exactly on the
configured target/cap — no overshoot, no starvation:

Preset Org ciphers Deleted (Q9) Archived (Q11) Both Notes
Central Perk (XS) 200 4 8 2 percentage targets (2% / 4% / 1%)
Bluth Company (SM) 500 20 40 15 percentage targets (4% / 8% / 3%)
Umbrella Corp (MD) 3,000 25 50 25 clamped to 25 / 50 caps; all
Tyrell Corp (LG) 17,000 25 50 25 clamped to 25 / 50 caps; all deleted also archived

Step 4: Owner-visibility guarantee (live)

Logged into the web-vault UI as the seeded org Owner and confirmed the Owner always has at least one
collection-assigned archived item and one deleted item visible — the Archive and Trash tabs
render them, matching the SQL counts. Verified for Central Perk and Bluth Company.

@theMickster theMickster added ai-review Request a Claude code review t:tech-debt Change Type - Tech debt labels Jul 3, 2026
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

🤖 Bitwarden Claude Code Review

Overall Assessment: APPROVE

Reviewed the Seeder density-pipeline enhancement that adds archived/deleted cipher lifecycle-state generation for both personal and org vaults. Traced the target-math (ComputeTargets), index selection (Select/EvenlySpacedIndices), round-robin owner attribution, and the deferred resolveArchiveOwner callback path in both GenerateCiphersStep and GeneratePersonalCiphersStep. This is dev/test tooling under util/Seeder with no production runtime or vault-crypto impact.

Code Review Details

No blocking findings.

Notable strengths that informed the assessment (no action required):

  • canArchive=false correctly zeroes both archivedTarget and bothTarget, so the deferred resolveArchiveOwner callback is never invoked with an empty position map.
  • Replacing EstimateTotal with the exact runningOffset makes expectedTotal precise rather than estimated, improving typeDistribution.Select bucketing.
  • Archived/deleted DaysAgo windows (15–90 vs 7–14) never overlap, guaranteeing ArchivedDate < DeletedDate for "both" ciphers, and this is locked in by regression tests.
  • New logic is backed by focused unit and regression tests in ArchiveAndDeleteRateTests and CipherComposerTests.

The three prior github-code-quality threads (unused locals, constant condition) are resolved in b9af380.

Comment thread util/Seeder/Steps/GenerateCiphersStep.cs Fixed
Comment thread util/Seeder/Steps/GeneratePersonalCiphersStep.cs Fixed
@theMickster theMickster marked this pull request as ready for review July 3, 2026 16:00
@codecov

codecov Bot commented Jul 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 61.36%. Comparing base (e899a9c) to head (b9af380).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7923   +/-   ##
=======================================
  Coverage   61.35%   61.36%           
=======================================
  Files        2236     2236           
  Lines       98547    98547           
  Branches     8911     8911           
=======================================
+ Hits        60468    60469    +1     
+ Misses      35943    35942    -1     
  Partials     2136     2136           

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

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:tech-debt Change Type - Tech debt

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant