HomeDocs-Technical WhitePaper51-Pipeline Card Template v1.0

Chapter 7 — State, Idempotency & Fault Tolerance (Transactions / Retry / Replay)


I. Purpose & Scope


II. Prerequisites & Inputs


III. State Machine

  1. States: state ∈ {pending, running, succeeded, failed, rolled_back}.
  2. Basic transitions:
    • pending → running: all deps succeeded and gates G1–G3 passed.
    • running → succeeded: stage gates G1–G8 all passed.
    • running → failed: any of S1–S5 (dimensional/freshness/path/covariance/citation failure).
    • failed → rolled_back: checkpoint or compensation exists and audit is complete.
  3. Invariants: transitions must not violate upstream artifact consistency; rollback must match checkpoints and be replayable.

IV. Transactions & Errors

  1. Transactional boundary: input read → compute → output write is one atomic commit; external side effects must be compensable.
  2. Error classes:
    • E_INPUT (contract/type/window errors)
    • E_DIM (dimensional failure)
    • E_GATE (quality gate failure)
    • E_SYNC (unlock/offset over threshold)
    • E_UQ (non-PD covariance/coverage mismatch)
    • E_INTERNAL (internal exception)
  3. Handling: compensable errors prefer rollback + retry; non-compensable errors mark failed and route to human review.

V. Idempotency


VI. Retry Strategy


VII. Replay & Checkpoint


VIII. Path-Aware Requirements


IX. Gates & Stops


X. Machine-Readable Configs
A. state_machine.yaml (extended)

version: "1.0.0"

states: [pending, running, succeeded, failed, rolled_back]

transitions:

- { from: pending, to: running, when: "deps_succeeded && G1..G3" }

- { from: running, to: succeeded, when: "G1..G8 && !S1..S5" }

- { from: running, to: failed, when: "any(S1..S5)" }

- { from: failed, to: rolled_back, when: "has_checkpoint && do_compensate" }

retry_policy: { max_retries: 3, backoff: "exp+jitter", deadline: "10m" }

idempotency_key: "run_id+partition+window"

B. replay_plan.yaml

version: "1.0.0"

replay:

enabled: true

order: "reverse_topology"

require_checkpoint: true

compensate_before_replay: true

verify:

hash: true

primary_keys: true

alerts:

on_divergence: ["page_ops","open_ticket"]


C. Audit event audit.jsonl (sample line)

JSON json
{
  "ts": "2025-09-24T16:10:00Z",
  "stage_id": "stage-30-arrival",
  "event": "retry",
  "idempotency_key": "run42+p010+win001",
  "attempt": 2,
  "backoff_ms": 800,
  "input_hashes": [ "sha256:..." ],
  "state": "running",
  "user": "scheduler",
  "checksum": "sha256:..."
}

XI. Validation & Monitoring


XII. Anti-Patterns & Fixes


XIII. Release & Layout

PTN_EXPORT/

configs/

state_machine.yaml

replay_plan.yaml

reports/

check_dim_report.json

validate_report.json

audit.jsonl

figs/

state_transitions.svg

retry_replay_timeline.pdf

report_manifest.yaml

SIGNATURE.asc


XIV. Cross-References


XV. Checklist


Copyright & License (CC BY 4.0)

Copyright: Unless otherwise noted, the copyright of “Energy Filament Theory” (text, charts, illustrations, symbols, and formulas) belongs to the author “Guanglin Tu”.
License: This work is licensed under the Creative Commons Attribution 4.0 International (CC BY 4.0). You may copy, redistribute, excerpt, adapt, and share for commercial or non‑commercial purposes with proper attribution.
Suggested attribution: Author: “Guanglin Tu”; Work: “Energy Filament Theory”; Source: energyfilament.org; License: CC BY 4.0.

First published: 2025-11-11|Current version:v5.1
License link:https://creativecommons.org/licenses/by/4.0/