Skip to content

@W-22247284@ feat: add DistributionType to package create and update - #926

Merged
sshyamala-sfdc merged 5 commits into
packaging-distribution/spifrom
prerelease/t/packaging-distribution/w-22247284/package-distribution-type
Sep 3, 2026
Merged

@W-22247284@ feat: add DistributionType to package create and update#926
sshyamala-sfdc merged 5 commits into
packaging-distribution/spifrom
prerelease/t/packaging-distribution/w-22247284/package-distribution-type

Conversation

@sshyamala-sfdc

Copy link
Copy Markdown
Collaborator

What & why

Adds an optional distribution type to 2GP package create and package update (W-22247284).

The distribution type controls install-time security of a package. This PR is the library half of the feature; the plugin-packaging PR adds the --distribution-type flag and pins the prerelease this branch publishes.

Behavior

  • Optional on create. When omitted, the backend defaults the distribution type based on the package type.
  • CLI-settable values are PublicSecure and Limited only on both create and update. Public and Private are backend-only states (Public is the legacy default; Private is not yet selectable) and are rejected with a clear error.
  • Gated at API version 68.0. Supplying a distribution type against an older API version errors; the DistributionType field is only queried/sent at 68.0+.

Changes

  • DistributionType / SettableDistributionType types, SETTABLE_DISTRIBUTION_TYPES, and DISTRIBUTION_TYPE_MIN_API_VERSION constants (in the interfaces leaf module to avoid an import cycle).
  • Package2.DistributionType field; distributionType? on PackageCreateOptions; DistributionType? on PackageUpdateOptions.
  • validateDistributionType() enforces the API-version gate and the CLI-settable allow-list from both createPackage and Package.update.
  • DistributionType included in getPackage2Fields only at API 68.0+.
  • New error messages + unit tests (28 passing, including 7 new DistributionType cases).

🤖 Generated with Claude Code

…247284)

Add an optional distribution type to 2GP package create and update. The
value is gated at API version 68.0 and, when supplied from the CLI, must be
either PublicSecure or Limited; Public and Private are backend-only states.
When omitted on create, the backend defaults the distribution type based on
the package type.

- DistributionType / SettableDistributionType types + SETTABLE_DISTRIBUTION_TYPES
  and DISTRIBUTION_TYPE_MIN_API_VERSION constants
- Package2.DistributionType field; distributionType on PackageCreateOptions and
  DistributionType on PackageUpdateOptions
- validateDistributionType() enforces the API-version gate and CLI-settable
  allow-list from both createPackage and Package.update
- DistributionType included in getPackage2Fields only at API 68.0+
- messages + unit tests

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@sshyamala-sfdc
sshyamala-sfdc requested a review from a team as a code owner September 2, 2026 22:54
sshyamala-sfdc and others added 2 commits September 2, 2026 22:58
Sibling prerelease branches have already published spi.2 through spi.5.
Bumping this branch's version so the release action computes the next free
version (5.0.9-spi.6) instead of colliding on an existing tag.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
sshyamala-sfdc and others added 2 commits September 3, 2026 17:20
Private is not a selectable distribution type today. Removing it from the
DistributionType union keeps it out of the generated plugin schemas while
leaving the CLI-settable subset (PublicSecure, Limited) unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@sshyamala-sfdc
sshyamala-sfdc merged commit 973b73f into packaging-distribution/spi Sep 3, 2026
9 checks passed
@sshyamala-sfdc
sshyamala-sfdc deleted the prerelease/t/packaging-distribution/w-22247284/package-distribution-type branch September 3, 2026 20:26
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.

3 participants