unisonweb/unison

transcripts: make running “non-destructive”

Opened this issue · 0 comments

Is your feature request related to a problem? Please describe.

Transcripts are now largely idempotent, but that’s not quite good enough, as a transcript runner that turns an arbitrary transcript into the empty transcript is also idempotent.

This is frustrating when you are editing a transcript, and running it can remove some portion of the content (e.g., when an early block has an error).

Describe the solution you'd like

We want to ensure that running a transcript is roughly “additive”. I.e., no matter how the transcript fails, the output contains at least the

  • Unison code blocks,
  • UCM comments & commands, and
  • API comments & calls

that were in the input. API responses and UCM command output can be modified/removed, as can any :added-by-ucm blocks.

Describe alternatives you've considered

Right now this is worked around by having even idempotent transcripts write to a separate output file when there is an error, but this feels non-ergonomic, as the output files aren’t tracked by git, and thus show up as untracked files, rather than nice diffs of what we were expecting compared to what happened.

Additional context

This was suggested/approved in the idempotent transcripts PR.