Memex Admin
Dashboard
API Keys
Policies
Backend: StrEnum Unknown Fallback Pattern
Repository: mem-labs/mem
Back to Policies
Cancel
active
Updated Feb 19, 2026, 8:25 PM
Name
Status
active
inactive
Markdown
String enum parsing from external/stored values must be resilient. Rationale: - New enum values from persisted or external data should not cause uncontrolled runtime failures. Scope: - PR review policy for backend runtime changes under `domains/python/backend/app/src/**` involving `StrEnum` and string-to-enum parsing. Trigger: - A PR adds/changes a `StrEnum`, or adds/changes coercion from external/persisted string values into enum types. Approval checks: 1) Enums used for external/persisted inputs define an `UNKNOWN` fallback (or documented equivalent sentinel). 2) Parsing path for external/persisted values handles unknown values explicitly (fallback sentinel or typed validation error at boundary). 3) Direct unchecked coercion on external/persisted values is not introduced. Evidence: - Diff shows parsing guard behavior. - Tests cover at least one unknown-value path for changed enum parsing. Decision: - Return NOT APPROVED when trigger is met and resilient parsing checks fail.
Cancel
Save Policy