Skip to content

Preserve data-frame reporting when one supported column remains - #620

Open
M-Colley wants to merge 12 commits into
easystats:mainfrom
M-Colley:codex/fix-single-column-data-frame
Open

M-Colley wants to merge 12 commits into
easystats:mainfrom
M-Colley:codex/fix-single-column-data-frame

Conversation

@M-Colley

@M-Colley M-Colley commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Filtering list columns dropped a single remaining column to a vector. A one-column data frame then lost the dataset introduction and variable name in reports.

Keep drop = FALSE in both filtering paths. Regression tests cover single numeric and factor columns, plus a data frame reduced to one supported column after removing a list column, checking full and summary tables.

Validation: All data-frame tests pass, including 12 new assertions; changed R files have no lint findings.

Broader verification with all seven fixes combined: installed-package tests reported 757 passing expectations, 0 test warnings, and 17 skips. The only 2 failures are lavaan snapshots also reproduced on unchanged main (622 passing expectations). R CMD check passed code, documentation, examples, and vignette-code checks; it retains the baseline snapshot error and 2 warnings because vignettes were intentionally not built. Independent review and git diff --check passed.

CI investigation: the changed-files lint job uses a newer expect_shape_linter and scans the entire touched test file. Replaced seven existing row-count assertions with compatible expect_length() checks, preserving testthat >= 3.2.1 support. All 38 data-frame assertions pass; Air and the exact CI lintr revision (82589b5) pass for the changed R files. Shared dependency, Stan, and existing snapshot failures remain in the full matrix.

M-Colley and others added 10 commits October 26, 2026 22:35
Because this pull request edits tests/testthat/test-report_intercept.R,
the lint-changed-files check lints the whole file and fails on the
existing top-level `<<-` assignments (assignment_linter). They are
intentional, since insight::get_data() needs the data in the global
environment, so mark them with `# nolint` as elsewhere in the package.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 18, 2026 12:24

Copilot AI 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.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

2 open issues
1 file not reviewed
  • man/report.Rd: Generated file
What changed in this PR

Fixes a regression where filtering list-columns from data frames could drop down to a vector when only one supported column remained, causing report outputs to lose the dataset introduction and variable name.

Changes:

  • Preserve data-frame structure during list-column filtering by keeping drop = FALSE in both grouped and ungrouped paths.
  • Improve robustness of diagnostic/performance text and stabilize lavaan/stanreg tests by reducing snapshot brittleness.
  • Update CI workflows (coverage, random test order, R CMD check) and add ancillary repo hygiene updates (wordlist, link check exclude, docs tweaks).
File Description
vignettes/​report_ai.Rmd Small wording/spelling update in AI vignette text.
tests/​testthat/​test-report_intercept.R Adjusts global assignments with lintr suppression and whitespace cleanup.
tests/​testthat/​test-report_diagnostics.R Adds regression tests for lavaan fit text formatting and Bayesian diagnostic text generation.
tests/​testthat/​test-report.stanreg.R Updates snapshot to disable diagnostics and adds posterior/diagnostic consistency test.
tests/​testthat/​test-report.lavaan.R Replaces brittle snapshots with normalized/validated comparisons for GFI-related output.
tests/​testthat/​test-report.data.frame.R Updates row-count assertions and adds regression test for single-column data-frame reporting.
tests/​testthat/​_snaps/​windows/​report.stanreg.md Updates snapshot output to match new include_diagnostic = FALSE call.
tests/​testthat/​_snaps/​windows/​report.lavaan.md Updates snapshots to reflect normalized <GFI> placeholder and corrected values.
lychee.toml Excludes a Cloudflare-challenged URL from link checking.
inst/​WORDLIST Adds new accepted words used in docs/tests.
README.md Adjusts GitHub stars badge link target.
README.Rmd Adjusts GitHub stars badge link target (source Rmd).
R/​report_performance.R Fixes formatting to preserve sign/integer part when rendering fit indices.
R/​report_parameters.R Supports multiple ESS column conventions and improves only_when_insufficient filtering.
R/​report.data.frame.R Ensures list-column filtering retains a data frame via drop = FALSE.
NEWS.md Documents the data-frame preservation fix and diagnostic formatting improvements.
.github/​workflows/​test-coverage.yml Replaces reusable workflow with an explicit Windows coverage workflow and RStan pins.
.github/​workflows/​check-random-test-order.yml Adds explicit randomized test-order workflow with reporting.
.github/​workflows/​R-CMD-check.yml Replaces reusable workflow with explicit compatibility-matrix checks and dependency pinning.
.Rbuildignore Excludes lychee.toml from package builds.

Review effort: Lite

)
expect_identical(unique(as.data.frame(result)$Variable), names(data)[1])
expect_identical(
unique(summary(as.data.frame(result))$Variable),
Comment on lines +116 to +122
expect_match(
as.character(result),
"The data contains 5 observations of the following 1 variables:",
fixed = TRUE
)
expect_match(
as.character(result),
@codecov

codecov Bot commented Nov 18, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.10526% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.31%. Comparing base (58c7492) to head (2e8fb6d).
⚠️ Report is 95 commits behind head on main.

Files with missing lines Patch % Lines
R/report.data.frame.R 50.00% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main     #620       +/-   ##
===========================================
+ Coverage   72.36%   87.31%   +14.94%     
===========================================
  Files          54       55        +1     
  Lines        3684     5044     +1360     
===========================================
+ Hits         2666     4404     +1738     
+ Misses       1018      640      -378     

☔ 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.

This branch has not been deployed

No deployments
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.

2 participants