Skip to content

refactor!: delete dead L1 namespace-index/bulk-invalidation machinery (LAB-1433) - #258

Merged
27Bslash6 merged 2 commits into
mainfrom
lab-1433-l1-namespace-index-dead-code
Aug 5, 2026
Merged

refactor!: delete dead L1 namespace-index/bulk-invalidation machinery (LAB-1433)#258
27Bslash6 merged 2 commits into
mainfrom
lab-1433-l1-namespace-index-dead-code

Conversation

@27Bslash6

@27Bslash6 27Bslash6 commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR removes unused (dead) namespace-index and bulk-invalidation functionality from the L1 cache, along with all associated configuration and documentation.

Changes

Configuration (L1CacheConfig)

  • Removed the namespace_index config option entirely from nested.py.
  • Removed all namespace_index=... settings from the minimal(), production(), secure(), dev(), test(), and io() intent presets in decorator.py.

L1 Cache (l1_cache.py)

  • Removed the namespace field from the CacheEntry dataclass.
  • Removed the config and namespace parameters from L1Cache.__init__ and put().
  • Removed the internal _namespace_index data structure and all logic that maintained it during put() and _remove_entry().
  • Deleted three unused public methods: invalidate_by_key(), invalidate_by_namespace(), and invalidate_all().

Documentation

  • Removed namespace_index references and the "Namespace Index" feature column from README.md, docs/configuration.md, and docs/features/l1-invalidation.md, including updated feature/preset matrices.
  • Removed the namespace-index memory-impact note.

Purpose

The namespace-index and bulk-invalidation machinery was dead code — the configuration was exposed and documented but the invalidation methods were unused. This change deletes it to simplify the L1 cache implementation, its configuration surface, and the associated documentation (LAB-1433).

Notes

The .secrets.baseline file was updated to reflect the shifted line number in decorator.py and a new generation timestamp.


Based on the code changes provided, I can only see a single documentation change in docs/configuration.md.

Description

This pull request updates a documentation label in docs/configuration.md, changing the description of the io() preset's backend from "Managed SaaS backend" to "CachekitIO managed SaaS backend" to more explicitly identify the managed service by name.

Note on Scope

The PR title indicates this change should delete dead namespace-index/bulk-invalidation machinery in the L1 layer (LAB-1433). However, the code changes provided contain only a minor documentation wording update in docs/configuration.md.

The actual dead-code deletion described in the title is not reflected in the provided patches. If the L1 namespace-index/bulk-invalidation removal is intended to be part of this PR, those file changes appear to be missing from the diff shown here. I'd recommend verifying that all intended changes were included before merging.


Summary

This PR removes the dead L1 namespace-index and bulk-invalidation code that was never wired into any active code path (LAB-1433).

Changes

Configuration cleanup:

  • Removed the namespace_index field from L1CacheConfig in src/cachekit/config/nested.py
  • Removed all namespace_index settings from the six intent presets (minimal, production, secure, dev, test, io) in src/cachekit/config/decorator.py

L1 cache implementation cleanup (src/cachekit/l1_cache.py):

  • Removed the namespace field from CacheEntry
  • Removed the _namespace_index data structure and all bookkeeping tied to it in put, _remove_entry, and initialization
  • Dropped the config and namespace/per-entry namespace parameters from __init__ and put
  • Deleted three unused public methods: invalidate_by_key, invalidate_by_namespace, and invalidate_all
  • Cleaned up now-unused imports (defaultdict)

Documentation updates:

  • Removed all references to namespace_index and the L1 Namespace Index feature from README.md, docs/configuration.md, and docs/features/l1-invalidation.md, including the corresponding feature-matrix columns

Other:

  • Updated .secrets.baseline to reflect shifted line numbers and a new generation timestamp

Purpose

The namespace-index/bulk-invalidation machinery was unused dead code. Removing it simplifies the L1 cache, configuration surface, and documentation while eliminating per-entry namespace tracking overhead.

Summary by CodeRabbit

  • Changes

    • Removed namespace-based indexing and invalidation from the L1 cache.
    • Simplified cache entries to track keys, expiry, values, and sizes.
    • Removed key, namespace, and full-cache invalidation operations.
    • Retained TTL and byte validation, oversized-entry rejection, and LRU eviction.
  • Documentation

    • Updated configuration guides, feature comparisons, and L1 cache documentation to reflect the streamlined behaviour.
    • Removed namespace-index configuration examples and related performance references.

