Skip to content

feat(jtk): add issue history command#422

Merged
rianjs merged 4 commits into
mainfrom
feat/420-jtk-issue-history
Jun 21, 2026
Merged

feat(jtk): add issue history command#422
rianjs merged 4 commits into
mainfrom
feat/420-jtk-issue-history

Conversation

@rianjs

@rianjs rianjs commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add Jira changelog API support and jtk issues history <issue-key>.
  • Render compact changed-field history rows with --id, --extended, --fields, --max, and --next-page-token.
  • Update README/output spec/changelog and bump tools/jtk/version.txt to 1.3.

Verification

  • go test ./api ./internal/present ./internal/cmd/issues
  • make check

Live Validation

  • Built the local binary with make build.
  • Validated configured credentials with bin/jtk --non-interactive me.
  • Validated read-only issue discovery with bin/jtk --non-interactive issues list --project MON --max 20 --id.
  • Validated bin/jtk --non-interactive issues history MON-4648 --max 5.
  • Validated bin/jtk --non-interactive issues history MON-4648 --id --max 5.
  • Validated bin/jtk --non-interactive issues history MON-4648 --extended --max 5.
  • Validated bin/jtk --non-interactive issues history MON-4648 --fields CREATED,FIELD,TO --max 5.
  • Validated pagination with bin/jtk --non-interactive issues history MON-4648 --max 1 --next-page-token 1; the first page returned next: 1, and the second returned next: 2.

Closes #420

@rianjs

rianjs commented Jun 21, 2026

Copy link
Copy Markdown
Contributor Author

Findings

Major: live read-only validation is still unmet.
PR body / Live Validation documents a credential/keyring failure, but the original batch requirement and converged plan required a locally built bin/jtk to exercise jtk issues history against configured Jira credentials, including forced --max 1 pagination. Since this is a new Jira endpoint wrapper, the most important integration behavior remains unverified. Before merge, either run the live read-only matrix after fixing local auth, or record an explicit maintainer waiver for this ticket.

Minor: command-level coverage does not exercise --extended or --fulltext.
history_test.go covers default output, --id, projection, bad token, and empty pages, while presenter tests cover extended/fulltext directly. Add one command-path test proving opts.Extended produces extended columns and disables truncation, or opts.FullText disables truncation, so the global read-flag contract is locked at the command boundary.

Nit: history README flag table omits --extended.
README.md includes an --extended example but the command-specific flag table lists --fulltext and --id only. Add --extended there for consistency.

Nit: OUTPUT_SPEC text omits TYPE from the extended-only list.
OUTPUT_SPEC.md lists several extended-only columns but skips TYPE, even though it appears in the extended header. Small doc correction.

@rianjs

rianjs commented Jun 21, 2026

Copy link
Copy Markdown
Contributor Author

Live read-only validation with the local build is now complete.

Target: MON-4648 using configured credentials from this machine.

Validated commands:

  • bin/jtk --non-interactive me
  • bin/jtk --non-interactive issues list --project MON --max 20 --id
  • bin/jtk --non-interactive issues history MON-4648 --max 5
  • bin/jtk --non-interactive issues history MON-4648 --id --max 5
  • bin/jtk --non-interactive issues history MON-4648 --extended --max 5
  • bin/jtk --non-interactive issues history MON-4648 --fields CREATED,FIELD,TO --max 5
  • bin/jtk --non-interactive issues history MON-4648 --max 1 --next-page-token 1

Results: all commands returned successfully. Pagination was verified from next: 1 to the second history row and returned next: 2.

@rianjs

rianjs commented Jun 21, 2026

Copy link
Copy Markdown
Contributor Author

Findings

Minor: PR body still records the old failed live-validation state.
The current PR body’s Live Validation section still says configured-credential validation was blocked by keyring/auth state, while the updated validation state says local built bin/jtk passed against MON-4648 for default, --id, --extended, --fields CREATED,FIELD,TO, and --next-page-token. Please update the PR body or add a prominent validation summary that points to the passing comment, so the merge record does not preserve the earlier failed-validation state.

No code-level architectural findings after the follow-up. The prior non-live findings are addressed: command-level extended/fulltext behavior is covered, --extended is documented, TYPE is included in the extended-only output spec list, and the live-validation requirement is satisfied based on the provided validation state.

