Skip to content

feat(dc): add --details flag and thread nesting for pr comments#110

Merged
avivsinai merged 11 commits intoavivsinai:masterfrom
ivulub:feat/pr-comments-details
Apr 13, 2026
Merged

feat(dc): add --details flag and thread nesting for pr comments#110
avivsinai merged 11 commits intoavivsinai:masterfrom
ivulub:feat/pr-comments-details

Conversation

@ivulub
Copy link
Copy Markdown
Contributor

@ivulub ivulub commented Apr 1, 2026

Summary

  • Add --details flag for verbose output: file:line, resolved/complete status, full comment text
  • Distinguish "Comment" vs "Task" in header
  • Use "Resolved" for comment threads, "Complete" for tasks (matching Bitbucket terminology)
  • Flatten nested reply threads with depth-based indentation

Fixes #108. Depends on #109.

Sample output

Default mode (threads indented):

10001  alice  Review looks good overall
10002  bob    Re-check the error handling here
10003  alice    Already fixed in latest push
10004  carol  Missing null check

With --details:

--- Comment #10001 by alice ---

Review looks good overall

--- Comment #10002 by bob ---
File: src/handler.go:42
Resolved: yes

Re-check the error handling here

  --- Comment #10003 by alice ---
  File: src/handler.go:42
  Resolved: yes

  Already fixed in latest push

--- Task #10004 by carol ---
File: src/handler.go:87
Complete: no

Missing null check

Test plan

  • New test: TestListPullRequestCommentsFlattensReplies verifies depth-first flattening
  • Existing tests passing (go test ./pkg/bbdc/...)
  • Manual: bkt pr comments <id> --details on a Bitbucket DC instance with threaded comments and tasks

🤖 Generated with Claude Code

@jade-42
Copy link
Copy Markdown

jade-42 commented Apr 2, 2026

Perfect timing. This is exactly what I need.

Copy link
Copy Markdown
Owner

Hi @ivulub, thanks for the PR. The --details flag and thread nesting look like a solid addition.

GitHub is currently showing merge conflicts with master, so could you please rebase or merge the latest master into your branch and push the update? Once the branch is current, we can review the changes cleanly.

Copy link
Copy Markdown
Owner

@avivsinai avivsinai left a comment

Choose a reason for hiding this comment

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

Thanks for the PR, @ivulub — the --details flag and thread nesting are a solid addition. The activities endpoint switch and flattenComments tree-walking are well done.

One issue to address before this can merge:

Unresolved comments don't show resolution status

In --details mode, the code prints Resolved: yes when a thread is resolved but prints nothing when it isn't (DC path at comments.go:134-137, Cloud path at comments.go:224-226). Since --details is specifically meant to surface resolution status, unresolved comments should explicitly render Resolved: no — otherwise the main data point disappears for exactly the comments the reviewer most needs to find.

Non-blocking suggestions:

  • DC file comments without a line number render as File: path:0 (comments.go:121-123). When c.Anchor.Line is 0, consider omitting the :%d suffix to match the Cloud path behavior.
  • Breaking --json shape change: The DC PullRequestComment.Author changed from nested {"author":{"user":{...}}} to flat {"author":{...}}. This is arguably the right simplification, but it's a breaking change for anyone consuming --json output. Worth noting in the changelog or PR description.

Happy to re-review once updated.

@avivsinai avivsinai force-pushed the feat/pr-comments-details branch from 8e52915 to d727a26 Compare April 3, 2026 11:27
@avivsinai
Copy link
Copy Markdown
Owner

