Make plugin SDK inventory test contention-safe - #2490
Merged
ymichael merged 1 commit intoAug 26, 2026
Merged
Conversation
ymichael
deleted the
bb/ci-flake-fix-plugin-api-inventory-5s-timeout-thr_k5jadt4yz7
branch
August 26, 2026 18:58
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.
Human comments
What was wrong
At the independently verified merge-base
7dc6756e20ba749ad9d4d6d939b1dd7de363250b, the public SDK inventory test parsed and printed every non-internal generated declaration bundle with TypeScript inside a single 5-second Vitest case. That repeated heavyweight work was redundant because@get-bb/plugin-sdk#build:typeshad already parsed and normalized the declarations, and scheduler contention could stretch the case from its usual ~2 seconds in GitHub Actions to 6.46 seconds (failed run). A local 160-way contention harness reproduced the exact line-55 timeout in 158 of 160 invocations. Profiling showed declaration reads plus raw hashing took under 2 ms unloaded, while the repeated AST parse/print consumed about 160 ms unloaded and 5.4–8.8 seconds under that contention.What changed
The inventory now scans the already-built declaration token stream and hashes each token kind, byte length, and text. This preserves the exact declaration-shape gate while continuing to ignore comments and formatting, without constructing and printing ten TypeScript ASTs inside the timed test. The committed inventory digests were regenerated for the new canonical representation, and a focused contract test proves trivia-only changes are ignored while an API token change changes the digest.
There are no timeout changes, production behavior changes, wire changes, CLI changes, or user-facing configuration changes.
How you verified
hashDeclarationTokens is not a function; afterward,api-sync.test.tspasses 4/4 in 34 ms.pnpm exec turbo run build:types --filter=@get-bb/plugin-sdk --forcepnpm exec turbo run typecheck --filter=@bb/plugin-api-map --forcepnpm exec turbo run test --filter=@bb/plugin-api-map --force— 11 files, 75 tests passedgit diff --check