Skip to content

Conversation

@FBartos
Copy link
Owner

@FBartos FBartos commented Dec 10, 2025

This pull request updates the BayesTools test suite with new reference outputs for JAGS-based models and refines the test organization guidelines to enforce stricter duplication avoidance. The changes improve reproducibility and clarity in model testing, while also providing clearer protocols for both human and AI contributors to maintain consistency and minimize redundancy.

Test organization and maintenance guidelines:

  • Strengthened duplication avoidance in .github/instructions/tests.instructions.md, requiring exhaustive checks before adding new models and introducing an explicit AI agent protocol for test creation and refactoring. [1] [2]
  • Updated environment variable assignment in test files for loading reference outputs, switching to global assignment for REFERENCE_DIR.

Reference output updates for JAGS models:

  • Added new or updated reference tables for complex and simple mixed models, marginal models, spike-and-slab models, and missing data models in tests/results/JAGS-ensemble-tables/ and tests/results/JAGS-summary-tables/. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]
  • Added marginal estimates tables for model averaging and spike-slab models, including diagnostic warnings about Savage-Dickey density ratio overestimation when posterior samples do not span both sides of the null hypothesis. [1] [2]

Corrections and updates to spike factor outputs:

  • Corrected estimates and inference tables for spike factor models, reflecting updated posterior probabilities and mean/median values. [1] [2]

Copilot AI review requested due to automatic review settings December 10, 2025 14:10
@FBartos FBartos merged commit e70b5d1 into major-refactoring Dec 10, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the BayesTools test suite by adding new reference outputs for JAGS model tests and strengthening test organization guidelines to prevent duplication. The changes ensure reproducibility through updated reference tables and clarify protocols for maintaining test consistency.

Key changes:

  • Added/updated reference output files for JAGS model summary tables, ensemble tables, and marginal distribution estimates
  • Strengthened duplication avoidance guidelines in test organization documentation with explicit AI agent protocols
  • Updated environment variable assignment in test files from local to global scope

Reviewed changes

Copilot reviewed 30 out of 572 changed files in this pull request and generated 1 comment.

File Description
tests/results/JAGS-summary-tables/*.txt New reference tables for weight function, PET/PEESE, orthonormal contrast, mixed models, and marginal models
tests/results/JAGS-marginal-distributions/*.txt New marginal estimate tables with diagnostic warnings for spike-slab and model averaging
tests/results/JAGS-ensemble-tables/*.txt Updated spike factor estimates and inference tables, plus new mixed posteriors estimates
.github/instructions/tests.instructions.md Strengthened anti-duplication guidelines and added AI agent protocol for test creation

# Define at the top of test files with reference outputs
# Load common test helpers that define test_reference_table() and test_reference_text()
REFERENCE_DIR <- testthat::test_path("..", "results", "print")
REFERENCE_DIR <<- testthat::test_path("..", "results", "print")
Copy link

Copilot AI Dec 10, 2025

Choose a reason for hiding this comment

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

Using the global assignment operator <<- for REFERENCE_DIR is unconventional for test setup. Consider using regular assignment <- within test files, or if global scope is needed, document why this specific scoping is required. Global assignment can make tests harder to reason about and may cause unexpected side effects in the test environment.

Suggested change
REFERENCE_DIR <<- testthat::test_path("..", "results", "print")
REFERENCE_DIR <- testthat::test_path("..", "results", "print")

Copilot uses AI. Check for mistakes.
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