Skip to content

Restore installed scoring generics with development S7 - #183

Merged
franceslinyc merged 4 commits into
tidymodels:mainfrom
t-kalinowski:fix/s7-compatibility-preview-20261012
Nov 20, 2026
Merged

franceslinyc merged 4 commits into
tidymodels:mainfrom
t-kalinowski:fix/s7-compatibility-preview-20261012

Conversation

@t-kalinowski

@t-kalinowski t-kalinowski commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

The S7 1.0.0 reverse-dependency checks found failures in filtro's examples and vignettes and in important's predictor-step tests. The following call from an important test fails with attempt to apply non-function when filtro 0.2.0 is built with the pretest version of S7. It returns the fitted score with the fix. CRAN pretest results

filtro::score_cor_pearson |>
  filtro::fit(mpg ~ ., data = mtcars)

When filtro registers its methods, temporary bindings shadow imported generics in the installed package.

Run S7_on_build() after method registration to restore the imported generics. Use the S7 load and unload hooks when available and keep methods_register() for older releases. Quote the score class's vector defaults so they remain valid constructor defaults with S7 1.0.0.

@t-kalinowski

Copy link
Copy Markdown
Contributor Author

Thanks for maintaining filtro! I'm planning to submit the next version of S7 to CRAN on November 16 (see RConsortium/S7#786).

Would you be able to merge these compatibility changes and submit an updated version of filtro to CRAN before then? Please let me know if you need more time or if there’s anything I can help with.

@franceslinyc franceslinyc self-assigned this Nov 20, 2026
@franceslinyc
franceslinyc requested a balanced review from Copilot November 20, 2026 20:21
@franceslinyc
franceslinyc merged commit 56a9be5 into tidymodels:main Nov 20, 2026
13 checks passed
@franceslinyc

Copy link
Copy Markdown
Collaborator

@t-kalinowski Truly sorry for missing this, but thanks! This branch is now merged. I am on to submitting to CRAN next.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

The fix relies on S7 build/load/unload hooks and installed-namespace behavior that cannot be validated here against both older and pretest S7 releases.

No open issues 🎉

What changed in this PR

This PR addresses installed scoring-generic failures with development S7, restoring compatibility for filtro and downstream callers.

Changes:

  • Calls S7’s build hook after method registration and uses load/unload hooks when available, retaining the older registration fallback.
  • Quotes vector-valued score defaults for compatibility with S7 1.0.0.
  • Adds a compatibility note to the changelog.
File Description
R/​zzz.R Adds conditional S7 lifecycle hooks while preserving older-release support.
R/​class_score.R Quotes outcome and predictor type defaults.
NEWS.md Documents compatibility updates for S7 > 0.2.2.

Review effort: Balanced

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.

3 participants