You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A bug in file_appender() of utils_logging.R overwrites log files if append = FALSE because the flag is passed directly to cat(). This means anyone who sets log_file_path in their dataProcess() without setting append = TRUE, would get a log file with just the last line written.
Changes
Creates a log file or clears and existing one if append = FALSE, which is the intended behavior for appending logs to a file.
Testing
Modified test_logging.R to include asserts for append flag
Any dependent changes have been merged and published in downstream modules
Motivation and solution
When append = FALSE, .fileAppender previously passed FALSE to cat(). This could prevent the log file from retaining all entries. The change clears or creates the file first, then writes each message in append mode.
Changes
Updated .fileAppender in R/utils_logging.R to clear or create the target file when append = FALSE.
Set message writes to always use append mode after file setup.
Preserved existing-file behavior when append = TRUE.
Tests
Added assertions in inst/tinytest/test_logging.R that append = FALSE removes the old line and writes two new entries.
Added an assertion that append = TRUE adds a third entry.
The test saves and restores the MSstatsLog and MSstatsMsg options.
Test execution result: not available.
Coding guidelines
The contribution guide asks for relevant tests and says new code should follow the tidyverse style guide, with listed exceptions. The added logging tests address the relevant test guidance.
No coding guideline violation is established by the available evidence.
No actionable comments were generated in the recent review.
Walkthrough
The file appender now clears or creates the target file when append = FALSE, then writes log messages in append mode. A logging test checks the file contents with both append settings and restores the saved options.
Changes: Logging file behavior
Layer / File(s)
Summary
File initialization and logging test R/utils_logging.R, inst/tinytest/test_logging.R
When append = FALSE, the appender clears or creates the target file before writing. The test checks the resulting contents for append = FALSE and append = TRUE.
Logging retains multiple entries with either append setting. No merge-blocking risk was identified.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title clearly identifies the change to the log file append logic.
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Description check
The description includes the required motivation and context, a change summary, testing details, and all checklist items. The checklist items are present but remain unchecked.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
A rabbit checks the log at night First, old lines hop out of sight New lines follow, one by one Append keeps the earlier run The test restores each option Then I nibble on a carrot top
Recent review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: 8c122fae-bf23-49b8-8449-4dcbbb1d0abe
Commits
Reviewing files that changed from the base of the PR and between 3955a02 and 64dfc72.
Files selected for processing: 2
R/utils_logging.R
inst/tinytest/test_logging.R
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.
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
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.
Motivation and Context
A bug in
file_appender()of utils_logging.R overwrites log files ifappend = FALSEbecause the flag is passed directly tocat(). This means anyone who setslog_file_pathin their dataProcess() without settingappend = TRUE, would get a log file with just the last line written.Changes
append = FALSE, which is the intended behavior for appending logs to a file.Testing
Checklist Before Requesting a Review
Motivation and solution
When
append = FALSE,.fileAppenderpreviously passedFALSEtocat(). This could prevent the log file from retaining all entries. The change clears or creates the file first, then writes each message in append mode.Changes
.fileAppenderinR/utils_logging.Rto clear or create the target file whenappend = FALSE.append = TRUE.Tests
inst/tinytest/test_logging.Rthatappend = FALSEremoves the old line and writes two new entries.append = TRUEadds a third entry.MSstatsLogandMSstatsMsgoptions.Coding guidelines