Skip to content

Refactor logger persistence wrappers and document env expansion semantics#10086

Draft
lpcox with Copilot wants to merge 2 commits into
mainfrom
copilot/refactor-semantic-function-clustering
Draft

Refactor logger persistence wrappers and document env expansion semantics#10086
lpcox with Copilot wants to merge 2 commits into
mainfrom
copilot/refactor-semantic-function-clustering

Conversation

Copilot AI commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

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 writeToFile indirection

    • In internal/logger/tools_logger.go, inlined writeToFile() into LogTools by calling writeJSON(tl.data, 0644) directly.
    • In internal/logger/observed_url_domains_logger.go, removed writeToFile() and inlined serialization + writeJSON(..., 0600) at write sites (init + changed-domain flush path).
  • Env expansion docs: clarify intentional semantic split

    • In internal/envutil/expand_env_args.go, added a cross-reference note to internal/config/expand.go clarifying:
      • envutil expansion passes through missing env vars unchanged
      • config expansion fails on undefined ${VAR}
  • Test alignment with refactor

    • Updated internal/logger/tools_logger_test.go to validate the same file-write success/error paths through writeJSON(...) directly after removing writeToFile().
// Before
return tl.writeToFile()

// After
return tl.writeJSON(tl.data, 0644)

Copilot AI changed the title [WIP] Refactor semantic function clustering analysis based on report Refactor logger persistence wrappers and document env expansion semantics Jul 25, 2026
Copilot finished work on behalf of lpcox July 25, 2026 23:18
Copilot AI requested a review from lpcox July 25, 2026 23:18
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.

[refactor] Semantic Function Clustering Analysis — Refactoring Opportunities

2 participants