@kodus-27b

This comment has been minimized.

@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

The L1 cache no longer supports namespace-indexed invalidation. Related configuration and documentation were removed. Invalidation tests and benchmarks were deleted.

Changes

L1 namespace invalidation removal

Layer / File(s) Summary
Remove namespace-aware L1 cache behaviour
src/cachekit/l1_cache.py, tests/unit/test_l1_invalidation.py, tests/performance/test_l1_invalidation_benchmarks.py
L1Cache no longer stores namespace metadata or exposes namespace invalidation methods. Related tests and benchmarks were deleted.
Remove namespace configuration
src/cachekit/config/nested.py, src/cachekit/config/decorator.py
L1CacheConfig.namespace_index and namespace-index preset arguments were removed.
Align documentation and baseline
README.md, docs/configuration.md, docs/features/l1-invalidation.md, .secrets.baseline
Namespace-index references were removed from documentation. The secrets baseline records the moved line and refreshed timestamp.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

  • cachekit-io/cachekit-py#237: Both changes remove unsupported L1 invalidation functionality and update related configuration and documentation.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the change and motivation but omits the template's Type of Change, security, testing, and backward compatibility sections. Complete the required checklist sections, mark the breaking change, document migration impact, and record test results before merging.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
Title check ✅ Passed The title clearly identifies the removal of dead L1 namespace-index and bulk-invalidation machinery.
✨ 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 lab-1433-l1-namespace-index-dead-code

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/cachekit/l1_cache.py (1)

57-62: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Add a return annotation to L1Cache.__init__.

L1Cache.__init__ is a public API. Add -> None to meet the required public API type-hint rule.

Proposed fix
     def __init__(
         self,
         max_memory_mb: int = 100,
         ttl_buffer_seconds: float = 1.0,
         namespace: str = "default",
-    ):
+    ) -> None:

As per path instructions, type hints on public APIs are required.

🤖 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 `@src/cachekit/l1_cache.py` around lines 57 - 62, Update the public constructor
L1Cache.__init__ to include a -> None return annotation, leaving its parameters
and initialization behavior unchanged.

Source: Path instructions

🤖 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 `@docs/configuration.md`:
- Line 350: Update the io() row in the configuration table to replace “Managed
SaaS backend” with the established service name “CachekitIO,” preserving the
surrounding access and stale-TTL details.

---

Outside diff comments:
In `@src/cachekit/l1_cache.py`:
- Around line 57-62: Update the public constructor L1Cache.__init__ to include a
-> None return annotation, leaving its parameters and initialization behavior
unchanged.
🪄 Autofix

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: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 273158f0-4f7a-4c70-9f37-51271abf84c8

📥 Commits

Reviewing files that changed from the base of the PR and between 878ad08 and 1841551.

📒 Files selected for processing (9)
  • .secrets.baseline
  • README.md
  • docs/configuration.md
  • docs/features/l1-invalidation.md
  • src/cachekit/config/decorator.py
  • src/cachekit/config/nested.py
  • src/cachekit/l1_cache.py
  • tests/performance/test_l1_invalidation_benchmarks.py
  • tests/unit/test_l1_invalidation.py
💤 Files with no reviewable changes (5)
  • tests/performance/test_l1_invalidation_benchmarks.py
  • src/cachekit/config/nested.py
  • src/cachekit/config/decorator.py
  • README.md
  • tests/unit/test_l1_invalidation.py

Comment thread docs/configuration.md Outdated
kodus-27b[bot]
kodus-27b Bot previously approved these changes Aug 4, 2026
@codecov

codecov Bot commented Aug 4, 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 added a commit that referenced this pull request Aug 4, 2026
…AB-1433)

CodeRabbit review on #258: the io() row said "Managed SaaS backend"
generically instead of naming CachekitIO, the established service name
used elsewhere in the docs.
@kodus-27b

This comment has been minimized.

… (LAB-1433)

The L1 namespace-index / bulk-invalidation surface (CacheEntry.namespace, L1Cache's config param + _namespace_index, put()'s namespace= kwarg, invalidate_by_key/invalidate_by_namespace/invalidate_all, and L1CacheConfig.namespace_index) was inert end-to-end: the production L1Cache is constructed without config, the decorator wrapper never passes namespace= to put(), and there were zero src/ callers of the three invalidate_by_* methods. Same trust-bug family as LAB-388/LAB-520 — delete rather than wire, per that precedent. Docs (README preset matrix, configuration.md, l1-invalidation.md) corrected to stop claiming the feature. The live per-key invalidation path (L1Cache.invalidate(), used by invalidate_cache()) is untouched.

BREAKING CHANGE: L1CacheConfig.namespace_index is removed. The flag was read by nothing and toggled no behavior, but it shipped in v0.17.1 and docs/configuration.md documented a copy-pasteable L1CacheConfig(..., namespace_index=True) example — L1CacheConfig is a frozen dataclass, so constructors still passing it now raise TypeError instead of silently lying. L1Cache.invalidate_by_key(), .invalidate_by_namespace() and .invalidate_all() are removed with it; per-key L1Cache.invalidate() is unaffected. Same removal shape as L1CacheConfig.invalidation_enabled in v0.16.0 (LAB-520).
…AB-1433)

CodeRabbit review on #258: the io() row said "Managed SaaS backend"
generically instead of naming CachekitIO, the established service name
used elsewhere in the docs.
@27Bslash6
27Bslash6 force-pushed the lab-1433-l1-namespace-index-dead-code branch from ccd5532 to 383eeba Compare August 5, 2026 00:05
@27Bslash6 27Bslash6 changed the title fix(l1): delete dead namespace-index/bulk-invalidation machinery (LAB-1433) refactor!: delete dead L1 namespace-index/bulk-invalidation machinery (LAB-1433) Aug 5, 2026
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@kodus-27b

kodus-27b Bot commented Aug 5, 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.

@27Bslash6

Copy link
Copy Markdown
Contributor Author

Review-gate finding: this removal is breaking, and was typed as a patch

Caught during the review-signoff gate. No code changedgit diff ccd5532 383eeba is empty. Only the commit type and message changed.

The problem. L1CacheConfig is a @dataclass(frozen=True) exported from cachekit.config, and namespace_index shipped in released v0.17.1 — including a copy-pasteable example in the released docs:

v0.17.1:docs/configuration.md:246 →     namespace_index=True,

Removing a field from a frozen dataclass is not a silent ignore; L1CacheConfig(..., namespace_index=True) now raises TypeError. Typed as fix(l1):, release-please would have cut 0.17.2 — a patch, filed under "Bug Fixes" — so anyone on ~=0.17.0 who copied that documented example breaks on a routine upgrade with no changelog warning.

Precedent is unambiguous. This repo has removed a dead L1CacheConfig flag before and marked it breaking. From the v0.16.0 changelog:

⚠ BREAKING CHANGES
L1CacheConfig.invalidation_enabled is removed. The flag was read by nothing and toggled no behavior; constructors passing it now raise TypeError instead of silently lying.

That was #237 (refactor!:, LAB-520). Same class, same "dead flag that lied" rationale, same TypeError consequence. v0.15.0 (#239) and v0.12.0 did the same for their config removals.

The fix. Two changes, no code:

  1. Commit 1841551 reworded → refactor!: with a BREAKING CHANGE: footer naming the removed surface and the migration. Force-pushed as 08f25e8; tree is byte-identical.
  2. PR title retitled to refactor!:.

Both were needed: this repo squash-merges with squash_merge_commit_message: COMMIT_MESSAGES, so the footer must live in a commit body (the PR body is not read), while squash_merge_commit_title: COMMIT_OR_PR_TITLE takes the ! from the PR title.

Net effect: release-please now cuts 0.18.0 with a ⚠ BREAKING CHANGES entry instead of a silent 0.17.2.

Everything else stands. The deletion itself is correct and stays as reviewed — zero residual references to namespace_index / invalidate_by_* anywhere in the tree, and the live per-key path (L1Cache.invalidate(), 8 call sites in src/cachekit/decorators/wrapper.py) is untouched.

@27Bslash6
27Bslash6 merged commit 2607faf into main Aug 5, 2026
37 checks passed
@27Bslash6
27Bslash6 deleted the lab-1433-l1-namespace-index-dead-code branch August 5, 2026 01:12
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