-
Notifications
You must be signed in to change notification settings - Fork 0
[upstream-sync] Fix component context plumbing for state/memo functions (upstream PR #1777) #135
Description
Upstream Change Summary
Type: bug-fix
Difficulty: Medium
Recommendation: Adopt
Upstream PR #1777 fixes a bug where use_context() calls inside __coco_memo_state__() (memoized state functions) didn't receive the correct component context. The fix plumbs the component context through to state functions so that context-dependent operations within memoized state work correctly.
The core Rust change is in rust/core/src/engine/component.rs — the PyO3 binding in rust/py/src/component.rs is irrelevant to recoco.
Upstream References
- PR: fix(ctx-plubming): plubming component ctx for state functions cocoindex-io/cocoindex#1777
- Upstream repo: https://github.com/cocoindex-io/cocoindex
Relevant Upstream Files / Areas
rust/core/src/engine/component.rs→crates/recoco-core/src/execution/or equivalent component modulerust/py/src/component.rs→ skip (PyO3 bindings, not applicable)
Recoco Considerations
- Affected modules:
crates/recoco-corecomponent execution / memoization logic - No Python to port: The Python binding changes (
rust/py/src/component.rs) are irrelevant - Correctness impact: Without this fix, any recoco user relying on
use_context()within state/memo functions gets silently wrong behavior — context is missing or stale - Feature-gating: No new feature gate needed; this is a core engine fix
- API surface: Likely internal — component context threading is an implementation detail
Integration Notes
Review rust/core/src/engine/component.rs diff to understand exactly where context was not being threaded through. Recoco's equivalent component execution code should receive the same fix. The companion test PR (#1782) is Python-only but the test cases describe the scenarios to validate: direct function call with use_context() in a state function, and mount() component scenario with memoization skip behavior. Write equivalent Rust integration tests when adopting this fix.