MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / hasSynthesizedEdgesTouchingFile

Method hasSynthesizedEdgesTouchingFile

src/db/queries.ts:2656–2667  ·  view source on GitHub ↗

Must run before file replacement/deletion cascades the endpoint edges.

(filePath: string)

Source from the content-addressed store, hash-verified

2654
2655 /** Must run before file replacement/deletion cascades the endpoint edges. */
2656 hasSynthesizedEdgesTouchingFile(filePath: string): boolean {
2657 const owned = "CASE WHEN json_valid(e.metadata) THEN json_extract(e.metadata, '$.synthesizedBy') END IS NOT NULL";
2658 for (const endpoint of ['source', 'target']) {
2659 if (this.db.prepare(`SELECT 1 FROM nodes n JOIN edges e ON e.${endpoint} = n.id
2660 WHERE n.file_path = ? AND ${owned} LIMIT 1`).get(filePath)) return true;
2661 }
2662 // Wiring often lives in a third file, with neither endpoint in it.
2663 return !!this.db.prepare(`SELECT 1 FROM edges e WHERE ${owned}
2664 AND CASE WHEN json_valid(e.metadata) THEN json_extract(e.metadata, '$.registeredAt') END >= ?
2665 AND CASE WHEN json_valid(e.metadata) THEN json_extract(e.metadata, '$.registeredAt') END < ? LIMIT 1`
2666 ).get(`${filePath}:`, `${filePath};`);
2667 }
2668
2669 wasSynthesisInput(filePath: string): boolean {
2670 return !!this.db.prepare('SELECT 1 FROM synthesis_inputs WHERE file_path = ?').get(filePath);

Callers 3

assertStructuralFunction · 0.95
syncMethod · 0.80

Calls 2

getMethod · 0.65
prepareMethod · 0.65

Tested by 1

assertStructuralFunction · 0.76