refactor: decompose god files, add DI constructors, migrate to slog#251
Merged
Conversation
Split oversized files into focused modules: - logs.go (1906->808 lines): extracted parsing, formatting, streaming, filtering - checker.go (1077->394 lines): extracted HTTP, command, and process strategies Add dependency injection constructors: - wellknown.NewServiceRegistry() for injectable service definitions - service.NewOperationManager() alongside existing singleton Clarify executor naming: - Renamed service/executor.go to service/service_process.go with doc comments - Added service/doc.go documenting package domains Extract MCP handler boilerplate: - handleSingleServiceOp() eliminates repeated validation/controller setup - Refactored handleStartService and handleRestartService to use helper Migrate healthcheck logging from zerolog to log/slog: - checker.go, checker_http.go, monitor.go converted to structured slog calls - InitializeLogging rewritten using slog handlers Addresses: #233, #234, #236, #191, #185, #201 Partially addresses: #190 (doc.go added; full split deferred due to 43 importers)
bdc8657 to
4329ce3
Compare
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.
Summary
Refactoring PR addressing 7 issues from the backlog. Decomposes god files, introduces DI patterns, extracts handler boilerplate, clarifies naming, and migrates legacy logging.
Changes
Issue #233 - Split logs.go god file
Issue #234 - Decompose checker.go
Issue #236 - DI for global registries
Issue #191 - Clarify executor naming
Issue #185 - Extract MCP handler boilerplate
Issue #201 - Migrate zerolog to slog
log.Info().Str("k","v").Msg("m")->slog.Info("m", "k", "v")Issue #190 - Service package documentation (partial)
Verification
go build ./...passes cleanFixes #233, #234, #236, #191, #185, #201
Partially addresses #190