Skip to content

Package2 IsDeprecated, IsDeleted fields and unexpected (and undocumented) behaviors #2747

@dschach

Description

@dschach

Summary

tl;dr - Package2 and CLI have some unfortunate behaviors.

Just off long call with Support. Learned a few things:

  1. Package2 has undocumented fields. IsDeprecated and IsDeleted (and others)
  2. sf package delete does not delete the package. It marks it as deprecated.
    Deprecated packages can be renamed (BAD)
  3. here is reference to undelete in the CLI code (https://github.com/search?q=repo%3Aforcedotcom%2Fpackaging+undelete&type=code)
  4. There is no reference to undeprecate in the CLI code

Expected Behaviors:

  • We should not be able to rename deprecated packages
  • We should be able to undeprecate packages so we can, for example, rename them
  • Salesforce "says" they are deleted, but they are actually deprecated - I'm going to call this a trust violation (drastic, I know, but true with data deletion laws)
  • The documentation is pretty inaccurate - there are fields in the CLI code for Package2 that are not in the object documentation, and fields in the documentation that are not listed in the code
  • The difference between delete and deprecate must be clarified

Steps To Reproduce

Create a package (2GP)
Wait a minute or two
Query SELECT Id, Name, NamespacePrefix, IsDeleted, IsDeprecated, SubscriberPackageID FROM Package2 until it actually shows up
Create a package version (may be unnecessary, but that's what we did)
Delete the package version
Delete the package with sf package delete
Run the query again

Expected result

The package you just made should not be there IF it is actually deleted.

Actual result

The package shows up and IsDeleted = false and IsDeprecated = true

System Information

OSX VSCode
Fresh org with fresh namespace registry org

{
  "architecture": "darwin-arm64",
  "cliVersion": "@salesforce/cli/2.29.5",
  "nodeVersion": "node-v20.11.0",
  "osVersion": "Darwin 23.3.0",
  "rootPath": "/Users/dschach/.local/share/sf/client/2.29.5-06cd97f",
  "shell": "zsh",
  "pluginVersions": [
    "@jongpie/sfdx-bummer-plugin 0.0.19 (user)",
    "@oclif/plugin-autocomplete 3.0.8 (core)",
    "@oclif/plugin-commands 3.1.3 (core)",
    "@oclif/plugin-help 6.0.12 (core)",
    "@oclif/plugin-not-found 3.0.10 (core)",
    "@oclif/plugin-plugins 4.2.2 (core)",
    "@oclif/plugin-search 1.0.14 (core)",
    "@oclif/plugin-update 4.1.11 (core)",
    "@oclif/plugin-version 2.0.12 (core)",
    "@oclif/plugin-warn-if-update-available 3.0.10 (core)",
    "@oclif/plugin-which 3.0.15 (core)",
    "@salesforce/cli 2.29.5 (core)",
    "apex 3.0.23 (core)",
    "auth 3.3.11 (core)",
    "data 3.0.20 (core)",
    "deploy-retrieve 3.2.14 (core)",
    "info 3.0.24 (core)",
    "limits 3.1.8 (core)",
    "marketplace 1.0.22 (core)",
    "org 3.3.12 (core)",
    "packaging 2.1.7 (core)",
    "schema 3.1.3 (core)",
    "settings 2.0.24 (core)",
    "sobject 1.1.11 (core)",
    "source 3.1.13 (core)",
    "telemetry 3.1.11 (core)",
    "templates 56.0.14 (core)",
    "trust 3.3.8 (core)",
    "user 3.2.8 (core)",
    "@salesforce/sfdx-scanner 3.21.0 (user)"
  ]

Additional information

Metadata

Metadata

Assignees

No one assigned

    Labels

    investigatingWe're actively investigating this issuevalidatedVersion information for this issue has been validated

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions