* Scan hand-written `.go` files under `go/` and return every top-level exported * type or const name they declare. We use this to exclude those names from the * session-events alias file: when a schema-shared definition (e.g. `ContextTier`) * collides with a hand-written declaration of the same n
()
| 3638 | * test-only declaration would also collide with an alias of the same name. |
| 3639 | */ |
| 3640 | async function collectHandWrittenGoPublicNames(): Promise<Set<string>> { |
| 3641 | const goDir = path.join(REPO_ROOT, "go"); |
| 3642 | const names = new Set<string>(); |
| 3643 | let entries: string[]; |
| 3644 | try { |
| 3645 | entries = await fs.readdir(goDir); |
| 3646 | } catch { |
| 3647 | return names; |
| 3648 | } |
| 3649 | for (const entry of entries) { |
| 3650 | if (!entry.endsWith(".go")) continue; |
| 3651 | if (entry.startsWith("z")) continue; |
| 3652 | const filePath = path.join(goDir, entry); |
| 3653 | const stat = await fs.stat(filePath); |
| 3654 | if (!stat.isFile()) continue; |
| 3655 | const content = await fs.readFile(filePath, "utf-8"); |
| 3656 | for (const name of collectGoTopLevelNames(content, "type")) names.add(name); |
| 3657 | for (const name of collectGoTopLevelNames(content, "const")) names.add(name); |
| 3658 | } |
| 3659 | return names; |
| 3660 | } |
| 3661 | |
| 3662 | function assertNoGoRpcSessionEventConflicts(rpcGeneratedTypeCode: string): void { |
| 3663 | const duplicateTypes = collectGoTopLevelNames(rpcGeneratedTypeCode, "type") |
no test coverage detected
searching dependent graphs…