Skip to content

fix: close the log file when InitLogFile returns early - #863

Merged
mwbrooks merged 2 commits into
mainfrom
mwbrooks-fix-init-log-file-close
Nov 24, 2026
Merged

mwbrooks merged 2 commits into
mainfrom
mwbrooks-fix-init-log-file-close

Conversation

@mwbrooks

Copy link
Copy Markdown
Member

Changelog

N/A - closes a debug log file handle on an error path, with no user-facing changes.

Summary

This pull request closes the debug log file when InitLogFile returns early, so the file handle no longer stays open after a missing trace ID or session ID error.

Testing

  1. Run go test ./internal/iostreams/... -v and confirm the tests pass

Requirements

@mwbrooks mwbrooks added this to the Next Release milestone Nov 24, 2026
@mwbrooks mwbrooks added code health M-T: Test improvements and anything that improves code health semver:patch Use on pull requests to describe the release version increment labels Nov 24, 2026
@mwbrooks mwbrooks self-assigned this Nov 24, 2026
@mwbrooks
mwbrooks marked this pull request as ready for review November 24, 2026 19:04
@mwbrooks
mwbrooks requested a review from a team as a code owner November 24, 2026 19:04
@codecov

codecov Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 80.69%. Comparing base (1b757c7) to head (5088359).

Files with missing lines Patch % Lines
internal/iostreams/logfile.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #863      +/-   ##
==========================================
+ Coverage   80.66%   80.69%   +0.02%     
==========================================
  Files         247      247              
  Lines       18824    18824              
==========================================
+ Hits        15185    15190       +5     
+ Misses       3639     3634       -5     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@WilliamBergamin WilliamBergamin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧠 Thanks @mwbrooks! Deferring the close right after the open is the smallest fix, and it keeps the close ahead of the old-log cleanup. The #860 tests pass on top of it 🚀

@mwbrooks

Copy link
Copy Markdown
Member Author

Thanks @WilliamBergamin for the quick review and for catching the open file on #860! 🙇

@mwbrooks
mwbrooks merged commit 0c385e1 into main Nov 24, 2026
14 checks passed
@mwbrooks
mwbrooks deleted the mwbrooks-fix-init-log-file-close branch November 24, 2026 19:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

code health M-T: Test improvements and anything that improves code health semver:patch Use on pull requests to describe the release version increment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants