Skip to content

Conversation

@hdpriest-ui
Copy link
Collaborator

@hdpriest-ui hdpriest-ui commented Nov 3, 2025

  • separates R kernel installs into two locations: one is the core location where the libraries are installed. the 2nd location is the user's overlay install location where packages that user installs for that kernel are kept.
  • switching kernels switches both locations
  • removes conda-pack from the tool, as we are no long re-locating kernels
  • packages are now stationary, and therefore multiple users may rely on common library locations, making changes to these locations not possible

Note

Replaces tar-based kernel relocation with in-place environments, adds per-user R overlay registration, updates activation/cleanup flows, and aligns tests and update_r_libs.sh with the new model.

  • Manager (icrn_manager):
    • Replace conda-pack unpacking with in-place kernel usage via catalog environment_location.
    • Add R overlay support: create per-user overlay dirs and register overlay_path in user catalog.
    • Register paths: register_r_library_in_user_catalog, register_python_library_in_user_catalog, register_user_overlay_in_user_catalog.
    • Update kernels get to validate inputs, create overlay (R), and register paths; alias getget_in_place.
    • Update kernels use:
      • R: require overlay_path, symlink core lib, call update_r_libs.sh with kernel and overlay paths.
      • Python: reinstall kernelspecs; use <lang> none removes only catalog-installed kernels.
    • Remove kernels remove command; keep clean for catalog entries only.
    • Expand help/docs and safety checks; minor launcher routing tweaks.
  • update_r_libs.sh:
    • Change interface to accept target_kernel_path and target_overlay_path; write R_LIBS as overlay:kernel:${R_LIBS} and support unsetting.
  • Tests:
    • Overhaul test env to use environment_location and mock conda envs; drop tar/conda-pack artifacts.
    • Add tests for R overlay usage, overlay dir creation, security (wildcards/path traversal), Python none uninstall behavior.
    • Update existing tests to new outputs and parameters; update results log accordingly.

Written by Cursor Bugbot for commit 8bf30fb. This will update automatically on new commits. Configure here.

…tecture. this will break python support briefly.
…l, non-mobile, conda envs.

conda environments not relocated with conda-pack do not always have activate/deactivate files addressible with source.

R library location determiantion done by routing directly to $ENV/bin/Rscript (so, for now, it better be there)

Cannot use 'conda activate', as this requires conda init and a bash refresh.
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

This PR is being reviewed by Cursor Bugbot

Details

You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

@hdpriest-ui hdpriest-ui merged commit 2b9d668 into main Nov 20, 2025
2 of 4 checks passed
@hdpriest-ui hdpriest-ui deleted the enable-kernel-overlay-installs branch November 20, 2025 15:23
"R")
unpack_r_kernel "$target_unpacked" "$language" "$targetname" "$version"
echo "registering R library"
register_r_library_in_user_catalog "$target_location" "$language" "$targetname" "$version"
Copy link

Choose a reason for hiding this comment

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

Bug: Missing error handling for R library registration

The call to register_r_library_in_user_catalog doesn't check its return value. If this function fails (returns 1), for example when the conda-meta directory doesn't exist, the script continues to register the overlay anyway. This creates an inconsistent catalog state where overlay_path may be set but absolute_path is missing or incorrect, causing subsequent kernels use commands to fail.

Fix in Cursor Fix in Web

user_catalog_tmp=$(mktemp)
jq -r ".\"$language\".\"$targetname\".\"$version\"={\"absolute_path\":\"$target_kernel_path\"} " "$user_catalog" > "$user_catalog_tmp" && mv "$user_catalog_tmp" "$user_catalog"

jq -r ".\"$language\".\"$targetname\".\"$version\"={\"absolute_path\":\"$target_kernel_path\"}" "$user_catalog" > "$user_catalog_tmp" && mv "$user_catalog_tmp" "$user_catalog"
Copy link

Choose a reason for hiding this comment

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

Bug: Catalog entry replacement loses existing data

The jq command uses = to replace the entire version entry with a new object containing only absolute_path. If a user re-runs kernels get on an already-checked-out kernel, any existing fields in the catalog entry (like overlay_path from a previous checkout) are deleted before being re-added. This creates unnecessary data churn and fragility, though the overlay path gets re-added immediately after by register_user_overlay_in_user_catalog.

Fix in Cursor Fix in Web

;;
"Python")
unpack_python_kernel "$target_unpacked" "$language" "$targetname" "$version"
register_python_library_in_user_catalog "$target_location" "$language" "$targetname" "$version"
Copy link

Choose a reason for hiding this comment

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

Bug: Missing error handling for Python library registration

The call to register_python_library_in_user_catalog doesn't check its return value. If this function fails (returns 1), for example when the bin/activate script doesn't exist, the script exits the case statement without reporting the error properly. This could leave the user catalog in an inconsistent state or give the impression that the checkout succeeded when it actually failed.

Fix in Cursor Fix in Web

chmod +x "$TEST_REPO/r_kernels/ggplot2/3.4.0/bin/deactivate"
echo "#!/bin/bash" > "$TEST_REPO/r_kernels/ggplot2/3.4.0/bin/Rscript"
echo "echo '/mock/r/lib'" >> "$TEST_REPO/r_kernels/ggplot2/3.4.0/bin/Rscript"
chmod +x "$TEST_REPO/r_kernels/ggplot2/3.4.0/bin/Rscript"
Copy link

Choose a reason for hiding this comment

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

Bug: Test setup missing conda-meta directories for R kernels

The test setup creates mock R kernel environments with bin/ directories but doesn't create the conda-meta/ directories that register_r_library_in_user_catalog checks for on line 506 of icrn_manager. This causes R kernel registration to fail silently in tests, masking the missing error handling bug and preventing proper validation of the R kernel checkout flow.

Fix in Cursor Fix in Web

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