Skip to content

Add dry-run index preview - #274

Open
faysou wants to merge 3 commits into
cocoindex-io:mainfrom
faysou:dry-index-preview
Open

Add dry-run index preview#274
faysou wants to merge 3 commits into
cocoindex-io:mainfrom
faysou:dry-index-preview

Conversation

@faysou

@faysou faysou commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Summary

ccc index --dry now lists files that would enter or leave the index source set without running the indexer. The command compares files matched from the project tree with persisted process_file component paths, then prints sorted additions and deletions with exact counts.

Dry runs require an initialized project and do not auto-create settings. They open the CocoIndex application database through its read-only inspection API and leave the indexed paths unchanged.

Preview flow

flowchart LR
    Command["ccc index --dry"] --> Settings["Load project settings"]
    Settings --> Matched["Walk matched source files"]
    Command --> Persisted["Read persisted process_file paths"]
    Matched --> Compare["Compare path sets"]
    Persisted --> Compare
    Compare --> Added["Print sorted additions"]
    Compare --> Deleted["Print sorted deletions"]
Loading

The preview reads source and index state but does not start the indexing flow.

Matching behavior

  • Use the same include patterns, exclude patterns, nested .gitignore rules, and max_file_size limit as indexing.
  • Report matched empty files even when they produce no vector rows, because source membership is tracked by persisted components.
  • Treat every matched file as an addition when no index database exists.
  • Share the CocoIndex application name between indexing and inspection so the persisted paths are read from the correct application.

Testing

  • Focused dry-run tests: 4 passed.
  • The exact-path prek gate passed trailing whitespace, end-of-file, large-file, conflict, gitleaks, Ruff lint, Ruff format, mypy, and the full pytest suite.
  • git diff --check upstream/main...HEAD passed.

faysou added 3 commits August 14, 2026 11:25
- Compare matched files with persisted components without indexing
- Report added and deleted paths, including empty files
- Cover CLI help and non-mutating dry-run behavior
Apply the configured file-size limit when computing additions and preserve the E2E non-mutation check on main.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant