Skip to content

refactor: split internal/delegate/run.go into topical files (pure declaration moves) - #742

Merged
dmmdea merged 1 commit into
mainfrom
refactor/split-delegate-run
Oct 30, 2026
Merged

dmmdea merged 1 commit into
mainfrom
refactor/split-delegate-run

Conversation

@dmmdea

@dmmdea dmmdea commented Oct 30, 2026

Copy link
Copy Markdown
Owner

Intent

Desloppify backlog ("god files"): internal/delegate/run.go was 8302 lines. It is split into topical files of the same package by pure declaration moves; identical behaviour.

Scope

internal/delegate only (run.go plus 13 new run_*.go files), the fragment, and three one-line pointer updates in docs/systems (delegation-client.md, fleet-node.md, pair-workloads.md). No test changed; no declaration renamed or edited.

What changed

run_types.go 548, run_runner.go 551, run_placements.go 343, run_capacity.go 937, run_wait.go 572, run_replace.go 465, run_retry.go 775, run_localseat.go 457, run_deal.go 714, run_remote.go 595, run_dispatch.go 356, run_accept.go 169, run_probe.go 541 lines; run.go 8302 -> 1473 (it keeps the tunables, attempt, runLocal, record and the delegation log, because four source-scanning tests key on that file by name).

 18 files changed, 7471 insertions(+), 7272 deletions(-)

The real run and its output

Declaration census (go/ast hash of every top-level declaration, comments stripped) before and after: 682 declarations, diff empty, run by the builder and again by an independent verifier in a throwaway worktree of origin/main. go build ./... ok; go vet ./internal/delegate ok; gofmt clean on every new file; 18 named delegate tests plus the fleetnode, ledger and root changelog/lint tests that read run.go by name: ok. A second read-only audit ran every test that reads internal/delegate/run.go by name (TestNoNewBareHTTPClient, TestEverySiteThatGradesAResultRecordsTheAuthorityToo, TestJobWaitCapStaysBelowTheDelegatorsPollRequestTimeout, TestEveryWriterOfALedgerRowIsKnown): all pass and none went blind.

Blast radius

None at runtime; file layout of one package.

Risk

Low. Tier: no_review (ordinary change (consequential 0.09, blast 1.05))

Follow-ups (not in this PR)

  • Four tests pin run.go's layout (bare_http_client_allowlist_test.go, internal/ledger/defer_code_test.go, internal/fleetnode/healthwire_compat_test.go, acceptance_authority_publish_test.go); re-key them before any further shrink of run.go.
  • run_capacity.go (awaitCapacity ~580 lines) and run_retry.go could split further along function seams.

🤖 Generated with Claude Code

… moves

Moves declarations of the 8302-line run.go into run_types.go, run_runner.go,
run_placements.go, run_capacity.go, run_wait.go, run_replace.go, run_retry.go,
run_localseat.go, run_deal.go, run_remote.go, run_dispatch.go, run_accept.go
and run_probe.go; run.go keeps the tunables, entry points, attempt/runLocal and
the delegation log. Census (declaration hashes, comments stripped) before vs
after: identical, 682 declarations. Docs naming moved functions repointed.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@dmmdea
dmmdea merged commit 6d8e001 into main Oct 30, 2026
6 checks passed
@dmmdea
dmmdea deleted the refactor/split-delegate-run branch October 30, 2026 01:32
@dmmdea dmmdea mentioned this pull request Oct 30, 2026
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