Add preview mode for update actions#1945
Open
MrAnayDongre wants to merge 2 commits into
Open
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
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.
Summary
Adds preview mode for update actions in both the Python API and CLI.
With preview enabled, CocoIndex computes the same target actions as a normal update, but does not apply them to real targets and does not commit internal tracking state.
Closes #1890.
API and CLI
Preview is supported in:
App.update(..., preview=True)App.update_blocking(..., preview=True)cocoindex update --previewFor the Python API, preview returns the planned action objects.
For the CLI, preview prints the planned actions.
Implementation
This reuses the existing planning path instead of introducing a separate planner.
In preview mode:
pre_commit(...)sink.apply(...)is skippedThis keeps preview aligned with normal update behavior while remaining read-only.
First pass scope
This first pass supports flat / leaf target actions only.
If a target requires child target providers, preview fails clearly instead of returning partial output.
CLI behavior
Added:
cocoindex update ... --previewTests
Added coverage for:
Validation
Ran locally:
cargo fmt --checkcargo testuv run mypyuv run pytest python/tests/core -quv run pytest python/tests/internal -quv run pytest python/tests/cli/test_cli.py -q