Skip to content

Inconsistent version_selected semantics in package actions #356

@RRosio

Description

@RRosio

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 #342 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions