PM 31023 - Creating density models for Seeder#7157
PM 31023 - Creating density models for Seeder#7157theMickster wants to merge 12 commits intomainfrom
Conversation
|
Great job! No new security vulnerabilities introduced in this pull request |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7157 +/- ##
==========================================
+ Coverage 56.68% 56.77% +0.08%
==========================================
Files 2026 2026
Lines 88681 88685 +4
Branches 7905 7906 +1
==========================================
+ Hits 50272 50348 +76
+ Misses 36585 36507 -78
- Partials 1824 1830 +6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
|
|
||
| --- | ||
|
|
||
| ## Scale Preset Expected Values |
There was a problem hiding this comment.
I wonder if this adds a documentation burden. What if these expected values change? It may be more effective documentation-wise to provide a high level description of the shapes and diagrams, similar to what is shown in PM-31023. Then link to the presets, so readers can see how those high data distribution strategies get mapped to each preset
There was a problem hiding this comment.
I had Claude add this because I found it more than helpful for Claude to do the verifications for me as we tested. It could do the math of where we were slightly off from expected; and then it went and fixed the various loops/distributions until it was correct.
Maybe chat about this topic this week?
|
|
||
| ## QA | ||
|
|
||
| Handcrafted fixture data for visual UI verification. Known users, groups, collections, and permissions you can point at in the web vault. |
There was a problem hiding this comment.
This is overly verbose - QA does not only do visual UI verification with importable data. Maybe just, "Known users, groups, collections, and permissions you can point a client to." is a better representation
There was a problem hiding this comment.
10-4. Claude got a little excited and I didn't trim that.
| dotnet run -- seed --preset scale.{name} --mangle | ||
| ``` | ||
|
|
||
| | Preset | Tier | Archetype | Users | Groups | Collections | Ciphers | Plan | |
There was a problem hiding this comment.
This documentation is duplicated by verification.md. May be a nothingburger - but any updates to this need to then be updated in the verification.md too
There was a problem hiding this comment.
I'll work to trim these down when I break the work into 3-4 PRs shortly.
| @@ -0,0 +1,82 @@ | |||
| # Preset Catalog | |||
|
|
|||
| Complete catalog of all seeder presets, organized by purpose. Use `--mangle` to avoid collisions with existing data. | |||
There was a problem hiding this comment.
random note here (probably out of scope)- is there a situation where a user would not use --mangle?
There was a problem hiding this comment.
So I thought about this and, frankly, I am not so sure anymore 🤷🏼 Perhaps we look to invert the flag and, instead, it's a --no-mangle.
Say we're in a near perfect state in Q4 of 2026 with test automation, would you foresee it making more sense that we always use the mangle feature? 🤔
There was a problem hiding this comment.
I do foresee that. I imagine a "--no-mangle" would be for more rare "one-off" situations. Whereas, we would want most situations to be using mangle to prevent any confusion that might arise if someone did not have mangled data and did end up having data collisions




Not Planning to Publish because this is too large. Really just wanted to get the whole thing working and some eyes on it before breaking it down
🎟️ Tracking
PM-31023 - Relational Density Modeling
PM-32777 - Baked-In Density Preset Profiles
📔 Objective
Complete the density modeling additions to the Seeder in our presets. The work represents a sizable shift in the way the Seeder was first allocating entities as it created them. By leveraging the new JSON density property, we can now make precise adjustments to allocate entity distribution without changing the Seeder.
Key changes
Note on the Hamilton apportionment bug
The Distribution.Select() method divides items into percentage-based buckets using integer truncation, which leaves unclaimed remainder items. The old code silently dumped all remainder onto the last bucket — so a zero-weight HidePasswords bucket would still receive items. The fix uses Hamilton apportionment (largest-remainder method): remainder items go one-at-a-time to whichever buckets lost the most from truncation, and zero-weight buckets are guaranteed to receive exactly zero.
Alexander Hamilton — the first U.S. Secretary of the Treasury. He proposed this method in 1792 to apportion congressional seats among states. The math problem is the same: distribute a fixed number of indivisible items (seats, or in our case collection permissions) proportionally across groups when the proportional shares aren't whole numbers.
Where did our distribution statistics come from?
The scale preset archetypes are modeled after three real production organizations analyzed in DBOPS-91: Company A (hierarchical, 2,795 users/74 groups), Company B (flat, 11,491 users/5 groups/13,906 collections), and Company C (balanced, 954 users/99 groups). These profiles revealed that production relationship patterns follow power-law and mega-group distributions — not the uniform round-robin the seeder previously generated. Each scale preset's density parameters (membership skew, collection fan-out, permission weights, orphan rates) were calibrated to reproduce these observed production shapes at five tiers from family (6 users) to mega-corp (10,000 users).
Why the re-organization or presets?
The seeder is still early-adoption — breaking preset names now costs nearly nothing, but doing it after teams build scripts around them has cost. Purpose-based folders (features/qa/scale/validation) make preset discovery self-documenting so engineers don't need to read a README to find the right one. Consolidating docs into Seeds/docs/ eliminates duplication across scattered READMEs and separates everyday usage from developer-only verification content.
🧪 Testing
Expand for detailed instructions
Step 1: Verify preset resolution (all 4 folders)
From util/SeederUtility/, run one preset from each folder:
All four should seed successfully with no errors.
Step 2: Verify density distributions on a scale preset
Seed a mid-tier and large-tier preset:
After each, run the verification queries from util/Seeder/Seeds/docs/verification.md against your local MSSQL database. Compare results to the expected-value tables in the same doc.
Key things to verify
Step 3: Verify backward compatibility
Seed the no-density validation preset:
Key things to verify
This confirms the null-density path is unchanged.
Claude Code prompt for verification
Note: Mick has a
reading-bw-mssqlskill that automates the pwsh/SqlClient connection pattern. If you'd like it for your Claude Code setup, ask him to share it.If you'd like Claude Code to run the verification queries for you, use this prompt after seeding: