Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

DavisVaughan
Copy link
Member

@hadley you owe me a coffee at useR for this headache 😛

#310 swapped us from s3_register() to base R's @exportS3Method. Unfortunately, @lionel- and I have re-discovered that we absolutely cannot use this feature right now, as isNamespaceLoaded() incorrectly returns TRUE at the wrong times, which has a bad interaction with base R's form of lazy registration.

This PR reverts us back to s3_register().


If you are in the vctrs project and you load_all() with CRAN glue, this happens even when you already have glue installed:

Screen.Recording.2025-08-04.at.12.33.53.PM.mov

With advanced debugging turned on using Sys.setenv("_R_TRACE_LOADNAMESPACE_" = "4"), we see

image

What we see here is:

  • While vctrs is in the middle of loading with load_all()
  • glue has to be loaded, which causes registerS3Methods() to run for glue
  • One of glue's lazy S3 methods is a vctrs::vec_cast() method. Ideally this runs once vctrs is fully loaded. Instead, isNamespaceLoaded("vctrs") returns TRUE and registerS3Methods() tries to immediately register the method for vec_cast(), which is a generic that does not exist yet. This causes glue to fail to load and we get an error which seems to get swallowed by someone (can't tell by who) when running through load_all(), but we can see it in my image below.
  • Because glue failed to load, we get asked if we want to install our missing dependency by pkgload
Screenshot 2025-08-04 at 12 45 01 PM Screenshot 2025-08-04 at 12 47 39 PM

When running tests in parallel, this is even more confusing because we automatically answer "no" to check_installed()'s request (because we are in a subprocess) and we get:

Screenshot 2025-08-04 at 12 58 59 PM

@DavisVaughan DavisVaughan requested a review from hadley August 4, 2025 17:12
@hadley
Copy link
Member

hadley commented Aug 4, 2025

I will buy you a coffee of your choice 😢

@jennybc
Copy link
Member

jennybc commented Aug 5, 2025

I haven’t read this carefully yet but from skimming, it has echoes of this previous saga:

#254

@DavisVaughan
Copy link
Member Author

@jennybc do you want a news bullet? It would be a fairly technical one. Feel free to merge if not

@DavisVaughan DavisVaughan merged commit ed413d2 into main Aug 12, 2025
13 checks passed
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