Repository navigation
Conversation
dhruv8sh
left a comment
There was a problem hiding this comment.
PR Review
Summary
Adds a structured KvError::TtlLimitExceeded { requested, maximum } for TTLs above MAX_TTL while keeping the HTTP 400 mapping. The change is narrow, well tested, and covers every "Done when" item in #323. Approving.
😃 Praise
- Tight scope: a one-line change in the validator, HTTP 400 is kept, and adapters are untouched.
Findings
Non-blocking
- 📝 Silent behaviour change for existing matchers: callers that matched over-cap TTLs as
KvError::Validation(_)will now fall through to their catch-all branch. BecauseKvErroris already#[non_exhaustive], nothing fails to compile. The HTTP status is still 400, anddocs/guide/kv.mdalready documents this, so a changelog or release note entry would be enough. - 📝 Fastly claim checked: the Fastly SDK converts the TTL with
ttl.as_secs().try_into().unwrap_or_default()into au32(fastly-0.13.1/src/kv_store/handle.rs:412). 365 days fits, so the current cap is safe. Any future configurable cap must reject values aboveu32::MAXseconds on Fastly; otherwise the TTL silently becomes 0. - 🌱 Ready for a configurable cap:
maximumalways equalsMAX_TTLfor now. Because the error reports the cap that was actually applied, the per-store cap the issue prefers can be added later without breaking the API.
CI Status
- fmt: PASS
- clippy: PASS
- tests: PASS
- feature check (
fastly cloudflare spin): PASS
ChristianPavilonis
left a comment
There was a problem hiding this comment.
😃 Clear retention-policy contract. The structured error preserves the existing TTL bounds, pre-backend rejection, and HTTP 400 mapping. The migration guidance in docs/guide/kv.md:206–241 clearly distinguishes the portable cap from provider capabilities and explains how callers can replace silent clamping with an explicit policy decision.
No new defects found. Formatting, all-feature Clippy, workspace tests, feature compilation, all three adapter WASM compilation checks, and docs checks passed.
|
Addressed the non-blocking migration-note feedback in c31e8f9: |
Summary
KvError::TtlLimitExceeded { requested, maximum }when typed or raw KV TTL writes exceed the portable 365-day cap, including writes through named handles. Callers can distinguish a retention rejection without parsing a generic validation message.u32, with zero fallback on overflow; Spin does not support TTL writes.Changes
edgezero-core/src/key_value_store.rsDuration::MAX, with backend-call assertions.docs/guide/kv.mddocs/superpowers/specs/2026-11-13-kv-ttl-limit-error-design.mddocs/superpowers/plans/2026-11-13-kv-ttl-limit-error.mdCloses
Closes #323.
Test plan
Historical author-reported local verification below (original head unrecorded unless an explicit SHA is given). These results, counts, timings and negative controls were not rerun in this audit, and their underlying local logs were unavailable; checked boxes retain the original report. At the current head
5e63adc2, all 28 reported hosted checks are passing.Verified locally using Rust/Cargo 1.98.1 and Node 24.20.0. Cargo checks/tests used
--locked --offline.cargo test --workspace --all-targets— 1,554 passed, zero failed, one existing ignored test. Local-server fixtures needed socket access outside the restricted sandbox.cargo clippy --workspace --all-targets --all-features -- -D warningscargo fmt --all -- --checkcargo check --workspace --all-targets --features "fastly cloudflare spin"wasm32-wasip1, Spinwasm32-wasip2, Cloudflarewasm32-unknown-unknown, each with its adapter feature.npm run lint,npm run format, andnpm run build.manifest.rsandtest_env.rs, none in changed KV docs.examples/app-demoworkspace tests — not run.edgezero servetesting — not run; adapter implementations and supported TTL bounds are unchanged.Focused local regression command from the repository root:
cargo +1.98.1 test --locked -p edgezero-core key_value_store::testsThis command uses an in-memory backend through actual KV handles; it requires no provider account or credentials.
Checklist
CLAUDE.mdconventions.httpimports.KvRegistry; production store wiring is unchanged.