Skip to main content

Module charter

Module charter 

Source
Expand description

The site’s charter, its KPIs, its jobs’ earned autonomy and the signals the public partition sends the back office (spec 3.5 §7.6, §7.10, §7.11, §7.21; feature charter).

The charter format is AWP 2.0’s (awp_types::Charter); this module keeps it, measures against it and enforces what it says:

ItemWhat it doesSpec
CharterStore, CharterVersion, CommitDecision, RoleApproval, check_chain, commit_auditedEvery charter version with the decision that committed it; a commit refuses a draft that fails Charter::validate() and a decision whose approval chain distinct people did not satisfy§7.6, §7.11, A-I23
CharterDirectory, chain_policy, role_group, group_roleThe charter in force as the approval service’s directory: a chain becomes an ApprovalPolicy with one role:{role} slot per role, and only the people the charter names fill them§7.6, A-I23
KpiStore, KpiSample, KpiAggregate, KpiPeriod, KpiState, GuardrailStateMeasurements per KPI with daily and weekly aggregates, and the tracker’s state§7.11
KpiSource, KpiTracker, KpiTrackerExecutor, JobControl, JobPausesThe KPI tracker: reads each KPI’s source on its cadence, keeps the measure-only period, checks guardrails and pauses a breaching job before its next action§7.11, A-I14, A-I15
AutonomyStore, AutonomyLadder, JobAutonomy, AutonomyChange, JobDecision, OwnerDecision, PromotionPolicyEach job’s autonomy level and history: promotion only by an owner’s decision, demotion one level on a breach, two rejections in a row or an incident§7.11, A-I13
SignalStore, SignalSink, SignalRecord, SignalSourceToolTyped signals filed in the back office’s agenda as AgendaOrigin::Signal items, counted by kind and topic, rate-limited per source, waking Wake::Signal sleepers; never a crossing§7.10, A-I3
SiteProcessKindThe site’s process kinds, site.probe to site.digest§7.11, §7.19
CharterKitInstalls a site’s jobs, KPI tracker and signals on a kernel: each kind bound to the product’s target, the tracker as the kernel.kpi process, the unbound kinds in the kernel’s inventory§7.10, §7.11, §7.20
CharterEvent, CharterEventSinkCommits, baselines, breaches, pauses and autonomy changes, each with its urgency§7.21

Every store has in-memory, SQLite, PostgreSQL and Redis backends that pass one conformance suite each (conformance::charter, feature conformance):

StoreIn-memorySQLite (sqlite)PostgreSQL (postgres)Redis (redis)
CharterStoreInMemoryCharterStoreSqliteCharterStorePostgresCharterStoreRedisCharterStore
KpiStoreInMemoryKpiStoreSqliteKpiStorePostgresKpiStoreRedisKpiStore
AutonomyStoreInMemoryAutonomyStoreSqliteAutonomyStorePostgresAutonomyStoreRedisAutonomyStore
SignalStoreInMemorySignalStoreSqliteSignalStorePostgresSignalStoreRedisSignalStore

§Example

use adk_kernel::charter::{SiteProcessKind, SITE_PROCESS_LABEL};

assert_eq!(SiteProcessKind::Probe.as_str(), "site.probe");
assert_eq!(SITE_PROCESS_LABEL, "site.process");

Modules§

audit
Audit actions of the charter module (spec 3.5 §9.3).

Structs§

AutonomyChange
One change of a job’s autonomy, kept as its history (spec 3.5 §7.11).
AutonomyLadder
The autonomy ladder of a site’s jobs (spec 3.5 §7.11, A-I13): promotion only by an owner’s decision, demotion one level by the site on a guardrail breach, two owner rejections in a row, or an incident in the job’s area, each with its reason.
ChainRefusal
Why an approval chain is not satisfied (A-I23).
CharterDirectory
The approval service’s ApproverDirectory over the site charters in a CharterStore (spec 3.5 §7.6, A-I23): a person’s groups are role:{role} for every role their site’s charter in force gives them, so a release chain, a charter signature or a promotion is decided only by the people the charter names, whichever surface they decide on. An agent holds no role. The directory governs the role: groups only: a caller’s claim to one is ignored, while other groups, such as an operator scope, stay as the caller’s authentication asserted them.
CharterKit
Installs a site’s charter machinery on a kernel (spec 3.5 §7.10, §7.11, §7.19, §7.20): the product binds each SiteProcessKind it runs to its own target with job, and install registers on a KernelBuilder:
CharterStores
The four charter stores of one backend (spec 3.5 §7.6, §7.10, §7.11): the charter field of KernelStores, so a site’s charter, KPIs, autonomy and signals sit beside the kernel’s other stores.
CharterVersion
One committed charter version with the decision that committed it (spec 3.5 §7.11).
CommitDecision
The decision that commits a charter version (spec 3.5 §7.6, §7.11): its id, the approvals of its chain, and the signed note that seals it in the audit log.
GuardrailState
Whether a guardrail is breached, and since when (spec 3.5 §7.11, A-I15): a breach pauses and demotes its jobs once, when it begins, and a later breach after a recovery does so again.
InMemoryAutonomyStore
An AutonomyStore in process memory (spec 3.5 §7.11).
InMemoryCharterStore
A CharterStore in process memory, for tests and a kernel with no durable store (spec 3.5 §7.11). Its versions end with the process.
InMemoryKpiStore
A KpiStore in process memory (spec 3.5 §7.11).
InMemorySignalStore
A SignalStore in process memory (spec 3.5 §7.10).
JobAutonomy
A job’s autonomy now (spec 3.5 §7.11).
JobDecision
One owner decision on one of a job’s proposals (spec 3.5 §7.11).
JobPauses
Paused jobs, enforced on the governed path (spec 3.5 §7.11, A-I15): as a ToolPolicy it denies every tool call of a paused job’s agents until an owner resumes the job.
KpiAggregate
A KPI’s samples over one period (spec 3.5 §7.11). A period without samples has count 0 and no min, max or last, so a series has no gaps.
KpiReview
One KPI’s week for the weekly review (spec 3.5 §7.11, §7.21).
KpiSample
One measurement of a KPI, as the tracker read it from the KPI’s source (spec 3.5 §7.11).
KpiState
What the tracker knows about one KPI between ticks (spec 3.5 §7.11, A-I14): when its measure-only period began, the baseline it locked when the period ended, and when it last read the source.
KpiStatus
One KPI against its baseline and target after a tick (spec 3.5 §7.11).
KpiTracker
The KPI tracker of one site (spec 3.5 §7.11): a kernel maintenance process that, on each tick, reads every KPI of the charter in force whose cadence is due from its KpiSource, records the measurement, compares it with the baseline and target, keeps the measure-only period, and checks the guardrails.
KpiTrackerExecutor
Runs the tracker’s maintenance runs (spec 3.5 §7.11): target KPI_TRACKER_TARGET, input {"site": <uuid>}, output the TrackerReport. KernelBuilder::kpi_tracker registers one over every tracker it is given, beside the tracker’s KpiTracker::trigger; CharterKit calls it.
OwnerDecision
An owner’s decision, the proof a promotion takes (spec 3.5 §7.11, A-I13): its id, the owner who made it, when, and the signed note that seals it.
PostgresAutonomyStore
An AutonomyStore in PostgreSQL (spec 3.5 §7.11, features charter and postgres).
PostgresCharterStore
A CharterStore in PostgreSQL, shared by every replica (spec 3.5 §7.11, features charter and postgres).
PostgresKpiStore
A KpiStore in PostgreSQL (spec 3.5 §7.11, features charter and postgres).
PostgresSignalStore
A SignalStore in PostgreSQL (spec 3.5 §7.10, features charter and postgres).
PromotionEligibility
Whether a job has earned a promotion (spec 3.5 §7.11): streak unchanged approvals in a row within the policy’s window since its last change, of needed.
PromotionPolicy
When a job is offered a promotion (spec 3.5 §7.11): approvals unchanged approvals in a row (20) within within (30 days), with no breach since its last change.
RedisAutonomyStore
An AutonomyStore in Redis (spec 3.5 §7.11, features charter and redis).
RedisCharterStore
A CharterStore in Redis, shared by every replica (spec 3.5 §7.11, features charter and redis). See the module documentation for its keys.
RedisKpiStore
A KpiStore in Redis (spec 3.5 §7.11, features charter and redis).
RedisSignalStore
A SignalStore in Redis (spec 3.5 §7.10, features charter and redis).
RoleApproval
One approval of a decision by a person holding a role (spec 3.5 §7.6, A-I23).
SignalFilter
Which signal records SignalStore::list returns (spec 3.5 §7.10); an empty field matches everything.
SignalKey
What makes two signals repeats of each other (spec 3.5 §7.10): the back-office partition they are filed in, their kind, and a digest of the fields that name their topic.
SignalRateLimit
How many signals one source may send per window (spec 3.5 §7.10): 60 a minute by default; a signal past the limit is refused and not filed.
SignalRecord
One signal as the back office’s agenda holds it (spec 3.5 §7.10): the latest typed signal of its kind and topic, and how many arrived while its item was open.
SignalSink
Files typed signals in a back-office partition’s agenda (spec 3.5 §7.10, A-I3).
SignalSourceTool
The request a back-office agent would make for the raw text behind a signal (spec 3.5 §7.10): a crossing tool into the public partition’s sessions, registered with the back-office PartitionPolicy, which denies it — to any agent but the coordinator, and to the coordinator too, since a public partition crosses nowhere.
SqliteAutonomyStore
An AutonomyStore in SQLite (spec 3.5 §7.11, features charter and sqlite). Call migrate once before use.
SqliteCharterStore
A CharterStore in SQLite (spec 3.5 §7.11, features charter and sqlite), on a pool such as harness.db’s. Call migrate once before use.
SqliteKpiStore
A KpiStore in SQLite (spec 3.5 §7.11, features charter and sqlite). Call migrate once before use.
SqliteSignalStore
A SignalStore in SQLite (spec 3.5 §7.10, features charter and sqlite). Call migrate once before use.
TrackerReport
What one KpiTracker::tick did (spec 3.5 §7.11).

