Skip to content

test(cachekit): pin {"ttl": null} decoding of TtlResponse (LAB-3593) - #78

Open
27Bslash6 wants to merge 1 commit into
mainfrom
lab-3593-ttl-null-test
Open

27Bslash6 wants to merge 1 commit into
mainfrom
lab-3593-ttl-null-test

Conversation

@27Bslash6

@27Bslash6 27Bslash6 commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR adds a test to pin the JSON decoding behavior of TtlResponse when the server returns a ttl field with a null value (LAB-3593).

Changes

Adds a new unit test ttl_response_decodes_null_ttl_as_none in crates/cachekit/src/backend/cachekitio_ttl.rs that verifies three decoding scenarios:

  • {"ttl": null} decodes successfully to None (representing a live key with no expiry), rather than producing a parse error.
  • {"ttl": 42} decodes successfully to Some(42).
  • {"ttl": null, "extra": 1} produces an error, confirming that unexpected/extra fields are rejected.

Purpose

The server responds with {"ttl": null} for live keys that have no expiry set. This test locks in the expected behavior that such a response is treated as a valid None value and not misinterpreted as a decoding failure, guarding against future regressions in TtlResponse deserialization.

The server answers 200 {"ttl": null} for a live key with no expiry.
TtlResponse must keep decoding that to None; without a test, changing
the field to a bare u64 passes CI and turns every such key into a
client-side parse error. Also pins deny_unknown_fields.
@kodus-27b

kodus-27b Bot commented Sep 14, 2026

Copy link
Copy Markdown

Kody Review Complete

Great news! 🎉
No issues were found that match your current review configurations.

Keep up the excellent work! 🚀

Kody Guide: Usage and Configuration
Interacting with Kody
  • Request a Review: Ask Kody to review your PR manually by adding a comment with the @kody start-review command at the root of your PR.

  • Validate Business Logic: Ask Kody to validate your code against business rules by adding a comment with the @kody -v business-logic command.

  • Provide Feedback: Help Kody learn and improve by reacting to its comments with a 👍 for helpful suggestions or a 👎 if improvements are needed.

Current Kody Configuration
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug
Performance
Security
Business Logic

Access your configuration settings here.

@coderabbitai

coderabbitai Bot commented Sep 14, 2026

Copy link
Copy Markdown

Review Change StackReview 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: Team

Run ID: 962046f8-8790-408b-b5c9-63e5529c4bbe

📥 Commits

Reviewing files that changed from the base of the PR and between 306c1b1 and cec9249.

📒 Files selected for processing (1)
  • crates/cachekit/src/backend/cachekitio_ttl.rs

Included review availability: 0 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 2 reviews per hour.


Walkthrough

The change adds unit coverage for TtlResponse deserialisation. The tests check null, numeric TTL values, and unknown response fields.

Changes

TTL response tests

Layer / File(s) Summary
TTL deserialisation coverage
crates/cachekit/src/backend/cachekitio_ttl.rs
Tests verify that null maps to None, numeric TTL values map to Some(value), and unknown fields are rejected.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Other

Merge Risk: ⚪ Minimal · up to cec92

This PR adds focused TTL decoding coverage without changing production behavior, so it is mergeable after normal checks.

🚥 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%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies a regression test for TtlResponse TTL decoding and matches the pull request changes.
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.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch lab-3593-ttl-null-test

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

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