# summary

Permanently remove canceled and rejected profiling requests — cleaning up terminal request artifacts that never produced a summary.

# description

Every profiling run begins with a request record that tracks who initiated profiling, which definition was targeted, and the execution outcome. Canceled and rejected requests are terminal — they never produced a summary and serve no ongoing purpose. This command permanently removes them.

ELIGIBLE STATUSES: Only Canceled and Rejected requests can be deleted. The eligibility filter is enforced at the query level — Queued and Completed requests are structurally excluded.

PROTECTED STATUSES: Completed requests maintain the profiling user context reference needed for reprofiling. They are cascade-deleted automatically when their summary is purged via `summary purge`. Queued requests must be canceled first with `profile request cancel` before they become eligible for deletion.

TWO SELECTION MODES (mutually exclusive):

- **Broad** (`--all`) — Delete all deletable requests (Canceled and Rejected)
- **Targeted** (`--request-ids`) — Delete specific requests by Salesforce record ID

LIFECYCLE CONTEXT: Delete removes terminal, summary-less requests:

1. `profile request cancel` — transition queued requests to Canceled status
2. `profile request delete` — permanently remove Canceled and Rejected requests
3. `summary purge` — cascade-deletes Completed requests automatically

WHEN TO USE:

- Post-cancellation cleanup — remove canceled request artifacts after resolving the issue
- Engagement close-out — clean up the request history before org handoff
- Periodic housekeeping — remove old canceled and rejected requests to keep the request list focused
- CI pipeline reset — automate scratch org cleanup between test runs

NATURAL LANGUAGE → FLAG MAPPING:
"delete all processed requests" → --all
"delete just this one request" → --request-ids a0Xxx0000001AAA
"what would be deleted?" → --all --dry-run
"delete without asking" → --all --no-prompt

COMMAND SEQUENCE: `profile request cancel` (cancel queued requests) → `profile request delete` (remove canceled/rejected) → `summary purge` (remove summaries, cascade-delete completed requests) → `definition purge` (remove definitions)

# flags.target-org.summary

Salesforce org containing the profiling requests to delete. The command validates Cuneiform installation before executing.

# flags.all.summary

Delete all deletable requests (Canceled and Rejected status). Targets request artifacts that never produced summaries. Completed requests are excluded — they are cascade-deleted when their summary is purged. Mutually exclusive with --request-ids.

# flags.request-ids.summary

Specific profiling request IDs to delete (e.g., --request-ids a0Xxx0000001AAA,a0Xxx0000002BBB). Targets individual canceled or rejected requests. Look up request IDs with `profile request list`. Mutually exclusive with --all.

# flags.dry-run.summary

Preview what would be deleted without making changes. Shows the same request details and counts as a real deletion. Use this first — deletion is permanent and cannot be undone.

# flags.no-prompt.summary

Skip the confirmation prompt and delete immediately. Use for scripted cleanup in CI pipelines and automation workflows. The irreversibility warning is bypassed — the caller accepts permanent deletion programmatically.

# examples

- Preview what would be deleted (deletion is permanent — always preview first):

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

- Delete all canceled and rejected requests after resolving the underlying issues:

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

- Delete specific requests by ID for targeted cleanup:

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

- Scripted scratch org reset in CI pipelines:

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

- Capture deletion results as JSON for engagement close-out documentation:

  <%= config.bin %> <%= command.id %> --target-org myOrg --all --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 delete.

# errors.deleteFailed

Failed to delete profiling requests: %s

# errors.noDeletable

No deletable requests found matching the specified criteria.

# errors.partialFailure

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

# errors.invalidIds

Invalid request ID format: %s

# prompt.confirm.singular

Permanently delete this profiling request? This action cannot be undone.

# prompt.confirm.plural

Permanently delete these %s profiling requests? This action cannot be undone.

# output.dryRunTitle

Dry Run — Requests That Would Be Deleted

# output.deleted

Successfully deleted %s profiling request(s).

# output.noDeletable

No deletable requests found.

# output.dryRunSummary

%s request(s) would be deleted.

# output.userCancelled

Deletion aborted by user.

# output.failedHeader

Failed to Delete
