Skip to content

improve knit_print for LogisticNormalMixture#937

Merged
danielinteractive merged 10 commits intomainfrom
fix_knit_print_LogisticNormalMixture
Mar 17, 2026
Merged

improve knit_print for LogisticNormalMixture#937
danielinteractive merged 10 commits intomainfrom
fix_knit_print_LogisticNormalMixture

Conversation

@danielinteractive
Copy link
Copy Markdown
Collaborator

No description provided.

Copy link
Copy Markdown

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 updates the knit_print() output for LogisticNormalMixture models and adds snapshot coverage to ensure the rendered LaTeX/markdown/HTML stays stable.

Changes:

  • Reworked knit_print.LogisticNormalMixture() to build the mixture prior LaTeX directly (instead of embedding nested knit_print(ModelParamsNormal) output).
  • Added a new snapshot test for knit_print() on LogisticNormalMixture and corresponding markdown snapshot.
  • Updated the macOS/Darwin HTML snapshot for knit_print_LogisticNormalMixture.html to reflect the new rendering.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
R/helpers_knitr_GeneralModel.R Adjusts knit_print.LogisticNormalMixture() output construction for mixture prior rendering.
tests/testthat/test-helpers_knitr_GeneralModel.R Adds a snapshot test for knit_print() on LogisticNormalMixture.
tests/testthat/_snaps/helpers_knitr_GeneralModel.md Adds the expected snapshot output for the new test.
tests/testthat/_snaps/Darwin/helpers_knitr/knit_print_LogisticNormalMixture.html Updates the Darwin HTML snapshot to match the new output.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

danielinteractive and others added 4 commits March 16, 2026 21:52
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown

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

Fixes knit_print() rendering for LogisticNormalMixture in knitr/rmarkdown output and adds regression coverage to prevent reintroducing the formatting issue.

Changes:

  • Refactors knit_print.LogisticNormalMixture() to render mixture components via a dedicated internal LaTeX helper (avoiding malformed nested knit_print() output).
  • Adds a new snapshot test for knitr::knit_print() on a LogisticNormalMixture instance and updates snapshots.
  • Bumps development version and documents the fix in NEWS.md.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
tests/testthat/test-helpers_knitr_GeneralModel.R Adds snapshot regression test for knitr::knit_print(LogisticNormalMixture).
tests/testthat/_snaps/Darwin/helpers_knitr_GeneralModel.md Adds Darwin snapshot output for the new GeneralModel knit_print test.
tests/testthat/_snaps/Darwin/helpers_knitr/knit_print_LogisticNormalMixture.html Updates Darwin HTML snapshot showing corrected mixture-prior rendering in rendered HTML.
R/helpers_knitr_GeneralModel.R Introduces internal Normal-component renderer and updates knit_print.LogisticNormalMixture() to use it.
NEWS.md Notes the LogisticNormalMixture knit_print rendering bugfix.
DESCRIPTION Bumps package version to 2.1.0.9000.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 16, 2026

Unit Tests Summary

    1 files     55 suites   4m 41s ⏱️
1 575 tests 1 417 ✅ 158 💤 0 ❌
7 469 runs  7 243 ✅ 226 💤 0 ❌

Results for commit ba2705e.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 16, 2026

Unit Test Performance Difference

Test Suite $Status$ Time on main $±Time$ $±Tests$ $±Skipped$ $±Failures$ $±Errors$
Design-methods 💚 $88.47$ $-3.57$ $0$ $0$ $0$ $0$
Rules-methods 💚 $38.65$ $-1.15$ $0$ $0$ $0$ $0$
Samples-methods 💚 $49.81$ $-1.13$ $0$ $0$ $0$ $0$
helpers_knitr_GeneralModel 👶 $+0.02$ $+1$ $+1$ $0$ $0$
Additional test case details
Test Suite $Status$ Time on main $±Time$ Test Case
helpers_knitr_GeneralModel 👶 $+0.02$ knit_print_works_ok_for_LogisticNormalMixture

Results for commit 747f8b5

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 16, 2026

badge

Code Coverage Summary

