Skip to main content

message_shape_issue

Function message_shape_issue 

Source
pub fn message_shape_issue(msg: &str) -> Option<String>
Expand description

Report why msg violates the operator-message shape rules, or None if it is well-formed. Pure and always-compiled so tests in any crate (validators in kopiur-api, event/condition builders in the controller and mover) can assert their user-facing strings against one checker.

The rules are deliberately conservative — they flag the failure modes this overhaul removes, not stylistic taste, so they can run over the existing (already-good) messages without false positives:

  • empty / whitespace-only,
  • a doubled space or a ". ." gap (copy/format slips),
  • a leaked volatile kopia temp fragment (.shards / .tmp.<hex>) — these must only ever live in status.failure.stderrTail, never in a built message,
  • a generic filler lead ("error:", "failed:", …) that buries the specific problem behind a word truncation would waste,
  • a message longer than MAX_MESSAGE_CHARS — the anti-ramble cap: an operator-facing message that long is narrating, not naming what’s wrong.