Skip to content

fix(cachekitio): surface HTTP 413 as a clear permanent "value too large" error#182

Merged
27Bslash6 merged 3 commits into
mainfrom
fix/cachekitio-413-too-large
Jun 15, 2026
Merged

fix(cachekitio): surface HTTP 413 as a clear permanent "value too large" error#182
27Bslash6 merged 3 commits into
mainfrom
fix/cachekitio-413-too-large

Conversation

@27Bslash6

@27Bslash6 27Bslash6 commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Surface an oversized-value rejection (HTTP 413) as a clear, permanent error in the SDK.

Change

  • error_handler.py: a dedicated 413 branch → BackendErrorType.PERMANENT with an actionable "value too large" message. (A 413 already classified PERMANENT via the generic 4xx branch; this gives a clearer message.) Retrying never helps — the value must shrink — so @cache.io degrades once and runs uncached instead of retrying.

Tests

  • Unit (CI): 413 → PERMANENT, message contains "too large".
  • E2E (sdk_e2e, run against a live worker — not default CI): multi-MB value round-trips; direct-HTTP round-trip + overwrite returns exactly the new value; oversized PUT → 413.

Context

A multi-MB @cache.io value previously surfaced a transient-classified error that the SDK retried before degrading silently. This makes the API's permanent "value too large" rejection (413) surface clearly and stop the wasted retries. The 25 MB max value size and 413 semantics are documented in the protocol spec.

(Also bumps the pinned pyo3 to 0.29 via merge from main to clear RUSTSEC-2026-0176/0177 in the security gate.)

Summary by CodeRabbit

Release Notes

  • Bug Fixes

    • Enhanced error handling for oversized cache payloads with clearer, non-retryable error messages that prevent unnecessary retry attempts.
  • Tests

    • Added integration tests validating large-value caching performance and proper enforcement of backend payload size limits.

…ge" error

When the SaaS rejects an oversized value with 413, classify it PERMANENT (it
already would via the generic 4xx branch) with an actionable message instead of
"Client error: HTTP 413", so the graceful-degrade log reads "value too large"
rather than a generic client error. Retrying never helps — the value must
shrink — so the decorator degrades: runs uncached, once.

Adds a unit regression (413 -> PERMANENT, message mentions "too large") and
multi-MB SaaS E2E tests (chunked round-trip, overwrite-shrink, 413 ceiling)
that exercise the server-side chunking landing in the SaaS backend. The E2E
tests are sdk_e2e-marked and run against a live worker, not in default CI.
@coderabbitai

coderabbitai Bot commented Jun 15, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 2d4d255f-d339-4bf3-afee-5067468ab5ce

📥 Commits

Reviewing files that changed from the base of the PR and between beffbfc and 9fd3583.

📒 Files selected for processing (3)
  • src/cachekit/backends/cachekitio/error_handler.py
  • tests/integration/saas/test_sdk_data_handling.py
  • tests/unit/backends/test_cachekitio_error_handler.py

Walkthrough

Adds a dedicated HTTP 413 branch to classify_http_error in the cachekitio backend that returns a PERMANENT BackendError with a "value too large" message. Includes a unit regression test and three integration tests covering multi-MB chunked value round-trips, stale chunk cleanup on overwrite, and oversized value rejection.

Changes

HTTP 413 Permanent Error Classification and Chunking Tests

Layer / File(s) Summary
413 permanent error classification and unit test
src/cachekit/backends/cachekitio/error_handler.py, tests/unit/backends/test_cachekitio_error_handler.py
classify_http_error gains an explicit if status == 413 branch returning BackendErrorType.PERMANENT with a "value too large for cachekit.io backend" message, overriding the generic 4xx path. Docstring updated to document the rule. Unit test on TestHTTPStatusClassification asserts the permanent error type and that the message contains "too large".
Integration tests: chunked round-trip, overwrite, and 413 rejection
tests/integration/saas/test_sdk_data_handling.py
Adds _size_limit_key helper and three E2E tests: SDK-layer round-trip of a ~13.5MB incompressible blob; raw HTTP PUT/GET of a large value followed by overwrite with a small value to confirm stale chunk cleanup; raw HTTP PUT of a ~26MB payload asserting a 413 response.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarises the main change: adding dedicated HTTP 413 handling as a permanent error with a clear 'value too large' message.
Description check ✅ Passed The description covers the change, motivation, tests, and context well. Type of Change is marked as bug fix. All critical sections are adequately addressed.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/cachekitio-413-too-large

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot]
coderabbitai Bot previously approved these changes Jun 15, 2026
@codecov

codecov Bot commented Jun 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@27Bslash6

Copy link
Copy Markdown
Contributor Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jun 15, 2026

Copy link
Copy Markdown
✅ Action performed

Full review finished.

@27Bslash6 27Bslash6 merged commit d76d526 into main Jun 15, 2026
32 checks passed
@27Bslash6 27Bslash6 deleted the fix/cachekitio-413-too-large branch June 15, 2026 08:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant