Repository navigation
perf(platform): index approved OAuth assets by content tuple - #556
Merged
cpojer merged 2 commits intoOct 23, 2026
Merged
Conversation
yangshun
marked this pull request as draft
October 23, 2026 00:35
yangshun
marked this pull request as ready for review
October 23, 2026 01:03
cpojer
reviewed
Oct 23, 2026
cpojer
left a comment
Member
There was a problem hiding this comment.
This is ridiculous. Sorry for the slop, and thanks for the fix!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue
OAuth upload validation currently scans every approved asset for each requested asset while holding the project lock. At the allowed 5,000-asset batch size, this can require millions of comparisons.
Fix
This reduces validation from O(approved × requested) to expected O(approved + requested).
Build a
Setof approved(blake3, md5, size)tuples, using a localassetApprovalKey()helper withJSON.stringifyfor both indexing and lookup. Project matching and exact matching of all three fields are preserved.Benchmark results
12 paired runs on Apple M2 Pro, Node v24.21.0. Validation timings include Set construction and JSON encoding; database, presigning, and network I/O are excluded.
The 5,000/5,000 case is about 68× faster.
Why the tests changed
Expanded coverage verifies multiple approved assets, reordered batches, duplicates, mismatched fields, mixed valid/invalid batches, and strict field types (
"3"versus3). All 19 tests pass against both the original and optimized implementations.Verification
Typechecking passed; 4,447 affected tests and 14,496 full-suite tests passed.