-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sm/max-api-version-on-deploys #684
Conversation
@@ -269,3 +269,16 @@ export abstract class MetadataTransfer<Status extends MetadataRequestStatus, Res | |||
protected abstract pre(): Promise<AsyncResult>; | |||
protected abstract post(result: Status): Promise<Result>; | |||
} | |||
|
|||
/* prevent requests on apiVersions higher than the org supports */ | |||
const getConnectionNoHigherThanOrgAllows = async (conn: Connection, requestedVersion: string): Promise<Connection> => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have test coverage for this method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's being executed on every deploy, so about 100x.
At least some of those specify an apiVersion...not sure if any don't and would check the if conditional.
const getConnectionNoHigherThanOrgAllows = async (conn: Connection, requestedVersion: string): Promise<Connection> => { | ||
// uses a TTL cache, so mostly won't hit the server | ||
const maxApiVersion = await conn.retrieveMaxApiVersion(); | ||
if (requestedVersion && parseInt(requestedVersion, 10) > parseInt(maxApiVersion, 10)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be worthwhile to validate the requested version here? It seems the caller could send an invalid version string here and get by without altering the max version allowed on the connection.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the ComponentSet allows consumers to set its apiVersion and sourceApiVersion properties. If there's a place to put validation, it'd be there. This is internal non-exported function, only called from this file, which is extended by Deploy and Retrieve.
Are you wanting to put getters/setters so we can do validation on those props for ComponentSet?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a few question in there but change looks good.
What does this PR do?
[NB the proper way to do this is to set
sourceApiVersion
in yoursfdx-project.json
. This is the workaround for tooling to use more intelligent default behavior.What issues does this PR fix or reference?
@W-11549415@
forcedotcom/cli#1656
Functionality Before
Functionality After
pushes as expected