Skip to content

Commit 97c6750

Browse files
authored
Merge pull request DeusData#968 from DeusData/feat/coverage-signal-a
feat(index): best-effort parse-coverage signal — flag not-fully-indexed files
2 parents ee68144 + 3eb294f commit 97c6750

26 files changed

Lines changed: 1996 additions & 71 deletions

‎Makefile.cbm‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,7 @@ TEST_EXTRACTION_SRCS = \
317317
tests/test_extraction.c \
318318
tests/test_extraction_inheritance.c \
319319
tests/test_extraction_imports.c \
320+
tests/test_parse_coverage.c \
320321
tests/test_grammar_regression.c \
321322
tests/test_grammar_labels.c \
322323
tests/test_grammar_imports.c \

‎graph-ui/src/components/FilterPanel.tsx‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ interface FilterPanelProps {
2222
onToggleShowOnlyDead: () => void;
2323
onToggleHideEntryPoints: () => void;
2424
onToggleHideTests: () => void;
25+
/* Missed skeleton (#963): white satellite of not-fully-indexed files */
26+
missedView: boolean;
27+
missedCount: number;
28+
onToggleMissedView: () => void;
2529
}
2630

2731
/* Checkbox row matching the existing "Show labels" toggle style */
@@ -76,6 +80,9 @@ export function FilterPanel({
7680
onToggleShowOnlyDead,
7781
onToggleHideEntryPoints,
7882
onToggleHideTests,
83+
missedView,
84+
missedCount,
85+
onToggleMissedView,
7986
}: FilterPanelProps) {
8087
const { labelCounts, edgeTypeCounts, statusCounts } = useMemo(() => {
8188
const lc = new Map<string, number>();
@@ -163,6 +170,32 @@ export function FilterPanel({
163170
</div>
164171
</ScrollArea>
165172

173+
{/* Missed skeleton (#963): white satellite cluster of files the indexer
174+
could not fully cover, shown beside the code galaxy. Click it to
175+
focus; click the code galaxy to come back. */}
176+
<div className="px-4 pt-2 border-t border-border/30 space-y-2 shrink-0">
177+
<div className="flex items-center justify-between">
178+
<span className="text-[10px] text-foreground/30 uppercase tracking-widest">
179+
Missed files
180+
</span>
181+
{missedCount > 0 && (
182+
<span className="text-[10px] text-foreground/50 tabular-nums">
183+
{missedCount.toLocaleString()} files
184+
</span>
185+
)}
186+
</div>
187+
<CheckRow
188+
checked={missedView}
189+
onToggle={onToggleMissedView}
190+
label="Show missed skeleton"
191+
/>
192+
<p className="text-[9px] leading-snug text-foreground/30">
193+
{missedCount > 0
194+
? "White satellite = files not fully indexed (best-effort). Click it to focus, click the galaxy to return."
195+
: "No known misses (best-effort — not a completeness guarantee)."}
196+
</p>
197+
</div>
198+
166199
{/* Dead-code view */}
167200
<div className="px-4 pt-2 border-t border-border/30 space-y-2 shrink-0">
168201
<div className="flex items-center justify-between">

‎graph-ui/src/components/GraphScene.tsx‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,22 +112,31 @@ function IdleAutoRotate({
112112

113113
interface GraphSceneProps {
114114
data: GraphData;
115+
/* Missed skeleton (#963): pre-offset, pre-painted white nodes + edges of
116+
* the not-fully-indexed files, rendered as a ghost cluster beside the
117+
* galaxy. null hides it. */
118+
missed?: { nodes: GraphNode[]; edges: GraphData["edges"] } | null;
115119
highlightedIds: Set<number> | null;
116120
cameraTarget: CameraTarget | null;
117121
showLabels: boolean;
118122
display?: DisplaySettings;
119123
onNodeClick: (node: GraphNode) => void;
124+
/* Fired when a click hits empty space (no node). Used to fly back to the
125+
* overview after focusing the missed skeleton. */
126+
onBackgroundClick?: () => void;
120127
}
121128

122129
export type { CameraTarget };
123130

124131
export function GraphScene({
125132
data,
133+
missed = null,
126134
highlightedIds,
127135
cameraTarget,
128136
showLabels,
129137
display = DEFAULT_DISPLAY_SETTINGS,
130138
onNodeClick,
139+
onBackgroundClick,
131140
}: GraphSceneProps) {
132141
const [hovered, setHovered] = useState<GraphNode | null>(null);
133142
const controlsRef = useRef<OrbitControlsImpl | null>(null);
@@ -151,6 +160,7 @@ export function GraphScene({
151160
alpha: false,
152161
powerPreference: "high-performance",
153162
}}
163+
onPointerMissed={onBackgroundClick}
154164
>
155165
<color attach="background" args={["#06090f"]} />
156166
<ambientLight intensity={0.5} />
@@ -176,6 +186,30 @@ export function GraphScene({
176186
/>
177187
{showLabels && <NodeLabels nodes={data.nodes} highlightedIds={highlightedIds} />}
178188

189+
{/* Missed skeleton (#963): white ghost of the not-fully-indexed files.
190+
* Clicks route through the same handler — GraphTab re-centers the
191+
* camera on the whole skeleton cluster. */}
192+
{missed && missed.nodes.length > 0 && (
193+
<group>
194+
<EdgeLines
195+
nodes={missed.nodes}
196+
edges={missed.edges}
197+
highlightedIds={null}
198+
opacity={0.28}
199+
brightness={display.edgeBrightness}
200+
/>
201+
<NodeCloud
202+
nodes={missed.nodes}
203+
highlightedIds={null}
204+
onHover={setHovered}
205+
onClick={onNodeClick}
206+
opacity={0.6}
207+
boost={nodeBoost * 0.75}
208+
/>
209+
{showLabels && <NodeLabels nodes={missed.nodes} highlightedIds={null} />}
210+
</group>
211+
)}
212+
179213
{/* Satellite galaxies for cross-repo linked projects */}
180214
{data.linked_projects?.map((lp: LinkedProject) => {
181215
const offsetNodes = lp.nodes.map((n) => ({

‎graph-ui/src/components/GraphTab.tsx‎

Lines changed: 96 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import {
2222
import { Sidebar } from "./Sidebar";
2323
import { FilterPanel } from "./FilterPanel";
2424
import { NodeDetailPanel } from "./NodeDetailPanel";
25+
import { MissedCallout } from "./MissedCallout";
2526
import { ResizeHandle } from "./ResizeHandle";
2627
import { ErrorBoundary } from "./ErrorBoundary";
2728
import type { GraphNode, GraphData, RepoInfo } from "../lib/types";
@@ -102,6 +103,12 @@ export function GraphTab({ project }: GraphTabProps) {
102103
const [enabledLabels, setEnabledLabels] = useState<Set<string>>(new Set());
103104
const [enabledEdgeTypes, setEnabledEdgeTypes] = useState<Set<string>>(new Set());
104105

106+
/* Missed skeleton (#963): the file structure of files the indexer could
107+
* not fully cover, shown as a white satellite cluster beside the code
108+
* galaxy. Toggle only hides/shows it — the data rides along with every
109+
* code-graph layout. */
110+
const [showMissedSkeleton, setShowMissedSkeleton] = useState(true);
111+
105112
/* Dead-code view: recolor by status + status-based filters */
106113
const [deadCodeView, setDeadCodeView] = useState(false);
107114
const [showOnlyDead, setShowOnlyDead] = useState(false);
@@ -190,6 +197,48 @@ export function GraphTab({ project }: GraphTabProps) {
190197
}
191198
}, [project, budget, fetchOverview]);
192199

200+
/* Missed skeleton: offset into place and paint white — a ghost of the
201+
* files the graph could not fully cover, sitting beside the galaxy. */
202+
const missedSkeleton = useMemo(() => {
203+
const mg = data?.missed_graph;
204+
if (!mg || mg.nodes.length === 0) return null;
205+
const nodes = mg.nodes.map((n) => ({
206+
...n,
207+
x: n.x + mg.offset.x,
208+
y: n.y + mg.offset.y,
209+
z: n.z + mg.offset.z,
210+
color: "#e9eef5",
211+
}));
212+
return { nodes, edges: mg.edges, ids: new Set(nodes.map((n) => n.id)) };
213+
}, [data]);
214+
215+
/* Overview framing: both clusters (galaxy + skeleton) in one shot. */
216+
const overviewTarget = useMemo(() => {
217+
if (!data) return null;
218+
const all = missedSkeleton ? [...data.nodes, ...missedSkeleton.nodes] : data.nodes;
219+
return computeCameraTarget(all, new Set(all.map((n) => n.id)));
220+
}, [data, missedSkeleton]);
221+
222+
/* With a skeleton beside the galaxy, auto-frame BOTH clusters on load so
223+
* the side-by-side composition is visible without manual zooming. */
224+
useEffect(() => {
225+
if (missedSkeleton && overviewTarget) {
226+
setCameraTarget(overviewTarget);
227+
}
228+
}, [missedSkeleton, overviewTarget]);
229+
230+
/* Clicking empty space while the skeleton has focus flies back to the
231+
* overview (the galaxy may be entirely off-screen at that point, so there
232+
* is no code node to click). No-op during normal galaxy exploration. */
233+
const handleBackgroundClick = useCallback(() => {
234+
if (selectedNode && missedSkeleton?.ids.has(selectedNode.id) && overviewTarget) {
235+
setSelectedNode(null);
236+
setHighlightedIds(null);
237+
setSelectedPath(null);
238+
setCameraTarget(overviewTarget);
239+
}
240+
}, [selectedNode, missedSkeleton, overviewTarget]);
241+
193242
/* Fetch git remote metadata for GitHub deep-links */
194243
useEffect(() => {
195244
if (!project) {
@@ -226,6 +275,19 @@ export function GraphTab({ project }: GraphTabProps) {
226275
const handleNodeClick = useCallback(
227276
(node: GraphNode) => {
228277
if (!filteredData) return;
278+
279+
/* Clicking the missed skeleton re-centers the camera on that whole
280+
* cluster (it's small — the natural focus unit is the skeleton, not a
281+
* single node); clicking any code node flies back to the code galaxy
282+
* via the normal per-node focus below. */
283+
if (missedSkeleton?.ids.has(node.id)) {
284+
setSelectedNode(node);
285+
setHighlightedIds(null);
286+
setSelectedPath(node.file_path ?? null);
287+
setCameraTarget(computeCameraTarget(missedSkeleton.nodes, missedSkeleton.ids));
288+
return;
289+
}
290+
229291
setSelectedNode(node);
230292

231293
/* Highlight the node and its direct connections */
@@ -238,7 +300,7 @@ export function GraphTab({ project }: GraphTabProps) {
238300
setSelectedPath(node.file_path ?? null);
239301
setCameraTarget(computeCameraTarget(filteredData.nodes, connectedIds));
240302
},
241-
[filteredData],
303+
[filteredData, missedSkeleton],
242304
);
243305

244306
const handleNavigateToNode = useCallback(
@@ -351,6 +413,9 @@ export function GraphTab({ project }: GraphTabProps) {
351413
onToggleShowOnlyDead={() => setShowOnlyDead((v) => !v)}
352414
onToggleHideEntryPoints={() => setHideEntryPoints((v) => !v)}
353415
onToggleHideTests={() => setHideTests((v) => !v)}
416+
missedView={showMissedSkeleton}
417+
missedCount={data?.missed_graph?.nodes.filter((n) => n.label === "File").length ?? 0}
418+
onToggleMissedView={() => setShowMissedSkeleton((v) => !v)}
354419
/>
355420
<Sidebar
356421
nodes={filteredData.nodes}
@@ -385,11 +450,13 @@ export function GraphTab({ project }: GraphTabProps) {
385450
<ErrorBoundary>
386451
<GraphScene
387452
data={filteredData}
453+
missed={showMissedSkeleton ? missedSkeleton : null}
388454
highlightedIds={highlightedIds}
389455
cameraTarget={cameraTarget}
390456
showLabels={showLabels}
391457
display={display}
392458
onNodeClick={handleNodeClick}
459+
onBackgroundClick={handleBackgroundClick}
393460
/>
394461
</ErrorBoundary>
395462

@@ -490,19 +557,34 @@ export function GraphTab({ project }: GraphTabProps) {
490557
className="border-l border-border shrink-0 h-full overflow-hidden"
491558
style={{ width: rightWidth, maxHeight: "100%" }}
492559
>
493-
<NodeDetailPanel
494-
node={selectedNode}
495-
allNodes={filteredData.nodes}
496-
allEdges={filteredData.edges}
497-
project={project}
498-
repoInfo={repoInfo}
499-
onClose={() => {
500-
setSelectedNode(null);
501-
setHighlightedIds(null);
502-
setSelectedPath(null);
503-
}}
504-
onNavigate={handleNavigateToNode}
505-
/>
560+
{missedSkeleton?.ids.has(selectedNode.id) ? (
561+
/* Skeleton node: the standard panel (code snippet, callers) is
562+
* meaningless for a not-fully-indexed file — show the coverage
563+
* callout with its report-the-edge-case actions instead. */
564+
<MissedCallout
565+
node={selectedNode}
566+
project={project}
567+
onClose={() => {
568+
setSelectedNode(null);
569+
setHighlightedIds(null);
570+
setSelectedPath(null);
571+
}}
572+
/>
573+
) : (
574+
<NodeDetailPanel
575+
node={selectedNode}
576+
allNodes={filteredData.nodes}
577+
allEdges={filteredData.edges}
578+
project={project}
579+
repoInfo={repoInfo}
580+
onClose={() => {
581+
setSelectedNode(null);
582+
setHighlightedIds(null);
583+
setSelectedPath(null);
584+
}}
585+
onNavigate={handleNavigateToNode}
586+
/>
587+
)}
506588
</div>
507589
</>
508590
)}

0 commit comments

Comments
 (0)