feat(testing): add a lock ttl option to the store contract #28
All Vouch review confidence checks passed
Residual risk 0.17 = Change Risk (0.40) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 284 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.338
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #28"
general
weight: 0.35
kamilmysliwiec
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
idempotencyStoreContract()hard-codesLOCK_TTL = 600ms, and derives the expiry margin (150) and the record ttl (1800) from it. For a store that performs a network round trip per call (e.g. a PostgreSQL store, one transaction per call), thekeeps keys apart exactly, however similar or longcase acquires 18 keys in a row and then expects key #0 to still be locked. Under parallel load on a shared database those acquires can take longer than 600 ms, so key #0 expires and the case fails withacquiredinstead ofin-flight.Issue Number: #21
What is the new behavior?
idempotencyStoreContract()accepts alockTtloption (in ms). The expiry margin is derived aslockTtl / 4and the record ttl as3 * lockTtl, so the default600reproduces today's600 / 150 / 1800exactly, and there is no behavior change for existing callers. A non-positive-integer value throws aRangeError, mirroring the existingconcurrent.callersvalidation.A store that needs more time per call can now run the contract without a flaky case, for example
idempotencyStoreContract(createStore, { lockTtl: 2_000 }). The expiry cases still wait throughadvanceTime, so a larger ttl only makes them slower, never less correct.Does this PR introduce a breaking change?
The option is additive and the default preserves the current values.
Other information
Tests: added
refuses a lock ttl that is not a positive whole number of millisecondsand threadedlockTtl: 120through the existing async-factory/async-clock test.npm run test:e2e(381 passed),npm run lint, andnpm run buildall pass.