@rianjs

rianjs commented Jun 21, 2026

Copy link
Copy Markdown
Contributor Author

Findings

No findings.

The remaining PR-body validation issue is resolved. The current metadata now records successful configured-credential validation with the local build, including default output, --id, --extended, projected fields, and token pagination. The diff remains aligned with the ticket intent: compact changelog rows, standard read flags, bounded output, projection identity behavior, docs, tests, and jtk minor version bump.

@rianjs

rianjs commented Jun 21, 2026

Copy link
Copy Markdown
Contributor Author

Findings

  • Major: The new history tests do not exercise the full Cobra path for the headline flags. history_test.go covers --fields via cmd.Execute(), but --id, --extended, --fulltext, and a successful non-empty --next-page-token are only covered through direct runHistory(...) calls or presenter tests. That means a broken flag binding or RunE handoff could still pass CI even though the public command surface is wrong. I’d add one end-to-end cmd.Execute() case that uses a real page token and at least one of the global flags, then assert both the request startAt and the rendered mode.
  • Minor: All fixtures use a single changelog group, so the suite never proves that multiple history groups stay in Jira order or that group IDs are preserved/repeated correctly across a page. A regression that reorders or drops groups would still pass today. Add a two-group fixture in history_test.go or issue_history_test.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: f1ddf61

Summary

Reviewer Findings
documentation:docs-reviewer 2
harness-engineering:harness-self-documenting-code-reviewer 3
documentation:docs-reviewer (2 findings)

💡 Suggestion - tools/jtk/CHANGELOG.md:20

