Conversation
📝 WalkthroughWalkthroughPackage version bumped from 0.0.9 to 0.0.10 with bug fixes for IO versioning. Corrects st_save() to pass relative path instead of storage path to st_should_save(), preventing double normalization and incorrect save decisions. Removes two unused internal path-resolution functions. Adds regression test for identical-content handling. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). 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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
copilot_logs/LOG_fix_versioning.md (1)
51-51: Optional wording polish: use hyphenated “To-Do”.Tiny readability/style tweak for the section header.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@copilot_logs/LOG_fix_versioning.md` at line 51, Update the section header string "To Do List" to the hyphenated form "To-Do List" to match the requested style; locate the header text "To Do List" in the document and replace it with "To-Do List" so the section uses the hyphenated wording.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@tests/testthat/test-should-save.R`:
- Around line 83-115: The test relies on global st_opts state so make it
deterministic by explicitly setting the versioning mode before saves; call
st_opts(versioning = "content", default_format = "qs2") (or at minimum set
versioning = "content") near the start of the test (before the first st_save) so
the behavior of st_save, st_versions and skipped/no_change_policy checks is
consistent; update the test that uses st_init, st_opts, st_save, and st_versions
to pin versioning to "content" and then proceed with the three save/check steps.
---
Nitpick comments:
In `@copilot_logs/LOG_fix_versioning.md`:
- Line 51: Update the section header string "To Do List" to the hyphenated form
"To-Do List" to match the requested style; locate the header text "To Do List"
in the document and replace it with "To-Do List" so the section uses the
hyphenated wording.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 95eecf99-5bf6-4c5b-b72f-b4a4751456ac
📒 Files selected for processing (8)
DESCRIPTIONNEWS.mdR/IO_core.RR/aaa.Rcopilot_logs/LOG_fix_versioning.mdman/dot-st_resolve_and_normalize.Rdman/dot-st_resolve_file_path.Rdtests/testthat/test-should-save.R
💤 Files with no reviewable changes (3)
- man/dot-st_resolve_file_path.Rd
- R/aaa.R
- man/dot-st_resolve_and_normalize.Rd
| test_that("st_save correctly skips saving identical content (regression test)", { | ||
| skip_on_cran() | ||
| td <- withr::local_tempdir() | ||
| st_init(td) | ||
| st_opts(default_format = "qs2") | ||
|
|
||
| df <- data.frame(x = 1:5, y = letters[1:5]) | ||
|
|
||
| # First save | ||
| r1 <- st_save(df, "test.qs2", verbose = FALSE) | ||
| expect_false(is.null(r1$version_id)) | ||
| v1 <- r1$version_id | ||
|
|
||
| # Second save with IDENTICAL content - should be skipped | ||
| r2 <- st_save(df, "test.qs2", verbose = FALSE) | ||
| expect_true(r2$skipped) | ||
| expect_equal(r2$reason, "no_change_policy") | ||
|
|
||
| # Verify only one version exists | ||
| versions <- st_versions("test.qs2") | ||
| expect_equal(nrow(versions), 1) | ||
| expect_equal(versions$version_id[1], v1) | ||
|
|
||
| # Third save with CHANGED content - should create new version | ||
| df_changed <- data.frame(x = 6:10, y = letters[6:10]) | ||
| r3 <- st_save(df_changed, "test.qs2", verbose = FALSE) | ||
| expect_false(is.null(r3$version_id)) | ||
| expect_false(r3$version_id == v1) | ||
|
|
||
| # Verify two versions exist now | ||
| versions2 <- st_versions("test.qs2") | ||
| expect_equal(nrow(versions2), 2) | ||
| }) |
There was a problem hiding this comment.
Make this regression test deterministic by pinning versioning mode.
This test relies on global st_opts() state; explicitly setting versioning = "content" would ensure it always validates the intended default-mode bug path.
Suggested hardening
test_that("st_save correctly skips saving identical content (regression test)", {
skip_on_cran()
td <- withr::local_tempdir()
st_init(td)
st_opts(default_format = "qs2")
+ st_opts(versioning = "content")📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| test_that("st_save correctly skips saving identical content (regression test)", { | |
| skip_on_cran() | |
| td <- withr::local_tempdir() | |
| st_init(td) | |
| st_opts(default_format = "qs2") | |
| df <- data.frame(x = 1:5, y = letters[1:5]) | |
| # First save | |
| r1 <- st_save(df, "test.qs2", verbose = FALSE) | |
| expect_false(is.null(r1$version_id)) | |
| v1 <- r1$version_id | |
| # Second save with IDENTICAL content - should be skipped | |
| r2 <- st_save(df, "test.qs2", verbose = FALSE) | |
| expect_true(r2$skipped) | |
| expect_equal(r2$reason, "no_change_policy") | |
| # Verify only one version exists | |
| versions <- st_versions("test.qs2") | |
| expect_equal(nrow(versions), 1) | |
| expect_equal(versions$version_id[1], v1) | |
| # Third save with CHANGED content - should create new version | |
| df_changed <- data.frame(x = 6:10, y = letters[6:10]) | |
| r3 <- st_save(df_changed, "test.qs2", verbose = FALSE) | |
| expect_false(is.null(r3$version_id)) | |
| expect_false(r3$version_id == v1) | |
| # Verify two versions exist now | |
| versions2 <- st_versions("test.qs2") | |
| expect_equal(nrow(versions2), 2) | |
| }) | |
| test_that("st_save correctly skips saving identical content (regression test)", { | |
| skip_on_cran() | |
| td <- withr::local_tempdir() | |
| st_init(td) | |
| st_opts(default_format = "qs2") | |
| st_opts(versioning = "content") | |
| df <- data.frame(x = 1:5, y = letters[1:5]) | |
| # First save | |
| r1 <- st_save(df, "test.qs2", verbose = FALSE) | |
| expect_false(is.null(r1$version_id)) | |
| v1 <- r1$version_id | |
| # Second save with IDENTICAL content - should be skipped | |
| r2 <- st_save(df, "test.qs2", verbose = FALSE) | |
| expect_true(r2$skipped) | |
| expect_equal(r2$reason, "no_change_policy") | |
| # Verify only one version exists | |
| versions <- st_versions("test.qs2") | |
| expect_equal(nrow(versions), 1) | |
| expect_equal(versions$version_id[1], v1) | |
| # Third save with CHANGED content - should create new version | |
| df_changed <- data.frame(x = 6:10, y = letters[6:10]) | |
| r3 <- st_save(df_changed, "test.qs2", verbose = FALSE) | |
| expect_false(is.null(r3$version_id)) | |
| expect_false(r3$version_id == v1) | |
| # Verify two versions exist now | |
| versions2 <- st_versions("test.qs2") | |
| expect_equal(nrow(versions2), 2) | |
| }) |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@tests/testthat/test-should-save.R` around lines 83 - 115, The test relies on
global st_opts state so make it deterministic by explicitly setting the
versioning mode before saves; call st_opts(versioning = "content",
default_format = "qs2") (or at minimum set versioning = "content") near the
start of the test (before the first st_save) so the behavior of st_save,
st_versions and skipped/no_change_policy checks is consistent; update the test
that uses st_init, st_opts, st_save, and st_versions to pin versioning to
"content" and then proceed with the three save/check steps.
Hola @randrescastaneda,
I had to fix a bug in stamp because the default versioning ("content") was not working and files with the same content hash were saved many times. I also created a small log you can review. Let me know if you have questions.
Summary by CodeRabbit