Skip to content

feat(jtk): add comments update to edit an existing comment - #499

Merged
zzwong merged 2 commits into
mainfrom
zzwong/498-comments-update
Oct 2, 2026
Merged

zzwong merged 2 commits into
mainfrom
zzwong/498-comments-update

Conversation

@zzwong

@zzwong zzwong commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Closes #498.

jtk comments had list, add, and delete but no way to change an existing comment. Fixing a typo or a stale link meant delete-and-re-add, which changes the comment ID and moves it to the bottom of the thread. This adds jtk comments update <issue-key> <comment-id> --body, using update per the verb table in internal/cmd/GUARDRAILS.md.

  • api.Client.UpdateComment sends PUT /rest/api/3/issue/{key}/comment/{id} with an ADF body and returns the updated comment. Empty issue key or comment ID returns the existing sentinel errors before any request.
  • --body goes through the same path as comments add: markdown conversion, escape-sequence interpretation, and raw ADF passthrough (jtk: pass raw ADF through for rich-text fields (completes #191) #484) via text.InterpretEscapesUnlessRawADF.
  • The previous body can't be recovered, so per GUARDRAILS §5.1 the command prompts by default and takes a long-only --force. --non-interactive without --force fails before any request.
  • Output reuses the comments add detail block, and --id emits the comment ID.
  • README, CHANGELOG, OUTPUT_SPEC, integration-tests, and the ManageComments skill workflow are updated.

Testing: API tests cover the method, path, request body, and both sentinel errors. Command tests cover the arg and required-flag contract, prompt decline, confirm, and non-interactive rejection (asserting no write), the detail output, --id, and raw ADF passthrough with an escaped \n and an inlineCard. go build, go vet, and go test -race pass on the touched packages, and go test ./... for jtk passes. I checked against a live Jira Cloud site by adding a comment, updating it with a raw ADF body, reading it back, and deleting it. The comment kept its ID, updated advanced, and the code mark survived. Local golangci-lint v2.12.2 fails to type-check the Go 1.27 standard library on this machine, which is unrelated to this diff, so CI is the lint gate.

@monit-reviewer monit-reviewer left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Automated PR Review

Reviewed commit: 4f4f46f74570
Profile: open-cli-collective-review - Posting as: monit-reviewer

Summary

Reviewer Findings
go:implementation-tests 0
policies:conventions 1
policies:conventions (1 finding)

Major - tools/jtk/internal/cmd/comments/comments.go:224

This immediately overwrites the existing comment body without confirmation or an undo path. GUARDRAILS.md §5.1 explicitly requires confirmation when recovery depends on remembering lost state, including comment contents; keeping the ID does not make this reversible. Add a long-only --force flag and confirmation before the PUT, using ConfirmOrFail so --non-interactive without --force fails without writing. Update the examples and test cancellation, forced updates, and non-interactive rejection.

Reviewer Coverage

  • go:implementation-tests — complete (broad); inspected 4 assigned files (9 inspected across reviewers): tools/jtk/api/comments.go, tools/jtk/api/comments_test.go, tools/jtk/internal/cmd/comments/comments.go, tools/jtk/internal/cmd/comments/comments_test.go; skipped: none; constraints: Static review only; inspected implementation and tests but did not execute builds, tests, or live Jira verification.
  • policies:conventions — complete (broad); inspected 7 assigned files (9 inspected across reviewers): skills/Jira/Workflows/ManageComments.md, tools/jtk/CHANGELOG.md, tools/jtk/README.md, tools/jtk/integration-tests.md, tools/jtk/internal/cmd/OUTPUT_SPEC.md, tools/jtk/internal/cmd/comments/comments.go, tools/jtk/internal/cmd/comments/comments_test.go; skipped: none; constraints: Reviewed the pinned diff and repository-local command contracts; no tests were executed. Shared command-surface documentation could not be inspected: sibling-path access was denied by the review tool.
Inspected files (9)
  • skills/Jira/Workflows/ManageComments.md
  • tools/jtk/CHANGELOG.md
  • tools/jtk/README.md
  • tools/jtk/api/comments.go
  • tools/jtk/api/comments_test.go
  • tools/jtk/integration-tests.md
  • tools/jtk/internal/cmd/OUTPUT_SPEC.md
  • tools/jtk/internal/cmd/comments/comments.go
  • tools/jtk/internal/cmd/comments/comments_test.go

0 PR discussion threads considered. 0 summarized; 0 resolved.


Completed in 1m 04s | $0.06 | openai-codex/gpt-6.1-sol | cr 0.10.319
Field Value
Model openai-codex/gpt-6.1-sol
Reviewers go:implementation-tests, policies:conventions
Engine pi_rpc · openai-codex/gpt-6.1-sol
Reviewed by cr · monit-reviewer
Duration 1m 04s wall · 1m 22s compute
Cost $0.06
Tokens 24.9k in / 776 out

Per-workstream usage

  • orchestrator-selection — openai-codex/gpt-6.1-sol
    • In: 6.3k
    • Out: 310
    • Cache read: 0
    • Cache create: 0
    • Cost: $0.02
    • Duration: 14s
  • go:implementation-tests — openai-codex/gpt-6.1-sol
    • In: 2.9k
    • Out: 113
    • Cache read: 20.4k
    • Cache create: 0
    • Cost: $0.01
    • Duration: 28s
  • policies:conventions — openai-codex/gpt-6.1-sol
    • In: 11.3k
    • Out: 265
    • Cache read: 23.9k
    • Cache create: 0
    • Cost: $0.03
    • Duration: 35s
  • orchestrator-rollup — openai-codex/gpt-6.1-sol
    • In: 4.4k
    • Out: 88
    • Cache read: 0
    • Cache create: 0
    • Cost: $0.01
    • Duration: 4s

Comment thread tools/jtk/internal/cmd/comments/comments.go

@monit-reviewer monit-reviewer left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Automated PR Review

Reviewed commit: 5ded6aea3413
Profile: open-cli-collective-review - Posting as: monit-reviewer

Summary

Reviewer Findings
go:implementation-tests 0
policies:conventions 0

Reviewer Coverage

  • go:implementation-tests — complete (constrained); inspected 5 assigned files (10 inspected across reviewers): tools/jtk/api/comments.go, tools/jtk/api/comments_test.go, tools/jtk/internal/cmd/comments/comments.go, tools/jtk/internal/cmd/comments/comments_test.go, tools/jtk/internal/present/comment.go; skipped: none; constraints: Review limited to the five assigned Go files and their visible surrounding context. Tests were inspected, not executed; only read-only repository tools were available.
  • policies:conventions — complete (constrained); inspected 7 assigned files (10 inspected across reviewers): skills/Jira/Workflows/ManageComments.md, tools/jtk/CHANGELOG.md, tools/jtk/README.md, tools/jtk/integration-tests.md, tools/jtk/internal/cmd/OUTPUT_SPEC.md, tools/jtk/internal/cmd/comments/comments.go, tools/jtk/internal/cmd/comments/comments_test.go; skipped: none; constraints: Reviewed against visible repo-local conventions; linked cli-common standards and external harness principles were not available in the review context. Static review only; tests and live Jira behavior were not independently executed.
Inspected files (10)
  • skills/Jira/Workflows/ManageComments.md
  • tools/jtk/CHANGELOG.md
  • tools/jtk/README.md
  • tools/jtk/api/comments.go
  • tools/jtk/api/comments_test.go
  • tools/jtk/integration-tests.md
  • tools/jtk/internal/cmd/OUTPUT_SPEC.md
  • tools/jtk/internal/cmd/comments/comments.go
  • tools/jtk/internal/cmd/comments/comments_test.go
  • tools/jtk/internal/present/comment.go

1 PR discussion threads considered. 1 summarized; 1 resolved.


Completed in 58s | $0.03 | openai-codex/gpt-6.1-sol | cr 0.10.319
Field Value
Model openai-codex/gpt-6.1-sol
Reviewers go:implementation-tests, policies:conventions
Engine pi_rpc · openai-codex/gpt-6.1-sol
Reviewed by cr · monit-reviewer
Duration 58s wall · 45s compute
Cost $0.03
Tokens 10.5k in / 404 out

Per-workstream usage

  • go:implementation-tests — openai-codex/gpt-6.1-sol
    • In: 5.3k
    • Out: 174
    • Cache read: 10.9k
    • Cache create: 0
    • Cost: $0.01
    • Duration: 15s
  • policies:conventions — openai-codex/gpt-6.1-sol
    • In: 1.0k
    • Out: 167
    • Cache read: 22.5k
    • Cache create: 0
    • Cost: $0.01
    • Duration: 25s
  • orchestrator-rollup — openai-codex/gpt-6.1-sol
    • In: 4.2k
    • Out: 63
    • Cache read: 0
    • Cache create: 0
    • Cost: $0.01
    • Duration: 4s

@zzwong
zzwong marked this pull request as ready for review October 2, 2026 05:48
@zzwong
zzwong merged commit e108421 into main Oct 2, 2026
16 checks passed
@zzwong
zzwong deleted the zzwong/498-comments-update branch October 2, 2026 05:48
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.

jtk: add comments update to edit an existing comment

2 participants