mixle.substrate.governance moduleΒΆ

Promotion gates for shared substrate knowledge.

Teams can publish items into shared scopes, while curated scopes can require an explicit approval step. propose() marks an item as pending promotion, approve() promotes it when the approver is authorized for the target scope, reject() records a refusal, and pending() lists items awaiting review.

Approved promotion delegates the scope change to publish(), preserving the same provenance trail as ordinary sharing.

class Governance(approvers=<factory>)[source]

Bases: object

Who may approve promotions into which scope – the org-governance ACL.

Parameters:

approvers (dict[str, set[str]])

approvers: dict[str, set[str]]
may_approve(who, scope)[source]
Parameters:
Return type:

bool

grant(who, scope)[source]

Add who as an approver for scope (chainable).

Parameters:
Return type:

Governance

propose(substrate, ids, *, to, by=None)[source]

Mark items as pending promotion to scope to (they are NOT yet visible there). Returns the ids.

Parameters:
Return type:

list[str]

pending(substrate, *, to=None)[source]

Items awaiting approval (optionally only those proposed to scope to).

Parameters:
  • substrate (Substrate)

  • to (str | None)

Return type:

list[SubstrateItem]

approve(substrate, item_id, *, by, governance, to=None)[source]

Promote a pending item into its proposed scope – IFF by may approve for that scope (the gate).

On success the item is published into the target scope (via P1 publish(), so it inherits the versioned/audited share) and its proposal is marked approved with the approver id. Returns False (no change) if the item has no pending proposal or by lacks approval rights.

Parameters:
  • substrate (Substrate)

  • item_id (str)

  • by (str)

  • governance (Governance)

  • to (str | None)

Return type:

bool

reject(substrate, item_id, *, by, reason='')[source]

Refuse a pending promotion – the item stays in its origin scope; the refusal is recorded.

Parameters:
  • substrate (Substrate)

  • item_id (str)

  • by (str)

  • reason (str)

Return type:

bool