Address review findings#98
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR follows up on prior review findings by reducing duplicated logic and improving performance in the indexer/graph/impact pipelines (parsed-context reuse, import-resolution caching, edge/item deduplication), plus consolidating diff-hunk utilities.
Changes:
- Reuse/caches expensive work: parsed file contexts for namespace-member reference scans, and resolved import targets within
collectImportsForFile(). - Consolidate duplicated logic: shared diff-hunk utilities (
src/impact/hunks.ts), shared Kotlin import parsing, and shared member-chain resolution in detailed symbol graph. - Reduce duplication/noise in outputs: deduplicate file graph edges during index build and replace
JSON.stringify-based streaming impact item dedupe with a cheaper structural key.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/indexer/navigation.ts | Reuses a cached parsed context when collecting namespace-member references. |
| src/indexer/imports.ts | Adds per-file import resolution caching and consolidates implicit import binding heuristics via a helper. |
| src/indexer/build-index.ts | Centralizes graph edge key generation and deduplicates edges when merging per-file + manifest edges. |
| src/impact/suggestions.ts | Moves changed-line extraction to shared hunk utilities. |
| src/impact/streaming.ts | Replaces expensive JSON.stringify dedupe with a structural emission key. |
| src/impact/report.ts | Moves newFileRangeForHunk into shared hunk utilities and re-exports it. |
| src/impact/report-suggestions.ts | Uses shared hunk utilities and caps reference scans for “untested change” suggestions. |
| src/impact/map.ts | Uses and re-exports shared changed-line collection helper. |
| src/impact/hunks.ts | New shared module for diff-hunk line/range utilities. |
| src/impact/context.ts | Uses graph adjacency helpers and attempts to preserve typeOnly metadata on edges. |
| src/impact/analyzer.ts | Threads a bounded maxReferences limit into reference scanning with headroom. |
| src/graphs/symbol-graph-detailed.ts | Deduplicates member-chain resolution logic into a shared helper. |
| src/graphs/specifiers.ts | Reuses Kotlin import statement parser instead of local regex. |
| REVIEW_PLAN.md | Documents review follow-ups and remaining refactor opportunities. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+479
to
+480
| const target = edge.to.type === "file" ? edge.to.path : edge.to.name; | ||
| return `${edge.from}::${target}::${edge.raw ?? ""}::${edge.typeOnly ? 1 : 0}`; |
| const revDeps = reverseDeps.get(edge.to.path) || []; | ||
| revDeps.push(edge.from); | ||
| reverseDeps.set(edge.to.path, revDeps); | ||
| typeOnlyByEdge.set(`${edge.from}\0${edge.to.path}`, edge.typeOnly); |
Comment on lines
+156
to
+172
| function impactItemEmissionKey(item: ImpactItem, partial: boolean): string { | ||
| const symbols = item.symbols.slice().sort().join(","); | ||
| const reasons = item.reasons.slice().sort().join(","); | ||
| const refCount = item.refs?.length ?? 0; | ||
| const hintCount = item.explain?.hints?.length ?? 0; | ||
| return [ | ||
| item.file, | ||
| partial ? "partial" : "final", | ||
| symbols, | ||
| reasons, | ||
| item.severity.toFixed(6), | ||
| String(item.depth ?? 0), | ||
| String(item.confidence ?? 0), | ||
| String(refCount), | ||
| String(hintCount), | ||
| ].join("|"); | ||
| } |
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.
No description provided.