Refactor helper ownership across cmd/server and document logger sink topology#5496
Merged
Merged
Conversation
4 tasks
Copilot
AI
changed the title
[WIP] Refactor outliers and improve structure in function analysis
Refactor helper ownership across cmd/server and document logger sink topology
May 12, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors helper function ownership in internal/cmd and internal/server to better align helpers with their feature responsibilities, and adds package-level documentation clarifying internal/logger’s multi-sink logging APIs.
Changes:
- Moved WASM cache directory helpers from
flags_logging.gotowasm_cache.goalongside cache configuration logic. - Moved
ensureTracingConfigfromroot.gointotracing.goto keep tracing helpers together. - Renamed DIFC filtered-item helper
getStringField→getFilteredItemStringField(and updated tests), and addedinternal/loggerpackage docs.
Show a summary per file
| File | Description |
|---|---|
| internal/server/difc_log.go | Renames the DIFC filtered-item string helper to a more specific name and updates call sites. |
| internal/server/difc_log_helpers_test.go | Updates helper test naming and references to match the renamed helper. |
| internal/logger/doc.go | Adds package-level documentation describing logger sink API families. |
| internal/cmd/wasm_cache.go | Co-locates WASM cache dir resolution helpers with cache configuration. |
| internal/cmd/tracing.go | Co-locates ensureTracingConfig with other tracing helpers. |
| internal/cmd/root.go | Removes the tracing helper from root command file after relocation. |
| internal/cmd/flags_logging.go | Removes moved WASM cache dir helper implementations from logging flags file. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 7/7 changed files
- Comments generated: 1
Comment on lines
+3
to
+10
| // The package exposes three parallel global sink APIs: | ||
| // - LogInfo / LogWarn / LogError / LogDebug for unified file/stdout logs | ||
| // - LogInfoMd / LogWarnMd / LogErrorMd / LogDebugMd for markdown preview logs | ||
| // - LogInfoWithServer / LogWarnWithServer / LogErrorWithServer / LogDebugWithServer | ||
| // for per-server logs | ||
| // | ||
| // These APIs target different sinks and can be used together when a message should | ||
| // appear in multiple outputs. |
This was referenced May 12, 2026
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.
✨ Enhancement
The semantic clustering pass flagged cohesion outliers: WASM cache helpers in logging flags, a tracing config helper in
root.go, and ambiguous local helper naming in DIFC logging, plus missing docs around parallel logger sink APIs. This PR realigns helper placement to file responsibility and clarifies the logger API contract.What does this improve?
Stronger package/file cohesion in
internal/cmdandinternal/server, plus clearerinternal/loggerAPI intent for multi-sink logging.Why is this valuable?
It reduces maintenance friction (finding/changing logic in the expected file) and lowers misuse risk where logger sink APIs could be interpreted as alternatives rather than parallel outputs.
Implementation approach:
WASM cache ownership (
internal/cmd)defaultWasmCacheDirandresolveWasmCacheDirfromflags_logging.gotowasm_cache.go, colocated withconfigureWasmCompilationCache.Tracing ownership (
internal/cmd)ensureTracingConfigfromroot.gototracing.goso tracing setup helpers live together.Logger API contract documentation (
internal/logger)doc.go) explicitly describing the three parallel global sink families:LogInfo/...)LogInfoMd/...)LogInfoWithServer/...)DIFC helper naming clarity (
internal/server)getStringField→getFilteredItemStringFieldindifc_log.goand updated corresponding helper tests.