Refactor logger persistence wrappers and document env expansion semantics#10086
Conversation
There was a problem hiding this comment.
Pull request overview
Refactors logger persistence paths without intended behavior changes and clarifies environment-expansion semantics.
Changes:
- Inlines JSON persistence calls in logger implementations.
- Updates related persistence tests.
- Documents differing undefined-variable behavior.
Show a summary per file
| File | Description |
|---|---|
internal/logger/tools_logger.go |
Removes the persistence wrapper. |
internal/logger/tools_logger_test.go |
Tests writeJSON directly. |
internal/logger/observed_url_domains_logger.go |
Inlines serialization and persistence. |
internal/envutil/expand_env_args.go |
Clarifies environment-expansion semantics. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comments suppressed due to low confidence (2)
internal/logger/tools_logger_test.go:258
- This direct
writeJSONtest still has the staleTestWriteToFile_WriteFileFailsname and comment, even thoughwriteToFileno longer exists. Rename both references to keep test failures searchable against the current symbol.
err := tl.writeJSON(tl.data, 0644)
internal/logger/tools_logger_test.go:280
- This test was switched to
writeJSON, but the enclosing name and comment still reference the deletedwriteToFilemethod. Rename them to reflect the code path now being tested.
err := tl.writeJSON(tl.data, 0644)
- Files reviewed: 4/4 changed files
- Comments generated: 2
- Review effort level: Medium
|
|
||
| // Write the updated data to file | ||
| return tl.writeToFile() | ||
| return tl.writeJSON(tl.data, 0644) |
🔒 mcpg Read-Only Stress — gVisorSurface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Overall: PASS Notes:
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
@copilot Fix the code for all comments in this review thread. When a review comment includes a suggested change, apply the suggestion exactly. Do not make changes beyond what is described in the linked review thread. |
Implemented the requested fixes from that review thread in commit |
🔒 mcpg Read-Only Stress — defaultSurface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Overall: PASS
References: §30210811727
|
🔒 mcpg Read-Only Stress — docker-sbxSurface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Overall: PASS
References: §30210811698
|
Semantic clustering flagged low-effort cleanup opportunities: thin persistence wrappers in logger internals and potential confusion between two env-expansion paths with different failure semantics. This PR applies those targeted refactors without changing behavior.
Logger internals: remove thin
writeToFileindirectioninternal/logger/tools_logger.go, inlinedwriteToFile()intoLogToolsby callingwriteJSON(tl.data, 0644)directly.internal/logger/observed_url_domains_logger.go, removedwriteToFile()and inlined serialization +writeJSON(..., 0600)at write sites (init + changed-domain flush path).Env expansion docs: clarify intentional semantic split
internal/envutil/expand_env_args.go, added a cross-reference note tointernal/config/expand.goclarifying:envutilexpansion passes through missing env vars unchangedconfigexpansion fails on undefined${VAR}Test alignment with refactor
internal/logger/tools_logger_test.goto validate the same file-write success/error paths throughwriteJSON(...)directly after removingwriteToFile().