Skip to content

feat: incremental ingest with file hashing#29

Merged
zaebee merged 4 commits into
mainfrom
feat/incremental-ingest
Jun 7, 2026
Merged

feat: incremental ingest with file hashing#29
zaebee merged 4 commits into
mainfrom
feat/incremental-ingest

Conversation

@zaebee

@zaebee zaebee commented Jun 7, 2026

Copy link
Copy Markdown
Owner

Summary

  • SQLiteStore: new files_state(file_path, hash) table + indexes on nodes/edges.file_path; methods: get_file_hash, upsert_file_hash, delete_file_data, get_nodes_by_file, get_all_tracked_files
  • IngestionPipeline.run(store=): incremental mode — unchanged files (same MD5) are skipped, existing nodes loaded from store for the resolver; changed/new files re-extracted and saved; stale files (deleted from disk) cleaned up automatically
  • CLI: --incremental / -i flag on cgis ingest; graceful warning + fallback if output is JSON

Usage

# First full ingest
cgis ingest ./myproject --output graph.db

# Subsequent incremental runs — only changed files re-ingested
cgis ingest ./myproject --output graph.db --incremental

Test plan

  • make pytest — 75 passed
  • make lint && make type-check — clean
  • 3 new pipeline tests: skip unchanged, reparse changed, remove stale
  • 4 new store tests: hash roundtrip, delete_file_data, get_nodes_by_file, get_all_tracked_files

Closes #22

🤖 Generated with Claude Code

zaebee and others added 2 commits June 7, 2026 05:23
- SQLiteStore: files_state(file_path, hash) table + indexes on
  nodes/edges.file_path; new methods: get_file_hash, upsert_file_hash,
  delete_file_data, get_nodes_by_file, get_all_tracked_files
- IngestionPipeline.run(store=): incremental mode — unchanged files are
  skipped (nodes loaded from store for resolver), changed/new files are
  re-extracted and saved; stale files removed automatically
- CLI: --incremental / -i flag on cgis ingest; warns and falls back to
  full ingest when output is JSON
- Tests: 4 new store tests + 3 new pipeline incremental tests (75 total)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@zaebee zaebee self-assigned this Jun 7, 2026
zaebee and others added 2 commits June 7, 2026 05:27
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… transaction

- Use full_path.as_posix() in pipeline to prevent hash mismatches on
  Windows (str(Path) returns backslashes; posix paths are consistent).
- delete_file_data now also deletes edges by source node, so structural
  edges with file_path=None (e.g. CONTAINS, DECLARES) are not orphaned.
- Replace 3-commits-per-file loop with save_incremental_batch: a single
  SQLite transaction covers all deletes + inserts + hash upserts for
  every changed and stale file (150 → 1 transaction for 50 files).
- _persist_incremental uses source→file lookup to assign edges without
  file_path to the correct file bucket.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@sonarqubecloud

sonarqubecloud Bot commented Jun 7, 2026

Copy link
Copy Markdown

@zaebee zaebee merged commit 08fab94 into main Jun 7, 2026
1 check passed
@zaebee zaebee deleted the feat/incremental-ingest branch June 7, 2026 06:35
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.

[MUST-HAVE] File Hashing & Incremental Ingest

1 participant