Repository navigation
fix(function_pod): as_table clears a stale cache before using it (ITL-1045) - #358
Conversation
…-1045) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
ITL-1045 as_table builds rows and content hashes in two passes: a stale upstream between them gives old rows with new rows' hashes
OverviewFound on November 12, 2026 by the code sweep of ITL-1034 and reproduced by that worker on current
s1 = stamp.pod(src) # stamp is not deterministic (a counter, a timestamp, a random draw)
s2 = plus_one.pod(s1)
s2.as_table() # z = [2, 103, 204]
s1.clear_cache() # public; s2.is_stale -> True
t = s2.as_table(columns={"content_hash": True}) # z still [2, 103, 204]
# no row's _content_hash is the hash of its own z (0 of 3); a fresh read gives z = [302, 403, 504]With a deterministic function the recomputed values are the same and the table stays aligned, so it needs an upstream whose values changed. Goals & Success Criteria
Scope & BoundariesIn scope:
Out of scope:
Dependencies
|
|
Warning Review limit reachedThe included review limit has been reached and this organization has disabled usage-based review continuation. Wait for reviews to reset or ask a billing admin to change After included review limits. Next included review available in 57 seconds. View limit details
|
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the change that clears stale caches before table assembly.
No open issues 🎉
What changed in this PR
Fixes ITL-1045 by clearing stale caches before as_table() uses them, keeping returned rows aligned with their content hashes. This builds on #355’s transitive staleness handling.
Changes:
- Adds upfront staleness checks to function pod streams and function nodes; cached pod streams inherit the fix.
- Adds regression coverage for stale reads, content-hash alignment, and related public read methods.
- Records the fix in the design issue, implementation plan, and changelog without changing hashes, stored layouts, or public APIs.
| File | Description |
|---|---|
tests/test_core/function_pod/test_as_table_stale_between_passes.py |
Adds regression tests for stale reads and row/hash alignment. |
superpowers/plans/2026-11-13-itl-1045-as-table-two-passes.md |
Documents the fix strategy and test scope. |
src/orcapod/core/nodes/function_node.py |
Clears stale node caches before table assembly. |
src/orcapod/core/function_pod.py |
Clears stale pod-stream caches before table assembly. |
design_issues/ITL-1045-FP1.md |
Records the defect and its resolution. |
changelog.d/ITL-1045.md |
Adds the release note for the stale-cache fix. |
Review effort: Balanced
…nfiguration (ITL-1034) Merge main at 5c7a058 (#351 ITL-1050, #354 ITL-1053, #356 ITL-1060, #358 ITL-1045, #360 ITL-1065, #361). With --runxfail only the ITL-1066 cases fail, so every ITL-1050, ITL-1060, ITL-1065 and ITL-1045 mark is removed. head(n, cfg) now takes sort_by_tags and all_info: node, operator and stream heads are checked under every configuration, must be sorted when asked and must equal as_table(cfg).slice(0, n). Previews before a full read sort the rows the stream holds; the check allows any order among tied tags. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fixes ITL-1045
What
FunctionPodStream.as_table(_CachedFunctionPodStreaminherits it) andFunctionNodeBase.as_tableused their cached table without a staleness check and built the content hashes in a seconditer_data()pass, which is the pass that clears a stale cache. With a non-deterministic function, an upstreamclear_cache()betweenas_table()andas_table(columns={"content_hash": True})gave the OLD rows with the hashes of the NEW rows.as_tablenow clears a stale cache first (the same two lines in both), so the table and the hashes come from the same rows and the call returns the current rows. It builds on #355 (staleness is transitive, a pod stream stamps only when complete); nothing here stamps at the start of a read.Evidence
tests/test_core/function_pod/test_as_table_stale_between_passes.py, public interface, tags not in order, a call-counter function): pod stream and pod-cached stream failed before the fix (0 of 3 rows carried their own hash), pass after.head()anditer_data()after the same sequence were already correct (tests added, pass).upstream_node.clear_cache()the job node is stale, but its values are re-read from the store, so the rows are the same and the hashes aligned (checked on the unfixed code). It was latent; the shared base-class fix covers it, and a test pins it.🤖 Generated with Claude Code