# summary

Transition queued profiling requests to Canceled status before they begin processing — prevent incorrect or unnecessary requests from generating summaries.

# description

When profiling is triggered, the system creates a request record that tracks execution. Requests begin in a Queued state, waiting for the backend to process them. This command transitions queued requests to Canceled status before processing begins — preventing them from generating summaries that would need to be identified and cleaned up later.

IMPORTANT: Cancel applies to QUEUED requests only. Once a request has been processed and its summary is actively executing, the request is complete. To halt an in-progress summary, use `sf cuneiform summary stop` instead.

TWO SELECTION MODES (mutually exclusive):

- **Broad** (`--all`) — Cancel all cancellable requests (Queued status)
- **Targeted** (`--request-ids`) — Cancel specific requests by Salesforce record ID

SAFETY: Completed, rejected, and already-canceled requests are automatically excluded. Use --dry-run to preview what would be canceled before committing. A confirmation prompt shows the count before proceeding — use --no-prompt to skip for scripted use.

Cancellation transitions status only — it does not delete records. Canceled requests remain visible in `profile request list` until permanently removed with `profile request delete`.

CANCEL vs STOP — these address different objects at different lifecycle stages:

- **Cancel** prevents a Request from being processed. No Summary is created.
- **Stop** halts an active Summary that is already executing. Preserves completed fields.

By the time a Summary exists, its originating Request is already complete. These operations do not overlap.

WHEN TO USE:

- Wrong definition submitted — cancel the queued request before it generates incorrect results
- Pre-maintenance window — clear the queue before planned downtime
- Configuration issue discovered — pause processing until the issue is resolved
- Selective cleanup in shared orgs — cancel specific requests by ID while preserving valid requests

NATURAL LANGUAGE → FLAG MAPPING:
"cancel everything in the queue" → --all
"cancel just this one request" → --request-ids a0Xxx0000001AAA
"what would be canceled?" → --all --dry-run
"cancel without asking" → --all --no-prompt

COMMAND SEQUENCE:
`profile` or `profile request list` → **`profile request cancel`** → `profile request delete` (remove artifacts) or re-submit with corrected parameters

# flags.target-org.summary

Cancel profiling requests in this Salesforce org. Specify the org alias or username when you have multiple authenticated orgs.

# flags.all.summary

Cancel all queued requests in a single operation. Use for pre-maintenance windows, configuration corrections, or full queue pauses when processing should be deferred. Mutually exclusive with --request-ids.

# flags.request-ids.summary

Cancel specific profiling requests by Salesforce record ID (comma-separated). Use for targeted cancellation when only some queued requests are problematic — preserving valid requests in shared environments. Find request IDs with `profile request list`. Mutually exclusive with --all.

# flags.dry-run.summary

Preview which requests would be canceled, showing the same request details as a real cancellation. Use first in production orgs or shared environments to verify scope before committing — particularly important when other users have valid requests in the queue.

# flags.no-prompt.summary

Skip the confirmation prompt and cancel immediately. Use in scripts or automation where interactive prompts are not available. JSON mode also skips the prompt.

# examples

- Preview what would be canceled — verify scope before committing:

  <%= config.bin %> <%= command.id %> --target-org myOrg --all --dry-run

- Cancel all queued requests — clear the processing queue before maintenance:

  <%= config.bin %> <%= command.id %> --target-org myOrg --all

- Cancel specific requests by ID — targeted cancellation in shared orgs:

  <%= config.bin %> <%= command.id %> --target-org myOrg --request-ids a0Xxx0000001AAA,a0Xxx0000002BBB

- Cancel immediately for scripted workflows:

  <%= config.bin %> <%= command.id %> --target-org myOrg --all --no-prompt

- Cancel specific requests as JSON output for automation:

  <%= config.bin %> <%= command.id %> --target-org myOrg --request-ids a0Xxx0000001AAA --json

# errors.noTargetOrg

Could not determine target org username.

# errors.mutuallyExclusive

The --all and --request-ids flags are mutually exclusive. Provide one or the other.

# errors.noSelection

You must provide either --all or --request-ids to specify which requests to cancel.

# errors.cancelFailed

Failed to cancel profiling requests: %s

# errors.noCancellable

No cancellable requests found matching the specified criteria.

# errors.partialFailure

Some requests could not be canceled. %s of %s succeeded.

# errors.invalidIds

Invalid request ID format: %s

# prompt.confirm.singular

Cancel this profiling request?

# prompt.confirm.plural

Cancel these %s profiling requests?

# output.dryRunTitle

Dry Run — Requests That Would Be Canceled

# output.cancelled

Successfully canceled %s profiling request(s).

# output.noCancellable

No cancellable requests found.

# output.dryRunSummary

%s request(s) would be canceled.

# output.userCancelled

Cancellation aborted by user.

# output.failedHeader

Failed to Cancel
