Skip to content

refactor: split oversized Go files for code clarity#39

Merged
Patel230 merged 47 commits into
mainfrom
refactor/code-clarity
Jun 19, 2026
Merged

refactor: split oversized Go files for code clarity#39
Patel230 merged 47 commits into
mainfrom
refactor/code-clarity

Conversation

@Patel230

@Patel230 Patel230 commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Summary

Pure mechanical, behavior-preserving refactor for code clarity: every Go file over 1000 LOC (including test files) is split into smaller, same-package files. No behavior, API, or exported-symbol changes.

How the split was done:

  • Whole top-level declarations were relocated verbatim (sliced at declaration boundaries, preserving comments and formatting).
  • goimports recomputed per-file imports; gofumpt formatted.
  • Build constraints (//go:build integration) and package clauses are replicated into each new file.
  • One file split per commit, Conventional Commits style (47 commits).

Result:

  • 47 oversized files split into 81 new same-package files (47 originals modified).
  • No remaining Go file exceeds 1000 LOC (largest file in the module is now 997 LOC, pre-existing and untouched).

Verification

Check Result
go build ./... pass
go vet ./... pass
go test ./... pass (60 packages ok)

Notes:

  • cli/integration_test (-tags integration) does not compile at baseline (main) in module-isolated mode (GOWORK=off) due to pre-existing references to symbols absent from this module (session.KindAgentInvestigate, strategy.SessionState.InvestigateRunID/InvestigateTopic, checkpoint.CommittedMetadata.InvestigateTopic) in investigate_test.go — a file not touched by this PR. The compile-error set is byte-for-byte identical to origin/main, and the split files in that package parse cleanly. This is a pre-existing condition, unrelated to this refactor.
  • cli/api has a flaky network test (TestClient_Post_NilBody) that intermittently fails with a transport CloseIdleConnections error; it passes on re-run and is in a package not touched by this PR.

Files split (per package)

  • redact (1): redact_test.go
  • cli (17): explain_test.go, explain.go, setup_test.go, setup.go, status_test.go, migrate_test.go, clean_test.go, migrate.go, rewind.go, setup_github_test.go, search_tui_test.go, attach_test.go, resume.go, lifecycle.go, sessions_test.go, search_tui.go, trail_cmd.go
  • cli/strategy (13): manual_commit_test.go, manual_commit_hooks.go, phase_postcommit_test.go, manual_commit_condensation.go, common.go, manual_commit_attribution_test.go, common_test.go, push_common_test.go, hooks_test.go, content_overlap_test.go, manual_commit_rewind.go, checkpoint_remote_test.go, metadata_reconcile_test.go
  • cli/checkpoint (4): checkpoint_test.go, committed.go, temporary.go, v2_store_test.go
  • cli/integration_test (7, build-tagged): testenv.go, manual_commit_workflow_test.go, hooks.go, agent_test.go, deferred_finalization_test.go, resume_test.go, explain_test.go
  • cli/settings (1): settings.go
  • cli/agent/factoryaidroid (1): transcript_test.go
  • cli/investigate (1): cmd.go
  • cli/summarize (1): summarize_test.go
  • cli/review (1): cmd_test.go

Test plan

  • go build ./...
  • go vet ./...
  • go test ./...
  • CI green on the PR

Patel230 added 30 commits June 19, 2026 21:11
@Patel230 Patel230 force-pushed the refactor/code-clarity branch from edded7c to a248d14 Compare June 19, 2026 15:58
@Patel230 Patel230 changed the title refactor(trace): split oversized Go files (>1000 LOC) for code clarity refactor: split oversized Go files for code clarity Jun 19, 2026
@Patel230 Patel230 merged commit a3dd0cb into main Jun 19, 2026
12 checks passed
@Patel230 Patel230 deleted the refactor/code-clarity branch June 20, 2026 08:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant