P355 · Tool use

Ordered Actions and Final-State Audit

Trace the complete action sequence and verify its final state, including later actions that undo earlier ones.

Editorially reviewed

These examples and illustrative results are independently authored teaching materials, not measured model results.

Use case

A mail interface’s New Email button must clear the selected thread and open the composer. Teaching action selectThread(null) also sets composeOpen=false. Opening before clearing therefore closes the panel again.

Mechanism

Find the handler and list each call’s reads, writes, resets and asynchronous effects in execution order. Compare them with the expected final state: thread=null and composeOpen=true. Under the actual contract, clear first and open second, or use one coherent transition. After related asynchronous work finishes, check state and the visible panel from both selected-thread and empty-thread entry states.

Bad example

Fix New Email by calling setComposeOpen(true), then selectThread(null). Treat the button as successful once the opening setter runs.

Good example

Audit the complete New Email handler under its action contracts. Since selectThread(null) resets composeOpen, clear the thread before opening. After the whole sequence, assert thread=null, composeOpen=true, a visible composer and expected input focus. Check whether later asynchronous callbacks close it again.

Why the change matters

A correct local action does not establish a correct interaction. An action-effect map exposes a later reset overwriting an earlier write. Final state and visible behavior bind verification to what the button promises.

Observable expectation

The teaching old trace is false→true→false, leaving the composer closed. Clearing then opening ends at true. Test both selected and empty thread states. Injecting a delayed reset should make the regression check fail and identify the later action.

Limits

Reordering can affect drafts, selection and focus, which also need their product assertions. Async races may require cancellation, version checks or a unified transition; swapping synchronous calls does not fix every case. Source action names are illustrative; inspect the target application’s actual implementation.

Sources and evidence

Read the editorial criteria