Conversation
…line Tier 1 was a pure pass-through converting FileChanged → ASTDirty with zero value-add. Remove it to reduce latency, eliminate an extra Valkey stream hop, and simplify the architecture. Before: Watcher → file-changed → Tier1 → ast-dirty → Tier2 → Tier3 After: Watcher → file-changed → Tier2 → embed-dirty → Tier3
Compute SHA-256 of file contents before parsing and compare against stored hashes in Memgraph. Files with matching hashes are skipped entirely, avoiding unnecessary AST parsing and graph writes. - strip_whitespace mode normalizes formatting before hashing so formatter-only changes (e.g. ruff format) are ignored - Hash gate is bypassed for deleted files and full reindexes (where stored hashes are empty) - Pre-read file bytes are passed to the parser to avoid double I/O
There was a problem hiding this comment.
Pull request overview
Refactors the indexing pipeline from three tiers to two stages (AST → Embed), adding a content-hash gate to skip unchanged files and a per-file cooldown to throttle rapid reprocessing in daemon mode.
Changes:
- Remove the Tier 1 pass-through consumer and wire
FileChangeddirectly into the AST stage. - Add a SHA-256-based file hash gate (with optional whitespace normalization) persisted on Module/Package nodes in Memgraph.
- Add per-file cooldown deferral/re-publish logic for daemon mode; rename Tier2/3 terminology to AST/Embed across code, tests, and docs.
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/unit/search/test_embeddings.py | Updates embed consumer naming and doc-section strings for AST/Embed rename. |
| tests/integration/indexing/test_consumers.py | Adds integration tests for AST consumer, hash gate, and cooldown behavior. |
| tests/conftest.py | Renames “Tier3” wording to “embed stage” in NO_EMBED docstring. |
| src/code_atlas/settings.py | Adds index.file_hash_gate, index.strip_whitespace, and watcher.cooldown_s settings; updates embed settings wording. |
| src/code_atlas/search/embeddings.py | Updates doc-section breadcrumb example text for “AST Stage”. |
| src/code_atlas/indexing/orchestrator.py | Removes Tier1/Tier2 wiring; runs AST + optional Embed consumers; updates drain/publish logic. |
| src/code_atlas/indexing/daemon.py | Starts AST/Embed consumers and passes watcher cooldown into AST consumer. |
| src/code_atlas/indexing/consumers.py | Deletes Tier1; implements AST consumer hash gate + cooldown; renames Tier3 to Embed consumer. |
| src/code_atlas/indexing/init.py | Re-exports ASTConsumer/EmbedConsumer instead of Tier1/2/3. |
| src/code_atlas/graph/client.py | Adds batch read/write helpers for persisting file hashes on Module/Package nodes. |
| src/code_atlas/events.py | Removes ASTDirty event/topic; updates event union and EmbedDirty docstring. |
| scripts/profile_index.py | Renames profiling spans/labels from tier2/tier3 to ast/embed. |
| docs/guides/repo-guidelines.md | Updates example consumer name to ASTConsumer. |
| docs/benchmarks.md | Renames benchmark stage labels to AST/Embed. |
| docs/architecture.md | Updates pipeline diagrams and narrative to the two-stage AST/Embed pipeline. |
| docs/adr/0006-pure-python-tree-sitter.md | Updates ADR wording to AST consumer/stage naming. |
| docs/adr/0005-deployment-process-model.md | Updates deployment/process model diagrams and wording to AST/Embed. |
| docs/adr/0004-event-driven-tiered-pipeline.md | Updates ADR to describe the two-stage pipeline (FileChanged → AST → EmbedDirty → Embed). |
| CLAUDE.md | Updates repository architecture and event model documentation for two-stage pipeline. |
| CHANGELOG.md | Updates historical changelog wording to AST/Embed terminology. |
| .gitattributes | Adds repo-wide gitattributes for text/binary handling and LFS patterns. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
Tier1GraphConsumerconvertedFileChanged→ASTDirtywith zero value-add. Pipeline simplified from 3-tier to 2-stage:Watcher → file-changed → AST → embed-dirty → EmbedCommits
refactor(indexing): remove Tier 1 consumer, simplify to two-tier pipelinefeat(indexing): add file hash gate to skip unchanged filesfeat(indexing): add per-file cooldown for daemon modetest(indexing): add integration tests for two-tier pipeline, hash gate, and cooldownrefactor(indexing): rename Tier 2/3 to AST/Embed stage across code and docsTest plan