Skip to content

refactor(keystore): MlsPendingMessage has no real primary key#1810

Merged
coriolinus merged 7 commits intomainfrom
prgn/refactor/mlspendingmessage-has-no-primary-key
Feb 2, 2026
Merged

refactor(keystore): MlsPendingMessage has no real primary key#1810
coriolinus merged 7 commits intomainfrom
prgn/refactor/mlspendingmessage-has-no-primary-key

Conversation

@coriolinus
Copy link
Contributor

What's new in this PR

We'd been faking it with an inefficient workaround, but we now have the trait infrastructure to handle this properly.


PR Submission Checklist for internal contributors
  • The PR Title
    • conforms to the style of semantic commits messages¹ supported in Wire's Github Workflow²
    • contains a reference JIRA issue number like SQPIT-764
    • answers the question: If merged, this PR will: ... ³
  1. https://sparkbox.com/foundry/semantic_commit_messages
  2. https://github.com/wireapp/.github#usage
  3. E.g. feat(conversation-list): Sort conversations by most emojis in the title #SQPIT-764.

@github-actions
Copy link

github-actions bot commented Jan 30, 2026

🐰 Bencher Report

Branchprgn/refactor/mlspendingmessage-has-no-primary-key
Testbedubuntu-latest

⚠️ WARNING: No Threshold found!

Without a Threshold, no Alerts will ever be generated.

Click here to create a new Threshold
For more information, see the Threshold documentation.
To only post results if a Threshold exists, set the --ci-only-thresholds flag.

Click to view all benchmark results
BenchmarkLatencymicroseconds (µs)
Commit add f(group size)/cs1/mem/1002📈 view plot
⚠️ NO THRESHOLD
15,433.00 µs
Commit add f(group size)/cs1/mem/2📈 view plot
⚠️ NO THRESHOLD
673.90 µs
Commit add f(group size)/cs1/mem/202📈 view plot
⚠️ NO THRESHOLD
3,795.70 µs
Commit add f(group size)/cs1/mem/402📈 view plot
⚠️ NO THRESHOLD
7,033.10 µs
Commit add f(group size)/cs1/mem/602📈 view plot
⚠️ NO THRESHOLD
10,480.00 µs
Commit add f(group size)/cs1/mem/802📈 view plot
⚠️ NO THRESHOLD
12,766.00 µs
Commit add f(number clients)/cs1/mem/1002📈 view plot
⚠️ NO THRESHOLD
980,780.00 µs
Commit add f(number clients)/cs1/mem/2📈 view plot
⚠️ NO THRESHOLD
654.48 µs
Commit add f(number clients)/cs1/mem/202📈 view plot
⚠️ NO THRESHOLD
79,031.00 µs
Commit add f(number clients)/cs1/mem/402📈 view plot
⚠️ NO THRESHOLD
213,970.00 µs
Commit add f(number clients)/cs1/mem/602📈 view plot
⚠️ NO THRESHOLD
422,010.00 µs
Commit add f(number clients)/cs1/mem/802📈 view plot
⚠️ NO THRESHOLD
669,090.00 µs
Commit pending proposals f(group size)/cs1/mem/1002📈 view plot
⚠️ NO THRESHOLD
114,390.00 µs
Commit pending proposals f(group size)/cs1/mem/2📈 view plot
⚠️ NO THRESHOLD
22,427.00 µs
Commit pending proposals f(group size)/cs1/mem/202📈 view plot
⚠️ NO THRESHOLD
40,684.00 µs
Commit pending proposals f(group size)/cs1/mem/402📈 view plot
⚠️ NO THRESHOLD
56,378.00 µs
Commit pending proposals f(group size)/cs1/mem/602📈 view plot
⚠️ NO THRESHOLD
75,667.00 µs
Commit pending proposals f(group size)/cs1/mem/802📈 view plot
⚠️ NO THRESHOLD
91,140.00 µs
Commit pending proposals f(pending size)/cs1/mem/1📈 view plot
⚠️ NO THRESHOLD
15,988.00 µs
Commit pending proposals f(pending size)/cs1/mem/101📈 view plot
⚠️ NO THRESHOLD
112,650.00 µs
Commit pending proposals f(pending size)/cs1/mem/21📈 view plot
⚠️ NO THRESHOLD
32,310.00 µs
Commit pending proposals f(pending size)/cs1/mem/41📈 view plot
⚠️ NO THRESHOLD
53,736.00 µs
Commit pending proposals f(pending size)/cs1/mem/61📈 view plot
⚠️ NO THRESHOLD
72,500.00 µs
Commit pending proposals f(pending size)/cs1/mem/81📈 view plot
⚠️ NO THRESHOLD
92,989.00 µs
Commit remove f(group size)/cs1/mem/1002📈 view plot
⚠️ NO THRESHOLD
10,483.00 µs
Commit remove f(group size)/cs1/mem/2📈 view plot
⚠️ NO THRESHOLD
517.66 µs
Commit remove f(group size)/cs1/mem/202📈 view plot
⚠️ NO THRESHOLD
2,026.40 µs
Commit remove f(group size)/cs1/mem/402📈 view plot
⚠️ NO THRESHOLD
3,565.00 µs
Commit remove f(group size)/cs1/mem/602📈 view plot
⚠️ NO THRESHOLD
5,440.30 µs
Commit remove f(group size)/cs1/mem/802📈 view plot
⚠️ NO THRESHOLD
7,432.80 µs
Commit remove f(number clients)/cs1/mem/1002📈 view plot
⚠️ NO THRESHOLD
13,087.00 µs
Commit remove f(number clients)/cs1/mem/2📈 view plot
⚠️ NO THRESHOLD
132,730.00 µs
Commit remove f(number clients)/cs1/mem/202📈 view plot
⚠️ NO THRESHOLD
108,420.00 µs
Commit remove f(number clients)/cs1/mem/402📈 view plot
⚠️ NO THRESHOLD
85,487.00 µs
Commit remove f(number clients)/cs1/mem/602📈 view plot
⚠️ NO THRESHOLD
61,142.00 µs
Commit remove f(number clients)/cs1/mem/802📈 view plot
⚠️ NO THRESHOLD
37,060.00 µs
Commit update f(group size)/cs1/mem/1002📈 view plot
⚠️ NO THRESHOLD
132,030.00 µs
Commit update f(group size)/cs1/mem/2📈 view plot
⚠️ NO THRESHOLD
676.92 µs
Commit update f(group size)/cs1/mem/202📈 view plot
⚠️ NO THRESHOLD
27,320.00 µs
Commit update f(group size)/cs1/mem/402📈 view plot
⚠️ NO THRESHOLD
53,645.00 µs
Commit update f(group size)/cs1/mem/602📈 view plot
⚠️ NO THRESHOLD
81,311.00 µs
Commit update f(group size)/cs1/mem/802📈 view plot
⚠️ NO THRESHOLD
106,490.00 µs
🐰 View full continuous benchmarking report in Bencher

@coriolinus coriolinus force-pushed the prgn/refactor/mlspendingmessage-has-no-primary-key branch 2 times, most recently from 8a0c253 to 5c188e8 Compare February 2, 2026 13:17
@coriolinus coriolinus marked this pull request as ready for review February 2, 2026 13:32
@coriolinus coriolinus requested a review from a team February 2, 2026 13:32
@coriolinus coriolinus changed the title refactor(keystore): MlsPendingMessage has no primary key refactor(keystore): MlsPendingMessage has no real primary key Feb 2, 2026
@coriolinus coriolinus force-pushed the prgn/refactor/mlspendingmessage-has-no-primary-key branch from 5c188e8 to aa16b14 Compare February 2, 2026 14:23
Copy link
Contributor

@fewerner fewerner left a comment

Choose a reason for hiding this comment

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

To me this looks fine, ty!

This trait let us delete entities in batches corresponding
to the search key for which the trait is implemented.

Mostly it's here as special-case handling for `MlsPendingMessage`s,
but adding it as a trait generalizes things and overall reduces
special handling.
…`MlsPendingMessage`

This opens the door to a more general solution for this type.
Originally I'd hoped we could eliminate a non-unit key entirely, but it
turns out that we cannot. So a better solution is to compute a fast
deterministic hash of the content.

This is more space-efficient than run-length-encoding for obvious reasons,
and also avoids keeping copies of sensitive data in more places in memory
than are strictly required.

Given 128 bits of hashed data, the chance of a collision should be
infinitesimal.
@coriolinus coriolinus force-pushed the prgn/refactor/mlspendingmessage-has-no-primary-key branch from 5126f51 to 4818bbc Compare February 2, 2026 15:15
@coriolinus coriolinus merged commit 4818bbc into main Feb 2, 2026
1 check passed
@coriolinus coriolinus deleted the prgn/refactor/mlspendingmessage-has-no-primary-key branch February 2, 2026 15:15
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.

3 participants