Hi @ivulub — checking in on this. The dependency (#109) has merged and there are no merge conflicts, which is great.

The primary blocking finding from the previous review is still unaddressed: unresolved comments should explicitly show Resolved: no in --details mode. Currently only resolved threads display their status, which is the opposite of what reviewers need most.

Correction from my previous review: the --json shape change I flagged is not actually breaking — the Author User struct was already flat on master. Apologies for the false positive.

Let me know if you need any help with the changes.

@ivulub ivulub force-pushed the feat/pr-comments-details branch from d727a26 to cbc38fe Compare April 7, 2026 13:16
@ivulub
Copy link
Copy Markdown
Contributor Author

ivulub commented Apr 7, 2026

Rebased onto master and addressed the feedback:

  • Blocking fix: --details now always prints Resolved: yes/no for comments (DC and Cloud), not only when resolved.
  • Non-blocking fix: DC anchor without a line number renders as File: path instead of File: path:0.

@ivulub ivulub requested a review from avivsinai April 7, 2026 13:17
@sentry
Copy link
Copy Markdown

sentry Bot commented Apr 7, 2026

Codecov Report

❌ Patch coverage is 49.39759% with 42 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/cmd/pr/comments.go 43.24% 31 Missing and 11 partials ⚠️

📢 Thoughts on this report? Let us know!

avivsinai added a commit that referenced this pull request Apr 9, 2026
Cover validation (missing/invalid PR ID, invalid --state, --state on DC),
DC comment listing with activity filtering, Cloud comment listing with
state filtering (all/resolved/unresolved), and empty result handling for
both backends.

Addresses the codecov/patch failure on PR #110.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@avivsinai
Copy link
Copy Markdown
Owner

Hi! We merged the additional pr-comments test coverage into master in #140. Could you please rebase this PR onto the latest master when you get a chance so GitHub can recalculate the patch coverage and we can re-review the current diff? Thanks.

ivulub and others added 4 commits April 9, 2026 14:55
Show file:line, Comment/Task distinction, resolved/complete status.
Flatten nested reply threads with depth-based indentation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Also omit line suffix when DC anchor line is 0.
Tasks previously omitted Resolved status. Now both Complete and
Resolved are always printed for tasks in --details mode.
@ivulub ivulub force-pushed the feat/pr-comments-details branch from b8160e2 to 1e60958 Compare April 9, 2026 14:00
@ivulub
Copy link
Copy Markdown
Contributor Author

ivulub commented Apr 9, 2026

Rebased onto latest master (includes #140).

The conflict in comments_test.go was an add/add: #140 added TestCommentsCommandValidation, TestCommentsDC, TestCommentsCloud, and TestCommentsEmpty; this branch added TestDCPRCommentsDetailsTask. Resolved by keeping all tests from master and appending mine.

Latest commit: Tasks in --details mode now print both Complete: yes/no (task completion via State) and Resolved: yes/no (thread resolved via ThreadResolved), consistent with how regular comments behave.

@ivulub
Copy link
Copy Markdown
Contributor Author

ivulub commented Apr 10, 2026

Updated skills/bkt/rules/pr.md to document the new --details flag: added it to the summary table, flags table, and examples. Verified end-to-end against a live DC instance (PR #15, IVUPLAN/dev-tools) — output correctly shows File:, Resolved:, and full untruncated comment bodies.

Copy link
Copy Markdown
Owner

@avivsinai avivsinai left a comment

Choose a reason for hiding this comment

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

Re-review found one remaining issue.

In non---details DC output, nested replies use truncate(c.Text, 80-2*c.Depth) in pkg/cmd/pr/comments.go. Once the reply depth reaches 39+, that width drops to 2 or less, and truncate slices with maxLen-3, which will panic. Since this PR now flattens arbitrary reply trees from the API, the display width needs clamping before truncation (or truncate needs to handle very small widths safely).

The rest of the rereview was clean: the new Complete/Resolved task output is covered, docs match the flag, and go test ./pkg/cmd/pr/... ./pkg/bbdc/..., go vet ./pkg/cmd/pr/... ./pkg/bbdc/..., gofmt -d pkg/cmd/pr pkg/bbdc, and go build ./cmd/bkt all passed.

@ivulub
Copy link
Copy Markdown
Contributor Author

ivulub commented Apr 13, 2026

Comment depth is now capped at 20, with a [...] marker for each thread that goes deeper (consecutive deep comments produce only one marker). Added TestDCCommentsDepthCap covering: deep comments hidden (both plain and --details), the marker appearing exactly once for consecutive skipped replies, and no marker when all comments are within the cap.

@ivulub ivulub requested a review from avivsinai April 13, 2026 11:44
Copy link
Copy Markdown
Owner

@avivsinai avivsinai left a comment

Choose a reason for hiding this comment

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

Reviewed with Claude via AMQ. Latest head is green and looks good to merge.

@avivsinai avivsinai merged commit 47cd1ff into avivsinai:master Apr 13, 2026
7 checks passed
avivsinai added a commit that referenced this pull request Apr 15, 2026
Add the missing Unreleased notes for the notable changes merged after v0.23.0 so the release can be cut through the supported release PR flow.

Refs GH-110
Refs GH-162
Refs GH-164
Co-Authored-By: OpenAI Codex <noreply@openai.com>
avivsinai added a commit that referenced this pull request Apr 15, 2026
Add the missing Unreleased notes for the notable changes merged after v0.23.0 so the next release can be cut through the supported release PR flow.

This covers the Data Center PR comments details view, PKCE in the Bitbucket Cloud OAuth login flow, and the release-pipeline attestation/gate tightening.

Refs GH-110
Refs GH-162
Refs GH-164
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.

feat: add --details flag and thread nesting to bkt pr comments

3 participants