cadrumo.application.operator_output.emit module

The one sanctioned entry point for an operator-facing JSON success envelope.

emit_operator_json_success() is the SOLE function outside core.json_contract itself that may call emit_json_success() directly for an operator-facing command result. Every JSON-emitting command surface — the CLI transport’s emit_envelope() and the setup wizard’s success/save-exit emitters — routes through this function so the sandbox-active indicator cannot be dropped by a caller that forgets to ask for it: there is no other way to reach SchemaEnvelope for a routine command result. The CLI transport’s metadata-only fast path (--help / --version) is the one documented exception, justified and enforced by the widened test_json_schema_conformance.py::test_no_bare_emit_json_success_call gate.

emit_operator_json_success(command, result, *, notices=(), active_profile=None)[source]

Emit result through SchemaEnvelope, prepending the sandbox notice.

Resolves sandbox_notice_for_active_bucket() and, when the active profile bucket is a sandbox, prepends the persistent info Notice ahead of notices before delegating to emit_json_success(). Callers must never pre-add the sandbox notice themselves — this function is the single place that decides whether it belongs on the envelope.

Parameters:
  • command (str) – Stable command-spec result identity for result’s type.

  • result (object) – The strict-validated, registered OutputSchema payload.

  • notices (Sequence[Notice]) – Caller-supplied notices, excluding the sandbox indicator.

  • active_profile (str | None) – Optional active-profile display label for the envelope spine.

Return type:

None