Skip to content

feat(issue): add --dry-run to create issue and issue update - #147

Merged
f3rdy merged 2 commits into
masterfrom
feat/135-dry-run-create-update
Oct 21, 2026
Merged

f3rdy merged 2 commits into
masterfrom
feat/135-dry-run-create-update

Conversation

@f3rdy

@f3rdy f3rdy commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

Why (from #135)

On instances where issues cannot be deleted and API-posted content cannot be edited, the first write is the only write. Until now the only way to check the converted text beforehand was importing budjira internals (from budjira.utils.description import render_description) from an external script. --dry-run makes "did we hit the customer format exactly?" answerable before the irreversible write.

What

  • budjira create issue --dry-run prints the resolved fields payload (project, issuetype, priority, labels, parent, timetracking, custom fields) and the description after dialect conversion, then exits 0 — no client is even constructed.
  • budjira issue update --dry-run previously only previewed transitions and was silently ignored without --status while field updates were still applied. It now previews every requested operation — fields payload, labels, epic link, timetracking, worklog — and applies nothing.
  • Payload assembly moved into build_create_fields/build_update_fields (budjira/services/issues.py), shared by the real calls and the preview so the two cannot drift apart. Service behaviour is unchanged (existing tests green); render_description's signature is untouched, so the external checker script keeps working.
  • currentUser() is not resolved in a dry run (no myself() read); the payload marks the spot with <currentUser()> instead.
  • No credentials, tokens or headers are printed — only the fields payload.

Evidence (real dry-run output, measured)

Dry run: would create Bug in project PROJ — no API call made
fields payload:
{
  "project": { "key": "PROJ" },
  "summary": "Fix login bug",
  "issuetype": { "name": "Bug" },
  "description": "h2. Notes\n\n* one\n* two",
  "priority": { "name": "High" },
  "labels": [ "bug" ]
}
Description after conversion (dialect: markdown) — the exact string that would be sent:
╭───────────╮
│ h2. Notes │
│           │
│ * one     │
│ * two     │
╰───────────╯

Tests

  • CLI: create dry run never constructs a client (from_connection.assert_not_called()); update dry run performs no write (update_issue, issue, add_labels, link_to_epic, add_worklog all not called); converted-string assertions for markdown→wiki and wiki passthrough.
  • Service: builder unit tests for both dialects, all assignee forms (name / currentUser() with and without id / unassign), extra-fields merge, and input-dict immutability; update() still resolves currentUser() via myself().
  • Full suite: 1439 passed, 3 skipped; ruff, mypy, bandit green.
  • budjira ai usage-prompt --plain output checked; regenerated prompt committed separately.

Closes #135

f3rdy added 2 commits October 21, 2026 14:07
The dry run prints the resolved fields payload and the description
after dialect conversion - the exact string that would be sent - and
performs no API write. On instances where issues cannot be deleted and
API-posted content cannot be edited, this makes 'did we hit the
customer format exactly?' answerable before the irreversible write.

The payload assembly moves into build_create_fields/build_update_fields
in the service layer, shared by the real calls and the preview so the
two can never drift apart. currentUser() is not resolved in a dry run
(no myself() read); the payload marks the spot instead.

create issue gains the flag; issue update extends --dry-run from the
transition preview to all field updates, labels, epic link,
timetracking and worklog - previously the flag was silently ignored
without --status while the updates were still applied.

Closes #135
Regenerate .claude/ai-usage-prompt.md after --dry-run for create issue
and issue update.
@f3rdy
f3rdy force-pushed the feat/135-dry-run-create-update branch from 244d80f to a28f128 Compare October 21, 2026 12:09
@f3rdy
f3rdy merged commit bc01a65 into master Oct 21, 2026
5 checks passed
@f3rdy
f3rdy deleted the feat/135-dry-run-create-update branch October 21, 2026 12:31
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(create/update): --dry-run that prints the exact payload before sending

1 participant