Repository navigation
docs(maintenance): explain how to test invocation-scoped state - #5661
Merged
Merged
Conversation
Documents in CODING_STANDARDS.md why concurrency tests reset the InvokeStore in beforeEach, why sequence() suffices inside invocation callbacks, and why code that runs before it must call getInstanceAsync() after stubbing AWS_LAMBDA_MAX_CONCURRENCY. Adds pointers from the sequence() JSDoc and the AWS_LAMBDA_BENCHMARK_MODE line in setupEnv. Closes #5619
Applies wording fixes from review: drops the getInstanceAsync(true) escape hatch, narrows the throw claim to invocation-scoped reads and writes, and shortens the sentences.
dreamorosi
approved these changes
Sep 7, 2026
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.
Summary
Documents why the concurrency tests in Logger, Metrics, and Batch reset the
InvokeStoreinbeforeEach, whysequence()is enough inside invocation callbacks, and why code that runs beforesequence()must callgetInstanceAsync()after stubbingAWS_LAMBDA_MAX_CONCURRENCY. None of this was written down anywhere in the repo and had to be re-derived from the@aws/lambda-invoke-storesource while reviewing #5615.Changes
CODING_STANDARDS.md, covering the lazy publication ofglobalThis.awslambda.InvokeStore, the module-level instance cache whose kind is fixed on first creation, thereset()andgetInstanceAsync()ordering rule with a minimal example, the silent failure mode when the order is wrong, and thevi.stubGlobal('awslambda', undefined)/vi.unstubAllGlobals()pairing used by theInvokeStore is not availabletests.@aws/lambda-invoke-storeto its npm page.sequence()JSDoc inpackages/testing/src/helpers.tsstating that it callsgetInstanceAsync()itself and pointing pre-sequence()code at the standards doc.AWS_LAMBDA_BENCHMARK_MODEinpackages/testing/src/setupEnv.tsexplaining that it exposesInvokeStore._testing.reset().Issue number: closes #5619
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.