fix(languages): detect C++ symbols in .h headers - #22
Draft
JohnXu22786 wants to merge 5 commits into
Draft
JohnXu22786 wants to merge 5 commits into
JohnXu22786 wants to merge 5 commits into
Conversation
Register the C++ language before C so first-match extension lookup assigns .h files to C++ symbol patterns.
Accept extern struct declarations in the C++ definition used for .h files so C-compatible header symbols remain visible after C++ precedence is applied.
Compare the persisted file language during incremental refresh so unchanged files are reindexed when extension classification changes.
Refresh a loaded persisted index before serving a lazy search so language metadata changes are applied without an explicit reindex command.
Restore inferred OpenAI dimensions before lazy persistence and re-embed the full local corpus whenever incremental changes update IDF weights.
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.
What this PR does
Before this PR:
First-match extension lookup assigned
.hfiles to C, so C++ class declarations in headers were not recognized as symbols. Routing.hto C++ then exposed four compatibility gaps:extern struct Foo foo;declarations from C headers were not recognized, persisted indexes skipped unchanged files after their language classification became stale, lazy searches served a loaded stale index without refreshing it, and lazy refresh could autosave auto-dimension OpenAI indexes with metadata dimension0but fallback-width vectors. Incremental local refreshes also left unchanged vectors weighted with the old corpus IDF.After this PR:
Register C++ before C so
.hfiles use C++ symbol patterns, acceptexterndeclarations for C-compatible headers, compare stored/current language metadata during incremental refresh, refresh loaded persisted state before lazy searches—includingautoIndex: false—restore inferred OpenAI dimensions before persistence, reject non-empty unknown-dimension writes, and re-embed the full local corpus whenever IDF can change. Regression coverage covers all cases plus existing C behavior.Type of change
Bug fix
Breaking changes (if any)
None.