fix(caching): avoid storing metadata and results for CachingBehavior.IGNORE nodes - #1716
Open
Shoryamishra61 wants to merge 2 commits into
Open
Shoryamishra61 wants to merge 2 commits into
Shoryamishra61 wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The moderate test assertion issue remains unresolved.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (1)
What changed in this PR
Fixes CachingBehavior.IGNORE so ignored nodes do not persist cache metadata or results while downstream caching remains supported.
Changes:
- Restricts metadata persistence to
RECOMPUTE. - Restricts result persistence to
DEFAULTandRECOMPUTE. - Updates integration coverage for ignored nodes and downstream
<ignore>keys.
Review finding: Moderate — Strengthen the assertion at tests/caching/test_integration.py:522 to verify the fresh result store contains exactly B’s single entry.
| File | Summary |
|---|---|
tests/caching/test_integration.py |
Updates ignore-behavior expectations and adds regression coverage. |
hamilton/caching/adapter.py |
Prevents metadata and result persistence for ignored nodes. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Shoryamishra61
force-pushed
the
fix-ignore-cache-metadata-1704
branch
from
September 22, 2026 04:53
df6c96a to
d99c285
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Fixes #1704
Description
CachingBehavior.IGNOREis documented as "Results are never stored nor versioned" (adapter.py), but was previously included in the metadata storage branch indo_node_executeand the result storage branch inpost_node_execute. Becausepre_node_executereturns early forIGNOREnodes without creating acache_key, storing metadata resulted in entries withcache_key = NULL. In SQLite,INSERT OR IGNOREdoes not treatNULLas duplicate, leading to orphaned metadata entries accumulating on every run for ignored nodes.Changes
hamilton/caching/adapter.py:do_node_execute: removedCachingBehavior.IGNOREfrom the metadata persistence block, restricting it toCachingBehavior.RECOMPUTE.post_node_execute: removedCachingBehavior.IGNOREfrom the result store persistence block, keeping onlyDEFAULTandRECOMPUTE.IGNOREnodes and the"<ignore>"dependency version marker used by downstream nodes intact.tests/caching/test_integration.py:test_ignore_behaviorassertions to confirm that repeated executions with an ignored node do not increase metadata store size beyond the new<ignore>key created for downstream nodes.test_ignore_behavior_from_startverifying that when a node is ignored from run 1, it writes 0 metadata entries and 0 result store entries, while downstream nodes can still cache under the<ignore>dependency key.How I tested this
pytest tests/caching/test_integration.py -k "test_ignore_behavior" -vvpytest tests/caching/test_integration.py -vvpytest tests/caching/ -vvruff check,ruff format, license headers, etc.):pre-commit run --files hamilton/caching/adapter.py tests/caching/test_integration.pyChecklist