Skip to content

feat(worklog): resolve real Tempo author, add JSON output and author/date filters (#92) - #102

Merged
f3rdy merged 4 commits into
masterfrom
fix/issue-92-worklog-list-json-author
Jul 21, 2026
Merged

f3rdy merged 4 commits into
masterfrom
fix/issue-92-worklog-list-json-author

Conversation

@f3rdy

@f3rdy f3rdy commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Closes #92.

Problem

worklog list <ISSUE> was unreliable for attribution on Tempo-managed tickets:

  1. Wrong author — the Jira worklog API reports only the Tempo sync account ("Timesheets by Tempo") as author, never the real person.
  2. --format json ignored — the command always emitted a Rich table, so programmatic use was impossible.
  3. No filters — no --mine / --author / --from / --to.

Change

  • Route through the Tempo API on Tempo-enabled connections so the real author displayName is shown; non-Tempo connections keep using the Jira worklog API.
  • Honor the global --format json on both paths (emits id, author.accountId, author.displayName, timeSpentSeconds, startDate, startTime, description).
  • Add --mine / --author <accountId> / --from / --to, backed by the Tempo client's existing account_id and date parameters. --mine resolves the current user via myself(). These filters require a Tempo connection and error clearly on non-Tempo ones instead of being silently ignored; --mine + --author together is a usage error.

Notes / scope

  • --author takes a Jira accountId (use --mine for yourself). Resolving a plain email to an accountId is left as a follow-up.
  • Reuses the established jira_client.client.myself()["accountId"] pattern already used in tempo.py, services/issues.py and workflow.py; no new helper added.

Tests

  • 8 new tests in tests/cli/test_worklog.py (Tempo real-author, JSON fields, --mine, --author, --from/--to, mutual exclusion, non-Tempo JSON, filter-on-non-Tempo error). Written test-first (red → green).
  • Full suite: 901 passed, 3 skipped, coverage 86%. ruff check/ruff format/mypy clean.

f3rdy added 4 commits July 21, 2026 17:44
…date filters (#92)

worklog list was unreliable for attribution: on Tempo-managed tickets the
Jira worklog API reports only the Tempo sync account as author, --format json
was ignored, and there were no author/date filters.

- Route worklog list through the Tempo API on Tempo-enabled connections so the
  real author displayName is shown; keep the Jira worklog API for non-Tempo
  connections.
- Honor the global --format json (emits id, author.accountId/displayName,
  timeSpentSeconds, startDate, startTime, description).
- Add --mine (resolves the current user via myself()), --author <accountId>,
  and --from/--to date filters, backed by the existing Tempo client account_id
  and date parameters. These require a Tempo connection and error clearly on
  non-Tempo ones instead of being silently ignored.

Closes #92
- reject invalid --from/--to dates with a usage error instead of a traceback
- surface truncation at the 1000-entry Tempo fetch limit (table hint + JSON
  'truncated' flag on both paths)
- align Jira fallback JSON schema with the Tempo path (startDate/startTime
  split, handles +0000-style offsets on Python 3.10)
- type connection params as Connection instead of Any
- deduplicate worklog table construction
@f3rdy

f3rdy commented Jul 21, 2026

Copy link
Copy Markdown
Contributor Author

Self-review (session-assisted)

Findings, all addressed in 033c116:

  1. (Medium) Invalid --from/--to dates raised an uncaught ValueError (traceback instead of a usage error). Now parsed via _parse_date_option with a clean exit-1 message + test.
  2. (Minor) Silent truncation at the 1000-entry Tempo fetch limit. Table output now prints a hint, JSON carries a truncated flag (both paths, always false on the Jira fallback) + tests.
  3. (Minor) JSON schema drift between paths: the Jira fallback omitted startTime and put the full timestamp into startDate. Now split into date/time parts (with +0000-offset normalization for Python 3.10) + test.
  4. (Nit) connection: Any → typed as Connection (TYPE_CHECKING import).
  5. (Nit) Duplicated Rich table construction extracted into _worklog_table.

Full suite 904 passed / 3 skipped, ruff check + mypy clean.

@f3rdy
f3rdy merged commit 8624871 into master Jul 21, 2026
5 checks passed
@f3rdy
f3rdy deleted the fix/issue-92-worklog-list-json-author branch July 21, 2026 22:17
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.

worklog list: resolve real Tempo author + add --format json and --mine/--author/--from filters

1 participant