Skip to content

feat(taskflow): let a handle configure its confirmation dialog - #468

Open
WebCooper wants to merge 1 commit into
OpenNSW:mainfrom
WebCooper:feat/handle-pre-confirm
Open

WebCooper wants to merge 1 commit into
OpenNSW:mainfrom
WebCooper:feat/handle-pre-confirm

Conversation

@WebCooper

@WebCooper WebCooper commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

A task's confirmation dialog (shown before a primary, secondary or danger action is sent) has one fixed text for every button. An artifact needs to word it for its own action, or turn it off where the action is safe to repeat, such as a verify that only checks the form.

This adds an optional pre_confirm to a handle in render.json. The renderer passes it to the task view unchanged; the portal decides what to show.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvement
  • Other (please describe):

Changes Made

  • zoneview.HandleClaim gains PreConfirm *HandlePreConfirm (JSON pre_confirm, omitted when unset).
  • New HandlePreConfirm: skip (send without asking), title and description (an empty one leaves the portal's own text).
  • Nothing else changes: filterLegalHandles copies each claim whole, and EnrichedComponent.Handles reuses the type.

Example handle:

{
  "command": "cancel_cdn",
  "label": "Cancel CDN",
  "element": "danger_action",
  "pre_confirm": {
    "title": "Cancel this CDN?",
    "description": "The CDN will be withdrawn from Customs."
  }
}

Testing

  • I have tested this change locally
  • I have added tests that prove my fix is effective or that my feature works
  • I have tested edge cases
  • All existing tests pass

TestRender_CarriesHandlePreConfirm covers a handle with a title and description, one with skip, and one without pre_confirm, which comes out with none.

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have checked that there are no merge conflicts

Related Issues

N/A

Additional Notes

Backward compatible: a handle without pre_confirm is unchanged. The portal (nsw-srilanka trader-app) and the artifacts follow once this is released.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Handles can now display a configurable confirmation title and description before an action. They can also be configured to skip confirmation, and leaving the text fields empty preserves the renderer’s existing text.

A handle in render.json can carry pre_confirm: a title and description for
the dialog that asks before the handle is sent, or skip to send it without
asking. The renderer passes it to the task view unchanged.
@coderabbitai

coderabbitai Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Zone view handle configuration now supports optional pre-confirm skip, title, and description settings. A render test checks configured values and verifies that a handle without the setting has no pre-confirm value.

Changes: Handle pre-confirm configuration

Layer / File(s) Summary
Define and render pre-confirm settings
taskflow/renderer/zoneview/zoneview.go, taskflow/renderer/zoneview/renderer_test.go
HandleClaim adds an optional PreConfirm setting with Skip, Title, and Description fields. The render test checks configured values and confirms that the setting is nil when absent.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Feature

Suggested labels: Type/New Feature

Merge Risk: Minimal · up to c4e7b

This adds an optional pre_confirm setting for handles. Handles that do not use it behave as before, and the new test covers the configured and absent cases. No merge-blocking risk is evident.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "feat(taskflow): let a handle configure its confirmation dialog" names the main change. The PR adds an optional pre_confirm field to a handle in render.json. That field sets a custom title a…
Description check Passed The description follows the repository template. It has a Summary that explains the problem and the new optional pre_confirm field. It marks the New feature type. It lists the main changes, including …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "feat(taskflow): let a handle configure its confirmation dialog" names the main change. The PR adds an optional pre_confirm field to a handle in render.json. That field sets a custom title and description for the confirmation dialog, or skips it. The title is specific, short, and accurate to the changeset.

Full details: Description check

Explanation

The description follows the repository template. It has a Summary that explains the problem and the new optional pre_confirm field. It marks the New feature type. It lists the main changes, including the HandleClaim and HandlePreConfirm additions and the unchanged filterLegalHandles path. It records testing with TestRender_CarriesHandlePreConfirm and gives a backward-compatibility note. Gaps: the Related Issues section says N/A rather than an issue reference, and the documentation checkbox is unchecked. The description does not need either to be mostly complete.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c37d87cd-c893-4be8-a17a-00ec4bfc5e08
Commits

Reviewing files that changed from the base of the PR and between 68efa35 and c4e7bed.

Files selected for processing: 2

  • taskflow/renderer/zoneview/renderer_test.go
  • taskflow/renderer/zoneview/zoneview.go

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

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.

1 participant