Enums§

AutonomyReason
Why a job’s autonomy changed (spec 3.5 §7.11): the weekly review says it in these words.
CharterEvent
Something the charter machinery did that the owner hears about (spec 3.5 §7.11, §7.21): the weekly review, alarms and the site view read these.
DecisionOutcome
How the owner decided one proposal of a job (spec 3.5 §7.11): what promotion and the two-rejections rule count.
KpiPeriod
The length of an aggregate’s period (spec 3.5 §7.11): a UTC day, or an ISO week from Monday.
KpiPhase
Where a KPI stands (spec 3.5 §7.11, A-I14).
SignalOutcome
What SignalSink::emit did with a signal (spec 3.5 §7.10).
SiteProcessKind
A kind of process a website’s team runs (spec 3.5 §7.11, §7.19, §7.20): the kernel recognises these, and the product does their work.

Constants§

CHARTER_ACTION
The action class of a charter change in a charter’s approval chains (spec 3.5 §7.6): a commit needs every role of the chain with this action, or one owner when the charter names no such chain.
KPI_TRACKER_TARGET
The target of the tracker’s maintenance run (spec 3.5 §7.11): a durable run that a KpiTrackerExecutor executes as one KpiTracker::tick.
SIGNAL_SOURCE_TOOL
The tool a back-office agent would call for the raw text behind a signal (spec 3.5 §7.10): a crossing into the public partition’s sessions, which the partition policy denies (SignalSourceTool).
SITE_PROCESS_LABEL
The label every site process carries, with its kind’s name as the value (spec 3.5 §7.11).
WEBSITE_AUDIT_KIND
The kind of the charter’s website.* audit records, as AuditRecordKind::Other(WEBSITE_AUDIT_KIND.into()) (spec 3.5 §9.3); kernel.signal is a kernel record of kind KERNEL_AUDIT_KIND.

Traits§

AutonomyStore
Every job’s autonomy, its history and the owner’s decisions on its proposals (spec 3.5 §7.11), on in-memory, SQLite, PostgreSQL and Redis.
CharterEventSink
Where CharterEvents go: the product’s alarms and weekly review (spec 3.5 §7.21).
CharterStore
Every committed version of every site’s charter (spec 3.5 §7.11), append-only, on in-memory, SQLite, PostgreSQL and Redis.
JobControl
The hook a guardrail breach pauses a job through (spec 3.5 §7.11, A-I15): the harness stops the job’s next action. JobPauses is an implementation that is also a ToolPolicy.
KpiSource
A source of KPI measurements (spec 3.5 §7.11, §7.12): the edge beacon, host logs, an analytics driver, the commerce or spend ledger, the email driver. The product and the edge implement them; the tracker reads each KPI’s source by its name, the KPI’s SourceRef.
KpiStore
The KPI time series of every site and the tracker’s state (spec 3.5 §7.11), on in-memory, SQLite, PostgreSQL and Redis.
SignalStore
The signal records of every back-office partition and the per-source rate counters (spec 3.5 §7.10), on in-memory, SQLite, PostgreSQL and Redis.

Functions§

aggregate
The aggregates of samples per period (spec 3.5 §7.11), one for every period from the one holding from through the one holding to_inclusive, in order, empty periods included; samples of other KPIs than the first sample’s, and samples outside those periods, are left out.
chain_policy
The approval policy of action’s chain under governance (spec 3.5 §7.6, A-I23): one slot per role of the chain, role:{role}, each filled by a distinct person who holds the role, none of them the requester. A charter that names no chain for action needs one owner, as check_chain does.
check_chain
Checks that approvals satisfy the approval chain governance names for action (spec 3.5 §7.6, A-I23): every role the chain lists has an approval by a person holding that role, each role’s approval by a different person, none by proposer. A role the chain lists twice needs two people. A charter that names no chain for action needs one owner.
commit_audited
Commits draft by decision on store as CharterStore::commit does, and records the outcome on trail (spec 3.5 §9.3): website.approval_chain.satisfied and website.charter.committed for a commit, website.approval_chain.refused for a decision whose chain is not satisfied. The records name the approvers and the decision, never the charter’s text.
group_role
The role a role:{role} group names; None for any other group.
is_agent_principal
Whether id names an agent rather than a person: an urn:adk:agent: URN or a SPIFFE id, the forms of adk_core::principal::AgentId (spec 3.5 §7.6: no agent holds a role).
ladder_rank
The rung of level on the autonomy ladder, 0 for Observe up to 4 for “act within budget” (spec 3.5 §7.11); a promotion moves up, a demotion one rung down.
period_start
The first day of the period holding day (spec 3.5 §7.11): day itself, or the Monday of its ISO week.
role_group
The approver group of role: role:{role}, such as role:publisher.
signal_key
The repeat key of signal filed in partition (spec 3.5 §7.10).
signal_topic
The digest of the fields that name kind’s topic, 32 hex digits (spec 3.5 §7.10): a content gap’s topic, a lead’s reference, a thread, a requester and capability. Text is compared without case or spacing, and no text is kept.