fix: enforce idempotency TTL store conformance - #1385
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
๐ WalkthroughWalkthroughidempotency store conformance suite๊ฐ reserve, commit, fail์ ์๋ชป๋ TTL๊ณผ ์๋ต๋ TTL ๋์์ ๊ฒ์ฆํ๋๋ก ํ์ฅ๋์์ต๋๋ค. README์ changeset์๋ TTL ์ ํจ์ฑ ๋ฐ ChangesIdempotency TTL conformance
Estimated code review effort: 2 (Simple) | ~10 minutes ๐ฅ Pre-merge checks | โ 4 | โ 1โ Failed checks (1 warning)
โ Passed checks (4 passed)
โจ Finishing Touches๐ Generate docstrings
๐งช Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
๐ Benchmark Resultsโ All benchmarks passed
Updated: 2026-07-24T12:42:41.206Z ยท Commit: f7ab85f |
10784fd to
bfbbd9e
Compare
|
@coderabbitai review |
โ Action performedReview finished.
|
bfbbd9e to
7871103
Compare
|
@coderabbitai review |
โ Action performedReview finished.
|
7871103 to
9920b76
Compare
|
@coderabbitai review |
โ Action performedReview finished.
|
9920b76 to
08cb6f1
Compare
|
@coderabbitai review |
โ Action performedReview finished.
|
bfa53f0 to
fe45159
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
๐ค Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/idempotency-core/src/libs/conformance.ts`:
- Around line 158-259: Expand the TTL validation conformance cases around the
existing reserve, commit, and fail tests to cover representative invalid values
beyond zero, including negative, NaN/non-finite, fractional, and out-of-range
TTLs. Use separate createConformanceKey values and preserve the current
assertions that invalid inputs reject before changing reservation state.
๐ช Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
โน๏ธ Review info
โ๏ธ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: d19f54cc-f232-43ac-a079-9a700da010d9
โ Files ignored due to path filters (1)
packages/problems-core/src/generated/problem-code-registry.tsis excluded by!**/generated/**
๐ Files selected for processing (17)
.changeset/valid-idempotency-ttl.mddocs/problem-code-registry.jsonpackages/docs/src/content/docs/api/idempotency-core/src/classes/InvalidIdempotencyTtlProblem.mdpackages/docs/src/content/docs/api/idempotency-core/src/type-aliases/IdempotencyTtlOperation.mdpackages/docs/src/content/docs/api/idempotency-core/src/type-aliases/InvalidIdempotencyTtlReason.mdpackages/docs/src/content/docs/api/idempotency-core/src/variables/IDEMPOTENCY_DIAGNOSTIC_CODES.mdpackages/docs/src/content/docs/en/reference/problem-recovery-cookbook.mdpackages/idempotency-core/README.mdpackages/idempotency-core/src/index.tspackages/idempotency-core/src/libs/InMemoryIdempotencyStore.tspackages/idempotency-core/src/libs/conformance.tspackages/idempotency-core/src/libs/problems/IdempotencyProblems.tspackages/idempotency-core/src/tests/IdempotencyConformance.spec.tspackages/idempotency-core/src/tests/InMemoryIdempotencyStore.spec.tspublic-api-surface.snapshot.jsonscripts/static-misuse-raw-error-allowlist.jsontsconfig/contract-strict.baseline.json
fe45159 to
db7c526
Compare
db7c526 to
05ccd9b
Compare
05ccd9b to
a9b56c3
Compare
There was a problem hiding this comment.
โป๏ธ Duplicate comments (1)
packages/idempotency-core/src/libs/conformance.ts (1)
158-225: ๐ฏ Functional Correctness | ๐ Major | โก Quick win๊ธฐ์กด TTL ๋ํ๊ฐ ํ์ฅ ์ง์ ์ด ์ฌ์ ํ ์ ํจํฉ๋๋ค.
ํ์ฌ ์ธ transition์
ttlMs: 0๋ง ๊ฒ์ฆํฉ๋๋ค. ๊ณ์ฝ์ ๋ช ์๋ ์์,NaN/๋ฌดํ๋, ์์,Date๋ฒ์ ์ด๊ณผ ๊ฐ๋ reserveยทcommitยทfail๋ง๋ค ๊ฒ์ฆํด์ผ ์๋ํํฐ ์ ์ฅ์๊ฐ ์ ์ฒด invalid TTL ๊ณ์ฝ์ ์ฐํํ์ง ๋ชปํฉ๋๋ค. ์ถ๊ฐํ case ์ด๋ฆ์ ๋ง์ถฐIdempotencyConformance.spec.ts์ ๊ธฐ๋ ๋ชฉ๋ก๋ ํจ๊ป ๊ฐฑ์ ํ์ธ์.๐ค Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/idempotency-core/src/libs/conformance.ts` around lines 158 - 225, Expand the invalid-TTL conformance cases for reserve, commit, and fail beyond zero to cover negative, NaN/infinite, fractional, and Date-range-overflow values. Ensure each case asserts rejection with InvalidIdempotencyTtlProblem before any state change, preserving reservation state for commit and fail. Update the expected case-name list in IdempotencyConformance.spec.ts to include all newly added cases.
๐ค Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Duplicate comments:
In `@packages/idempotency-core/src/libs/conformance.ts`:
- Around line 158-225: Expand the invalid-TTL conformance cases for reserve,
commit, and fail beyond zero to cover negative, NaN/infinite, fractional, and
Date-range-overflow values. Ensure each case asserts rejection with
InvalidIdempotencyTtlProblem before any state change, preserving reservation
state for commit and fail. Update the expected case-name list in
IdempotencyConformance.spec.ts to include all newly added cases.
โน๏ธ Review info
โ๏ธ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: ce76b105-c874-4fb6-a0bf-8e88285b7e10
๐ Files selected for processing (4)
.changeset/9c4317b7.mdpackages/idempotency-core/README.mdpackages/idempotency-core/src/libs/conformance.tspackages/idempotency-core/src/tests/IdempotencyConformance.spec.ts
a9b56c3 to
e83fa0b
Compare
Fixes #1370.
Summary
trunkby fix: reject invalid idempotency TTLs and secure generated appsย #1449 instead of reintroducing a competing implementation.Verification
pnpm --filter=@croco/idempotency-core testโ 68/68 tests passed.pnpm typecheck --filter=@croco/idempotency-coreโ 4/4 tasks passed.pnpm lint --filter=@croco/idempotency-coreโ 2/2 tasks passed.pnpm static-misuse:checkโ all rules passed.pnpm checkโ repository profile passed 21/22 gates, with one non-applicable gate.git diff --checkโ passed.Self-review gates
Rebase accounting
The original PR commit
db7c526was rebased ontob65ed66. Its runtime/API/generated-artifact changes were already represented ontrunkby62885fe(#1449); the PR-only conformance and README changes were retained as9153ff2. Repository policy support is ine83fa0b, and the review-requested invalid TTL matrix is in94f6639.Residual risk
No known validation gap remains for the numeric TTL classes defined by the contract.