Filename                          Stmts    Miss  Cover    Missing
------------------------------  -------  ------  -------  ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
R/Backfill-class.R                   56      12  78.57%   36-41, 423-428
R/Backfill-methods.R                 30       0  100.00%
R/Backfill-validity.R                38       0  100.00%
R/checkmate.R                       100       2  98.00%   72, 462
R/crmPack-package.R                   4       0  100.00%
R/CrmPackClass-methods.R              5       0  100.00%
R/Data-class.R                      170       7  95.88%   43-45, 600-601, 607-612
R/Data-methods.R                    447      21  95.30%   34-66, 117
R/Data-validity.R                   210       1  99.52%   21
R/Design-class.R                    402       0  100.00%
R/Design-methods.R                 2947     294  90.02%   501-505, 517-525, 530, 788-792, 795-801, 803, 812, 815-822, 1433-1442, 1470, 1514-1515, 1768-1772, 1779-1790, 1793-1804, 1808-1841, 1858-1867, 1873-1888, 2264-2275, 2278-2289, 2293-2327, 2411, 2462-2463, 2860, 2862-2863, 2939, 3052-3063, 3074, 3100-3104, 3199-3243, 3247-3250, 3255-3261, 3294, 3308-3327, 3583, 3914-3918, 4024, 4038-4042, 4098, 4247, 4354
R/Design-validity.R                  42      14  66.67%   51-64
R/fromQuantiles.R                   189       0  100.00%
R/helpers_backfill.R                 14      12  14.29%   3-14
R/helpers_broom.R                    77      10  87.01%   33, 37-38, 40-41, 43, 87, 108-110
R/helpers_covr.R                     25       0  100.00%
R/helpers_data.R                    136       6  95.59%   142, 155, 176-180
R/helpers_design.R                  258      36  86.05%   78-130, 459
R/helpers_jags.R                     83       0  100.00%
R/helpers_knitr_Backfill.R           38       0  100.00%
R/helpers_knitr_CohortSize.R        133       0  100.00%
R/helpers_knitr_Design.R            358      14  96.09%   24-29, 331-338
R/helpers_knitr_GeneralData.R       220      41  81.36%   128-131, 148-151, 189-191, 274-278, 287-310, 325-330, 383
R/helpers_knitr_GeneralModel.R      896      12  98.66%   67-73, 162, 518, 966-967, 1044
R/helpers_knitr_Increments.R        181       0  100.00%
R/helpers_knitr_NextBest.R          325       0  100.00%
R/helpers_knitr_Opening.R           108       0  100.00%
R/helpers_knitr_Recruitment.R        16       0  100.00%
R/helpers_knitr_SafetyWindow.R      155       1  99.35%   109
R/helpers_knitr_Stopping.R          272       0  100.00%
R/helpers_knitr.R                    28       0  100.00%
R/helpers_model.R                    85       4  95.29%   40, 89-90, 141
R/helpers_rules.R                   532       0  100.00%
R/helpers_samples.R                   8       0  100.00%
R/helpers_simulations.R              27       0  100.00%
R/helpers.R                         239      35  85.36%   177-194, 225-268, 388-406
R/logger.R                           11       0  100.00%
R/mcmc.R                            310      17  94.52%   88-93, 354-355, 364-366, 369-372, 560-561, 662, 718
R/McmcOptions-class.R                22       0  100.00%
R/McmcOptions-methods.R               8       1  87.50%   43
R/McmcOptions-validity.R             42       0  100.00%
R/Model-class.R                    1146     181  84.21%   147-149, 221-223, 227-229, 291-293, 365-367, 371-373, 455-457, 524-526, 591-595, 598-601, 706-712, 716-717, 843-847, 964-966, 970-978, 1126-1128, 1133-1136, 1140-1143, 1260-1264, 1266-1269, 1273-1276, 1279, 1443-1457, 1462-1468, 1623-1626, 1632-1640, 1792, 1801, 1810, 1819, 1828-1837, 1969, 1978, 1987, 1995-1998, 2847-2876, 2881-2890, 2897-2901, 2906, 3036-3049, 3076, 3184-3186, 3190, 3290-3292, 3296, 3367-3379, 3398, 3463-3465, 3467-3468, 3471-3476
R/Model-methods.R                   557      44  92.10%   83, 246-254, 841-886, 1213-1225
R/Model-validity.R                  545      16  97.06%   485-488, 497-500, 703-711
R/ModelParams-class.R                17       0  100.00%
R/ModelParams-validity.R             26       0  100.00%
R/Rules-class.R                     534       0  100.00%
R/Rules-methods.R                  2076     274  86.80%   1176-1182, 1192-1198, 1208, 1360-1366, 1376-1382, 1388, 1517-1520, 1552, 1669-1672, 1704, 2237, 3170-3182, 3207-3217, 3382-3391, 3595-3890, 4506, 4510
R/Rules-validity.R                  557      36  93.54%   391-396, 807-846
R/Samples-class.R                     6       0  100.00%
R/Samples-methods.R                1158       4  99.65%   1635-1636, 1668, 1681
R/Samples-validity.R                 10       0  100.00%
R/Simulations-class.R               227      61  73.13%   165-176, 245-274, 974-993, 1019
R/Simulations-methods.R            1627     153  90.60%   51, 95, 174-180, 318, 326-330, 402-419, 432-437, 482-491, 526, 765, 768, 893-910, 921-930, 1041-1049, 1182-1187, 1210-1216, 2418-2421, 2523-2526, 2611-2615, 2667, 2987-3037
R/Simulations-validity.R             76       0  100.00%
R/utils.R                             6       0  100.00%
TOTAL                             17815    1309  92.65%

Diff against main

Filename                          Stmts    Miss  Cover
------------------------------  -------  ------  -------
R/helpers_knitr_GeneralModel.R      +38      +9  -0.99%
TOTAL                               +38      +9  -0.03%

Results for commit: ba2705e

Minimum allowed coverage is 80%

♻️ This comment has been updated with latest results

danielinteractive and others added 3 commits March 17, 2026 08:15
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@danielinteractive danielinteractive merged commit 38ee7fa into main Mar 17, 2026
21 checks passed
@danielinteractive danielinteractive deleted the fix_knit_print_LogisticNormalMixture branch March 17, 2026 01:14
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