Skip to content

fix(cli): wrap comment not-found errors with item context#910

Merged
xarmian merged 1 commit into
PerpetualSoftware:mainfrom
cnYui:codex/fix-comment-not-found-context
Jul 11, 2026
Merged

fix(cli): wrap comment not-found errors with item context#910
xarmian merged 1 commit into
PerpetualSoftware:mainfrom
cnYui:codex/fix-comment-not-found-context

Conversation

@cnYui

@cnYui cnYui commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Applies the existing wrapItemNotFound behavior to Client.CreateComment, so pad item comment TASK-999999 ... reports the failing item ref and workspace instead of the bare API message.

The wrapper preserves the original APIError code, details, and concrete type, matching the existing Get/Update/Delete item paths.

Closes #902

How to test

  1. go test ./internal/cli -run 'Test(GetItemWrapsNotFound|NotFoundPreservesDetails|GetItemPassesThroughOtherErrors)$' -count=1
  2. go vet ./internal/cli
  3. gofmt -d internal/cli/client.go internal/cli/item_notfound_test.go
  4. git diff --check

The focused tests pass on Windows. Broader local package runs have existing workspace prerequisites/platform failures (missing generated web/build embed output and Windows HOME/credentials assumptions), unrelated to this two-file CLI change.

Checklist

  • make build passes - not run locally; requires the generated web embed assets
  • make test passes - broader Windows baseline has unrelated HOME/credentials failures
  • New features have tests (if applicable)
  • TypeScript types updated (if API changed) - N/A
  • CLI help text updated (if new command) - N/A

@cnYui cnYui requested a review from xarmian as a code owner July 11, 2026 03:16

@xarmian xarmian left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed and verified against the codebase — this is a clean, correct fix for #902.

  • The one-line change matches the exact wrapItemNotFound pattern already used at internal/cli/client.go:241/249/255.
  • wrapItemNotFound only rewrites not_found APIErrors and passes all other errors through unchanged, so wrapping the full CreateComment error introduces no behavior change for non-404 failures.
  • Adds a real case to the existing table test.

The local Windows make build/make test gaps you noted are the expected web/build embed prerequisite, unrelated to this change. CI has been approved to run.

Thanks for the tidy, well-scoped contribution!

@xarmian xarmian merged commit 9f4704a into PerpetualSoftware:main Jul 11, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CLI: wrap pad item comment not-found error with the failing ref + workspace

2 participants