forcedotcom / cli

Salesforce CLI
https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/
BSD 3-Clause "New" or "Revised" License
491 stars 79 forks source link

ancestorVersion HIGHEST from documentation is invalid #1392

Closed paustint closed 2 years ago

paustint commented 2 years ago

Summary

The documentation here https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_dev2gp_config_ancestors.htm suggestions that we can use the HIGHEST keyword, which does not work.

  1. the docs have invalid JSON since there are no quotes around the keyword HIGHEST
  2. The cli does not accept this as a valid value. ERROR running force:package:version:create: The ancestor versionNumber must be in the format major.minor.patch but the value found is [HIGHEST]
"packageDirectories": [
{
"path": "util",
"package": "Expense Manager - Util",
"versionNumber": "4.7.0.NEXT",
"ancestorVersion": HIGHEST
},

Steps To Reproduce:

  1. Work with a managed pacakge
  2. Specify ancestorVersion = "HIGHEST" in sfdx-project.json
  3. Run sfdx force:package:version:create with proper flags
  4. Observe error message

Expected result

Documentation should be accurate and cli should work as documented

Actual result

ERROR running force:package:version:create: The ancestor versionNumber must be in the format major.minor.patch but the value found is [HIGHEST]

System Information

{
        "cliVersion": "sfdx-cli/7.136.2",
        "architecture": "darwin-x64",
        "nodeVersion": "node-v16.13.2",
        "pluginVersions": [
                "@oclif/plugin-autocomplete 0.3.0 (core)",
                "@oclif/plugin-commands 1.3.0 (core)",
                "@oclif/plugin-help 3.3.1 (core)",
                "@oclif/plugin-not-found 1.2.6 (core)",
                "@oclif/plugin-plugins 1.10.11 (core)",
                "@oclif/plugin-update 1.5.0 (core)",
                "@oclif/plugin-warn-if-update-available 1.7.3 (core)",
                "@oclif/plugin-which 1.0.4 (core)",
                "@salesforce/sfdx-diff 0.0.6",
                "@salesforce/sfdx-plugin-lwc-test 0.1.7 (core)",
                "alias 1.2.0 (core)",
                "apex 0.8.0 (core)",
                "auth 1.8.1 (core)",
                "config 1.3.15 (core)",
                "custom-metadata 1.0.12 (core)",
                "data 0.6.8 (core)",
                "generator 1.2.1 (core)",
                "info 1.2.0 (core)",
                "isvte-sfdx-plugin 1.1.14",
                "limits 1.3.0 (core)",
                "org 1.11.1 (core)",
                "salesforce-alm 53.7.6 (core)",
                "schema 1.1.0 (core)",
                "sfdx-cli 7.136.2 (core)",
                "sfdx-falcon 0.0.93",
                "shane-sfdx-plugins 4.43.0",
                "├─ @mshanemc/plugin-streaming 1.1.7",
                "└─ @mshanemc/sfdx-sosl 1.1.0",
                "source 1.8.9 (core)",
                "telemetry 1.4.0 (core)",
                "templates 53.3.0 (core)",
                "trust 1.1.0 (core)",
                "user 1.7.0 (core)"
        ],
        "osVersion": "Darwin 21.1.0"
}
github-actions[bot] commented 2 years ago

Thank you for filing this issue. We appreciate your feedback and will review the issue as soon as possible. Remember, however, that GitHub isn't a mechanism for receiving support under any agreement or SLA. If you require immediate assistance, contact Salesforce Customer Support.

github-actions[bot] commented 2 years ago

We have determined that the issue you reported exists in code owned by another team that uses only the official support channels. To ensure that your issue is addressed, open an official Salesforce customer support ticket with a link to this issue. We encourage anyone experiencing this issue to do the same to increase the priority. We will keep this issue open for the community to collaborate on.

mshanemc commented 2 years ago

I've let the packaging team know about this.

They use support cases to prioritize work and it'll help for you to open one for them.

mshanemc commented 2 years ago

OK, here's one thing to try--use what's currently in latest-rc (7.137.1) to try it. I think that's where the change happened.

t7job commented 2 years ago

This functionality is available only for Dev Hubs on Spring '22 release and later. The Spring '22 release cycle is in progress and it will be GA by Feb 14. You'll need to be on the CLI version mentioned by Shane, as well.

paustint commented 2 years ago

Thanks, will wait for my devhub to get upgraded and will try again after that.

And I am assuming the docs have a syntax error because "ancestorVersion": HIGHEST would throw invalid JSON, so will make sure that JSON is indeed valid with "ancestorVersion": "HIGHEST"

ekapner commented 2 years ago

@t7job - I just made Penelope aware of the doc bug.

penelopy commented 2 years ago

Thank you for this feedback, I updated the doc today. The doc change will be live next week.

paustint commented 2 years ago

I am able to publish new package versions, but for some reason cannot create scratch orgs when I use the HIGHEST keyword.

sfdx force:org:create -f /...../scratch-def.json -a SCRATCH-DEV -d 30 -s

ERROR running force:org:create: The ancestor versionNumber must be in the format major.minor.patch but the value found is HIGHEST

Is there a schema validation that was not updated for force:org:create? I don't see any other reason why ancestorVersion would be checked unless the entire JSON goes through generic schema validation.

i temporarily removed "ancestorVersion": "HIGHEST", in my sfdx-project.json and was unblocked, but still think there is an issue somewhere. I tried before and after updating to ## 7.140.0 (March 3, 2022) [stable] and still hit the issue.

VivekMChawla commented 2 years ago

@paustint - Thank you for reporting the issue you're experiencing. I've shared your observations with the Packaging team and an investigation has been opened to determine the cause.

FYI: @mshanemc - This is related to W-10809996

ternst-micado commented 2 years ago

Just adding to what @paustint described. If I remove the quotation marks around HIGHEST in the project file and then try to create a scratch org it works. I am using this as the workaround for now.

paustint commented 2 years ago

Wow, that seems really odd, since removing the quotation marks means that the project file is no longer valid JSON, and that should cause a parsing error when anything attempts to read the file. Seems like the create org code probably ignores this exception and continues on with the process.

ternst-micado commented 2 years ago

@VivekMChawla Is there a way to see the status of the work item? Is there a timeline for a fix? Thanks

VivekMChawla commented 2 years ago

@mshanemc are you able to share timeline/details about a possible fix, per @ternst-micado's question? Thanks!

Valpich commented 2 years ago

Hello, Any news on the fix?

shetzel commented 2 years ago

I just checked the work item and the fix is being tested. There's a chance it could make the release candidate tomorrow but if not, certainly next week's RC. I'll post back here when I know. Sorry for the delay.

Valpich commented 2 years ago

Thanks for you fast answer, no problem! The latest updates of the CLI has broken the trick to put "ancestorVersion": HIGHEST. We did implement a replace of "ancestorVersion": "HIGHEST" by nothing if it can help other ones.

shetzel commented 2 years ago

The fix was merged a few hours ago and will be in tomorrow's release candidate. If you want early access you can install the latest version of the salesforce-alm plugin (sfdx plugins:install salesforce-alm) and try it out. Just remember to uninstall that plugin to go back to the core version bundled with your version of the CLI.

paustint commented 2 years ago

Was there a regression on this? I am just trying to create an org, so not clear why it is checking package versions.

Just upgraded sfdx a day or two ago and now seeing ERROR running force:org:create: The ancestorId for ancestorVersion HIGHEST can't be found. Package ID XXXX

The ancestor package version [HIGHEST] specified in the sfdx-project.json file may exist hasn’t been promoted and released. Release the ancestor package version before specifying it as the ancestor in a new package or patch version.

peternhale commented 2 years ago

@paustint the team that owns this works from Salesforce support tickets. Are you able to raise your question via Salesforce support?

paustint commented 2 years ago

I really prefer not to go through all that song and dance to report this bug since I am not actually a Salesforce customer. I'll just deal with it until they eventually hear about it.

Damecek commented 1 year ago

Still happening on sfdx-cli/7.175.0 win32-x64 node-v18.12.0, with or without double-quotation marks I get this error.

ERROR running force:package:version:create:  The ancestor versionNumber must be in the format major.mi
nor.patch but the value found is [HIGHEST].
amil-abdallah commented 1 year ago

I've updated sfdx/CLI as of 12/22/2022 and I've still not been able to reference "HIGHEST" as the ancestor version for new package version creation. Same error as others mentioned

ERROR running force:package:version:create: The ancestor versionNumber must be in the format major.mi nor.patch but the value found is [HIGHEST].

amil-abdallah commented 1 year ago

As of today (FINALLY), I can confirm that I am able to use ancestor version HIGHEST.

Today I ran the following commands from terminal:

My current SFDX version is now at: sfdx-cli/7.192.2 win32-x64 node-v18.14.1

Hopefully this is good news for other folks experiencing this issue still.