Skip to main content

Module exec_state

Module exec_state 

Source
Expand description

Surgical, byte-preserving sync of the ## Execution State header bullets.

Backs three callers so the durable execution-state Markdown stays in step with the runtime run-state.json at the workflow’s two transitions:

  • plan-issue record open writes the - Tracking issue: URL once the live issue exists (so plan-archive discover can infer the provider ref).
  • plan-issue record close writes the terminal state back (- Status:, - Last updated:, - Branch/commit/PR:) so the in-repo file is final after closeout, not transient-stale until plan-archive migrate.
  • plan-tooling exec-state-sync exposes the same routine as an on-demand repair command for existing bundles.

Scope is intentionally narrow, mirroring crate::ledger: only the named - <Label>: bullets inside the ## Execution State section are touched and every other byte of the file is preserved verbatim. The ## Task Ledger rows are owned by crate::ledger and the existing close-ready ledger-rows-pending gate, so this module never rewrites them.

Structs§

BulletChange
One bullet change record, surfaced in JSON output.
SyncReport
Aggregate outcome of a sync. changed is true when at least one bullet was patched or inserted (i.e. the file content differs).
TerminalState
Terminal-state fields written back at closeout.

Enums§

BulletAction
What happened to a single bullet during a sync.
ExecStateError

Constants§

BRANCH_LABEL
LAST_UPDATED_LABEL
STATUS_LABEL
TRACKING_ISSUE_LABEL
Canonical bullet labels this module syncs.

Functions§

is_placeholder
True when value is empty or a known “not yet recorded” placeholder.
sync_tracking_issue
Write-if-missing/placeholder/mismatch the - Tracking issue: bullet to the canonical autolinked url. Idempotent: a re-run with the same URL is a no-op. Used by record open and by the self-heal path.
tracking_issue_value
Return the current - Tracking issue: value inside ## Execution State, or None when the bullet is absent. The angle-bracket autolink wrapper is stripped so callers compare bare values.
writeback_terminal
Write the terminal-state bullets back at closeout. Only the fields present in state are touched. Byte-preserving and idempotent. With dry_run the change set is computed and reported but the file is left untouched.