Repository navigation
Raise meaningful test coverage toward portfolio target (≥90%) - #76
bbuchsbaum merged 8 commits into
Conversation
Raise the coverage-target gate by exercising bids_datatype_spec, tabular validators/summary, file_pairs edge branches, real bids_project subject graphs, report/index helpers, infer_tr fallbacks, and mock query/confound error paths. Co-authored-by: bbuchsbaum <bbuchsbaum@users.noreply.github.com>
Exercise mock validation, plot modes, metadata/query edges, example-zip extraction, and dataset_description print paths. Fix plot_bids heatmap mode discarding its plot object, and stabilize create_virtual_bids_project rbind column schemas. Co-authored-by: bbuchsbaum <bbuchsbaum@users.noreply.github.com>
Cover list_files_github mocking, formula rescue in search/query, metadata provenance, compliance/session edges, nested confound cleaning/plot views, infer_tr stem sidecars, and pack listing. Co-authored-by: bbuchsbaum <bbuchsbaum@users.noreply.github.com>
Add tests for downsample stub fallback, BIDS URI resolution (including DatasetLinks schemes), schema filename validation, inheritance-aware read_sidecar/n_volumes, print crayon fallback, and remaining summary/query edges. Co-authored-by: bbuchsbaum <bbuchsbaum@users.noreply.github.com>
Accept either fallback or normal print output so the coverage gate run does not fail when trace injection is ineffective. Co-authored-by: bbuchsbaum <bbuchsbaum@users.noreply.github.com>
Cover bids_uri/resolve validation, entity-filter formula errors, schema empty helpers, sidecar empty/corrupt JSON, event input checks, and unsupported pack_bids downsample methods. Co-authored-by: bbuchsbaum <bbuchsbaum@users.noreply.github.com>
Remove a missing-argument style lint introduced by a trailing comma in expect_warning(). Co-authored-by: bbuchsbaum <bbuchsbaum@users.noreply.github.com>
Move switch() default stop() out of the switch expression in .bidser_event_path_entity so lintr no longer treats later code as unreachable. Behavior unchanged. Co-authored-by: bbuchsbaum <bbuchsbaum@users.noreply.github.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Unprotected setwd in zip test
- Registered on.exit(setwd(old_wd)) immediately after setwd(staging) so a utils::zip failure restores the working directory before later tests run.
Or push these changes by commenting:
@cursor push da4af87243
Preview (da4af87243)
diff --git a/tests/testthat/test_coverage_target2.R b/tests/testthat/test_coverage_target2.R
--- a/tests/testthat/test_coverage_target2.R
+++ b/tests/testthat/test_coverage_target2.R
@@ -190,6 +190,7 @@
))
old_wd <- getwd()
setwd(staging)
+ on.exit(setwd(old_wd), add = TRUE)
utils::zip(
zipfile = zip_file,
files = "bids-examples-master",You can send follow-ups to the cloud agent here.
Reviewed by Cursor Bugbot for commit 1af20a2. Configure here.
| files = "bids-examples-master", | ||
| flags = "-rq" | ||
| ) | ||
| setwd(old_wd) |
There was a problem hiding this comment.
Unprotected setwd in zip test
Medium Severity
setwd(staging) is restored only after utils::zip(...) succeeds. If zip fails, the process stays in the staging temp directory and the later on.exit(unlink(staging)) never registers, so later tests inherit a leftover or vanished working directory.
Reviewed by Cursor Bugbot for commit 1af20a2. Configure here.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1af20a25da
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| pre <- file.path(tempdir(), "bids_example_ds_preexist") | ||
| dir.create(pre, showWarnings = FALSE) | ||
| on.exit(unlink(pre, recursive = TRUE, force = TRUE), add = TRUE) | ||
| got <- get_example_bids_dataset("ds_preexist") |
There was a problem hiding this comment.
Stub the network check before testing the disk cache
In offline R CMD check environments, this call fails before reaching the supposedly pre-existing cache path: get_example_bids_dataset() performs httr::HEAD("https://github.com", ...) and raises “Internet connection required” before it checks whether tempdir()/bids_example_ds_preexist exists. Mock the HEAD request here (and guard for the suggested httr dependency) so this offline-safe test can actually exercise the disk-cache branch without requiring network access.
Useful? React with 👍 / 👎.





Summary
Addresses portfolio gate
coverage-targetfor #75.Coverage
432ca6b)Hosted
test-coverageon this PR: success. Codecov project/patch: pass.Changes
Meaningful tests only (plus small bugfixes exposed by those tests):
Tests added
test_coverage_target.R–test_coverage_target5.Rcovering uncovered exports, boundary cases, and error paths (bids_datatype_spec, tabulars,file_pairs, realbuild_subject_graph, report/index helpers, URI resolution, schema validation, confound/plot edges, and more).Bugfixes
plot_bids(..., visualization_mode = "heatmap")discarded its plot (never assignedcombined_plot)create_virtual_bids_project(derivatives = TRUE)rbindcolumn mismatchunreachable_code_linterfalse positive in.bidser_event_path_entity(switchdefaultstop())Checks
covr::package_coverage()= 90.19%;lintr::lint_package()cleanNotes
# nocov