Skip to content

Handle dependencies that reject the configured install key in promote_package_version - #4018

Open
jeromeyyy wants to merge 6 commits into
SFDO-Tooling:mainfrom
jeromeyyy:fix/promote-dep-install-key
Open

jeromeyyy wants to merge 6 commits into
SFDO-Tooling:mainfrom
jeromeyyy:fix/promote-dep-install-key

Conversation

@jeromeyyy

@jeromeyyy jeromeyyy commented Nov 3, 2026 •

Copy link
Copy Markdown

See #4007

Problem

release_unlocked_production (via promote_package_version) queries every dependency's SubscriberPackageVersion with the target package's install_key in the InstallationKey filter. As reported in #4007, when a dependency unlocked package does not share that key, the Tooling API rejects the query with INSTALL_KEY_INVALID and the release fails.

What this changes (and what it does not)

Dependency SubscriberPackageVersion queries now retry once without the InstallationKey filter when the configured key is rejected with INSTALL_KEY_INVALID.

  • Proposed handling, not a proven fix: dependencies that are not key-protected. The Tooling API only requires the InstallationKey filter when the queried version is itself protected by a key, so a keyless retry should let the release proceed in that case. However, the issue report involves a differently-keyed dependency, and there is no live-org or documented evidence here that a non-key-protected version rejects a mismatched key filter with INSTALL_KEY_INVALID - so this path is proposed behavior that needs maintainer qualification, not an established defect fix.
  • Not fixed: dependencies protected by their own, different install key (the reported scenario). A keyless query cannot retrieve a key-protected version. If the retry fails, its original API error is preserved, including its error code and response. This task does not currently provide a separate dependency key. No promotion or other workaround is claimed here. Full resolution of release_unlocked_production fails when dependent unlocked package has an install key #4007 remains open and requires maintainer guidance.

Only a structured error response containing the exact errorCode value INSTALL_KEY_INVALID triggers the retry. Unrelated API errors, malformed error payloads, and failures on the target-package path propagate unchanged.

Queries for the target package itself are unchanged: its configured key is still used, and a rejection still fails the task.

Tests

  • 26 tests in the task module pass. Coverage includes the proposed successful fallback using mocked responses, no records from the retry, a second API rejection, exact structured error-code matching, unrelated errors before and after retry, no configured key, and fail-closed target-package queries.
  • Seven corrected/new cases fail against the prior PR code and pass after the error-handling repair. These mocks verify local control flow, not Salesforce behavior for unprotected dependency versions.
  • Full local suite: 3289 passed, 37 skipped, 5 pre-existing environment failures (4 OAuth client tests and test_bad_entry_point). No live Salesforce org was used.

…ckage_version

Queries for dependency SubscriberPackageVersions reused the target package's install key. The Tooling API only requires the InstallationKey filter when the queried version is itself protected by a key, and rejects a mismatched key with INSTALL_KEY_INVALID, so a dependency with a different key (or none) made release_unlocked_production fail. Dependency queries now retry once without the key filter when the configured key is rejected with INSTALL_KEY_INVALID. The target package's own queries are unchanged.
Added tests for handling dependency queries with install key validation and retry logic.
@jeromeyyy
jeromeyyy requested a review from a team as a code owner November 3, 2026 17:33
@salesforce-cla

salesforce-cla Bot commented Nov 3, 2026

Copy link
Copy Markdown

Thanks for the contribution! Before we can merge this, we need @jeromeyyy to sign the Salesforce Inc. Contributor License Agreement.

…queries

Handle exceptions when querying subscriber package versions without an install key.
@jeromeyyy jeromeyyy changed the title Fix promote_package_version failing on dependencies with a different install key Handle dependencies that reject the configured install key in promote_package_version Nov 3, 2026
Only exact structured INSTALL_KEY_INVALID errors trigger the proposed fallback. Preserve errors from its retry and remove the unsupported promotion workaround.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant