Aetherlight AL2b-1: comments, seal doc-test, PROVENANCE section, dead readers
Restates comments that named deleted symbols as a reason, swaps the seal doc-test that named ScopeDigest for DecisionEvent, deletes WorldJournal::commits and FictionalMinutes::since (dead with the operator log and attention order), and writes the AL2b-1 PROVENANCE section with the residue list for AL2b-2. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
d512a6706a
commit
d48f1d7aa7
6 changed files with 98 additions and 83 deletions
|
|
@ -73,8 +73,8 @@ pub enum ActionMismatch {
|
|||
EmptyDisplay,
|
||||
/// The acting subject's effective authority covers no such target under
|
||||
/// this kind. A target that walked out of the jurisdiction while the
|
||||
/// proposal was in flight arrives here, not as a rebind: what the actor is
|
||||
/// authorized over is in the digest, the world it reaches is not.
|
||||
/// proposal was in flight arrives here: what the actor is authorized over
|
||||
/// is in its scope, the world it reaches is not.
|
||||
NotAuthorized {
|
||||
precondition: usize,
|
||||
},
|
||||
|
|
@ -92,7 +92,7 @@ pub enum ActionMismatch {
|
|||
},
|
||||
/// The actor does not hold the bound fact at the required confidence. A
|
||||
/// re-appraisal that lowered its own confidence while the proposal was in
|
||||
/// flight arrives here rather than as a rebind: confidence is admission-only.
|
||||
/// flight arrives here: confidence is admission-only.
|
||||
FactUnknown {
|
||||
precondition: usize,
|
||||
},
|
||||
|
|
@ -1976,9 +1976,8 @@ mod tests {
|
|||
assert!(bench.try_as(treasury, &bench.levy(farmer, 1)).is_ok());
|
||||
}
|
||||
|
||||
/// An office lends jurisdiction its holder does not own, vacating takes it
|
||||
/// back, and a proposal bound before the vacate rebinds rather than
|
||||
/// rejecting: revocation mid-flight is a `ScopeChanged`.
|
||||
/// An office lends jurisdiction its holder does not own, and vacating takes
|
||||
/// it back: the act is refused at admission.
|
||||
#[test]
|
||||
fn office_delegation_grants_and_vacating_revokes() {
|
||||
let directory = tempfile::tempdir().unwrap();
|
||||
|
|
|
|||
|
|
@ -24,13 +24,6 @@ impl FictionalMinutes {
|
|||
pub(crate) fn checked_add(self, span: TickMinutes) -> Option<Self> {
|
||||
self.0.checked_add(u64::from(span.0)).map(Self)
|
||||
}
|
||||
|
||||
/// Minutes elapsed since an earlier reading. Saturating because the caller
|
||||
/// is the attention order, which reads a stamp `verify_state_shape` already
|
||||
/// holds to `<= now`.
|
||||
pub(crate) fn since(self, earlier: Self) -> u64 {
|
||||
self.0.saturating_sub(earlier.0)
|
||||
}
|
||||
}
|
||||
|
||||
/// The span one `AdvanceTime` names. Constructor-checked `1..=MAX_ROUTE_COST`
|
||||
|
|
|
|||
|
|
@ -181,11 +181,6 @@ impl WorldJournal {
|
|||
self.commits.get(&command_id)
|
||||
}
|
||||
|
||||
/// Every commit the journal holds, in no particular order.
|
||||
pub(super) fn commits(&self) -> impl Iterator<Item = &WorldCommit> {
|
||||
self.commits.values()
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
pub(super) fn commit_count(&self) -> usize {
|
||||
self.commits.len()
|
||||
|
|
@ -667,7 +662,7 @@ pub(super) fn verify_state_shape(state: &WorldState) -> Result<(), JournalError>
|
|||
));
|
||||
}
|
||||
}
|
||||
// Commitments, pressures, attention stamps, and the authored scale target.
|
||||
// Commitments, pressures, and the authored scale target.
|
||||
// Absence is the only spelling of nothing at every level, so a store
|
||||
// satisfying these clauses carries no empty inner map, no zero magnitude,
|
||||
// and no dangling row — with no scan for any of them.
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@
|
|||
//! ```
|
||||
//!
|
||||
//! ```compile_fail
|
||||
//! let _ = aetherlight::ScopeDigest::fixture("x");
|
||||
//! use aetherlight::DecisionEvent;
|
||||
//! ```
|
||||
|
||||
// The kernel has no entry point until AL4 adds the ABI, so most of it is unreachable
|
||||
|
|
@ -346,7 +346,7 @@ pub(crate) enum NewController {
|
|||
NarrativePersona,
|
||||
OperationalAgent,
|
||||
/// Declared as a mirror of state this world does not own. Mints no
|
||||
/// controller, no mode, and no opportunity.
|
||||
/// controller, no mode, and no grants.
|
||||
External {
|
||||
consumer: ConsumerId,
|
||||
},
|
||||
|
|
@ -581,7 +581,7 @@ enum ControllerAssignment {
|
|||
/// A subject `Retire` ended for good. Not a second partition:
|
||||
/// `controller_assignments` stays the sole answer to who may call, and
|
||||
/// this is one of its values. It has no controller id, no mode, and no
|
||||
/// caller, so it mints no opportunity and is never an audience.
|
||||
/// caller, so it holds no grants and is never an audience.
|
||||
Retired,
|
||||
}
|
||||
|
||||
|
|
@ -705,26 +705,23 @@ struct WorldState {
|
|||
/// between two sources of one permission.
|
||||
authority: BTreeMap<SubjectId, BTreeSet<AuthorityGrant>>,
|
||||
/// The offices each institution constitutes, and who sits in them. An
|
||||
/// incumbent never exercises its institution's opportunity:
|
||||
/// `controller_assignments` stays the sole answer to who may call, and an
|
||||
/// office answers the different question of what its incumbent has
|
||||
/// jurisdiction over.
|
||||
/// incumbent never acts as its institution: an office answers what its
|
||||
/// incumbent has jurisdiction over, not who the actor is.
|
||||
selection: BTreeMap<SubjectId, BTreeMap<OfficeName, Office>>,
|
||||
/// Where each kind of grievance goes, and who may bring it. Keyed by
|
||||
/// neither a subject nor a referent, so it enters no scope digest and is
|
||||
/// admission-only state.
|
||||
/// neither a subject nor a referent, so it enters no scope components and
|
||||
/// is admission-only state.
|
||||
redress: BTreeMap<GrievanceKindName, Forum>,
|
||||
/// What each subject has promised. Never empty for a present key.
|
||||
commitments: BTreeMap<SubjectId, BTreeMap<CommitmentKey, Commitment>>,
|
||||
/// Lived meaning per subject. Read by projection and by nothing that
|
||||
/// decides, so it enters `state_digest` and no `ScopePreimage`.
|
||||
/// decides, so it enters `state_digest` and no scope.
|
||||
/// Pressure *on* each subject, keyed target-major then source. Never empty
|
||||
/// for a present key; no stored zero magnitude.
|
||||
pressures: BTreeMap<SubjectId, BTreeMap<PressureSource, PressureMagnitude>>,
|
||||
/// Minutes since genesis. The world's only clock, advanced by exactly one
|
||||
/// command body and read by no wall clock. It enters `state_digest` and no
|
||||
/// `ScopePreimage`: it is world truth, and it is read by no precondition, so
|
||||
/// a tick that only advances pressure moves no proposal's binding.
|
||||
/// scope: it is world truth, and it is read by no precondition.
|
||||
now: FictionalMinutes,
|
||||
controller_assignments: BTreeMap<DecisionScope, ControllerAssignment>,
|
||||
/// What an affordance *is*. World-authored, Draft-only, written by
|
||||
|
|
@ -827,12 +824,12 @@ pub struct SubjectSnapshot {
|
|||
pub human_controller: Option<PrincipalId>,
|
||||
pub affordances: BTreeSet<AffordanceId>,
|
||||
pub(crate) position: Option<EntityId>,
|
||||
/// Set for a subject `Retire` ended: no opportunity, no position, no
|
||||
/// Set for a subject `Retire` ended: no grants, no position, no
|
||||
/// audience, its history kept. The agent's view and the surface read this
|
||||
/// rather than inferring retirement from an absent position, which a
|
||||
/// merely unplaced live subject also has.
|
||||
pub retired: bool,
|
||||
/// Exactly what the scope digest binds for this subject, carried whole
|
||||
/// Exactly what a verification reads for this subject, carried whole
|
||||
/// rather than lowered into projections that then have to be diffed back
|
||||
/// together: its own position, incident routes, holdings, dependencies,
|
||||
/// grants, delegated offices, known fact keys, controlled channels, and
|
||||
|
|
@ -864,10 +861,9 @@ pub struct SubjectSnapshot {
|
|||
/// This subject's own dependencies, lowered from `components.dependencies`
|
||||
/// (private to this module) so the play table's omniscient view can print
|
||||
/// what a `release` may name without reaching into `ScopeComponents`
|
||||
/// itself. View-only, covered by no digest of its own: it is already bound
|
||||
/// through `components`.
|
||||
/// itself. View-only: it is already carried by `components`.
|
||||
pub(crate) dependencies: Vec<DependencyTarget>,
|
||||
/// The greatest `DecisionEvent.revision` whose scope is this subject, or
|
||||
/// The greatest `DecisionEvent.revision` whose actor is this subject, or
|
||||
/// `None` if the subject never acted. Derived from `state.events` alone:
|
||||
/// no new state, no schema change. The recency marker `projector_knowledge`
|
||||
/// stamps onto each knowledge row is `acquired_at > last_acted_at`.
|
||||
|
|
@ -1754,9 +1750,7 @@ fn admit_resolved(
|
|||
));
|
||||
}
|
||||
// Controller-shaped, both ways: a mirror receives no affordance, and
|
||||
// every other controller must receive one. That is what makes the
|
||||
// mirror's exclusion from opportunity derivation consistent rather than
|
||||
// merely enforced.
|
||||
// every other controller must receive one.
|
||||
if matches!(
|
||||
subject.controller,
|
||||
ControllerAssignment::ExternallyControlled { .. }
|
||||
|
|
@ -3100,25 +3094,20 @@ fn overlapping_holder(state: &WorldState) -> Option<SubjectId> {
|
|||
}
|
||||
|
||||
/// Exactly the components a subject's verification reads. One owner, consumed by
|
||||
/// the scope digest and by the snapshot, so the two cannot drift. `routes` is
|
||||
/// `action::exercise` and by the snapshot, so the two cannot drift. `routes` is
|
||||
/// every edge whose `from` or `to` is the subject's place: an inbound route
|
||||
/// decides who can arrive, and reading too little is a correctness hole while
|
||||
/// reading too much only costs an extra rejection. `holdings` and `dependencies`
|
||||
/// are the acting subject's own; a counterparty's holdings do not enter, because
|
||||
/// a transfer changes both subjects' components and so changes both digests.
|
||||
/// a transfer changes both subjects' components.
|
||||
/// It also holds what the actor *is* authorized over, and nothing about the
|
||||
/// world the actor reaches: the target's position, the target's container
|
||||
/// chain, the forum's state, and any subordinate's components stay out. A
|
||||
/// realm-wide authority whose preimage held its jurisdiction's occupancy would
|
||||
/// conflict with every commit in the realm, which is whole-world binding
|
||||
/// restored by the front door. A target that walks out of a jurisdiction
|
||||
/// mid-flight therefore fails at `Authorized` rather than rebinding, while a
|
||||
/// revoked grant is a `ScopeChanged`.
|
||||
/// target that walks out of a jurisdiction mid-flight fails at `Authorized`
|
||||
/// at commit, and a revoked grant fails the same way.
|
||||
///
|
||||
/// `Deserialize` is here so the narrative lane can persist a subject's own
|
||||
/// components as the "before" an interruption is measured against. No field
|
||||
/// changes with it, so `ScopePreimage`'s serialization — and therefore every
|
||||
/// scope digest — is byte-identical.
|
||||
/// components as the "before" an interruption is measured against.
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct ScopeComponents {
|
||||
|
|
@ -3131,9 +3120,9 @@ pub struct ScopeComponents {
|
|||
/// What each held office lends: for every office whose incumbent is this
|
||||
/// subject, the institution's live grants whose kind that office delegates.
|
||||
/// The institution's authority is copied in through the office link, so one
|
||||
/// scope digest covers the grant, the office, and the institution's
|
||||
/// jurisdiction, and only delegated kinds enter — an institution's `judge`
|
||||
/// jurisdiction never churns a `levy`-only incumbent's proposals.
|
||||
/// scope covers the grant, the office, and the institution's jurisdiction,
|
||||
/// and only delegated kinds enter — an institution's `judge` jurisdiction
|
||||
/// never reaches a `levy`-only incumbent.
|
||||
delegated: BTreeMap<SubjectId, BTreeMap<OfficeName, BTreeSet<AuthorityGrant>>>,
|
||||
/// The keys of this subject's own knowledge. Keys, not payloads: a statement
|
||||
/// is immutable, so it cannot change without the key changing, and
|
||||
|
|
@ -3143,13 +3132,11 @@ pub struct ScopeComponents {
|
|||
knows: BTreeSet<EntityId>,
|
||||
/// The channels this subject controls, with their records. Membership of a
|
||||
/// channel it merely hears never enters: a 1,000-member channel would churn
|
||||
/// a thousand digests per membership change, which is whole-world binding by
|
||||
/// the front door.
|
||||
/// a thousand scopes per membership change.
|
||||
controls: BTreeMap<EntityId, ChannelRecord>,
|
||||
/// This subject's own commitments. `Precondition::Committed` reads them, so
|
||||
/// the digest must bind them. Pressure, the clock, and the attention stamp
|
||||
/// stay out: no precondition reads any of the three, so a tick that only
|
||||
/// advances pressure invalidates no in-flight proposal.
|
||||
/// they are in scope. Pressure and the clock stay out: no precondition reads
|
||||
/// either.
|
||||
commitments: BTreeMap<CommitmentKey, Commitment>,
|
||||
}
|
||||
|
||||
|
|
@ -8742,8 +8729,8 @@ mod knowledge_tests {
|
|||
assert!(candidate.knowledge.contains_key(&speech.listener));
|
||||
}
|
||||
|
||||
/// The scope table: a telling rebinds its listener and leaves a bystander
|
||||
/// alone, and a reach change moves only the controller's digest.
|
||||
/// The scope table: a telling moves its listener's scope and leaves a bystander
|
||||
/// alone, and a reach change moves only the controller's scope.
|
||||
#[test]
|
||||
fn a_telling_moves_only_the_listeners_scope() {
|
||||
let directory = tempfile::tempdir().unwrap();
|
||||
|
|
@ -9237,7 +9224,7 @@ mod soul_knowledge_tests {
|
|||
assert_eq!(
|
||||
digest_of(&kernel, *subject),
|
||||
digest,
|
||||
"an utterance nobody heard moved a scope digest"
|
||||
"an utterance nobody heard moved a scope"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -10632,7 +10619,7 @@ mod witness_tests {
|
|||
}
|
||||
}
|
||||
|
||||
/// The clock, commitments, pressure, ordered attention, boundaries, and scale.
|
||||
/// The clock, commitments, pressure, boundaries, and scale.
|
||||
#[cfg(test)]
|
||||
mod clock_tests {
|
||||
use super::patch::{PreconditionRef, PressureSourceRef};
|
||||
|
|
@ -11737,9 +11724,9 @@ mod clock_tests {
|
|||
let after = digests(&kernel);
|
||||
for (subject, digest) in &before {
|
||||
if *subject == clockwork.reeve {
|
||||
assert_ne!(after[subject], *digest, "the fulfilling subject rebinds");
|
||||
assert_ne!(after[subject], *digest, "the fulfilling subject's scope moved");
|
||||
} else {
|
||||
assert_eq!(after[subject], *digest, "everyone else still commits");
|
||||
assert_eq!(after[subject], *digest, "everyone else's scope is untouched");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -114,8 +114,7 @@ pub(crate) struct OfficeName(pub(crate) String);
|
|||
/// A seat inside one institution. It carries no term and no selection method:
|
||||
/// there is no clock, so nothing can expire, and a field nothing reads is a
|
||||
/// decoration the next pass has to delete. `delegated` is the field that earns
|
||||
/// its keep — `scope_components` reads it, `Authorized` resolves through it, and
|
||||
/// the scope digest binds it.
|
||||
/// its keep — `scope_components` reads it and `Authorized` resolves through it.
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub(crate) struct Office {
|
||||
|
|
@ -348,7 +347,7 @@ pub(crate) enum ReachRef {
|
|||
pub(crate) struct ChannelRecord {
|
||||
pub(crate) reach: Reach,
|
||||
/// Who may speak on it besides those inside its reach, and whose scope
|
||||
/// digest binds it. The horn belongs to the temple, not to whoever happens
|
||||
/// components carry it. The horn belongs to the temple, not to whoever happens
|
||||
/// to be within earshot of it.
|
||||
pub(crate) controller: Option<SubjectId>,
|
||||
}
|
||||
|
|
@ -495,9 +494,8 @@ pub(crate) struct Commitment {
|
|||
#[serde(transparent)]
|
||||
pub(crate) struct PressureMagnitude(pub(crate) u32);
|
||||
|
||||
/// Target-major, because every reader is: the attention order reads pressure
|
||||
/// *on* a subject and the typed view shows pressure on self. Source-major has no
|
||||
/// reader.
|
||||
/// Target-major, because every reader is: the typed view shows pressure on
|
||||
/// self. Source-major has no reader.
|
||||
#[derive(Clone, Copy, Debug, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
|
||||
#[serde(tag = "from", content = "of", rename_all = "snake_case")]
|
||||
pub(crate) enum PressureSource {
|
||||
|
|
@ -1242,8 +1240,8 @@ pub(crate) enum ComponentOp {
|
|||
source: PressureSourceRef,
|
||||
target: Ref<SubjectId>,
|
||||
},
|
||||
/// Ends a subject's turn for good: no opportunity, no position, no
|
||||
/// audience, its history kept. Only the owner and `Play` may write it.
|
||||
/// Ends a subject for good: no grants, no position, no audience, its
|
||||
/// history kept. Only the owner and `Play` may write it.
|
||||
Retire {
|
||||
subject: Ref<SubjectId>,
|
||||
},
|
||||
|
|
@ -1256,7 +1254,7 @@ pub(crate) enum ComponentOp {
|
|||
affordance: Ref<AffordanceId>,
|
||||
},
|
||||
/// Revokes a grant. Refused if it would leave a controlled subject with
|
||||
/// none: `derive_opportunities` requires at least one.
|
||||
/// none: a controlled subject is never left mute.
|
||||
RevokeAffordance {
|
||||
subject: Ref<SubjectId>,
|
||||
affordance: Ref<AffordanceId>,
|
||||
|
|
@ -1666,8 +1664,7 @@ pub enum Mismatch {
|
|||
operation: usize,
|
||||
},
|
||||
/// A `RevokeAffordance` that would leave a controlled subject with no
|
||||
/// affordance at all. `derive_opportunities` requires at least one; a
|
||||
/// subject is never left mute.
|
||||
/// affordance at all: a subject is never left mute.
|
||||
WouldLeaveSubjectMute {
|
||||
operation: usize,
|
||||
},
|
||||
|
|
@ -3228,7 +3225,7 @@ pub(super) fn resolve_patch(
|
|||
}
|
||||
}
|
||||
if let Declaration::Subject(subject) = declaration {
|
||||
// Both ways. A mirror receives no opportunity, so it may hold no
|
||||
// Both ways. A mirror receives no controller, so it may hold no
|
||||
// affordance; every other controller must hold one.
|
||||
if matches!(subject.controller, NewController::External { .. })
|
||||
!= subject.affordances.is_empty()
|
||||
|
|
|
|||
Loading…
Reference in a new issue