Skip to content

Commit 49b74af

Browse files
committed
feat: add deprecation cycle deploy/retrieve start
1 parent 5b103cb commit 49b74af

File tree

6 files changed

+40
-1
lines changed

6 files changed

+40
-1
lines changed

messages/deploy.metadata.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,3 +257,8 @@ The `pushPackageDirectoriesSequentially` property is not respected by this comma
257257
# apiVersionMsgDetailed
258258

259259
%s %s metadata to %s using the v%s %s API.
260+
261+
# noSourceTrackingWarning
262+
263+
Starting in December 2025, this command will require source tracking support.
264+
Production orgs and other non-tracking orgs will no longer be supported without explicit metadata specification.

messages/retrieve.start.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,3 +199,8 @@ This command expects the org to support source tracking. If it doesn't, you must
199199
- Use the `--source-dir`, `--manifest` or `--package-name` flags to retrieve metadata in source format.
200200

201201
- Use the `--target-metadata-dir` flag to retrieve metadata in metadata format to a directory.
202+
203+
# noSourceTrackingWarning
204+
205+
Starting in December 2025, this command will require source tracking support.
206+
Production orgs and other non-tracking orgs will no longer be supported without explicit metadata specification.

src/commands/project/deploy/start.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ export default class DeployMetadata extends SfCommand<DeployResultJson> {
234234
...flags,
235235
'target-org': username,
236236
api,
237+
warnCallback: this.warn.bind(this),
237238
},
238239
project
239240
);

src/commands/project/retrieve/start.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,19 @@ export default class RetrieveMetadata extends SfCommand<RetrieveResultJson> {
176176
// eslint-disable-next-line complexity
177177
public async run(): Promise<RetrieveResultJson> {
178178
const { flags } = await this.parse(RetrieveMetadata);
179+
180+
// Add warning for non-source-tracking orgs when using default behavior
181+
const isChanges =
182+
!flags['source-dir'] &&
183+
!flags['manifest'] &&
184+
!flags['metadata'] &&
185+
!flags['target-metadata-dir'] &&
186+
!flags['package-name']?.length;
187+
188+
if (isChanges && !(await flags['target-org'].tracksSource())) {
189+
this.warn(messages.getMessage('noSourceTrackingWarning'));
190+
}
191+
179192
let resolvedTargetDir: string | undefined;
180193
if (flags['output-dir']) {
181194
resolvedTargetDir = resolve(flags['output-dir']);
@@ -518,6 +531,7 @@ const buildRetrieveOptions = async (
518531
output: string | undefined
519532
): Promise<RetrieveSetOptions> => {
520533
const apiVersion = await resolveApiVersion(flags);
534+
521535
return {
522536
usernameOrConnection: flags['target-org'].getUsername() ?? flags['target-org'].getConnection(flags['api-version']),
523537
merge: true,

src/utils/deploy.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,11 @@ export type DeployOptions = {
5353
'pre-destructive-changes'?: string;
5454
'post-destructive-changes'?: string;
5555
'purge-on-delete'?: boolean;
56+
warnCallback?: (message: string) => void;
5657
};
5758

5859
/** Manifest is expected. You cannot pass metadata and source-dir array--use those to get a manifest */
59-
export type CachedOptions = Omit<DeployOptions, 'wait' | 'metadata' | 'source-dir'> & {
60+
export type CachedOptions = Omit<DeployOptions, 'wait' | 'metadata' | 'source-dir' | 'warnCallback'> & {
6061
wait: number;
6162
/** whether the user passed in anything for metadata-dir (could be a folder, could be a zip) */
6263
isMdapi: boolean;
@@ -150,6 +151,10 @@ export async function executeDeploy(
150151
subscribeSDREvents: !opts['dry-run'] || !(await org.tracksSource()),
151152
ignoreConflicts: opts['ignore-conflicts'],
152153
});
154+
155+
if (!(await org.tracksSource()) && opts.warnCallback) {
156+
opts.warnCallback(deployMessages.getMessage('noSourceTrackingWarning'));
157+
}
153158
registry = stl.registry;
154159

155160
componentSet = await buildComponentSet(opts, stl);

test/nuts/retrieve/noTracking.nut.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,15 @@ describe('retrieve mdapi format without project', () => {
4949
expect(result?.files).to.not.be.empty;
5050
});
5151

52+
it('should fail when retrieving changes from a non-tracking org', () => {
53+
const result = execCmd<RetrieveResultJson>(`project:retrieve:start -o ${session.hubOrg.username} --json`, {
54+
ensureExitCode: 1,
55+
});
56+
57+
expect(result.jsonOutput?.name).to.equal('noSourceTracking');
58+
expect(result.jsonOutput?.message).to.include('does not support source tracking');
59+
});
60+
5261
after(async () => {
5362
await session?.clean();
5463
});

0 commit comments

Comments
 (0)