Skip to content

fix(languages): detect C++ symbols in .h headers - #22

Draft
JohnXu22786 wants to merge 5 commits into
mainfrom
bug/languages-cpp-header-symbol-detection
Draft

JohnXu22786 wants to merge 5 commits into
mainfrom
bug/languages-cpp-header-symbol-detection

Conversation

@JohnXu22786

@JohnXu22786 JohnXu22786 commented Sep 12, 2026

Copy link
Copy Markdown
Owner

What this PR does

Before this PR:

First-match extension lookup assigned .h files to C, so C++ class declarations in headers were not recognized as symbols. Routing .h to 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 dimension 0 but fallback-width vectors. Incremental local refreshes also left unchanged vectors weighted with the old corpus IDF.

After this PR:

Register C++ before C so .h files use C++ symbol patterns, accept extern declarations for C-compatible headers, compare stored/current language metadata during incremental refresh, refresh loaded persisted state before lazy searches—including autoIndex: 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.

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.
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