gator icon indicating copy to clipboard operation
gator copied to clipboard

Inconsistent version_selected semantics in package actions

Open RRosio opened this issue 3 weeks ago • 0 comments

Problem

  • The version_selected property uses inconsistent values across the codebase:
    • 'none' = not selected / to be removed
    • '' (empty string) = used for updatable packages in applyPackageChanges, but also used to mean "unpinned" in CondaPkgDrawer
    • 'auto' = used in CreateEnvDrawer to mean "let conda pick latest"
    • Specific version strings like '3.11'

Files affected

  • packageActions.ts: Uses '' specifically for updatable packages
  • CondaPkgDrawer.tsx: Uses '' with misleading comment about "unpinned"
  • CreateEnvDrawer.tsx: Uses 'auto' for new installations
  • CondaPkgList.tsx & other components? may rely on these values for rendering

The comment on line 108 says "It's currently not selected, so select with empty string (represents "unpinned" version)" but this is misleading. The empty string doesn't represent "unpinned" - looking at the applyPackageChanges logic, an empty string for version_selected is specifically used for packages that are marked as updatable (line 134). For new installations, the version should be specified or use 'auto'. This inconsistency could lead to confusion about what an empty string means in different contexts.

      // It's currently not selected, so select with 'auto' (represents latest version for new installations)
      pkg.version_selected = 'auto';

Originally posted by @Copilot in https://github.com/mamba-org/gator/pull/342#discussion_r2605298502

RRosio avatar Dec 11 '25 03:12 RRosio