Repository navigation
fix(search): ground lexical identifier evidence - #207
PatrickSys wants to merge 3 commits into
Conversation
Verify ranked project-relative paths and category filtering through the executable in text and JSON. Document how callers can refresh examples from older indexes. Agent: codex gpt-6.2-sol 01a24913-17e6-7211-965f-9513e7747f28
Accept whole environment and configuration identifiers as file-local clues, and apply the existing indexed import proof to underscored declarations. Keep the candidate window and source validation for rescued hits. Agent: codex gpt-6.2-sol 01a24913-17e6-7211-965f-9513e7747f28
Agent: codex gpt-6.2-sol 01a24930-57ce-7221-97a4-ba695a5d5e08
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ae1c2a6559
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const lineComment = | ||
| (char === '/' && next === '/') || char === '#' || (char === '-' && next === '-'); |
There was a problem hiding this comment.
Make comment delimiters conditional on the source language
For JavaScript/TypeScript, # can introduce a private field and -- is a decrement operator, but this treats both as line comments. For example, #limit = process.env.WIDGET_RETRY_LIMIT; loses the entire identifier during masking. Consequently, a query combining that identifier with one natural-language clue cannot rescue the file, even when both clues are present. Use language-aware comment recognition rather than applying every supported language's delimiters simultaneously; this also preserves the repository's language-agnostic search contract.
AGENTS.md reference: AGENTS.md:L108-L108
Useful? React with 👍 / 👎.
|
|
||
| const literalMatches = (item: CodeChunk, nominationText: string): string[] => { | ||
| if (!literalAnchors.some((anchor) => nominationText.includes(anchor))) return []; | ||
| const code = maskComments(item.content).toLowerCase(); |
There was a problem hiding this comment.
Preserve comment context across chunk boundaries
When a multiline comment crosses a chunk boundary, masking item.content starts with no knowledge of the opening delimiter. The line-based chunker in src/utils/chunking.ts slices files every 50 lines without preserving comment boundaries, so an identifier appearing only inside a comment after that boundary remains unmasked. Combined with one natural clue elsewhere in the file, it becomes sufficient rescue evidence and returns a comment-only identifier match, contrary to the new admission contract. Mask the complete source before selecting chunk intervals, or retain the lexical state at each chunk's start.
Useful? React with 👍 / 👎.
Confidence Score: 4/5
[Medium impact] The main reach is searches that use the model-free fallback. The PR appears safe to merge, with non-blocking search edge cases in comment masking. Findings
SummaryExtends lexical rescue to use undeclared camelCase and snake_case identifiers alongside natural-language clues.
Reviews (1) · Last reviewed commit: "fix(search): ground lexical identifier e..." · Reviewed by Greptile |
| const lineComment = | ||
| (char === '/' && next === '/') || char === '#' || (char === '-' && next === '-'); |
There was a problem hiding this comment.
Private fields lose search evidence
maskComments treats # and -- as comments in every language. In valid TypeScript such as class Settings { #limit = process.env.WIDGET_RETRY_LIMIT; }, it erases the environment variable along with the private field. A question about WIDGET_RETRY_LIMIT and one other clue then misses this file because only the other clue survives. Use the chunk's language to decide which comment markers apply.
| if (quote) { | ||
| if (escaped) escaped = false; | ||
| else if (char === '\\') escaped = true; | ||
| else if (char === quote) quote = undefined; | ||
| continue; | ||
| } | ||
|
|
||
| if (char === '"' || char === "'" || char === '`') { | ||
| quote = char; | ||
| continue; |
There was a problem hiding this comment.
Template comments count as evidence
maskComments leaves comments inside template expressions untouched. For example, const text = ${/* WIDGET_RETRY_LIMIT */ 3}; keeps WIDGET_RETRY_LIMIT because the opening backtick puts the entire template into quoted mode. Another clue such as throttling in the same file then makes this comment-only mention count toward admission. Track template expressions separately so their comments are removed while literal template text stays searchable.
|
|
||
| const literalMatches = (item: CodeChunk, nominationText: string): string[] => { | ||
| if (!literalAnchors.some((anchor) => nominationText.includes(anchor))) return []; | ||
| const code = maskComments(item.content).toLowerCase(); |
There was a problem hiding this comment.
Split comments count as evidence
maskComments starts fresh for each chunk, but chunks can begin inside a block comment. The line-based splitter cuts files every 50 lines without carrying comment state. In a CSS file with a long opening comment, a chunk starting at line 51 can contain WIDGET_RETRY_LIMIT without the earlier /*; the mask keeps it, and another matching word admits the file. Build the comment mask from the full source before selecting the chunk's range, or preserve the comment state across chunk boundaries.
|
FIX FIRST. I did not merge PR #207. The current head is |
|
Verdict: FIX FIRST. The reviewed PR head ae1c2a6 still has three landing blockers: language independent masking removes executable operators/fields (including TypeScript decrement/private fields and Python floor division); regex and nested template handling can admit identifiers that occur only in comments; and masking each chunk separately loses block comment state across chunk boundaries. Independent real searcher probes failed 14 of 31 cases. Keep this PR open and repair the source language aware masking across full source, then rerun the regression probes and suite. No merge was made. |
Fixes lexical rescue false positives by masking comments, retaining quoted config literals, and using Unicode-aware identifier boundaries for admission.
Validation: