Repository navigation
refactor: architecture governance — unify atomicfile/tailcatpool/web engine, enforce layer boundaries, decompose god files - #1249
Merged
Conversation
…SOT drift triggers
…r agent config paths
… reconcile, panemove, notify
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Across the codebase, several parallel implementations and oversized mixed-concern files had accumulated:
internal/rex/remote.goandios/tailnet/tailcat.go) had already drifted in cancel handling, close blocking, andHalfCloserforwarding (docs/lessons.md, tailcat: a connection open across a server restart keeps the dead client #751).internal/*and root*.gohad inconsistent safety (fixed.tmpraces ininternal/rex/remote.go, uncheckedjson.MarshalIndenterror ininternal/rexapi/lan.go, temp-file leak inbrand_fetch.go, missing Windows rename retry).go run ./tools/verify -audit(extPane.kind,placeholderExt.kind), duplicatedcopyDir(internal/extvsinternal/iconpack), hand-rolledcmpOr/itoa, and scatteredCLAUDE_CONFIG_DIR/CODEX_HOME/XDG_CONFIG_HOMEresolution.el()12 times,openDB()twice, and ~95% oftailengine.ts/catengine.ts.state.go3,452L,internal/rexapi/layout.go2,130L,internal/cli/commands.go1,656L) hindered navigability and parallel changes.assets/brands.json,internal/rexproto/protocol.json) were not checked bytools/verify.Change
2f940b3f): Removed unusedpaneExt.kind()(extPane.kind,placeholderExt.kind) and orphan comments inbrowser.go; addedtools/verify/arch.go(archBoundariesCheck, pure read-onlygo/parsercheck for leaf packages,internal/rex, andios/tailnetboundaries) and SSOT drift triggers intools/verify/main.go.internal/atomicfile(2ea22008): ExtractedWrite,WriteSync, andWriteJSON(os.CreateTemp+Chmod+ Windows retryRename) and migrated all 10+ call sites, deleting old copies.internal/tailcatpool(0b964add,eba32ae0): Unified desktop (internal/rex/remote.go) and iOS (ios/tailnet/tailcat.go+lifecycle.go) tailcat client pools into a single leaf package, deleting ~400 lines of duplicated pool code and ensuring lock-order safety (KeyFninvoked without holdingPool.mu;SetTailcatHostsunlockstcMubeforeKeepOnly).1c1a1020): Exported streamingext.CopyDirand migratedinternal/iconpack, replacedcmpOr/itoawith stdlibcmp.Or/strconv.Itoa, and centralizedXDGConfigHome/ClaudeConfigDir/CodexHomeininternal/homedir.127b8ca9): Extractedweb/src/dom.ts(el),web/src/idb.ts(openDB, fixing CRLF incatstore.ts), andweb/src/wasmengine.ts(shared loader/socket/transport fortailengine.tsandcatengine.ts, keeping separate on-demand chunks).02e8d860,f795862c): Pure domain-boundary moves splittingstate.go(3,452L → 1,465L) intofloat.go/paneattach.go/reconcile.go/panemove.go/notify.go,internal/cli/commands.go(1,656L → 936L) intohosts_cmd.go/remote_cmd.go/run_cmd.go, andinternal/rexapi/layout.go(2,130L → 1,047L) intolayout_spec.go/layout_focus.go/layout_blocks.go.Test
internal/atomicfile,internal/tailcatpool(verified with-race),internal/homediragent config resolution, andtools/verify/arch.go(TestArchBoundariesRepo,TestArchBoundariesViolations).go run ./tools/verify,go run ./tools/verify -audit, andgo test -race ./internal/tailcatpool+go test ./internal/rex -run TestTailcat+go test ./ios/tailnet -run TestTailcatafter independent review fixes.Verified: go run ./tools/verify: gofmt passed; arch boundaries passed; vet linux passed; vet windows passed; vet darwin passed; build linux/amd64 passed; build linux/arm64 passed; build windows/amd64 passed; build darwin/arm64 passed; web typecheck passed; golangci-lint passed; web test passed; go test passed; go test root skipped; ios xcodebuild NOT VERIFIED