Skip to content

Fix verbose#16

Open
dana89co wants to merge 3 commits intomasterfrom
Fix_vrb
Open

Fix verbose#16
dana89co wants to merge 3 commits intomasterfrom
Fix_vrb

Conversation

@dana89co
Copy link
Collaborator

@dana89co dana89co commented Mar 24, 2026

Hi @randrescastaneda,

I have made a small change on the verbose for st_init, which is creating a lot of noise on the new pipeline. Feel free to review it and approve it whenever you have the time. Thank you!

Summary by CodeRabbit

  • New Features

    • Added verbose parameter to st_init() function (default TRUE). When set to FALSE, suppresses informational messages and warnings while preserving error reporting.
  • Tests

    • Added tests verifying verbose flag behavior and input validation.
  • Chores

    • Updated build and repository ignore patterns.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 24, 2026

📝 Walkthrough

Walkthrough

The st_init() function now accepts a new verbose parameter (default TRUE) that conditionally suppresses informational messages and warnings while preserving error behavior. Configuration files are updated with additional ignore patterns, and comprehensive test coverage is added for the new parameter behavior.

Changes

Cohort / File(s) Summary
Build & Version Control Configuration
.Rbuildignore, .gitignore
Added ignore patterns for .cg-docs/ directory and Compound GPID-related paths (.github/prompts/, .github/skills/, .github/agents/, .github/instructions/, .github/copilot-instructions.md, compound-gpid.local.md).
Core Functionality
R/IO_core.R
Added verbose parameter (logical, default TRUE) to st_init() with input validation; informational messages, alias warnings, and rebasing messages now respect the verbose flag while error behavior remains unchanged.
Function Documentation
man/st_init.Rd
Updated function signature and documentation to reflect new verbose parameter and its behavior (suppresses informational output when FALSE, errors always emitted).
Test Coverage
tests/testthat/test-save-load.R
Added comprehensive test suite for st_init verbose flag behavior covering message suppression, warning behavior, and parameter validation; removed trivial multiplication test and adjusted option scope in existing test.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • randrescastaneda

Poem

🐰 A rabbit hops through build-time halls,
Adding verbose flags to st_init() calls,
Now users shush the chattiness of the day,
While errors still squeak in their forceful way! 🤫

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Fix verbose' is vague and does not clearly summarize the main change. While it references the verbose feature being modified, it does not specify what is being fixed or what the actual improvement is. Revise the title to be more descriptive, such as 'Add verbose flag to st_init to control output' or 'Reduce st_init output with optional verbose parameter' to better communicate the specific change.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch Fix_vrb

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
.gitignore (1)

22-34: Consider separating infrastructure changes from the verbose fix.

The ignore patterns for Compound GPID artifacts are correctly formatted and clearly documented. However, these infrastructure changes appear unrelated to the PR's stated objective of fixing verbose behavior in st_init.

While the changes themselves are fine, mixing tooling/infrastructure updates with functional code changes can make PR history less clear and complicate future rollbacks if needed.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.gitignore around lines 22 - 34, This PR mixes .gitignore entries for
Compound GPID artifacts (entries like .github/prompts/, .github/skills/,
.github/agents/, .github/instructions/, .github/copilot-instructions.md,
compound-gpid.local.md, and .cg-docs/) with a functional change to st_init;
split those infrastructure/tooling ignore updates into their own commit or
separate PR so the st_init fix remains focused and reviewable, or alternatively
revert the .gitignore additions from this branch and reintroduce them in an
isolated change.
tests/testthat/test-save-load.R (1)

1-34: Comprehensive test coverage for verbose flag behavior.

The test thoroughly covers:

  • verbose = TRUE emitting messages
  • verbose = FALSE being silent
  • Rebasing scenarios
  • Duplicate-alias warnings
  • Input validation for invalid values

However, there's a potential test isolation issue: the test modifies the "default" alias multiple times (td1→td2→td3→td4), which updates both .stamp_aliases and .stamp_state (via st_state_set() in st_init()). The withr::defer on line 23 only cleans up .stamp_aliases for the named aliases (dup_a, dup_b, dup_c), but doesn't restore .stamp_state to its original value after the "default" alias rebasing operations.

This may not cause issues in practice since withr::local_tempdir() cleans up the filesystem and subsequent tests likely call st_init() themselves, but for robustness you could consider also cleaning up .stamp_state or the "default" alias from .stamp_aliases.

🔧 Optional: Add cleanup for default alias state
 test_that("st_init respects verbose flag", {
+  # Capture initial state for cleanup
+  old_default <- rlang::env_get(stamp:::.stamp_aliases, "default", default = NULL)
+  old_root <- rlang::env_get(stamp:::.stamp_state, "root_dir", default = NULL)
+  withr::defer({
+    if (!is.null(old_default)) {
+      rlang::env_poke(stamp:::.stamp_aliases, "default", old_default)
+    } else {
+      rlang::env_unbind(stamp:::.stamp_aliases, "default", inherit = FALSE)
+    }
+    if (!is.null(old_root)) {
+      rlang::env_poke(stamp:::.stamp_state, "root_dir", old_root)
+    }
+  })
+
   td1 <- withr::local_tempdir()
   td2 <- withr::local_tempdir()
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/testthat/test-save-load.R` around lines 1 - 34, The test mutates the
global .stamp_aliases and .stamp_state via st_init (which calls st_state_set),
so add cleanup to restore state after the test: after creating temp dirs and
before exiting, capture the original value of stamp:::.stamp_state and/or
remove/reset the "default" entry from stamp:::.stamp_aliases, then use
withr::defer to restore stamp:::.stamp_state and unbind the "default" alias from
stamp:::.stamp_aliases; reference st_init, st_state_set, stamp:::.stamp_state
and stamp:::.stamp_aliases to locate where to add the capture and withr::defer
restore/unbind calls.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In @.gitignore:
- Around line 22-34: This PR mixes .gitignore entries for Compound GPID
artifacts (entries like .github/prompts/, .github/skills/, .github/agents/,
.github/instructions/, .github/copilot-instructions.md, compound-gpid.local.md,
and .cg-docs/) with a functional change to st_init; split those
infrastructure/tooling ignore updates into their own commit or separate PR so
the st_init fix remains focused and reviewable, or alternatively revert the
.gitignore additions from this branch and reintroduce them in an isolated
change.

In `@tests/testthat/test-save-load.R`:
- Around line 1-34: The test mutates the global .stamp_aliases and .stamp_state
via st_init (which calls st_state_set), so add cleanup to restore state after
the test: after creating temp dirs and before exiting, capture the original
value of stamp:::.stamp_state and/or remove/reset the "default" entry from
stamp:::.stamp_aliases, then use withr::defer to restore stamp:::.stamp_state
and unbind the "default" alias from stamp:::.stamp_aliases; reference st_init,
st_state_set, stamp:::.stamp_state and stamp:::.stamp_aliases to locate where to
add the capture and withr::defer restore/unbind calls.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0e10122f-a230-4cb3-90cc-117586e0df4b

📥 Commits

Reviewing files that changed from the base of the PR and between 23e23ee and 5091b34.

📒 Files selected for processing (5)
  • .Rbuildignore
  • .gitignore
  • R/IO_core.R
  • man/st_init.Rd
  • tests/testthat/test-save-load.R

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.

1 participant