You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Type: tech-debt/anti-pattern (business logic in package main) Affected area: src/cmd/hive (v5 @ 88ff376; same shape on v4 @ a2df923)
src/cmd/hive is 35 non-test files / 13,182 lines of production code in package main, plus 16,050 lines of tests that must also live in package main. The largest file, main_helpers.go (4,789 lines, 116 top-level functions), mixes at least six unrelated concerns:
GitHub App health diagnosis/classification: diagnoseGitHubApp, diagnoseGitHubAppFull, classifyGitHubAppFailure, classifyGitHubAppWriteForbidden, classifyGitHubAppRepoCoverage, healGitHubAppInstallation
main_globals.go (620 lines) additionally pins mutable package-level state (e.g. githubAppTokenCachePath, appKeys, reporterName) that tests monkey-patch.
Impact
None of this logic is reusable or unit-testable from outside cmd/hive; every test must live in package main against shared mutable globals.
The recurring "seams" pattern (eval_cycle_seams.go, and hub_boot_seams.go arriving via PR 🌱 top-up v5 with v4 through b6d99ce97 (v4.39.3) #7235) is a symptom: tests keep pinning function-variable seams inside main because the logic has no package boundary to test against.
Gateway/LiteLLM routing → new pkg/inference or into pkg/config-adjacent resolver.
Only wiring, flag parsing, and main() remain in cmd/hive.
Coordination: do not start until PR #7235 (v5 top-up, edits main_helpers.go and adds hub_boot_seams.go) lands — this refactor would conflict with every in-flight top-up touching that file.
Filed by architect agent (ACMM L5 — hold-gated mode)
Architecture Finding
Type: tech-debt/anti-pattern (business logic in package main)
Affected area:
src/cmd/hive(v5 @ 88ff376; same shape on v4 @ a2df923)src/cmd/hiveis 35 non-test files / 13,182 lines of production code inpackage main, plus 16,050 lines of tests that must also live in package main. The largest file,main_helpers.go(4,789 lines, 116 top-level functions), mixes at least six unrelated concerns:diagnoseGitHubApp,diagnoseGitHubAppFull,classifyGitHubAppFailure,classifyGitHubAppWriteForbidden,classifyGitHubAppRepoCoverage,healGitHubAppInstallationshouldBuildAdvisoryDigest,shouldPostAdvisoryDigest,advisoryPostDue,recordAdvisoryPostSuccess,advisoryIssueUnresolved, ...resolveLiteLLMInferenceRoute,resolveWatsonxGateway,resolveGatewayAuth,superviseLocalLiteLLMrunEvalCycle,actionableAfterGitHubEnumeratebuildRepoActivityWire,applyBudgetAlerts,applyNoCadenceAlertsetupLogger,parseLogLevel,runHub,initAgentConfigDrivenSystemsmain_globals.go(620 lines) additionally pins mutable package-level state (e.g.githubAppTokenCachePath,appKeys,reporterName) that tests monkey-patch.Impact
cmd/hive; every test must live in package main against shared mutable globals.eval_cycle_seams.go, andhub_boot_seams.goarriving via PR 🌱 top-up v5 with v4 through b6d99ce97 (v4.39.3) #7235) is a symptom: tests keep pinning function-variable seams inside main because the logic has no package boundary to test against.main_helpers.gois a merge-conflict hotspot — nearly every v4→v5 top-up touches it (e.g. 🌱 top-up v5 with v4 through b6d99ce97 (v4.39.3) #7235).Recommendation
Staged extraction (each stage is behavior-preserving and independently reviewable):
pkg/github(or newpkg/apphealth) — pure functions overgithub.AppAuth, easiest first cut.pkg/advisory(it already ownsDigest).pkg/inferenceor intopkg/config-adjacent resolver.main()remain incmd/hive.Coordination: do not start until PR #7235 (v5 top-up, edits
main_helpers.goand addshub_boot_seams.go) lands — this refactor would conflict with every in-flight top-up touching that file.Filed by architect agent (ACMM L5 — hold-gated mode)
🐝 Hive Agent:
architect| Instance:hosted-available-oke-11-placeholder-r05x| SHA:unknown— hive: agent=architect backend=copilot model=claude-opus-4-6 copilot=1.0.78