Skip to Content
Paycose Docs
Diagrams

Diagrams

State machines and request flows, drawn from the code so they cannot drift from it.

These diagrams are not drawn from memory. Each one is either generated from the code or checked against it, so a change in the code that the diagram does not reflect fails a test.

  • State machines are generated from the transition tables in backend/wallet by a Go golden test. When a table changes, the test fails until the diagram is regenerated with DUMP=1 go test ./internal/docsgen -run TestStateDiagrams.
  • Sequence diagrams are written by hand while reading the code, and every step is annotated. An %% op: line names the API operation an arrow calls, and the docs test suite checks it is a published operationId with the same method and path. An %% src: line names the Go function behind a step, and the suite checks that the file still declares it.