Ex4pm.Standing.Coded (ex4pm v26.9.9)

Copy Markdown View Source

Reason-coded standing: %Ex4pm.Standing.Coded{standing: atom(), code: String.t() | nil}, rendering as the real STANDING[REASON_CODE] shape observed in production beam4pm scheduled-task receipts (see docs/PRD-v26.9.10.md) -- e.g. ALIVE[WS3_CHICAGO_MERGE_50]. Does not replace bare-atom Ex4pm.Standing; both stay valid, this is additive for callers that need a reason payload.

new/2/to_string/1/parse/1 are generic -- they work for any real atom() standing and any String.t() code, not just the examples below. What IS admission-fact-driven here is the real set of example STANDING[CODE] strings this module's own generated test suite round-trips (grown by adding a new ex4pmsc:AdmittedStandingCode individual to priv/ontology/ex4pm.ttl and re-running scripts/standing_coded_sync.sh -- no hand-written Elixir change needed to add real-world round-trip coverage):

* `ALIVE[WS3_CHICAGO_MERGE_50]`
  • ALIVE[WS3_FORTUNE5_RUNTIME_VALUE_50]
  • BUILD_BROKEN[TAKT_SHORTFALL]
  • PARTIAL_ALIVE[MERGED_LOCAL_CAPSULE_NAMESPACE_UNAVAILABLE]

Summary

Functions

Builds a coded standing from a bare Ex4pm.Standing-shaped atom and an optional reason code.

Parses a real STANDING[CODE]-or-bare-STANDING string back into {:ok, t()}, or :error if the input doesn't match either shape. Round-trips every string to_string/1 can produce.

Rank/min dispatch: accepts a bare atom or a coded struct, via its .standing field.

Renders STANDING[CODE] (upcased standing, code verbatim), or just STANDING when code is nil.

Types

t()

@type t() :: %Ex4pm.Standing.Coded{code: String.t() | nil, standing: atom()}

Functions

min(left, right)

@spec min(atom() | t(), atom() | t()) :: atom() | t()

new(standing, code \\ nil)

@spec new(atom(), String.t() | nil) :: t()

Builds a coded standing from a bare Ex4pm.Standing-shaped atom and an optional reason code.

parse(str)

@spec parse(String.t()) :: {:ok, t()} | :error

Parses a real STANDING[CODE]-or-bare-STANDING string back into {:ok, t()}, or :error if the input doesn't match either shape. Round-trips every string to_string/1 can produce.

rank(standing)

@spec rank(atom() | t()) :: non_neg_integer()

Rank/min dispatch: accepts a bare atom or a coded struct, via its .standing field.

to_string(coded)

@spec to_string(t()) :: String.t()

Renders STANDING[CODE] (upcased standing, code verbatim), or just STANDING when code is nil.