-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Upstream Change Summary
Type: architectural-change
Difficulty: Hard
Recommendation: Adopt
Upstream PR #1787 introduces target state ownership transfer between components — enabling one component to "take over" a target state path from another via an update operation rather than a delete + re-insert. This restructures pre_commit into two phases and adds inverted tracking (TargetStateOwnerInfo) that maps each TargetStatePath to its owning component.
This is a meaningful correctness improvement: without it, transferring target state ownership between components causes a disruptive delete + insert cycle rather than an in-place update, which can break downstream consistency and is unnecessarily expensive.
Upstream References
- PR: feat: target state ownership transfer between components cocoindex-io/cocoindex#1787
- Upstream repo: https://github.com/cocoindex-io/cocoindex
Relevant Upstream Files / Areas
rust/core/src/engine/context.rs→crates/recoco-core/src/execution/(context)rust/core/src/engine/execution.rs→crates/recoco-core/src/execution/(execution engine)rust/core/src/state/db_schema.rs→crates/recoco-core/src/execution/(state tracking)python/tests/core/test_ownership_transfer.py→ Rust integration tests to be written
Recoco Considerations
- Affected modules:
crates/recoco-coreexecution engine and state tracking - Key structural changes needed:
- Add
TargetStateOwnerInfoinverted tracking map (mapsTargetStatePath→ owning component) - Restructure
pre_commitinto two phases:- Phase 1: Process inserts/updates; preempt ownership from other components via inverted tracking
- Phase 2: Handle deletes/contained entries for remaining tracked entries
- Rename
DeclaredEffect→DeclaredTargetStateandeffect_items→target_state_items
- Add
- Performance: The inverted tracking adds memory overhead but eliminates unnecessary delete+insert round-trips; net positive for execution efficiency
- Feature-gating: No new ops — applies to all target types, no new feature gate needed
- API surface: The
DeclaredTargetStaterename may surface in the public API if these types are exported
Integration Notes
The rename DeclaredEffect → DeclaredTargetState is a breaking change to any internal API using that type. Check recoco's current naming conventions against upstream before adopting. The two-phase pre_commit restructure is the most complex part — requires careful review of execution.rs to ensure recoco's state management remains consistent.