Skip to content

Add hard fail on unsupported R version#1199

Merged
thomasp85 merged 13 commits into
posit-dev:mainfrom
thomasp85:issue-696-hard-fail-version
May 21, 2026
Merged

Add hard fail on unsupported R version#1199
thomasp85 merged 13 commits into
posit-dev:mainfrom
thomasp85:issue-696-hard-fail-version

Conversation

@thomasp85
Copy link
Copy Markdown
Collaborator

Fix #696

This PR inserts a version check in the start method, right after R detection. It does not dive into checking R package versions as suggested since these are not hard requirements AFAICT and Ark gracefully handles it already

Comment thread crates/ark/src/version.rs Outdated
Comment thread crates/ark/src/version.rs Outdated
Comment thread crates/ark/src/version.rs Outdated
Comment thread crates/ark/src/version.rs Outdated
Comment thread crates/ark/src/version.rs Outdated
Comment thread crates/ark/src/version.rs Outdated
}
}

// It is assumed that r_home matches the R_HOME env var. Usually the input will
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.

That's a bit confusing. If we're passing r_home through, we should probably run that R?

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.

Right now we're only passing it to return it along with the version. That seems misleading, since it suggests the function needs it but not really.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

yeah, I agree... this was the minimally invasive path but it does lead to some weirdness

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

How would you feel about r_home_setup() returning an RVersion instead of a PathBuf? That is the nicest way to fold all of this together I think?

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.

Good idea. How about a new RHome struct with version and path field?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I'm fine with that - the use of RVersion is pretty much confined to this so it's easy to generalise it

Copy link
Copy Markdown
Contributor

@DavisVaughan DavisVaughan May 5, 2026

Choose a reason for hiding this comment

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

Do you mind if i merge #1172 first? It uses / moves around some things with r_home_setup()

update: merged

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

ok, with R_HOME always set we should probably just remove r_home from the RVersion struct and use that..?

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.

ok, with R_HOME always set we should probably just remove r_home from the RVersion struct and use that..?

It's still useful to have it in a struct, looking up an envvar is not thread safe and should in principle only be done from the R thread (we've seen crashes with 0mq init because of this in the past). The less we look up envvars, the better.

Copy link
Copy Markdown
Contributor

@lionel- lionel- left a comment

Choose a reason for hiding this comment

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

LG!

@thomasp85 thomasp85 requested a review from DavisVaughan May 19, 2026 06:16
@thomasp85
Copy link
Copy Markdown
Collaborator Author

@DavisVaughan Can you give the latest iteration I quick glance? I changed the version check to read from the DESCRIPTION file of base to completely avoid any R process execution for it

Copy link
Copy Markdown
Contributor

@DavisVaughan DavisVaughan left a comment

Choose a reason for hiding this comment

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

Looks great just one minor comment

Comment thread crates/ark/src/version.rs
use oak_package_metadata::description::Description;

pub const MIN_R_MAJOR: u32 = 4;
pub const MIN_R_MINOR: u32 = 2;
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.

You may as well throw in MIN_R_PATCH: u32: = 0

I think it makes the Ark requires R >= {}.{}.0 message clearer and we may need it one day

Don't forget to update is_supported

@thomasp85 thomasp85 merged commit c930b3a into posit-dev:main May 21, 2026
17 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators May 21, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ark: Fail hard on unsupported R versions (i.e. if launched through Jupyter)

3 participants