Child of #721 (modify-card redesign umbrella). Applies the #551 framework (entity-view + state machine + status badges + shared tier-1/4 helpers) to purchase-order modify / delete / correct.
Scope
Single new entrypoint build_po_modify_ui(response, *, confirm_request, confirm_tool) in prefab_ui.py.
Covers callers:
modify_purchase_order (foundation/purchase_orders.py)
delete_purchase_order (foundation/purchase_orders.py)
correct_purchase_order (foundation/corrections.py)
All three currently route through _modification.to_tool_result → build_modification_preview_ui / build_modification_result_ui. The dispatch in _modification.to_tool_result adds an entity_type == \"purchase_order\" branch that calls build_po_modify_ui.
Content
Same entity view shape as build_po_create_ui from #551 — reuses _PO_FIELD_SPEC — decorated with:
- Diff display per changed field:
before → after rendering driven by the changes parameter to _render_entity_view. The FieldChangeView payload comes from a converter that flattens ModificationResponse.changes per action.
- Per-field status pills in applied state: each changed field shows
APPLIED / APPLIED (verified) / FAILED per the corresponding ActionResult.succeeded + verified flags.
- Operation grouping is implicit: header-field changes appear under the Header group; row additions/deletions appear under the Line Items group with
added/removed kind; additional-cost rows under their own group.
Title verb varies by operation discriminator:
- modify → "Purchase Order Modify"
- delete → "Purchase Order Delete"
- correct → "Purchase Order Correct"
Confirm label + operation_label follow.
Tasks
Acceptance
Child of #721 (modify-card redesign umbrella). Applies the #551 framework (entity-view + state machine + status badges + shared tier-1/4 helpers) to purchase-order modify / delete / correct.
Scope
Single new entrypoint
build_po_modify_ui(response, *, confirm_request, confirm_tool)inprefab_ui.py.Covers callers:
modify_purchase_order(foundation/purchase_orders.py)delete_purchase_order(foundation/purchase_orders.py)correct_purchase_order(foundation/corrections.py)All three currently route through
_modification.to_tool_result→build_modification_preview_ui/build_modification_result_ui. The dispatch in_modification.to_tool_resultadds anentity_type == \"purchase_order\"branch that callsbuild_po_modify_ui.Content
Same entity view shape as
build_po_create_uifrom #551 — reuses_PO_FIELD_SPEC— decorated with:before → afterrendering driven by thechangesparameter to_render_entity_view. TheFieldChangeViewpayload comes from a converter that flattensModificationResponse.changesper action.APPLIED/APPLIED (verified)/FAILEDper the correspondingActionResult.succeeded+verifiedflags.added/removedkind; additional-cost rows under their own group.Title verb varies by operation discriminator:
Confirm label + operation_label follow.
Tasks
build_po_modify_uiusing shared helpers from design(mcp): redesign build_order_preview_ui per #537 four-tier framework (PO / SO / MO) #551._action_results_to_field_changes(or scope local to PO if cleaner)._action_results_to_field_statuses(parallel — drives the applied-state per-field pills).entity_type == \"purchase_order\"branch in_modification.to_tool_result.TestBuildPOModifyUIwith preview / applied / per-action-status / diff-decoration coverage. Field-spec parity test — every field in_PO_FIELD_SPECthat's non-None in the fixture appears in the rendered card.Acceptance
build_po_modify_uirenders the full PO entity view with diff decoration for changing fields and per-field status in applied state.modify_purchase_order/delete_purchase_order/correct_purchase_orderdispatches tobuild_po_modify_uivia_modification.to_tool_result.