New entry links to the GitHub issue (#420 via issues/420) while all other CHANGELOG entries consistently link to pull requests (pull/327, pull/189). GitHub auto-redirects so the link works, but the inconsistency may confuse readers tracing history.

💡 Suggestion - tools/jtk/internal/cmd/OUTPUT_SPEC.md:316

--id output mode is described in prose but has no rendered example block, unlike the default and --extended modes which both have examples. Readers cannot verify what --id output actually looks like from the spec alone.

harness-engineering:harness-self-documenting-code-reviewer (3 findings)

💡 Suggestion - tools/jtk/internal/cmd/issues/history.go:106

issueHistoryPagination is a noun phrase that does not surface the return contract (bool, string)(hasMore, nextToken). A verb-led name such as computeHistoryPageCursor or nextHistoryPageToken would let a reader understand what the function produces without scanning the body or call site.

⚠️ Should Fix - tools/jtk/internal/cmd/issues/history.go:111

The guard if advance == 0 && page.MaxResults > 0 { advance = page.MaxResults } handles a non-obvious Jira API edge case — an empty page mid-set — with no indication of why removing it would reintroduce a pagination loop. A short why-comment (e.g., // guard: avoid re-emitting the current offset when the API returns an empty page mid-set) is warranted here per the project standard of commenting non-obvious invariants.

💡 Suggestion - tools/jtk/internal/present/issue_history.go:154

s = strings.Join(strings.Fields(s), " ") is non-obvious without context: Jira changelog values can embed newlines and tab characters that would corrupt tab-separated table output. A short inline comment such as // collapse embedded newlines/tabs from Jira values explains the constraint to a future reader.

5 PR discussion threads considered.


Completed in 4m 05s | $2.40 | sonnet | daemon 0.2.127+dev.1.2b1249f | Glorfindel
Field Value
Model sonnet
Reviewers hybrid-synthesis, documentation:docs-reviewer, harness-engineering:harness-architecture-reviewer, harness-engineering:harness-enforcement-reviewer, harness-engineering:harness-knowledge-reviewer, harness-engineering:harness-self-documenting-code-reviewer, security:security-code-auditor
Engine claude · sonnet
Reviewed by pr-review-daemon · monit-pr-reviewer
Duration 4m 05s wall · 4m 02s compute (Reviewers: 2m 58s · Synthesis: 1m 04s)
Cost $2.40 (estimated)
Tokens 403.5k in / 23.7k out
Turns 14

Per-workstream usage

Workstream Model In Out Cache read Cache create Cost
hybrid-synthesis sonnet 39.8k 2.9k 13.1k 26.6k (1h) $0.21
documentation:docs-reviewer sonnet 39.0k 2.7k 10.6k 28.4k (1h) $0.21
harness-engineering:harness-architecture-reviewer sonnet 63.6k 954 0 63.6k (1h) $0.40
harness-engineering:harness-enforcement-reviewer sonnet 65.2k 2.1k 10.6k 54.6k (1h) $0.36
harness-engineering:harness-knowledge-reviewer sonnet 64.4k 1.5k 10.6k 53.8k (1h) $0.35
harness-engineering:harness-self-documenting-code-reviewer sonnet 71.8k 12.3k 10.6k 61.3k (1h) $0.56
security:security-code-auditor sonnet 59.8k 1.2k 10.6k 49.2k (1h) $0.32

Re-reviews only run when @monit-reviewer is re-requested as a reviewer — push as many commits as you need, then re-request when ready. PRs targeting branches other than main, master are skipped, even when @monit-reviewer is re-requested.

Comment thread tools/jtk/CHANGELOG.md Outdated
Comment thread tools/jtk/internal/cmd/OUTPUT_SPEC.md
Comment thread tools/jtk/internal/cmd/issues/history.go
Comment thread tools/jtk/internal/cmd/issues/history.go
Comment thread tools/jtk/internal/present/issue_history.go
@monit-reviewer monit-reviewer dismissed their stale review June 21, 2026 09:56

Superseded by updated review

@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: 09e3cc3 | Previous: f1ddf61 (incremental)

Summary

No issues found.

10 PR discussion threads considered.


Completed in 1m 09s | $6.05 | sonnet | daemon 0.2.127+dev.1.2b1249f | Glorfindel
Field Value
Model sonnet
Mode Re-review · Cycle 2 · Session resumed
Reviewers hybrid-synthesis, documentation:docs-reviewer, harness-engineering:harness-architecture-reviewer, harness-engineering:harness-enforcement-reviewer, harness-engineering:harness-knowledge-reviewer, harness-engineering:harness-self-documenting-code-reviewer, security:security-code-auditor
Engine claude · sonnet
Reviewed by pr-review-daemon · monit-pr-reviewer
Duration 1m 09s wall · 44s compute (Reviewers: 28s · Synthesis: 16s)
Cost $6.05 (estimated)
Tokens 1063.2k in / 26.1k out
Turns 28

Per-workstream usage

Workstream Model In Out Cache read Cache create Cost
hybrid-synthesis sonnet 90.5k 3.4k 26.3k 64.2k (1h) $0.44
documentation:docs-reviewer sonnet 89.7k 2.8k 23.7k 66.0k (1h) $0.45
harness-engineering:harness-architecture-reviewer sonnet 164.0k 1.1k 13.1k 150.9k (1h) $0.93
harness-engineering:harness-enforcement-reviewer sonnet 168.7k 2.3k 23.7k 145.0k (1h) $0.91
harness-engineering:harness-knowledge-reviewer sonnet 166.4k 1.7k 23.7k 142.7k (1h) $0.89
harness-engineering:harness-self-documenting-code-reviewer sonnet 188.4k 12.5k 23.7k 164.7k (1h) $1.18
security:security-code-auditor sonnet 152.4k 1.4k 23.7k 128.6k (1h) $0.80
discussion-summarizer 43.0k 719 0 43.0k (1h) $0.45

Re-reviews only run when @monit-reviewer is re-requested as a reviewer — push as many commits as you need, then re-request when ready. PRs targeting branches other than main, master are skipped, even when @monit-reviewer is re-requested.

@rianjs

rianjs commented Jun 21, 2026

Copy link
Copy Markdown
Contributor Author

Findings

No findings.

The daemon edits are consistent with the approved architecture: docs are clearer, --id output is now explicitly specified, the pagination helper name is more precise, and the comments explain real guards without changing behavior. The added tests strengthen the command-boundary and ordering coverage without expanding scope.

@rianjs rianjs merged commit d6fc0fb into main Jun 21, 2026
10 checks passed
@rianjs rianjs deleted the feat/420-jtk-issue-history branch June 21, 2026 09:58
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 issue history command

2 participants