From the 2026-08 architecture review follow-up (related to #1781, #1782).
What is wrong: "move an entity from one state to another only if it is in the expected state, else a typed conflict error" is implemented meaningfully the same but encoded four different ways:
internal/taskstate/transitions.go — data-driven transition maps + CanTransition/CanStepTransition (the one place the shape lives as a reusable form).
Binding state machine — store-guarded methods in internal/infrastructure/postgres/edastore.go (ApproveBinding/PauseBinding/ResumeBinding → ErrBindingTransition), with the atomic guard in SQL (WHERE id = @id AND status = @from_status, edastore.sql:135, tasks.sql:261).
Wanted: one generic guarded-transition primitive in the domain (a Machine[S] with the legal moves as data and Can(from,to) + a typed stale/illegal error, generalizing what taskstate already has), which identity/binding/source-signing adopt as data; the SQL WHERE status = @from guard stays per-table (it is the atomicity), but the Go-side validation and error mapping stop being re-encoded.
Done when:
one shared transition primitive in internal/domain; at least two of identity/binding/source-signing use it as data
SQL guards unchanged (atomicity stays in the store); task check green
From the 2026-08 architecture review follow-up (related to #1781, #1782).
**What is wrong:** "move an entity from one state to another only if it is in the expected state, else a typed conflict error" is implemented meaningfully the same but encoded four different ways:
1. `internal/taskstate/transitions.go` — data-driven transition maps + `CanTransition`/`CanStepTransition` (the one place the shape lives as a reusable form).
2. `internal/domain/identity/identity.go` — switch-encoded commands (`case CommandSuspend/Reactivate/Retire`).
3. Binding state machine — store-guarded methods in `internal/infrastructure/postgres/edastore.go` (`ApproveBinding`/`PauseBinding`/`ResumeBinding` → `ErrBindingTransition`), with the atomic guard in SQL (`WHERE id = @id AND status = @from_status`, edastore.sql:135, tasks.sql:261).
4. Control-plane resources — optimistic `expected_version` guard (resources.sql).
**Wanted:** one generic guarded-transition primitive in the domain (a `Machine[S]` with the legal moves as data and `Can(from,to)` + a typed stale/illegal error, generalizing what taskstate already has), which identity/binding/source-signing adopt as data; the SQL `WHERE status = @from` guard stays per-table (it is the atomicity), but the Go-side validation and error mapping stop being re-encoded.
**Done when:**
- one shared transition primitive in `internal/domain`; at least two of identity/binding/source-signing use it as data
- SQL guards unchanged (atomicity stays in the store); `task check` green
sam
added the discovery label 2026-11-02 15:24:35 +00:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
From the 2026-08 architecture review follow-up (related to #1781, #1782).
What is wrong: "move an entity from one state to another only if it is in the expected state, else a typed conflict error" is implemented meaningfully the same but encoded four different ways:
internal/taskstate/transitions.go— data-driven transition maps +CanTransition/CanStepTransition(the one place the shape lives as a reusable form).internal/domain/identity/identity.go— switch-encoded commands (case CommandSuspend/Reactivate/Retire).internal/infrastructure/postgres/edastore.go(ApproveBinding/PauseBinding/ResumeBinding→ErrBindingTransition), with the atomic guard in SQL (WHERE id = @id AND status = @from_status, edastore.sql:135, tasks.sql:261).expected_versionguard (resources.sql).Wanted: one generic guarded-transition primitive in the domain (a
Machine[S]with the legal moves as data andCan(from,to)+ a typed stale/illegal error, generalizing what taskstate already has), which identity/binding/source-signing adopt as data; the SQLWHERE status = @fromguard stays per-table (it is the atomicity), but the Go-side validation and error mapping stop being re-encoded.Done when:
internal/domain; at least two of identity/binding/source-signing use it as datatask checkgreen