* Dynamic-boundary surfacing (#687): when the flow among the agent's named * symbols does not fully connect, scan the disconnected symbols' bodies for * dynamic-dispatch sites (computed member calls, getattr, reflection, typed * message buses, runtime-keyed emits) and ANNOUNCE the boundary
(cg: CodeGraph, scanList: Node[], named: Map<string, Node>)
| 3988 | * connected flow never reaches this method. |
| 3989 | */ |
| 3990 | private buildDynamicBoundaries(cg: CodeGraph, scanList: Node[], named: Map<string, Node>): string { |
| 3991 | const MAX_NOTES = 4; // boundary bullets per explore |
| 3992 | // The verdict is not derived here — `findDynamicBoundaries` produces it and |
| 3993 | // the viewer's end cap renders the same object, so the two can never |
| 3994 | // disagree about where a flow stops. What is left here is the prose. |
| 3995 | const reports = findDynamicBoundaries(cg, scanList, { named, maxSites: MAX_NOTES }); |
| 3996 | const notes: string[] = []; |
| 3997 | for (const report of reports) { |
| 3998 | if (notes.length >= MAX_NOTES) break; |
| 3999 | for (const site of report.sites) { |
| 4000 | if (notes.length >= MAX_NOTES) break; |
| 4001 | const more = site.moreSites |
| 4002 | ? ` (+${site.moreSites} more such site${site.moreSites > 1 ? 's' : ''} in this body)` |
| 4003 | : ''; |
| 4004 | notes.push(`- \`${report.node.name}\` (${report.node.filePath}:${site.line}) — ${site.label}: \`${site.snippet}\`${more}`); |
| 4005 | const cand = this.boundaryCandidates(site); |
| 4006 | if (cand) notes.push(` ${cand}`); |
| 4007 | } |
| 4008 | } |
| 4009 | if (notes.length === 0) return ''; |
| 4010 | return [ |
| 4011 | '**Dynamic boundaries (the static path ends at runtime dispatch)**', |
| 4012 | '', |
| 4013 | ...notes, |
| 4014 | '', |
| 4015 | `> These sites choose their call target at runtime (registry / bus / reflection) — the site shown IS where the flow continues. To follow it, run codegraph_explore${this.isToolServed('node') ? ' or codegraph_node' : ''} on a candidate; source for the sites above is included below.`, |
| 4016 | '', |
| 4017 | ].join('\n'); |
| 4018 | } |
| 4019 | |
| 4020 | /** |
| 4021 | * Interface/registry-dispatch announcement — #687 extended to GRAPH-visible |
no test coverage detected