Environment
- hevycli version: dev (built from source)
- OS: macOS (Apple Silicon)
Steps to reproduce
hevycli routine list → routine "Back Day" (ID 75fa8ead-a1c4-4b25-bcd6-c452e9cbed83) is visible.
- Run
hevycli routine delete 75fa8ead-a1c4-4b25-bcd6-c452e9cbed83, type nothing / cancel → exits 0 (expected: non-zero).
- Run the same command again, type
yes to confirm → Error: failed to delete routine: NOT_FOUND: Resource not found, exits 1.
Bug 1 — Wrong exit code on cancellation
When the user declines the confirmation prompt, the command prints Deletion cancelled. but exits with code 0. A cancelled/no-op operation should exit non-zero so scripts can detect it.
Root cause: In cmd/routine/delete.go:104-107, the cancellation path returns nil, which Cobra treats as success (exit 0):
if response != "yes" {
fmt.Println("Deletion cancelled.")
return nil // ← should return an error or use os.Exit(1)
}
Bug 2 — NOT_FOUND for a routine that appears in routine list
After confirming deletion with yes, the API returns NOT_FOUND. The routine was returned by hevycli routine list moments earlier.
Possible root causes:
- The list endpoint (
GET /v1/routines) and the delete endpoint (DELETE /v1/routines/{id}) may be using different ID semantics — e.g., the API may expect a different identifier format for mutations.
- The list may be returning stale/cached data for a routine that no longer exists in the Hevy backend.
- The
GetRoutine call at delete.go:86 succeeds (so the routine exists for reads), but the DeleteRoutine call at delete.go:111 hits a different endpoint or applies different auth/permissions.
Both GetRoutine and DeleteRoutine in internal/api/client.go use the same path prefix (/routines/ + id), so the issue may be upstream in the Hevy API itself.
Expected behavior
- Cancellation → non-zero exit code.
- A routine visible in
routine list should be deletable without a NOT_FOUND error.
Environment
Steps to reproduce
hevycli routine list→ routine "Back Day" (ID75fa8ead-a1c4-4b25-bcd6-c452e9cbed83) is visible.hevycli routine delete 75fa8ead-a1c4-4b25-bcd6-c452e9cbed83, type nothing / cancel → exits 0 (expected: non-zero).yesto confirm →Error: failed to delete routine: NOT_FOUND: Resource not found, exits 1.Bug 1 — Wrong exit code on cancellation
When the user declines the confirmation prompt, the command prints
Deletion cancelled.but exits with code 0. A cancelled/no-op operation should exit non-zero so scripts can detect it.Root cause: In
cmd/routine/delete.go:104-107, the cancellation path returnsnil, which Cobra treats as success (exit 0):Bug 2 — NOT_FOUND for a routine that appears in
routine listAfter confirming deletion with
yes, the API returns NOT_FOUND. The routine was returned byhevycli routine listmoments earlier.Possible root causes:
GET /v1/routines) and the delete endpoint (DELETE /v1/routines/{id}) may be using different ID semantics — e.g., the API may expect a different identifier format for mutations.GetRoutinecall atdelete.go:86succeeds (so the routine exists for reads), but theDeleteRoutinecall atdelete.go:111hits a different endpoint or applies different auth/permissions.Both
GetRoutineandDeleteRoutineininternal/api/client.gouse the same path prefix (/routines/+ id), so the issue may be upstream in the Hevy API itself.Expected behavior
routine listshould be deletable without a NOT_FOUND error.