interplane.Get Omega
Read in your language

synapse

A component of the AienOS ecosystem.

Brought by drakestapleton

GitHub aien-dev/synapse#70 (code only)

closed derived 430ba5527eca9923 #70

Imported from GitHub aien-dev/synapse#70 (code only)

GitHub's metadata for this pull request is unavailable: its state is DERIVED from the commits (merged: the head is reachable from this project's main; open: GitHub kept a merge ref; else closed).

Base e089f3b3b3fed9fc06e1d3ec54c32ec314cc7dbc · Head 2952ab75c2bd1421377f8b170f58e3f0ae48d3c5

Fetch it

A git bundle of the pull request's head, 33596 bytes.

curl -fsSL https://interplane.io/drakestapleton/synapse/patches/430ba5527eca9923.bundle -o 430ba5527eca9923.bundle
git fetch 430ba5527eca9923.bundle refs/pull/70/head

Raw bundle · Diff

Provenance

This proposal is imported from GitHub; it is not signed by its author. Its import statement and source record:

github-import 1
aien-dev/synapse
70
2952ab75c2bd1421377f8b170f58e3f0ae48d3c5
{"kind":"github-import","owner":"aien-dev","repo":"synapse","number":70,"url":"https://github.com/aien-dev/synapse/pull/70","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:39:15Z","metadata":"unavailable","state_derived":true}

Changes

diff --git a/crates/synapse-auth/src/chain.rs b/crates/synapse-auth/src/chain.rs
new file mode 100644
index 0000000..920ed8e
--- /dev/null
+++ b/crates/synapse-auth/src/chain.rs
@@ -0,0 +1,1196 @@
+//! Attenuated capability chains (ADR 0003 section 5.8, section 9 step F1).
+//!
+//! The repository authority issues a root link; any holder can sign a narrower link to another
+//! key. Every link signs its parent's digest, the `repo_id`, its audience key, and its caveats
+//! (operations, path prefixes, reference kinds, change scope, partitioned quotas, validity
+//! window) under a domain-separated Ed25519 signature. Granting a link and revoking it are
+//! operations at a `WalSeq`; the server accepts a chain only if every link was granted at or
+//! before the request's `WalSeq`, is unrevoked at it, is unexpired, and narrows its parent.
+//!
+//! Every signed and persisted form here is the fixed-width, little-endian, length-prefixed binary
+//! encoding of `docs/F1_CAPABILITY_CHAINS.md` (ADR 0003 principle P5); there is no serde form.
+
+use crate::{AuditOutcome, BoundaryKind, Capability, PolicyEnforcer};
+use ed25519_dalek::{Signature, Signer, SigningKey, VerifyingKey};
+use sha2::{Digest, Sha256};
+use std::collections::BTreeMap;
+use synapse_core::{
+    encode_did_key_ed25519, validate_repo_relative_path, ChangeId, RefusalCode, RepoId,
+    SynapseError, SynapseResult, WalSeq,
+};
+
+/// Capability link format version.
+pub const CAPABILITY_LINK_VERSION: u16 = 1;
+/// Capability chain format version.
+pub const CAPABILITY_CHAIN_VERSION: u16 = 1;
+/// Domain tag for the Ed25519 signature over a link body.
+pub const DOMAIN_CAPABILITY_LINK_SIGN_V1: &[u8] = b"SYNAPSE_CAPABILITY_LINK_SIGN_V1\0";
+/// Domain tag for a link digest (the identity a child link signs as its parent).
+pub const DOMAIN_CAPABILITY_LINK_ID_V1: &[u8] = b"SYNAPSE_CAPABILITY_LINK_ID_V1\0";
+/// Domain tag for the presenting agent's Ed25519 signature over a chained request.
+pub const DOMAIN_CHAIN_REQUEST_V1: &[u8] = b"SYNAPSE_CHAIN_REQUEST_V1\0";
+/// Domain tag for the digest of a chained request's payload bytes.
+pub const DOMAIN_CHAIN_PAYLOAD_V1: &[u8] = b"SYNAPSE_CHAIN_PAYLOAD_V1\0";
+/// Most links in one chain (root included).
+pub const MAX_CHAIN_DEPTH: usize = 16;
+/// Most path prefixes in one link's path scope.
+pub const MAX_PATH_PREFIXES: usize = 256;
+/// Most `ChangeId`s in one link's change scope.
+pub const MAX_CHANGE_IDS: usize = 1024;
+/// Longest path prefix (the `validate_repo_relative_path` bound).
+pub const MAX_PATH_BYTES: usize = 2048;
+/// Longest repository id (the `RepoId::new` bound).
+pub const MAX_REPO_ID_BYTES: usize = 128;
+/// Parent digest of a root link.
+pub const ROOT_PARENT: LinkDigest = LinkDigest([0u8; 32]);
+
+const KNOWN_OPERATION_BITS: u8 = 0b0011_1111;
+const KNOWN_REFERENCE_BITS: u8 = 0b0000_0011;
+
+fn malformed(msg: impl Into<String>) -> SynapseError {
+    SynapseError::new(RefusalCode::AuthChainMalformed, msg)
+}
+
+/// Domain-separated SHA-256 identity of one encoded capability link.
+#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
+pub struct LinkDigest(pub [u8; 32]);
+
+/// Set of operations a link allows, one bit per `Capability` (bit `tag_byte - 1`).
+#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
+pub struct OperationSet(u8);
+
+impl OperationSet {
+    pub fn from_capabilities(caps: &[Capability]) -> Self {
+        Self(
+            caps.iter()
+                .fold(0u8, |acc, c| acc | (1u8 << (c.tag_byte() - 1))),
+        )
+    }
+
+    pub fn from_bits(bits: u8) -> SynapseResult<Self> {
+        if bits & !KNOWN_OPERATION_BITS != 0 {
+            return Err(malformed(format!("unknown operation bits {bits:#04x}")));
+        }
+        Ok(Self(bits))
+    }
+
+    pub fn bits(self) -> u8 {
+        self.0
+    }
+
+    pub fn contains(self, cap: Capability) -> bool {
+        self.0 & (1u8 << (cap.tag_byte() - 1)) != 0
+    }
+
+    pub fn is_subset_of(self, parent: Self) -> bool {
+        self.0 & !parent.0 == 0
+    }
+}
+
+/// Kind of reference a request touches (ADR 0003 section 5.8: own drafts only; canonical only
+/// through the promotion queue).
+#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
+pub enum ReferenceKind {
+    /// References owned by the holder's chain (drafts, workspaces).
+    OwnDrafts,
+    /// The canonical reference, moved only by the promotion queue (step E2).
+    CanonicalViaPromotionQueue,
+}
+
+impl ReferenceKind {
+    pub fn tag_byte(self) -> u8 {
+        match self {
+            Self::OwnDrafts => 1,
+            Self::CanonicalViaPromotionQueue => 2,
+        }
+    }
+}
+
+/// Set of reference kinds a link allows, one bit per `ReferenceKind` (bit `tag_byte - 1`).
+#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
+pub struct ReferenceScope(u8);
+
+impl ReferenceScope {
+    pub fn from_kinds(kinds: &[ReferenceKind]) -> Self {
+        Self(
+            kinds
+                .iter()
+                .fold(0u8, |acc, k| acc | (1u8 << (k.tag_byte() - 1))),
+        )
+    }
+
+    pub fn from_bits(bits: u8) -> SynapseResult<Self> {
+        if bits & !KNOWN_REFERENCE_BITS != 0 {
+            return Err(malformed(format!("unknown reference bits {bits:#04x}")));
+        }
+        Ok(Self(bits))
+    }
+
+    pub fn bits(self) -> u8 {
+        self.0
+    }
+
+    pub fn contains(self, kind: ReferenceKind) -> bool {
+        self.0 & (1u8 << (kind.tag_byte() - 1)) != 0
+    }
+
+    pub fn is_subset_of(self, parent: Self) -> bool {
+        self.0 & !parent.0 == 0
+    }
+}
+
+/// Path prefixes a link allows, in canonical form: strictly ascending bytes, no prefix covered
+/// by another, and the empty prefix (the whole repository) only on its own. A prefix covers a
+/// path when it is empty, equal to the path, or followed in the path by `/` (segment boundary).
+#[derive(Debug, Clone, PartialEq, Eq, Hash)]
+pub struct PathScope {
+    prefixes: Vec<String>,
+}
+
+fn prefix_covers(prefix: &str, path: &str) -> bool {
+    prefix.is_empty()
+        || path == prefix
+        || (path.len() > prefix.len()
+            && path.starts_with(prefix)
+            && path.as_bytes()[prefix.len()] == b'/')
+}
+
+impl PathScope {
+    /// The whole repository (the single empty prefix).
+    pub fn whole_repository() -> Self {
+        Self {
+            prefixes: vec![String::new()],
+        }
+    }
+
+    /// Build a canonical scope from any prefixes: each must be empty or a valid
+    /// repository-relative path; the result is sorted with covered prefixes removed.
+    pub fn new(prefixes: Vec<String>) -> SynapseResult<Self> {
+        if prefixes.len() > MAX_PATH_PREFIXES {
+            return Err(SynapseError::new(
+                RefusalCode::PathInvalid,
+                format!("path scope has more than {MAX_PATH_PREFIXES} prefixes"),
+            ));
+        }
+        for p in &prefixes {
+            if !p.is_empty() {
+                validate_repo_relative_path(p)?;
+            }
+        }
+        if prefixes.iter().any(String::is_empty) {
+            return Ok(Self::whole_repository());
+        }
+        let mut sorted = prefixes;
+        sorted.sort();
+        sorted.dedup();
+        let mut kept: Vec<String> = Vec::with_capacity(sorted.len());
+        for p in sorted {
+            if !kept.iter().any(|k| prefix_covers(k, &p)) {
+                kept.retain(|k| !prefix_covers(&p, k));
+                kept.push(p);
+            }
+        }
+        kept.sort();
+        Ok(Self { prefixes: kept })
+    }
+
+    pub fn prefixes(&self) -> &[String] {
+        &self.prefixes
+    }
+
+    pub fn covers_path(&self, path: &str) -> bool {
+        self.prefixes.iter().any(|p| prefix_covers(p, path))
+    }
+
+    /// True when every path this scope covers is covered by `parent`.
+    pub fn is_within(&self, parent: &PathScope) -> bool {
+        self.prefixes.iter().all(|c| parent.covers_path(c))
+    }
+
+    fn is_canonical(prefixes: &[String]) -> bool {
+        if prefixes.iter().any(String::is_empty) {
+            return prefixes.len() == 1;
+        }
+        prefixes.windows(2).all(|w| w[0] < w[1])
+            && prefixes.iter().enumerate().all(|(i, p)| {
+                prefixes
+                    .iter()
+                    .enumerate()
+                    .all(|(j, q)| i == j || !prefix_covers(q, p))
+            })
+    }
+}
+
+/// `ChangeId`s a link's holder may join (ADR 0003 sections 5.1 and 5.8): any, or exactly the
+/// listed ones (strictly ascending; an empty list allows none).
+#[derive(Debug, Clone, PartialEq, Eq, Hash)]
+pub struct ChangeScope {
+    only: Option<Vec<ChangeId>>,
+}
+
+impl ChangeScope {
+    pub fn any() -> Self {
+        Self { only: None }
+    }
+
+    pub fn only(mut ids: Vec<ChangeId>) -> SynapseResult<Self> {
+        ids.sort();
+        ids.dedup();
+        if ids.len() > MAX_CHANGE_IDS {
+            return Err(malformed(format!(
+                "change scope has more than {MAX_CHANGE_IDS} ids"
+            )));
+        }
+        Ok(Self { only: Some(ids) })
+    }
+
+    /// `None` for any `ChangeId`, else the allowed ids.
+    pub fn ids(&self) -> Option<&[ChangeId]> {
+        self.only.as_deref()
+    }
+
+    pub fn contains(&self, id: ChangeId) -> bool {
+        match &self.only {
+            None => true,
+            Some(ids) => ids.binary_search(&id).is_ok(),
+        }
+    }
+
+    pub fn is_within(&self, parent: &ChangeScope) -> bool {
+        match (&self.only, &parent.only) {
+            (_, None) => true,
+            (None, Some(_)) => false,
+            (Some(child), Some(_)) => child.iter().all(|id| parent.contains(*id)),
+        }
+    }
+}
+
+/// Quotas of one link. Request rate, storage, and footprint are partitioned: the children of
+/// one link together never exceed it, and the link itself keeps only what it has not handed
+/// down. `window_duration_ms` is inherited unchanged; `max_bytes_per_op` is a per-request cap
+/// that may only narrow (it is not a pool and is not partitioned).
+#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
+pub struct ChainQuotas {
+    pub max_ops_per_window: u32,
+    pub window_duration_ms: u64,
+    pub storage_bytes: u64,
+    /// Footprint breadth: declared prefixes weighted by the tracked paths beneath them (step F2).
+    pub footprint_paths: u64,
+    pub max_bytes_per_op: u64,
+}
+
+/// Caveats of one link: what its holder may do.
+#[derive(Debug, Clone, PartialEq, Eq, Hash)]
+pub struct LinkCaveats {
+    pub operations: OperationSet,
+    pub paths: PathScope,
+    pub references: ReferenceScope,
+    pub changes: ChangeScope,
+    pub quotas: ChainQuotas,
+    pub issued_at_ms: u64,
+    pub expires_at_ms: u64,
+}
+
+impl LinkCaveats {
+    /// The first dimension in which `self` is wider than `parent`, or `None` if it narrows.
+    pub fn escalation_against(&self, parent: &LinkCaveats) -> Option<&'static str> {
+        if !self.operations.is_subset_of(parent.operations) {
+            return Some("operations");
+        }
+        if !self.paths.is_within(&parent.paths) {
+            return Some("paths");
+        }
+        if !self.references.is_subset_of(parent.references) {
+            return Some("references");
+        }
+        if !self.changes.is_within(&parent.changes) {
+            return Some("change scope");
+        }
+        let (c, p) = (&self.quotas, &parent.quotas);
+        if c.window_duration_ms != p.window_duration_ms
+            || c.max_ops_per_window > p.max_ops_per_window
+            || c.storage_bytes > p.storage_bytes
+            || c.footprint_paths > p.footprint_paths
+            || c.max_bytes_per_op > p.max_bytes_per_op
+        {
+            return Some("quotas");
+        }
+        if self.issued_at_ms < parent.issued_at_ms || self.expires_at_ms > parent.expires_at_ms {
+            return Some("expiry");
+        }
+        None
+    }
+}
+
+/// One signed link of a capability chain.
+#[derive(Debug, Clone, PartialEq, Eq)]
+pub struct CapabilityLink {
+    pub version: u16,
+    pub nonce: [u8; 32],
+    pub parent: LinkDigest,
+    pub repo_id: RepoId,
+    pub issuer_key: [u8; 32],
+    pub audience_key: [u8; 32],
+    pub caveats: LinkCaveats,
+    pub signature: [u8; 64],
+}
+
+impl CapabilityLink {
+    /// Sign a link with `signer`. A root link has `parent == ROOT_PARENT` and is signed by a
+    /// repository authority; a derived link names its parent's digest and is signed by the
+    /// parent's audience. Narrowing is checked by the server, not here.
+    pub fn issue(
+        signer: &SigningKey,
+        parent: LinkDigest,
+        nonce: [u8; 32],
+        repo_id: RepoId,
+        audience_key: [u8; 32],
+        caveats: LinkCaveats,
+    ) -> Self {
+        let mut link = Self {
+            version: CAPABILITY_LINK_VERSION,
+            nonce,
+            parent,
+            repo_id,
+            issuer_key: signer.verifying_key().to_bytes(),
+            audience_key,
+            caveats,
+            signature: [0u8; 64],
+        };
+        link.signature = signer.sign(&link.signable_bytes()).to_bytes();
+        link
+    }
+
+    pub fn issuer_did(&self) -> String {
+        encode_did_key_ed25519(&self.issuer_key)
+    }
+
+    pub fn audience_did(&self) -> String {
+        encode_did_key_ed25519(&self.audience_key)
+    }
+
+    fn encode_body(&self, buf: &mut Vec<u8>) {
+        let c = &self.caveats;
+        buf.extend_from_slice(&self.version.to_le_bytes());
+        buf.extend_from_slice(&self.nonce);
+        buf.extend_from_slice(&self.parent.0);
+        put_str(buf, self.repo_id.as_str());
+        buf.extend_from_slice(&self.issuer_key);
+        buf.extend_from_slice(&self.audience_key);
+        buf.push(c.operations.bits());
+        buf.push(c.references.bits());
+        buf.extend_from_slice(&(c.paths.prefixes.len() as u32).to_le_bytes());
+        for p in &c.paths.prefixes {
+            put_str(buf, p);
+        }
+        match &c.changes.only {
+            None => buf.push(0),
+            Some(ids) => {
+                buf.push(1);
+                buf.extend_from_slice(&(ids.len() as u32).to_le_bytes());
+                for id in ids {
+                    buf.extend_from_slice(&id.0);
+                }
+            }
+        }
+        let q = &c.quotas;
+        buf.extend_from_slice(&q.max_ops_per_window.to_le_bytes());
+        buf.extend_from_slice(&q.window_duration_ms.to_le_bytes());
+        buf.extend_from_slice(&q.storage_bytes.to_le_bytes());
+        buf.extend_from_slice(&q.footprint_paths.to_le_bytes());
+        buf.extend_from_slice(&q.max_bytes_per_op.to_le_bytes());
+        buf.extend_from_slice(&c.issued_at_ms.to_le_bytes());
+        buf.extend_from_slice(&c.expires_at_ms.to_le_bytes());
+    }
+
+    /// `DOMAIN_CAPABILITY_LINK_SIGN_V1 || body`: what the issuer signs.
+    pub fn signable_bytes(&self) -> Vec<u8> {
+        let mut buf = Vec::with_capacity(512);
+        buf.extend_from_slice(DOMAIN_CAPABILITY_LINK_SIGN_V1);
+        self.encode_body(&mut buf);
+        buf
+    }
+
+    /// Canonical binary encoding: `body || signature`.
+    pub fn encode(&self) -> Vec<u8> {
+        let mut buf = Vec::with_capacity(512);
+        self.encode_body(&mut buf);
+        buf.extend_from_slice(&self.signature);
+        buf
+    }
+
+    /// `SHA-256(DOMAIN_CAPABILITY_LINK_ID_V1 || encode())`.
+    pub fn digest(&self) -> LinkDigest {
+        let mut h = Sha256::new();
+        h.update(DOMAIN_CAPABILITY_LINK_ID_V1);
+        h.update(self.encode());
+        LinkDigest(h.finalize().into())
+    }
+
+    /// Decode exactly one canonical link; anything else is `AuthChainMalformed`.
+    pub fn decode(bytes: &[u8]) -> SynapseResult<Self> {
+        let mut r = Reader::new(bytes);
+        let link = Self::decode_from(&mut r)?;
+        r.finish()?;
+        Ok(link)
+    }
+
+    fn decode_from(r: &mut Reader<'_>) -> SynapseResult<Self> {
+        let version = r.u16()?;
+        if version != CAPABILITY_LINK_VERSION {
+            return Err(malformed(format!(
+                "unsupported capability link version {version}"
+            )));
+        }
+        let nonce = r.arr32()?;
+        let parent = LinkDigest(r.arr32()?);
+        let repo_raw = r.string(MAX_REPO_ID_BYTES)?;
+        let repo_id = RepoId::new(repo_raw).map_err(|e| malformed(e.message))?;
+        let issuer_key = r.arr32()?;
+        let audience_key = r.arr32()?;
+        let operations = OperationSet::from_bits(r.u8()?)?;
+        let references = ReferenceScope::from_bits(r.u8()?)?;
+        let path_count = r.count(MAX_PATH_PREFIXES, 4)?;
+        let mut prefixes = Vec::with_capacity(path_count);
+        for _ in 0..path_count {
+            let p = r.string(MAX_PATH_BYTES)?;
+            if !p.is_empty() {
+                validate_repo_relative_path(&p).map_err(|e| malformed(e.message))?;
+            }
+            prefixes.push(p);
+        }
+        if !PathScope::is_canonical(&prefixes) {
+            return Err(malformed("path scope is not in canonical form"));
+        }
+        let changes = match r.u8()? {
+            0 => ChangeScope::any(),
+            1 => {
+                let n = r.count(MAX_CHANGE_IDS, 16)?;
+                let mut ids = Vec::with_capacity(n);
+                for _ in 0..n {
+                    let mut id = [0u8; 16];
+                    id.copy_from_slice(r.take(16)?);
+                    ids.push(ChangeId(id));
+                }
+                if !ids.windows(2).all(|w| w[0] < w[1]) {
+                    return Err(malformed("change scope ids are not strictly ascending"));
+                }
+                ChangeScope { only: Some(ids) }
+            }
+            other => return Err(malformed(format!("unknown change scope tag {other}"))),
+        };
+        let quotas = ChainQuotas {
+            max_ops_per_window: r.u32()?,
+            window_duration_ms: r.u64()?,
+            storage_bytes: r.u64()?,
+            footprint_paths: r.u64()?,
+            max_bytes_per_op: r.u64()?,
+        };
+        let issued_at_ms = r.u64()?;
+        let expires_at_ms = r.u64()?;
+        let mut signature = [0u8; 64];
+        signature.copy_from_slice(r.take(64)?);
+        Ok(Self {
+            version,
+            nonce,
+            parent,
+            repo_id,
+            issuer_key,
+            audience_key,
+            caveats: LinkCaveats {
+                operations,
+                paths: PathScope { prefixes },
+                references,
+                changes,
+                quotas,
+                issued_at_ms,
+                expires_at_ms,
+            },
+            signature,
+        })
+    }
+
+    /// Verify the issuer's Ed25519 signature over `signable_bytes()`.
+    pub fn verify_signature(&self) -> SynapseResult<()> {
+        let invalid = |msg: &str| SynapseError::new(RefusalCode::AuthGrantSignatureInvalid, msg);
+        let key = VerifyingKey::from_bytes(&self.issuer_key)
+            .map_err(|_| invalid("link issuer key is not a valid Ed25519 key"))?;
+        key.verify_strict(
+            &self.signable_bytes(),
+            &Signature::from_bytes(&self.signature),
+        )
+        .map_err(|_| invalid("link signature verification failed"))
+    }
+}
+
+/// A capability chain, root first.
+#[derive(Debug, Clone, PartialEq, Eq)]
+pub struct CapabilityChain {
+    pub links: Vec<CapabilityLink>,
+}
+
+impl CapabilityChain {
+    pub fn new(links: Vec<CapabilityLink>) -> Self {
+        Self { links }
+    }
+
+    /// The chain with `link` appended (the parent chain plus a newly issued child).
+    pub fn extended(&self, link: CapabilityLink) -> Self {
+        let mut links = self.links.clone();
+        links.push(link);
+        Self { links }
+    }
+
+    pub fn leaf(&self) -> Option<&CapabilityLink> {
+        self.links.last()
+    }
+
+    pub fn link_digests(&self) -> Vec<LinkDigest> {
+        self.links.iter().map(CapabilityLink::digest).collect()
+    }
+
+    /// `version u16 | count u8 | (len u32 | link)*`.
+    pub fn encode(&self) -> Vec<u8> {
+        let mut buf = Vec::with_capacity(512 * self.links.len() + 3);
+        buf.extend_from_slice(&CAPABILITY_CHAIN_VERSION.to_le_bytes());
+        buf.push(self.links.len() as u8);
+        for link in &self.links {
+            let bytes = link.encode();
+            buf.extend_from_slice(&(bytes.len() as u32).to_le_bytes());
+            buf.extend_from_slice(&bytes);
+        }
+        buf
+    }
+
+    /// Decode exactly one canonical chain of 1..=`MAX_CHAIN_DEPTH` links.
+    pub fn decode(bytes: &[u8]) -> SynapseResult<Self> {
+        let mut r = Reader::new(bytes);
+        let version = r.u16()?;
+        if version != CAPABILITY_CHAIN_VERSION {
+            return Err(malformed(format!(
+                "unsupported capability chain version {version}"
+            )));
+        }
+        let count = r.u8()? as usize;
+        if count == 0 || count > MAX_CHAIN_DEPTH {
+            return Err(malformed(format!(
+                "chain length {count} outside 1..={MAX_CHAIN_DEPTH}"
+            )));
+        }
+        let mut links = Vec::with_capacity(count);
+        for _ in 0..count {
+            let len = r.u32()? as usize;
+            let mut inner = Reader::new(r.take(len)?);
+            links.push(CapabilityLink::decode_from(&mut inner)?);
+            inner.finish()?;
+        }
+        r.finish()?;
+        Ok(Self { links })
+    }
+}
+
+/// What a chained request touches, checked against the leaf link's scopes.
+#[derive(Debug, Clone, PartialEq, Eq, Default)]
+pub struct RequestScope {
+    /// Repository-relative paths the request reads or writes.
+    pub paths: Vec<String>,
+    /// Reference kind the request reads or moves, if any.
+    pub reference: Option<ReferenceKind>,
+    /// `ChangeId` the request joins through change scope, if any (when change scope is needed
+    /// is decided by step B1).
+    pub join_change: Option<ChangeId>,
+}
+
+impl RequestScope {
+    fn encode_into(&self, buf: &mut Vec<u8>) {
+        buf.extend_from_slice(&(self.paths.len() as u32).to_le_bytes());
+        for p in &self.paths {
+            put_str(buf, p);
+        }
+        buf.push(self.reference.map_or(0, ReferenceKind::tag_byte));
+        match self.join_change {
+            None => buf.push(0),
+            Some(id) => {
+                buf.push(1);
+                buf.extend_from_slice(&id.0);
+            }
+        }
+    }
+}
+
+/// A request presented with a capability chain and signed by the leaf link's audience.
+#[derive(Debug, Clone, PartialEq, Eq)]
+pub struct ChainedRequest {
+    pub chain: CapabilityChain,
+    pub target_repo_id: RepoId,
+    pub agent_key: [u8; 32],
+    pub required_capability: Capability,
+    pub scope: RequestScope,
+    pub request_nonce: [u8; 32],
+    pub timestamp_ms: u64,
+    pub payload: Vec<u8>,
+    pub agent_signature: [u8; 64],
+}
+
+impl ChainedRequest {
+    #[allow(clippy::too_many_arguments)]
+    pub fn sign_new(
+        agent_key: &SigningKey,
+        chain: CapabilityChain,
+        target_repo_id: RepoId,
+        required_capability: Capability,
+        scope: RequestScope,
+        request_nonce: [u8; 32],
+        timestamp_ms: u64,
+        payload: Vec<u8>,
+    ) -> Self {
+        let mut req = Self {
+            chain,
+            target_repo_id,
+            agent_key: agent_key.verifying_key().to_bytes(),
+            required_capability,
+            scope,
+            request_nonce,
+            timestamp_ms,
+            payload,
+            agent_signature: [0u8; 64],
+        };
+        req.agent_signature = agent_key.sign(&req.canonical_signable_bytes()).to_bytes();
+        req
+    }
+
+    pub fn agent_did(&self) -> String {
+        encode_did_key_ed25519(&self.agent_key)
+    }
+
+    /// `SHA-256(DOMAIN_CHAIN_PAYLOAD_V1 || payload)`.
+    pub fn payload_sha256(&self) -> [u8; 32] {
+        let mut h = Sha256::new();
+        h.update(DOMAIN_CHAIN_PAYLOAD_V1);
+        h.update(&self.payload);
+        h.finalize().into()
+    }
+
+    /// `DOMAIN_CHAIN_REQUEST_V1 || leaf digest || repo || agent key || capability || scope ||
+    /// nonce || timestamp || payload length || payload digest`.
+    pub fn canonical_signable_bytes(&self) -> Vec<u8> {
+        let mut buf = Vec::with_capacity(256);
+        buf.extend_from_slice(DOMAIN_CHAIN_REQUEST_V1);
+        let leaf = self
+            .chain
+            .leaf()
+            .map_or(ROOT_PARENT, CapabilityLink::digest);
+        buf.extend_from_slice(&leaf.0);
+        put_str(&mut buf, self.target_repo_id.as_str());
+        buf.extend_from_slice(&self.agent_key);
+        buf.push(self.required_capability.tag_byte());
+        self.scope.encode_into(&mut buf);
+        buf.extend_from_slice(&self.request_nonce);
+        buf.extend_from_slice(&self.timestamp_ms.to_le_bytes());
+        buf.extend_from_slice(&(self.payload.len() as u64).to_le_bytes());
+        buf.extend_from_slice(&self.payload_sha256());
+        buf
+    }
+}
+
+#[derive(Debug, Clone)]
+struct GrantedLink {
+    granted_at: WalSeq,
+    revoked_at: Option<WalSeq>,
+    quotas: ChainQuotas,
+}
+
+/// Sums of the partitioned quotas handed down to a link's granted children.
+#[derive(Debug, Clone, Copy, Default)]
+struct Allocated {
+    ops: u64,
+    storage: u64,
+    footprint: u64,
+}
+
+/// Server-side record of granted and revoked links, quota partitions, and per-link rate windows.
+#[derive(Debug, Default)]
+pub(crate) struct ChainRegistry {
+    granted: BTreeMap<LinkDigest, GrantedLink>,
+    allocated: BTreeMap<LinkDigest, Allocated>,
+    rate_windows: BTreeMap<LinkDigest, Vec<u64>>,
+}
+
+impl PolicyEnforcer {
+    /// Stateless checks plus trusted root: linkage, repository, signatures, audience, narrowing,
+    /// and validity window of every link. Returns the link digests, root first.
+    fn verify_chain_links(
+        &self,
+        chain: &CapabilityChain,
+        expected_repo_id: &RepoId,
+        now_ms: u64,
+    ) -> SynapseResult<Vec<LinkDigest>> {
+        let n = chain.links.len();
+        if n == 0 || n > MAX_CHAIN_DEPTH {
+            return Err(SynapseError::new(
+                RefusalCode::AuthChainBroken,
+                format!("chain length {n} outside 1..={MAX_CHAIN_DEPTH}"),
+            ));
+        }
+        let mut digests: Vec<LinkDigest> = Vec::with_capacity(n);
+        for (i, link) in chain.links.iter().enumerate() {
+            if link.version != CAPABILITY_LINK_VERSION {
+                return Err(malformed(format!(
+                    "link {i}: unsupported version {}",
+                    link.version
+                )));
+            }
+            if &link.repo_id != expected_repo_id {
+                return Err(SynapseError::new(
+                    RefusalCode::AuthCrossRepoDenied,
+                    format!(
+                        "link {i} is bound to repository {} not {expected_repo_id}",
+                        link.repo_id
+                    ),
+                ));
+            }
+            link.verify_signature()
+                .map_err(|e| SynapseError::new(e.code, format!("link {i}: {}", e.message)))?;
+            if i == 0 {
+                if link.parent != ROOT_PARENT {
+                    return Err(SynapseError::new(
+                        RefusalCode::AuthChainBroken,
+                        "first link is not a root link",
+                    ));
+                }
+                let trusted = self
+                    .trusted_authorities
+                    .get(expected_repo_id)
+                    .is_some_and(|set| set.contains(&link.issuer_did()));
+                if !trusted {
+                    return Err(SynapseError::new(
+                        RefusalCode::AuthGrantSignatureInvalid,
+                        format!(
+                            "root issuer {} is not a trusted authority for {expected_repo_id}",
+                            link.issuer_did()
+                        ),
+                    ));
+                }
+            } else {
+                let parent = &chain.links[i - 1];
+                if link.parent != digests[i - 1] {
+                    return Err(SynapseError::new(
+                        RefusalCode::AuthChainBroken,
+                        format!("link {i} does not name link {} as its parent", i - 1),
+                    ));
+                }
+                if link.issuer_key != parent.audience_key {
+                    return Err(SynapseError::new(
+                        RefusalCode::AuthAudienceMismatch,
+                        format!(
+                            "link {i} issuer {} is not the audience {} of its parent",
+                            link.issuer_did(),
+                            parent.audience_did()
+                        ),
+                    ));
+                }
+                if let Some(dim) = link.caveats.escalation_against(&parent.caveats) {
+                    return Err(SynapseError::new(
+                        RefusalCode::AuthScopeEscalation,
+                        format!("link {i} is wider than its parent in {dim}"),
+                    ));
+                }
+            }
+            if now_ms < link.caveats.issued_at_ms || now_ms > link.caveats.expires_at_ms {
+                return Err(SynapseError::new(
+                    RefusalCode::AuthGrantExpired,
+                    format!(
+                        "link {i} expired or not yet valid (now={now_ms}, window={}..={})",
+                        link.caveats.issued_at_ms, link.caveats.expires_at_ms
+                    ),
+                ));
+            }
+            digests.push(link.digest());
+        }
+        Ok(digests)
+    }
+
+    /// Every listed link must be granted at or before `seq` and not revoked at `seq`.
+    fn check_granted_at(&self, digests: &[LinkDigest], seq: WalSeq) -> SynapseResult<()> {
+        for (i, d) in digests.iter().enumerate() {
+            let Some(rec) = self.chains.granted.get(d) else {
+                return Err(SynapseError::new(
+                    RefusalCode::AuthChainBroken,
+                    format!("link {i} was never granted"),
+                ));
+            };
+            if rec.revoked_at.is_some_and(|r| r <= seq) {
+                return Err(SynapseError::new(
+                    RefusalCode::AuthGrantRevoked,
+                    format!("link {i} is revoked at {seq}"),
+                ));
+            }
+            if rec.granted_at > seq {
+                return Err(SynapseError::new(
+                    RefusalCode::AuthChainBroken,
+                    format!(
+                        "link {i} is granted only at {}, after {seq}",
+                        rec.granted_at
+                    ),
+                ));
+            }
+        }
+        Ok(())
+    }
+
+    /// Grant the leaf link of `chain` at `seq` (granting is an operation in the log). Every
+    /// earlier link must already be granted and unrevoked at `seq`; the leaf must narrow its
+    /// parent and fit in what the parent has not yet handed to other children. Granting a link
+    /// that is already granted returns its digest without charging its quotas again.
+    pub fn grant_link(
+        &mut self,
+        chain: &CapabilityChain,
+        seq: WalSeq,
+        now_ms: u64,
+    ) -> SynapseResult<LinkDigest> {
+        let leaf = chain.leaf().ok_or_else(|| {
+            SynapseError::new(RefusalCode::AuthChainBroken, "empty capability chain")
+        })?;
+        let repo_id = leaf.repo_id.clone();
+        let digests = self.verify_chain_links(chain, &repo_id, now_ms)?;
+        let (leaf_digest, ancestors) = digests.split_last().expect("non-empty chain");
+        self.check_granted_at(ancestors, seq)?;
+        if let Some(rec) = self.chains.granted.get(leaf_digest) {
+            if rec.revoked_at.is_some() {
+                return Err(SynapseError::new(
+                    RefusalCode::AuthGrantRevoked,
+                    "link is revoked; a revoked link cannot be granted again",
+                ));
+            }
+            return Ok(*leaf_digest);
+        }
+        let quotas = leaf.caveats.quotas;
+        if let Some(parent_digest) = ancestors.last() {
+            let parent_quotas = self.chains.granted[parent_digest].quotas;
+            let used = self
+                .chains
+                .allocated
+                .get(parent_digest)
+                .copied()
+                .unwrap_or_default();
+            let next_ops = used.ops.checked_add(u64::from(quotas.max_ops_per_window));
+            let next_storage = used.storage.checked_add(quotas.storage_bytes);
+            let next_footprint = used.footprint.checked_add(quotas.footprint_paths);
+            let over = if next_ops.is_none_or(|v| v > u64::from(parent_quotas.max_ops_per_window)) {
+                Some("request rate")
+            } else if next_storage.is_none_or(|v| v > parent_quotas.storage_bytes) {
+                Some("storage")
+            } else if next_footprint.is_none_or(|v| v > parent_quotas.footprint_paths) {
+                Some("footprint")
+            } else {
+                None
+            };
+            if let Some(dim) = over {
+                return Err(SynapseError::new(
+                    RefusalCode::QuotaPartitionExceeded,
+                    format!("children of the parent link would together exceed its {dim} quota"),
+                ));
+            }
+            self.chains.allocated.insert(
+                *parent_digest,
+                Allocated {
+                    ops: next_ops.expect("checked above"),
+                    storage: next_storage.expect("checked above"),
+                    footprint: next_footprint.expect("checked above"),
+                },
+            );
+        }
+        self.chains.granted.insert(
+            *leaf_digest,
+            GrantedLink {
+                granted_at: seq,
+                revoked_at: None,
+                quotas,
+            },
+        );
+        Ok(*leaf_digest)
+    }
+
+    /// Revoke a granted link at `seq`. Revocation cannot be undone: a later revocation never
+    /// moves an earlier one, and there is no operation that clears it. Every chain through the
+    /// link is refused for requests at `seq` or later.
+    pub fn revoke_link(&mut self, link: LinkDigest, seq: WalSeq) -> SynapseResult<()> {
+        let rec = self.chains.granted.get_mut(&link).ok_or_else(|| {
+            SynapseError::new(
+                RefusalCode::AuthChainBroken,
+                "cannot revoke a link never granted",
+            )
+        })?;
+        rec.revoked_at = Some(rec.revoked_at.map_or(seq, |r| r.min(seq)));
+        Ok(())
+    }
+
+    /// The part of a granted link's partitioned quotas (rate, storage, footprint) not handed
+    /// down to its children; `None` if the link was never granted.
+    pub fn unallocated_quota(&self, link: &LinkDigest) -> Option<ChainQuotas> {
+        let rec = self.chains.granted.get(link)?;
+        let used = self.chains.allocated.get(link).copied().unwrap_or_default();
+        let mut q = rec.quotas;
+        q.max_ops_per_window = q
+            .max_ops_per_window
+            .saturating_sub(u32::try_from(used.ops).unwrap_or(u32::MAX));
+        q.storage_bytes = q.storage_bytes.saturating_sub(used.storage);
+        q.footprint_paths = q.footprint_paths.saturating_sub(used.footprint);
+        Some(q)
+    }
+
+    /// Verify and authorize a `ChainedRequest` whose `WalSeq` is `request_seq`, recording
+    /// `Admitted` or `Refused` in the hash-chained audit log.
+    #[allow(clippy::too_many_arguments)]
+    pub fn authorize_chain(
+        &mut self,
+        boundary: BoundaryKind,
+        operation: &str,
+        expected_repo_id: &RepoId,
+        expected_capability: Capability,
+        req: &ChainedRequest,
+        request_seq: WalSeq,
+        now_ms: u64,
+    ) -> SynapseResult<()> {
+        let result = self.check_chained_request(
+            expected_repo_id,
+            expected_capability,
+            req,
+            request_seq,
+            now_ms,
+        );
+        let outcome = match &result {
+            Ok(()) => AuditOutcome::Admitted,
+            Err(err) => AuditOutcome::Refused {
+                code: err.code,
+                reason: err.message.clone(),
+            },
+        };
+        self.audit_log.record(
+            now_ms,
+            boundary,
+            expected_repo_id.clone(),
+            req.agent_did(),
+            expected_capability,
+            operation,
+            outcome,
+        );
+        result
+    }
+
+    fn check_chained_request(
+        &mut self,
+        expected_repo_id: &RepoId,
+        expected_capability: Capability,
+        req: &ChainedRequest,
+        request_seq: WalSeq,
+        now_ms: u64,
+    ) -> SynapseResult<()> {
+        if &req.target_repo_id != expected_repo_id {
+            return Err(SynapseError::new(
+                RefusalCode::AuthCrossRepoDenied,
+                format!(
+                    "request targets {} not {expected_repo_id}",
+                    req.target_repo_id
+                ),
+            ));
+        }
+        let digests = self.verify_chain_links(&req.chain, expected_repo_id, now_ms)?;
+        self.check_granted_at(&digests, request_seq)?;
+        let leaf = req.chain.leaf().expect("verified non-empty chain");
+        let leaf_digest = *digests.last().expect("verified non-empty chain");
+
+        if req.agent_key != leaf.audience_key {
+            return Err(SynapseError::new(
+                RefusalCode::AuthAudienceMismatch,
+                format!(
+                    "request presented by {} but the leaf link's audience is {}",
+                    req.agent_did(),
+                    leaf.audience_did()
+                ),
+            ));
+        }
+        let agent_key = VerifyingKey::from_bytes(&req.agent_key).map_err(|_| {
+            SynapseError::new(RefusalCode::DidKeyInvalid, "invalid agent Ed25519 key")
+        })?;
+        agent_key
+            .verify_strict(
+                &req.canonical_signable_bytes(),
+                &Signature::from_bytes(&req.agent_signature),
+            )
+            .map_err(|_| {
+                SynapseError::new(
+                    RefusalCode::AuthSignatureInvalid,
+                    "agent Ed25519 chained request signature verification failed",
+                )
+            })?;
+
+        let caveats = &leaf.caveats;
+        if req.required_capability != expected_capability
+            || !caveats.operations.contains(expected_capability)
+        {
+            return Err(SynapseError::new(
+                RefusalCode::AuthCapabilityDenied,
+                format!(
+                    "chain of {} lacks required capability {expected_capability:?}",
+                    req.agent_did()
+                ),
+            ));
+        }
+        for path in &req.scope.paths {
+            validate_repo_relative_path(path)?;
+            if !caveats.paths.covers_path(path) {
+                return Err(SynapseError::new(
+                    RefusalCode::AuthPathOutOfScope,
+                    format!("path {path} is outside the chain's path scope"),
+                ));
+            }
+        }
+        if let Some(kind) = req.scope.reference {
+            if !caveats.references.contains(kind) {
+                return Err(SynapseError::new(
+                    RefusalCode::AuthReferenceOutOfScope,
+                    format!("reference kind {kind:?} is outside the chain's reference scope"),
+                ));
+            }
+        }
+        if let Some(id) = req.scope.join_change {
+            if !caveats.changes.contains(id) {
+                return Err(SynapseError::new(
+                    RefusalCode::AuthChangeOutOfScope,
+                    format!("{id:?} is outside the chain's change scope"),
+                ));
+            }
+        }
+        let payload_len = req.payload.len() as u64;
+        if payload_len > caveats.quotas.max_bytes_per_op {
+            return Err(SynapseError::new(
+                RefusalCode::QuotaPayloadTooLarge,
+                format!(
+                    "request payload size {payload_len} exceeds the chain's max_bytes_per_op {}",
+                    caveats.quotas.max_bytes_per_op
+                ),
+            ));
+        }
+
+        // Partitioned rate: the leaf may use only the part it has not handed to children.
+        let own = self
+            .unallocated_quota(&leaf_digest)
+            .expect("granted leaf has a quota record");
+        let window_start = now_ms.saturating_sub(own.window_duration_ms);
+        let timestamps = self.chains.rate_windows.entry(leaf_digest).or_default();
+        timestamps.retain(|&ts| ts >= window_start);
+        if timestamps.len() as u64 >= u64::from(own.max_ops_per_window) {
+            return Err(SynapseError::new(
+                RefusalCode::QuotaRateLimitExceeded,
+                format!(
+                    "link exceeded its unallocated rate ({} ops per {} ms)",
+                    own.max_ops_per_window, own.window_duration_ms
+                ),
+            ));
+        }
+
+        if expected_capability.is_mutating() {
+            let nonce_key = (expected_repo_id.clone(), req.agent_did(), req.request_nonce);
+            if !self.consumed_nonces.insert(nonce_key) {
+                return Err(SynapseError::new(
+                    RefusalCode::AuthReplayDetected,
+                    "replayed mutation request_nonce refused",
+                ));
+            }
+        }
+        self.chains
+            .rate_windows
+            .entry(leaf_digest)
+            .or_default()
+            .push(now_ms);
+        Ok(())
+    }
+}
+
+fn put_str(buf: &mut Vec<u8>, s: &str) {
+    buf.extend_from_slice(&(s.len() as u32).to_le_bytes());
+    buf.extend_from_slice(s.as_bytes());
+}
+
+/// Bounds-checked little-endian reader; every failure is `AuthChainMalformed`.
+struct Reader<'a> {
+    buf: &'a [u8],
+    pos: usize,
+}
+
+impl<'a> Reader<'a> {
+    fn new(buf: &'a [u8]) -> Self {
+        Self { buf, pos: 0 }
+    }
+
+    fn take(&mut self, n: usize) -> SynapseResult<&'a [u8]> {
+        let remaining = self.buf.len() - self.pos;
+        if n > remaining {
+            return Err(malformed(format!(
+                "truncated: need {n} bytes at offset {}, {remaining} remain",
+                self.pos
+            )));
+        }
+        let out = &self.buf[self.pos..self.pos + n];
+        self.pos += n;
+        Ok(out)
+    }
+
+    fn u8(&mut self) -> SynapseResult<u8> {
+        Ok(self.take(1)?[0])
+    }
+
+    fn u16(&mut self) -> SynapseResult<u16> {
+        Ok(u16::from_le_bytes(
+            self.take(2)?.try_into().expect("2 bytes"),
+        ))
+    }
+
+    fn u32(&mut self) -> SynapseResult<u32> {
+        Ok(u32::from_le_bytes(
+            self.take(4)?.try_into().expect("4 bytes"),
+        ))
+    }
+
+    fn u64(&mut self) -> SynapseResult<u64> {
+        Ok(u64::from_le_bytes(
+            self.take(8)?.try_into().expect("8 bytes"),
+        ))
+    }
+
+    fn arr32(&mut self) -> SynapseResult<[u8; 32]> {
+        Ok(self.take(32)?.try_into().expect("32 bytes"))
+    }
+
+    /// A `u32` count, refused above `cap` or above what `min_item_bytes` per item could fit.
+    fn count(&mut self, cap: usize, min_item_bytes: usize) -> SynapseResult<usize> {
+        let n = self.u32()? as usize;
+        let remaining = self.buf.len() - self.pos;
+        if n > cap || n.saturating_mul(min_item_bytes) > remaining {
+            return Err(malformed(format!(
+                "count {n} above cap {cap} or the {remaining} bytes that remain"
+            )));
+        }
+        Ok(n)
+    }
+
+    fn string(&mut self, cap: usize) -> SynapseResult<String> {
+        let len = self.u32()? as usize;
+        if len > cap {
+            return Err(malformed(format!("string length {len} above cap {cap}")));
+        }
+        let bytes = self.take(len)?;
+        String::from_utf8(bytes.to_vec()).map_err(|_| malformed("string is not UTF-8"))
+    }
+
+    fn finish(&self) -> SynapseResult<()> {
+        if self.pos != self.buf.len() {
+            return Err(malformed(format!(
+                "{} trailing bytes",
+                self.buf.len() - self.pos
+            )));
+        }
+        Ok(())
+    }
+}
diff --git a/crates/synapse-auth/src/lib.rs b/crates/synapse-auth/src/lib.rs
index c198e86..8fc4cbc 100644
--- a/crates/synapse-auth/src/lib.rs
+++ b/crates/synapse-auth/src/lib.rs
@@ -10,6 +10,9 @@ use synapse_core::{
     SynapseResult,
 };
 
+mod chain;
+pub use chain::*;
+
 /// Current capability grant schema version.
 pub const CAPABILITY_GRANT_VERSION: u16 = 1;
 
@@ -35,6 +38,9 @@ pub enum Capability {
     Review,
     /// Project changesets to Git/GitHub or request canonical promotion (`project_git`, `promote_canonical`).
     Publish,
+    /// Restore an earlier operation view (ADR 0003 section 5.4); undoing another actor's
+    /// operations also needs a delegation chain that dominates that actor's (step B2).
+    Undo,
 }
 
 impl Capability {
@@ -45,6 +51,7 @@ impl Capability {
             Self::Evaluate => 3,
             Self::Review => 4,
             Self::Publish => 5,
+            Self::Undo => 6,
         }
     }
 
@@ -378,6 +385,7 @@ pub struct PolicyEnforcer {
     consumed_nonces: BTreeSet<(RepoId, String, [u8; 32])>,
     rate_windows: BTreeMap<(RepoId, String), Vec<u64>>,
     audit_log: AuditLog,
+    chains: ChainRegistry,
 }
 
 impl Default for PolicyEnforcer {
@@ -393,6 +401,7 @@ impl PolicyEnforcer {
             consumed_nonces: BTreeSet::new(),
             rate_windows: BTreeMap::new(),
             audit_log: AuditLog::new(),
+            chains: ChainRegistry::default(),
         }
     }
 
diff --git a/crates/synapse-auth/tests/f1_capability_chains.rs b/crates/synapse-auth/tests/f1_capability_chains.rs
new file mode 100644
index 0000000..9e0ecbb
--- /dev/null
+++ b/crates/synapse-auth/tests/f1_capability_chains.rs
@@ -0,0 +1,1277 @@
+//! ADR 0003 section 9 step F1: attenuated capability chains with path, reference, and change
+//! scope, `Undo`, and partitioned rate, storage, and footprint quotas.
+//!
+//! Acceptance (each item names the test that proves it):
+//! * no derived grant exceeds its parent in operations, paths, references, change scope, quotas,
+//!   or expiry: `f1_property_no_derived_grant_exceeds_its_parent`
+//! * child quotas never sum above the parent's: `f1_property_child_quotas_never_sum_above_the_parent`
+//! * forged chains refused: `f1_forged_chains_are_refused`
+//! * stripped chains refused: `f1_stripped_chains_are_refused`
+//! * reordered chains refused: `f1_reordered_chains_are_refused`
+//! * a link bound to another repository refused: `f1_link_bound_to_another_repository_is_refused`
+//! * a link bound to another audience refused: `f1_link_bound_to_another_audience_is_refused`
+//! * out-of-scope path refused: `f1_out_of_scope_path_is_refused`
+//! * a chain with an ancestor revoked at the request's `WalSeq` refused:
+//!   `f1_chain_with_an_ancestor_revoked_at_the_request_walseq_is_refused`
+//!
+//! The property tests use a seeded SplitMix64 generator (no new dependency); the seed and case
+//! count are constants below and every failure message prints the seed, case, and caveats.
+
+use ed25519_dalek::SigningKey;
+use synapse_auth::{
+    AuditOutcome, BoundaryKind, Capability, CapabilityChain, CapabilityLink, ChainQuotas,
+    ChainedRequest, ChangeScope, LinkCaveats, LinkDigest, OperationSet, PathScope, PolicyEnforcer,
+    ReferenceKind, ReferenceScope, RequestScope, MAX_CHAIN_DEPTH, ROOT_PARENT,
+};
+use synapse_core::{encode_did_key_ed25519, ChangeId, RefusalCode, RepoId, WalSeq};
+
+const PROPERTY_SEED: u64 = 0xF1F1_0003_0025_5EED;
+const NARROWING_CASES: u64 = 256;
+const PARTITION_CASES: u64 = 256;
+
+const ALL_CAPS: [Capability; 6] = [
+    Capability::Read,
+    Capability::Propose,
+    Capability::Evaluate,
+    Capability::Review,
+    Capability::Publish,
+    Capability::Undo,
+];
+const ALL_OPS_BITS: u8 = 0b0011_1111;
+const ALL_REF_BITS: u8 = 0b0000_0011;
+
+struct SplitMix64(u64);
+
+impl SplitMix64 {
+    fn new(seed: u64) -> Self {
+        Self(seed)
+    }
+    fn next(&mut self) -> u64 {
+        self.0 = self.0.wrapping_add(0x9E37_79B9_7F4A_7C15);
+        let mut z = self.0;
+        z = (z ^ (z >> 30)).wrapping_mul(0xBF58_476D_1CE4_E5B9);
+        z = (z ^ (z >> 27)).wrapping_mul(0x94D0_49BB_1331_11EB);
+        z ^ (z >> 31)
+    }
+    /// Uniform in `0..=max`.
+    fn upto(&mut self, max: u64) -> u64 {
+        if max == u64::MAX {
+            self.next()
+        } else {
+            self.next() % (max + 1)
+        }
+    }
+    fn below(&mut self, n: u64) -> u64 {
+        self.next() % n
+    }
+    fn chance(&mut self, num: u64, den: u64) -> bool {
+        self.below(den) < num
+    }
+    fn bytes32(&mut self) -> [u8; 32] {
+        let mut out = [0u8; 32];
+        for chunk in out.chunks_mut(8) {
+            chunk.copy_from_slice(&self.next().to_le_bytes());
+        }
+        out
+    }
+    fn key(&mut self) -> SigningKey {
+        SigningKey::from_bytes(&self.bytes32())
+    }
+}
+
+fn repo() -> RepoId {
+    RepoId::new("aien-spark/synapse").unwrap()
+}
+
+fn pubkey(k: &SigningKey) -> [u8; 32] {
+    k.verifying_key().to_bytes()
+}
+
+fn change_id(n: u8) -> ChangeId {
+    ChangeId([n; 16])
+}
+
+fn wide_caveats() -> LinkCaveats {
+    LinkCaveats {
+        operations: OperationSet::from_capabilities(&ALL_CAPS),
+        paths: PathScope::whole_repository(),
+        references: ReferenceScope::from_kinds(&[
+            ReferenceKind::OwnDrafts,
+            ReferenceKind::CanonicalViaPromotionQueue,
+        ]),
+        changes: ChangeScope::any(),
+        quotas: ChainQuotas {
+            max_ops_per_window: 1_000,
+            window_duration_ms: 60_000,
+            storage_bytes: 1 << 30,
+            footprint_paths: 1 << 20,
+            max_bytes_per_op: 1 << 20,
+        },
+        issued_at_ms: 1_000,
+        expires_at_ms: 100_000,
+    }
+}
+
+const NOW: u64 = 2_000;
+
+/// Authority A issues root to orchestrator O; O delegates `mid` to worker W; W delegates `leaf`
+/// to sub-worker S. Granted at `WalSeq` 1, 2, 3.
+struct Fx {
+    enforcer: PolicyEnforcer,
+    authority: SigningKey,
+    o: SigningKey,
+    w: SigningKey,
+    s: SigningKey,
+    root: CapabilityLink,
+    mid: CapabilityLink,
+    leaf: CapabilityLink,
+}
+
+impl Fx {
+    fn new() -> Self {
+        let authority = SigningKey::from_bytes(&[1u8; 32]);
+        let o = SigningKey::from_bytes(&[2u8; 32]);
+        let w = SigningKey::from_bytes(&[3u8; 32]);
+        let s = SigningKey::from_bytes(&[4u8; 32]);
+        let mut enforcer = PolicyEnforcer::new();
+        enforcer.register_repo_authority(repo(), encode_did_key_ed25519(&pubkey(&authority)));
+
+        let root = CapabilityLink::issue(
+            &authority,
+            ROOT_PARENT,
+            [0xA0; 32],
+            repo(),
+            pubkey(&o),
+            wide_caveats(),
+        );
+        let mut mid_cav = wide_caveats();
+        mid_cav.paths = PathScope::new(vec!["crates/synapse-auth".into(), "docs".into()]).unwrap();
+        mid_cav.quotas.max_ops_per_window = 500;
+        mid_cav.quotas.storage_bytes = 1 << 29;
+        mid_cav.quotas.footprint_paths = 1 << 19;
+        let mid = CapabilityLink::issue(&o, root.digest(), [0xA1; 32], repo(), pubkey(&w), mid_cav);
+        let mut leaf_cav = mid.caveats.clone();
+        leaf_cav.operations =
+            OperationSet::from_capabilities(&[Capability::Read, Capability::Propose]);
+        leaf_cav.paths = PathScope::new(vec!["crates/synapse-auth".into()]).unwrap();
+        leaf_cav.references = ReferenceScope::from_kinds(&[ReferenceKind::OwnDrafts]);
+        leaf_cav.changes = ChangeScope::only(vec![change_id(1)]).unwrap();
+        leaf_cav.quotas.max_ops_per_window = 250;
+        leaf_cav.quotas.storage_bytes = 1 << 28;
+        leaf_cav.quotas.footprint_paths = 1 << 18;
+        let leaf =
+            CapabilityLink::issue(&w, mid.digest(), [0xA2; 32], repo(), pubkey(&s), leaf_cav);
+
+        let mut fx = Self {
+            enforcer,
+            authority,
+            o,
+            w,
+            s,
+            root,
+            mid,
+            leaf,
+        };
+        let c1 = fx.chain(&[&fx.root.clone()]);
+        let c2 = fx.chain(&[&fx.root.clone(), &fx.mid.clone()]);
+        let c3 = fx.full_chain();
+        fx.enforcer.grant_link(&c1, WalSeq(1), NOW).unwrap();
+        fx.enforcer.grant_link(&c2, WalSeq(2), NOW).unwrap();
+        fx.enforcer.grant_link(&c3, WalSeq(3), NOW).unwrap();
+        fx
+    }
+
+    fn chain(&self, links: &[&CapabilityLink]) -> CapabilityChain {
+        CapabilityChain::new(links.iter().map(|l| (*l).clone()).collect())
+    }
+
+    fn full_chain(&self) -> CapabilityChain {
+        self.chain(&[&self.root, &self.mid, &self.leaf])
+    }
+
+    fn request(
+        &self,
+        signer: &SigningKey,
+        chain: CapabilityChain,
+        cap: Capability,
+        scope: RequestScope,
+        nonce: u8,
+    ) -> ChainedRequest {
+        ChainedRequest::sign_new(
+            signer,
+            chain,
+            repo(),
+            cap,
+            scope,
+            [nonce; 32],
+            NOW,
+            b"payload".to_vec(),
+        )
+    }
+
+    fn authorize(&mut self, req: &ChainedRequest, seq: u64) -> Result<(), RefusalCode> {
+        self.enforcer
+            .authorize_chain(
+                BoundaryKind::Api,
+                "submit",
+                &repo(),
+                req.required_capability,
+                req,
+                WalSeq(seq),
+                NOW,
+            )
+            .map_err(|e| e.code)
+    }
+}
+
+fn paths(p: &[&str]) -> RequestScope {
+    RequestScope {
+        paths: p.iter().map(|s| s.to_string()).collect(),
+        ..RequestScope::default()
+    }
+}
+
+fn in_scope() -> RequestScope {
+    paths(&["crates/synapse-auth/src/lib.rs"])
+}
+
+// ---------------------------------------------------------------------------------------------
+// Property: no derived grant exceeds its parent.
+// ---------------------------------------------------------------------------------------------
+
+/// Independent model of prefix coverage at segment boundaries (not the crate's code).
+fn oracle_covers(prefixes: &[String], path: &str) -> bool {
+    prefixes.iter().any(|p| {
+        if p.is_empty() {
+            return true;
+        }
+        if path.is_empty() {
+            return false;
+        }
+        let ps: Vec<&str> = p.split('/').collect();
+        let xs: Vec<&str> = path.split('/').collect();
+        xs.len() >= ps.len() && xs[..ps.len()] == ps[..]
+    })
+}
+
+/// The first dimension in which `child` exceeds `parent` under the independent model.
+fn oracle_exceeds(child: &LinkCaveats, parent: &LinkCaveats) -> Option<&'static str> {
+    if child.operations.bits() & !parent.operations.bits() != 0 {
+        return Some("operations");
+    }
+    let parent_prefixes = parent.paths.prefixes();
+    for c in child.paths.prefixes() {
+        let probes = [c.clone(), format!("{c}/probe"), format!("{c}/probe/deeper")];
+        for probe in probes.iter() {
+            let probe = probe.trim_start_matches('/');
+            if oracle_covers(child.paths.prefixes(), probe)
+                && !oracle_covers(parent_prefixes, probe)
+            {
+                return Some("paths");
+            }
+        }
+    }
+    if child.references.bits() & !parent.references.bits() != 0 {
+        return Some("references");
+    }
+    match (child.changes.ids(), parent.changes.ids()) {
+        (_, None) => {}
+        (None, Some(_)) => return Some("change scope"),
+        (Some(c), Some(p)) => {
+            if c.iter().any(|id| !p.contains(id)) {
+                return Some("change scope");
+            }
+        }
+    }
+    let (c, p) = (&child.quotas, &parent.quotas);
+    if c.window_duration_ms != p.window_duration_ms
+        || c.max_ops_per_window > p.max_ops_per_window
+        || c.storage_bytes > p.storage_bytes
+        || c.footprint_paths > p.footprint_paths
+        || c.max_bytes_per_op > p.max_bytes_per_op
+    {
+        return Some("quotas");
+    }
+    if child.issued_at_ms < parent.issued_at_ms || child.expires_at_ms > parent.expires_at_ms {
+        return Some("expiry");
+    }
+    None
+}
+
+const SEGMENTS: [&str; 8] = ["src", "docs", "crates", "tests", "a", "b", "ab", "a-b"];
+
+fn random_prefix(rng: &mut SplitMix64) -> String {
+    let depth = 1 + rng.below(2) as usize;
+    (0..depth)
+        .map(|_| SEGMENTS[rng.below(SEGMENTS.len() as u64) as usize])
+        .collect::<Vec<_>>()
+        .join("/")
+}
+
+fn random_change_ids(rng: &mut SplitMix64, pool: u8, max: u64) -> Vec<ChangeId> {
+    (0..rng.upto(max))
+        .map(|_| change_id(1 + rng.below(pool as u64) as u8))
+        .collect()
+}
+
+fn random_root_caveats(rng: &mut SplitMix64) -> LinkCaveats {
+    let paths = if rng.chance(1, 10) {
+        PathScope::whole_repository()
+    } else {
+        PathScope::new((0..1 + rng.below(3)).map(|_| random_prefix(rng)).collect()).unwrap()
+    };
+    let changes = if rng.chance(1, 5) {
+        ChangeScope::any()
+    } else {
+        ChangeScope::only(random_change_ids(rng, 8, 4)).unwrap()
+    };
+    let issued = 1_000 + rng.below(500);
+    LinkCaveats {
+        operations: OperationSet::from_bits(rng.upto(ALL_OPS_BITS as u64) as u8).unwrap(),
+        paths,
+        references: ReferenceScope::from_bits(rng.upto(ALL_REF_BITS as u64) as u8).unwrap(),
+        changes,
+        quotas: ChainQuotas {
+            max_ops_per_window: 1 + rng.below(1_000) as u32,
+            window_duration_ms: if rng.chance(1, 2) { 1_000 } else { 60_000 },
+            storage_bytes: 1 + rng.below(1 << 30),
+            footprint_paths: 1 + rng.below(1 << 20),
+            max_bytes_per_op: 1 + rng.below(1 << 20),
+        },
+        issued_at_ms: issued,
+        expires_at_ms: NOW + 1 + rng.below(1_000_000),
+    }
+}
+
+/// A child that narrows `parent` in every dimension; partitioned quotas take at most a quarter
+/// so up to three siblings always fit.
+fn narrowed(rng: &mut SplitMix64, parent: &LinkCaveats) -> LinkCaveats {
+    let paths = if parent.paths.prefixes().iter().any(String::is_empty) {
+        if rng.chance(1, 4) {
+            PathScope::whole_repository()
+        } else {
+            PathScope::new((0..1 + rng.below(2)).map(|_| random_prefix(rng)).collect()).unwrap()
+        }
+    } else {
+        let mut picked = Vec::new();
+        for p in parent.paths.prefixes() {
+            match rng.below(3) {
+                0 => {}
+                1 => picked.push(p.clone()),
+                _ => picked.push(format!("{p}/{}", random_prefix(rng))),
+            }
+        }
+        PathScope::new(picked).unwrap()
+    };
+    let changes = match parent.changes.ids() {
+        None if rng.chance(1, 2) => ChangeScope::any(),
+        None => ChangeScope::only(random_change_ids(rng, 8, 3)).unwrap(),
+        Some(ids) => {
+            ChangeScope::only(ids.iter().copied().filter(|_| rng.chance(1, 2)).collect()).unwrap()
+        }
+    };
+    let q = &parent.quotas;
+    LinkCaveats {
+        operations: OperationSet::from_bits(parent.operations.bits() & rng.next() as u8).unwrap(),
+        paths,
+        references: ReferenceScope::from_bits(parent.references.bits() & rng.next() as u8).unwrap(),
+        changes,
+        quotas: ChainQuotas {
+            max_ops_per_window: rng.upto(u64::from(q.max_ops_per_window / 4)) as u32,
+            window_duration_ms: q.window_duration_ms,
+            storage_bytes: rng.upto(q.storage_bytes / 4),
+            footprint_paths: rng.upto(q.footprint_paths / 4),
+            max_bytes_per_op: rng.upto(q.max_bytes_per_op),
+        },
+        issued_at_ms: parent.issued_at_ms + rng.upto(NOW - parent.issued_at_ms),
+        expires_at_ms: NOW + rng.upto(parent.expires_at_ms - NOW),
+    }
+}
+
+const DIMENSIONS: [&str; 6] = [
+    "operations",
+    "paths",
+    "references",
+    "change scope",
+    "quotas",
+    "expiry",
+];
+
+/// A child that is `narrowed` except wider than `parent` in dimension `dim`; `None` when the
+/// parent is already maximal in that dimension.
+fn widened(rng: &mut SplitMix64, parent: &LinkCaveats, dim: usize) -> Option<LinkCaveats> {
+    let mut c = narrowed(rng, parent);
+    match DIMENSIONS[dim] {
+        "operations" => {
+            let missing = ALL_OPS_BITS & !parent.operations.bits();
+            if missing == 0 {
+                return None;
+            }
+            let bit = 1u8 << missing.trailing_zeros();
+            c.operations = OperationSet::from_bits(c.operations.bits() | bit).unwrap();
+        }
+        "paths" => {
+            if parent.paths.prefixes().iter().any(String::is_empty) {
+                return None;
+            }
+            c.paths = if rng.chance(1, 3) {
+                PathScope::whole_repository()
+            } else {
+                let mut p = c.paths.prefixes().to_vec();
+                p.push(format!("zz{}", rng.below(1_000)));
+                PathScope::new(p).unwrap()
+            };
+        }
+        "references" => {
+            let missing = ALL_REF_BITS & !parent.references.bits();
+            if missing == 0 {
+                return None;
+            }
+            let bit = 1u8 << missing.trailing_zeros();
+            c.references = ReferenceScope::from_bits(c.references.bits() | bit).unwrap();
+        }
+        "change scope" => {
+            let ids = parent.changes.ids()?;
+            c.changes = if rng.chance(1, 3) {
+                ChangeScope::any()
+            } else {
+                let mut v = c.changes.ids().unwrap_or(&[]).to_vec();
+                v.push(change_id(100 + rng.below(100) as u8));
+                debug_assert!(!ids.contains(v.last().unwrap()));
+                ChangeScope::only(v).unwrap()
+            };
+        }
+        "quotas" => {
+            let q = &parent.quotas;
+            match rng.below(5) {
+                0 => c.quotas.max_ops_per_window = q.max_ops_per_window.checked_add(1)?,
+                1 => c.quotas.storage_bytes = q.storage_bytes.checked_add(1)?,
+                2 => c.quotas.footprint_paths = q.footprint_paths.checked_add(1)?,
+                3 => c.quotas.max_bytes_per_op = q.max_bytes_per_op.checked_add(1)?,
+                _ => c.quotas.window_duration_ms = q.window_duration_ms + 1,
+            }
+        }
+        "expiry" => {
+            if rng.chance(1, 2) {
+                c.expires_at_ms = parent.expires_at_ms + 1 + rng.below(1_000);
+            } else {
+                c.issued_at_ms = parent.issued_at_ms - 1;
+            }
+        }
+        _ => unreachable!(),
+    }
+    Some(c)
+}
+
+struct Node {
+    chain: CapabilityChain,
+    holder: SigningKey,
+}
+
+#[test]
+fn f1_property_no_derived_grant_exceeds_its_parent() {
+    let mut accepted_narrowed = 0u64;
+    let mut refused_by_dim = [0u64; 6];
+    for case in 0..NARROWING_CASES {
+        let mut rng = SplitMix64::new(PROPERTY_SEED ^ case.wrapping_mul(0x2545_F491_4F6C_DD1D));
+        let authority = rng.key();
+        let mut enforcer = PolicyEnforcer::new();
+        enforcer.register_repo_authority(repo(), encode_did_key_ed25519(&pubkey(&authority)));
+        let root_holder = rng.key();
+        let root = CapabilityLink::issue(
+            &authority,
+            ROOT_PARENT,
+            rng.bytes32(),
+            repo(),
+            pubkey(&root_holder),
+            random_root_caveats(&mut rng),
+        );
+        let root_chain = CapabilityChain::new(vec![root]);
+        let mut seq = 1u64;
+        enforcer
+            .grant_link(&root_chain, WalSeq(seq), NOW)
+            .unwrap_or_else(|e| panic!("seed {PROPERTY_SEED:#x} case {case}: root refused {e}"));
+        let mut frontier = vec![Node {
+            chain: root_chain,
+            holder: root_holder,
+        }];
+        while let Some(node) = frontier.pop() {
+            if node.chain.links.len() >= 4 {
+                continue;
+            }
+            let parent = node.chain.leaf().unwrap().clone();
+            for _ in 0..1 + rng.below(3) {
+                let audience = rng.key();
+                let wide_dim = if rng.chance(1, 2) {
+                    None
+                } else {
+                    Some(rng.below(6) as usize)
+                };
+                let caveats = match wide_dim {
+                    None => narrowed(&mut rng, &parent.caveats),
+                    Some(d) => match widened(&mut rng, &parent.caveats, d) {
+                        Some(c) => c,
+                        None => continue,
+                    },
+                };
+                let child = CapabilityLink::issue(
+                    &node.holder,
+                    parent.digest(),
+                    rng.bytes32(),
+                    repo(),
+                    pubkey(&audience),
+                    caveats.clone(),
+                );
+                let chain = node.chain.extended(child);
+                seq += 1;
+                let granted = enforcer
+                    .grant_link(&chain, WalSeq(seq), NOW)
+                    .map_err(|e| e.code);
+
+                // The property: every link the server accepts lies inside its parent and inside
+                // every ancestor, under the independent model.
+                if granted.is_ok() {
+                    for (i, ancestor) in chain.links[..chain.links.len() - 1].iter().enumerate() {
+                        if let Some(dim) = oracle_exceeds(&caveats, &ancestor.caveats) {
+                            panic!(
+                                "seed {PROPERTY_SEED:#x} case {case}: accepted link exceeds \
+                                 ancestor {i} in {dim}\n child {caveats:#?}\n ancestor {:#?}",
+                                ancestor.caveats
+                            );
+                        }
+                    }
+                }
+                match wide_dim {
+                    None => {
+                        assert_eq!(
+                            granted.map(|_| ()),
+                            Ok(()),
+                            "seed {PROPERTY_SEED:#x} case {case}: narrowed link refused\n \
+                             child {caveats:#?}\n parent {:#?}",
+                            parent.caveats
+                        );
+                        accepted_narrowed += 1;
+                        frontier.push(Node {
+                            chain,
+                            holder: audience,
+                        });
+                    }
+                    Some(d) => {
+                        assert_eq!(
+                            granted.map(|_| ()),
+                            Err(RefusalCode::AuthScopeEscalation),
+                            "seed {PROPERTY_SEED:#x} case {case}: link wider in {} not refused",
+                            DIMENSIONS[d]
+                        );
+                        // The same widened chain presented on a request is refused too.
+                        let req = ChainedRequest::sign_new(
+                            &audience,
+                            chain,
+                            repo(),
+                            Capability::Read,
+                            RequestScope::default(),
+                            rng.bytes32(),
+                            NOW,
+                            Vec::new(),
+                        );
+                        let got = enforcer
+                            .authorize_chain(
+                                BoundaryKind::Api,
+                                "read",
+                                &repo(),
+                                Capability::Read,
+                                &req,
+                                WalSeq(seq),
+                                NOW,
+                            )
+                            .map_err(|e| e.code);
+                        assert_eq!(
+                            got,
+                            Err(RefusalCode::AuthScopeEscalation),
+                            "seed {PROPERTY_SEED:#x} case {case}: request through a link wider \
+                             in {} not refused",
+                            DIMENSIONS[d]
+                        );
+                        refused_by_dim[d] += 1;
+                    }
+                }
+            }
+        }
+    }
+    println!(
+        "seed {PROPERTY_SEED:#x}, {NARROWING_CASES} cases: {accepted_narrowed} narrowed links \
+         accepted; widened links refused per dimension {DIMENSIONS:?} = {refused_by_dim:?}"
+    );
+    assert!(accepted_narrowed > 0, "no narrowed link was generated");
+    for (d, n) in refused_by_dim.iter().enumerate() {
+        assert!(*n > 0, "no widened link generated in {}", DIMENSIONS[d]);
+    }
+}
+
+// ---------------------------------------------------------------------------------------------
+// Property: child quotas never sum above the parent's.
+// ---------------------------------------------------------------------------------------------
+
+#[derive(Clone, Copy, Default, Debug, PartialEq)]
+struct Sum {
+    ops: u64,
+    storage: u64,
+    footprint: u64,
+}
+
+#[test]
+fn f1_property_child_quotas_never_sum_above_the_parent() {
+    let (mut accepted, mut refused) = (0u64, 0u64);
+    for case in 0..PARTITION_CASES {
+        let mut rng = SplitMix64::new(PROPERTY_SEED ^ 0xC0FF_EE00 ^ case.wrapping_mul(0x9E37));
+        let authority = rng.key();
+        let mut enforcer = PolicyEnforcer::new();
+        enforcer.register_repo_authority(repo(), encode_did_key_ed25519(&pubkey(&authority)));
+        let mut root_cav = wide_caveats();
+        root_cav.quotas = ChainQuotas {
+            max_ops_per_window: rng.upto(200) as u32,
+            window_duration_ms: 60_000,
+            storage_bytes: rng.upto(10_000),
+            footprint_paths: rng.upto(1_000),
+            max_bytes_per_op: 1 << 20,
+        };
+        let holder = rng.key();
+        let root = CapabilityLink::issue(
+            &authority,
+            ROOT_PARENT,
+            rng.bytes32(),
+            repo(),
+            pubkey(&holder),
+            root_cav,
+        );
+        let mut nodes = vec![(CapabilityChain::new(vec![root]), holder)];
+        let mut seq = 1u64;
+        enforcer.grant_link(&nodes[0].0, WalSeq(seq), NOW).unwrap();
+        let mut children_sum = vec![Sum::default()];
+        for _ in 0..16 {
+            let pi = rng.below(nodes.len() as u64) as usize;
+            if nodes[pi].0.links.len() >= MAX_CHAIN_DEPTH {
+                continue;
+            }
+            let parent = nodes[pi].0.leaf().unwrap().clone();
+            let pq = parent.caveats.quotas;
+            let mut cav = parent.caveats.clone();
+            cav.quotas.max_ops_per_window = rng.upto(u64::from(pq.max_ops_per_window)) as u32;
+            cav.quotas.storage_bytes = rng.upto(pq.storage_bytes);
+            cav.quotas.footprint_paths = rng.upto(pq.footprint_paths);
+            let audience = rng.key();
+            let child = CapabilityLink::issue(
+                &nodes[pi].1,
+                parent.digest(),
+                rng.bytes32(),
+                repo(),
+                pubkey(&audience),
+                cav.clone(),
+            );
+            let chain = nodes[pi].0.extended(child);
+            let s = children_sum[pi];
+            let next = Sum {
+                ops: s.ops + u64::from(cav.quotas.max_ops_per_window),
+                storage: s.storage + cav.quotas.storage_bytes,
+                footprint: s.footprint + cav.quotas.footprint_paths,
+            };
+            let fits = next.ops <= u64::from(pq.max_ops_per_window)
+                && next.storage <= pq.storage_bytes
+                && next.footprint <= pq.footprint_paths;
+            seq += 1;
+            let got = enforcer
+                .grant_link(&chain, WalSeq(seq), NOW)
+                .map_err(|e| e.code);
+            match got {
+                Ok(_) => {
+                    // The property: what the server accepted keeps the children's sum within
+                    // the parent's rate, storage, and footprint quotas.
+                    assert!(
+                        fits,
+                        "seed {PROPERTY_SEED:#x} case {case}: accepted child makes children sum \
+                         {next:?} above parent quotas {pq:?}"
+                    );
+                    children_sum[pi] = next;
+                    children_sum.push(Sum::default());
+                    nodes.push((chain, audience));
+                    accepted += 1;
+                }
+                Err(code) => {
+                    assert!(
+                        !fits,
+                        "seed {PROPERTY_SEED:#x} case {case}: child that fits refused with \
+                         {code:?} (sum {next:?}, parent {pq:?})"
+                    );
+                    assert_eq!(
+                        code,
+                        RefusalCode::QuotaPartitionExceeded,
+                        "seed {PROPERTY_SEED:#x} case {case}"
+                    );
+                    refused += 1;
+                }
+            }
+        }
+        // What each granted link keeps for itself is its quota minus what it handed down.
+        for (i, (chain, _)) in nodes.iter().enumerate() {
+            let leaf = chain.leaf().unwrap();
+            let q = leaf.caveats.quotas;
+            let own = enforcer.unallocated_quota(&leaf.digest());
+            let expect = ChainQuotas {
+                max_ops_per_window: q.max_ops_per_window - children_sum[i].ops as u32,
+                storage_bytes: q.storage_bytes - children_sum[i].storage,
+                footprint_paths: q.footprint_paths - children_sum[i].footprint,
+                ..q
+            };
+            assert_eq!(
+                own,
+                Some(expect),
+                "seed {PROPERTY_SEED:#x} case {case} node {i}"
+            );
+        }
+    }
+    println!(
+        "seed {PROPERTY_SEED:#x}, {PARTITION_CASES} cases: {accepted} children accepted, \
+         {refused} refused with QuotaPartitionExceeded"
+    );
+    assert!(accepted > 0 && refused > 0);
+}
+
+#[test]
+fn f1_partitioned_rate_parent_keeps_only_what_it_has_not_handed_down() {
+    let mut fx = Fx::new();
+    // mid (500 ops) handed 250 to leaf; a second child asking 251 does not fit.
+    let mut cav = fx.mid.caveats.clone();
+    cav.quotas.max_ops_per_window = 251;
+    cav.quotas.storage_bytes = 0;
+    cav.quotas.footprint_paths = 0;
+    let extra = CapabilityLink::issue(&fx.w, fx.mid.digest(), [0xB0; 32], repo(), [9u8; 32], cav);
+    let chain = fx.chain(&[&fx.root, &fx.mid, &extra]);
+    assert_eq!(
+        fx.enforcer
+            .grant_link(&chain, WalSeq(4), NOW)
+            .map_err(|e| e.code),
+        Err(RefusalCode::QuotaPartitionExceeded)
+    );
+    let own = fx.enforcer.unallocated_quota(&fx.mid.digest()).unwrap();
+    assert_eq!(own.max_ops_per_window, 250);
+
+    // A link whose rate is fully handed down cannot make requests itself.
+    let mut cav = fx.leaf.caveats.clone();
+    cav.quotas.max_ops_per_window = 1;
+    cav.quotas.storage_bytes = 0;
+    cav.quotas.footprint_paths = 0;
+    let sub_key = SigningKey::from_bytes(&[5u8; 32]);
+    let sub = CapabilityLink::issue(
+        &fx.s,
+        fx.leaf.digest(),
+        [0xB1; 32],
+        repo(),
+        pubkey(&sub_key),
+        cav,
+    );
+    // Shrink the leaf's own allowance to zero by handing all 250 to children.
+    let mut big = fx.leaf.caveats.clone();
+    big.quotas.max_ops_per_window = 249;
+    big.quotas.storage_bytes = 0;
+    big.quotas.footprint_paths = 0;
+    let other = CapabilityLink::issue(&fx.s, fx.leaf.digest(), [0xB2; 32], repo(), [8u8; 32], big);
+    let full = fx.full_chain();
+    fx.enforcer
+        .grant_link(&full.extended(sub.clone()), WalSeq(5), NOW)
+        .unwrap();
+    fx.enforcer
+        .grant_link(&full.extended(other), WalSeq(6), NOW)
+        .unwrap();
+    assert_eq!(
+        fx.enforcer
+            .unallocated_quota(&fx.leaf.digest())
+            .unwrap()
+            .max_ops_per_window,
+        0
+    );
+    let req = fx.request(&fx.s.clone(), full.clone(), Capability::Read, in_scope(), 1);
+    assert_eq!(
+        fx.authorize(&req, 7),
+        Err(RefusalCode::QuotaRateLimitExceeded)
+    );
+
+    // The child with one op gets exactly one request in the window.
+    let sub_chain = full.extended(sub);
+    let r1 = fx.request(&sub_key, sub_chain.clone(), Capability::Read, in_scope(), 2);
+    assert_eq!(fx.authorize(&r1, 8), Ok(()));
+    let r2 = fx.request(&sub_key, sub_chain, Capability::Read, in_scope(), 3);
+    assert_eq!(
+        fx.authorize(&r2, 9),
+        Err(RefusalCode::QuotaRateLimitExceeded)
+    );
+}
+
+// ---------------------------------------------------------------------------------------------
+// Forged, stripped, and reordered chains; links bound to another repository or audience.
+// ---------------------------------------------------------------------------------------------
+
+#[test]
+fn f1_forged_chains_are_refused() {
+    let mut fx = Fx::new();
+    // Positive control: the genuine chain is admitted and audited.
+    let ok = fx.request(
+        &fx.s.clone(),
+        fx.full_chain(),
+        Capability::Propose,
+        in_scope(),
+        1,
+    );
+    assert_eq!(fx.authorize(&ok, 4), Ok(()));
+    let last = fx.enforcer.audit_log().entries().last().cloned();
+    assert_eq!(last.map(|e| e.outcome), Some(AuditOutcome::Admitted));
+
+    // A link whose caveats were widened after signing.
+    let mut mid_forged = fx.mid.clone();
+    mid_forged.caveats.paths = PathScope::whole_repository();
+    let chain = fx.chain(&[&fx.root, &mid_forged, &fx.leaf]);
+    let req = fx.request(
+        &fx.s.clone(),
+        chain.clone(),
+        Capability::Propose,
+        in_scope(),
+        2,
+    );
+    assert_eq!(
+        fx.authorize(&req, 4),
+        Err(RefusalCode::AuthGrantSignatureInvalid)
+    );
+    assert_eq!(
+        fx.enforcer
+            .grant_link(&fx.chain(&[&fx.root, &mid_forged]), WalSeq(4), NOW)
+            .map_err(|e| e.code),
+        Err(RefusalCode::AuthGrantSignatureInvalid)
+    );
+
+    // A link with signature bytes that were never produced by its issuer.
+    let mut leaf_forged = fx.leaf.clone();
+    leaf_forged.signature = [0x5A; 64];
+    let chain = fx.chain(&[&fx.root, &fx.mid, &leaf_forged]);
+    let req = fx.request(&fx.s.clone(), chain, Capability::Propose, in_scope(), 3);
+    assert_eq!(
+        fx.authorize(&req, 4),
+        Err(RefusalCode::AuthGrantSignatureInvalid)
+    );
+
+    // A leaf whose audience was swapped to the attacker, presented by the attacker.
+    let attacker = SigningKey::from_bytes(&[66u8; 32]);
+    let mut leaf_stolen = fx.leaf.clone();
+    leaf_stolen.audience_key = pubkey(&attacker);
+    let chain = fx.chain(&[&fx.root, &fx.mid, &leaf_stolen]);
+    let req = fx.request(&attacker, chain, Capability::Propose, in_scope(), 4);
+    assert_eq!(
+        fx.authorize(&req, 4),
+        Err(RefusalCode::AuthGrantSignatureInvalid)
+    );
+
+    // A root the attacker signed for itself (not a trusted repository authority).
+    let fake_root = CapabilityLink::issue(
+        &attacker,
+        ROOT_PARENT,
+        [0xEE; 32],
+        repo(),
+        pubkey(&attacker),
+        wide_caveats(),
+    );
+    let chain = CapabilityChain::new(vec![fake_root]);
+    let req = fx.request(&attacker, chain.clone(), Capability::Propose, in_scope(), 5);
+    assert_eq!(
+        fx.authorize(&req, 4),
+        Err(RefusalCode::AuthGrantSignatureInvalid)
+    );
+    assert_eq!(
+        fx.enforcer
+            .grant_link(&chain, WalSeq(4), NOW)
+            .map_err(|e| e.code),
+        Err(RefusalCode::AuthGrantSignatureInvalid)
+    );
+}
+
+#[test]
+fn f1_stripped_chains_are_refused() {
+    let mut fx = Fx::new();
+    let ok = fx.request(
+        &fx.s.clone(),
+        fx.full_chain(),
+        Capability::Read,
+        in_scope(),
+        1,
+    );
+    assert_eq!(fx.authorize(&ok, 4), Ok(()));
+    let cases: Vec<(&str, CapabilityChain)> = vec![
+        ("middle link dropped", fx.chain(&[&fx.root, &fx.leaf])),
+        ("root dropped", fx.chain(&[&fx.mid, &fx.leaf])),
+        ("only the leaf", fx.chain(&[&fx.leaf])),
+        ("empty chain", CapabilityChain::new(Vec::new())),
+    ];
+    for (i, (what, chain)) in cases.into_iter().enumerate() {
+        let req = fx.request(
+            &fx.s.clone(),
+            chain,
+            Capability::Read,
+            in_scope(),
+            10 + i as u8,
+        );
+        assert_eq!(
+            fx.authorize(&req, 4),
+            Err(RefusalCode::AuthChainBroken),
+            "{what}"
+        );
+    }
+}
+
+#[test]
+fn f1_reordered_chains_are_refused() {
+    let mut fx = Fx::new();
+    let links = [fx.root.clone(), fx.mid.clone(), fx.leaf.clone()];
+    let orders = [[0, 2, 1], [1, 0, 2], [1, 2, 0], [2, 0, 1], [2, 1, 0]];
+    let ok = fx.request(
+        &fx.s.clone(),
+        fx.full_chain(),
+        Capability::Read,
+        in_scope(),
+        1,
+    );
+    assert_eq!(fx.authorize(&ok, 4), Ok(()));
+    for (i, order) in orders.iter().enumerate() {
+        let chain = CapabilityChain::new(order.iter().map(|&j| links[j].clone()).collect());
+        let req = fx.request(
+            &fx.s.clone(),
+            chain,
+            Capability::Read,
+            in_scope(),
+            10 + i as u8,
+        );
+        assert_eq!(
+            fx.authorize(&req, 4),
+            Err(RefusalCode::AuthChainBroken),
+            "order {order:?}"
+        );
+    }
+}
+
+#[test]
+fn f1_link_bound_to_another_repository_is_refused() {
+    let mut fx = Fx::new();
+    let other = RepoId::new("aien-spark/aien-sovereign-core").unwrap();
+    fx.enforcer.register_repo_authority(
+        other.clone(),
+        encode_did_key_ed25519(&pubkey(&fx.authority)),
+    );
+
+    // A properly signed leaf bound to another repository, spliced under this repository's chain.
+    let leaf_other = CapabilityLink::issue(
+        &fx.w,
+        fx.mid.digest(),
+        [0xC0; 32],
+        other.clone(),
+        pubkey(&fx.s),
+        fx.leaf.caveats.clone(),
+    );
+    let chain = fx.chain(&[&fx.root, &fx.mid, &leaf_other]);
+    assert_eq!(
+        fx.enforcer
+            .grant_link(&chain, WalSeq(4), NOW)
+            .map_err(|e| e.code),
+        Err(RefusalCode::AuthCrossRepoDenied)
+    );
+    let req = fx.request(&fx.s.clone(), chain, Capability::Read, in_scope(), 1);
+    assert_eq!(fx.authorize(&req, 4), Err(RefusalCode::AuthCrossRepoDenied));
+
+    // This repository's whole chain presented to another repository.
+    let req = ChainedRequest::sign_new(
+        &fx.s,
+        fx.full_chain(),
+        other.clone(),
+        Capability::Read,
+        in_scope(),
+        [2u8; 32],
+        NOW,
+        Vec::new(),
+    );
+    let got = fx
+        .enforcer
+        .authorize_chain(
+            BoundaryKind::Api,
+            "read",
+            &other,
+            Capability::Read,
+            &req,
+            WalSeq(4),
+            NOW,
+        )
+        .map_err(|e| e.code);
+    assert_eq!(got, Err(RefusalCode::AuthCrossRepoDenied));
+}
+
+#[test]
+fn f1_link_bound_to_another_audience_is_refused() {
+    let mut fx = Fx::new();
+    let x = SigningKey::from_bytes(&[77u8; 32]);
+
+    // The chain names S as its audience; X presents it with X's own valid signature.
+    let req = fx.request(&x, fx.full_chain(), Capability::Read, in_scope(), 1);
+    assert_eq!(
+        fx.authorize(&req, 4),
+        Err(RefusalCode::AuthAudienceMismatch)
+    );
+
+    // X signs a child under mid, but mid is bound to audience W, so X cannot extend it.
+    let rogue = CapabilityLink::issue(
+        &x,
+        fx.mid.digest(),
+        [0xD0; 32],
+        repo(),
+        pubkey(&x),
+        fx.leaf.caveats.clone(),
+    );
+    let chain = fx.chain(&[&fx.root, &fx.mid, &rogue]);
+    assert_eq!(
+        fx.enforcer
+            .grant_link(&chain, WalSeq(4), NOW)
+            .map_err(|e| e.code),
+        Err(RefusalCode::AuthAudienceMismatch)
+    );
+    let req = fx.request(&x, chain, Capability::Read, in_scope(), 2);
+    assert_eq!(
+        fx.authorize(&req, 4),
+        Err(RefusalCode::AuthAudienceMismatch)
+    );
+
+    // A request that claims S as presenter but was signed by X.
+    let mut req = fx.request(&x, fx.full_chain(), Capability::Read, in_scope(), 3);
+    req.agent_key = pubkey(&fx.s);
+    assert_eq!(
+        fx.authorize(&req, 4),
+        Err(RefusalCode::AuthSignatureInvalid)
+    );
+
+    // An ancestor's holder (W) cannot present the leaf bound to S.
+    let req = fx.request(
+        &fx.w.clone(),
+        fx.full_chain(),
+        Capability::Read,
+        in_scope(),
+        4,
+    );
+    assert_eq!(
+        fx.authorize(&req, 4),
+        Err(RefusalCode::AuthAudienceMismatch)
+    );
+
+    let ok = fx.request(
+        &fx.s.clone(),
+        fx.full_chain(),
+        Capability::Read,
+        in_scope(),
+        5,
+    );
+    assert_eq!(fx.authorize(&ok, 4), Ok(()));
+}
+
+// ---------------------------------------------------------------------------------------------
+// Scope at request time and revocation at the request's WalSeq.
+// ---------------------------------------------------------------------------------------------
+
+#[test]
+fn f1_out_of_scope_path_is_refused() {
+    let mut fx = Fx::new();
+    let s = fx.s.clone();
+    let chain = fx.full_chain();
+    let mut nonce = 0u8;
+    let mut run = |fx: &mut Fx, scope: RequestScope| {
+        nonce += 1;
+        let req = fx.request(&s, chain.clone(), Capability::Propose, scope, nonce);
+        fx.authorize(&req, 4)
+    };
+    assert_eq!(run(&mut fx, in_scope()), Ok(()));
+    assert_eq!(
+        run(&mut fx, paths(&["crates/synapse-core/src/lib.rs"])),
+        Err(RefusalCode::AuthPathOutOfScope)
+    );
+    // Prefixes match whole segments: `crates/synapse-auth` does not cover `crates/synapse-authz`.
+    assert_eq!(
+        run(&mut fx, paths(&["crates/synapse-authz/src/lib.rs"])),
+        Err(RefusalCode::AuthPathOutOfScope)
+    );
+    // `docs` is in the parent's scope but not the leaf's.
+    assert_eq!(
+        run(
+            &mut fx,
+            paths(&["crates/synapse-auth/src/lib.rs", "docs/F1.md"])
+        ),
+        Err(RefusalCode::AuthPathOutOfScope)
+    );
+    assert_eq!(
+        run(
+            &mut fx,
+            paths(&["crates/synapse-auth/../synapse-core/src/lib.rs"])
+        ),
+        Err(RefusalCode::PathInvalid)
+    );
+    let with_ref = |k| RequestScope {
+        reference: Some(k),
+        ..in_scope()
+    };
+    assert_eq!(run(&mut fx, with_ref(ReferenceKind::OwnDrafts)), Ok(()));
+    assert_eq!(
+        run(&mut fx, with_ref(ReferenceKind::CanonicalViaPromotionQueue)),
+        Err(RefusalCode::AuthReferenceOutOfScope)
+    );
+    let with_change = |id| RequestScope {
+        join_change: Some(id),
+        ..in_scope()
+    };
+    assert_eq!(run(&mut fx, with_change(change_id(1))), Ok(()));
+    assert_eq!(
+        run(&mut fx, with_change(change_id(2))),
+        Err(RefusalCode::AuthChangeOutOfScope)
+    );
+}
+
+#[test]
+fn f1_chain_with_an_ancestor_revoked_at_the_request_walseq_is_refused() {
+    let mut fx = Fx::new();
+    let s = fx.s.clone();
+    let chain = fx.full_chain();
+    let mut nonce = 0u8;
+    let mut at = |fx: &mut Fx, seq: u64| {
+        nonce += 1;
+        let req = fx.request(&s, chain.clone(), Capability::Propose, in_scope(), nonce);
+        fx.authorize(&req, seq)
+    };
+    assert_eq!(at(&mut fx, 9), Ok(()));
+
+    fx.enforcer
+        .revoke_link(fx.mid.digest(), WalSeq(10))
+        .unwrap();
+    // Revocation applies from its own WalSeq on, not before.
+    assert_eq!(at(&mut fx, 9), Ok(()));
+    assert_eq!(at(&mut fx, 10), Err(RefusalCode::AuthGrantRevoked));
+    assert_eq!(at(&mut fx, 11), Err(RefusalCode::AuthGrantRevoked));
+
+    // A later revocation never moves the first one, so revocation cannot be undone that way.
+    fx.enforcer
+        .revoke_link(fx.mid.digest(), WalSeq(20))
+        .unwrap();
+    assert_eq!(at(&mut fx, 15), Err(RefusalCode::AuthGrantRevoked));
+
+    // No new child can be granted under the revoked ancestor.
+    let mut cav = fx.leaf.caveats.clone();
+    cav.quotas.max_ops_per_window = 0;
+    cav.quotas.storage_bytes = 0;
+    cav.quotas.footprint_paths = 0;
+    let late = CapabilityLink::issue(&fx.w, fx.mid.digest(), [0xF0; 32], repo(), [7u8; 32], cav);
+    assert_eq!(
+        fx.enforcer
+            .grant_link(&fx.chain(&[&fx.root, &fx.mid, &late]), WalSeq(12), NOW)
+            .map_err(|e| e.code),
+        Err(RefusalCode::AuthGrantRevoked)
+    );
+
+    // Revoking the root refuses even a chain of the root alone held by O.
+    fx.enforcer
+        .revoke_link(fx.root.digest(), WalSeq(30))
+        .unwrap();
+    let req = fx.request(
+        &fx.o.clone(),
+        fx.chain(&[&fx.root]),
+        Capability::Read,
+        in_scope(),
+        200,
+    );
+    assert_eq!(fx.authorize(&req, 30), Err(RefusalCode::AuthGrantRevoked));
+
+    // The leaf is granted at WalSeq 3: a request at WalSeq 2 predates it (no link is revoked
+    // at WalSeq 2, so this refusal is about the grant, not the revocations above).
+    assert_eq!(at(&mut fx, 2), Err(RefusalCode::AuthChainBroken));
+}
+
+// ---------------------------------------------------------------------------------------------
+// Binary encoding (ADR 0003 principle P5).
+// ---------------------------------------------------------------------------------------------
+
+#[test]
+fn f1_link_and_chain_binary_encoding_is_canonical_and_malformed_bytes_are_refused() {
+    let fx = Fx::new();
+    let leaf = fx.leaf.clone();
+    let bytes = leaf.encode();
+    // Documented layout: version u16 LE, nonce, parent digest, repo (u32 LE length + bytes).
+    assert_eq!(&bytes[0..2], &1u16.to_le_bytes());
+    assert_eq!(&bytes[2..34], &leaf.nonce);
+    assert_eq!(&bytes[34..66], &fx.mid.digest().0);
+    let repo_len = repo().as_str().len();
+    assert_eq!(&bytes[66..70], &(repo_len as u32).to_le_bytes());
+    assert_eq!(&bytes[bytes.len() - 64..], &leaf.signature);
+
+    let back = CapabilityLink::decode(&bytes).map_err(|e| e.code);
+    assert_eq!(back.as_ref(), Ok(&leaf));
+    assert_eq!(back.unwrap().encode(), bytes);
+
+    let chain = fx.full_chain();
+    let chain_bytes = chain.encode();
+    let chain_back = CapabilityChain::decode(&chain_bytes).map_err(|e| e.code);
+    assert_eq!(chain_back.as_ref(), Ok(&chain));
+    assert_eq!(chain_back.unwrap().encode(), chain_bytes);
+    assert_eq!(
+        chain.link_digests(),
+        vec![fx.root.digest(), fx.mid.digest(), leaf.digest()]
+    );
+
+    let malformed = |b: &[u8]| CapabilityChain::decode(b).map_err(|e| e.code);
+    for cut in 0..chain_bytes.len() {
+        assert_eq!(
+            malformed(&chain_bytes[..cut]),
+            Err(RefusalCode::AuthChainMalformed),
+            "truncated at {cut}"
+        );
+    }
+    let mut trailing = chain_bytes.clone();
+    trailing.push(0);
+    assert_eq!(malformed(&trailing), Err(RefusalCode::AuthChainMalformed));
+    let mut v2 = chain_bytes.clone();
+    v2[0] = 2;
+    assert_eq!(malformed(&v2), Err(RefusalCode::AuthChainMalformed));
+    for count in [0u8, (MAX_CHAIN_DEPTH + 1) as u8] {
+        let mut c = chain_bytes.clone();
+        c[2] = count;
+        assert_eq!(malformed(&c), Err(RefusalCode::AuthChainMalformed));
+    }
+
+    let link_err = |b: &[u8]| CapabilityLink::decode(b).map_err(|e| e.code);
+    let ops_at = 2 + 32 + 32 + 4 + repo_len + 32 + 32;
+    let mut bad_ops = bytes.clone();
+    bad_ops[ops_at] |= 0x40;
+    assert_eq!(link_err(&bad_ops), Err(RefusalCode::AuthChainMalformed));
+    let mut bad_refs = bytes.clone();
+    bad_refs[ops_at + 1] |= 0x04;
+    assert_eq!(link_err(&bad_refs), Err(RefusalCode::AuthChainMalformed));
+    let mut huge_paths = bytes.clone();
+    huge_paths[ops_at + 2..ops_at + 6].copy_from_slice(&u32::MAX.to_le_bytes());
+    assert_eq!(link_err(&huge_paths), Err(RefusalCode::AuthChainMalformed));
+
+    // Path prefixes out of order are not the canonical form.
+    let mut cav = wide_caveats();
+    cav.paths = PathScope::new(vec!["a".into(), "b".into()]).unwrap();
+    let two = CapabilityLink::issue(&fx.authority, ROOT_PARENT, [1; 32], repo(), [2; 32], cav);
+    let mut swapped = two.encode();
+    let first = ops_at + 2 + 4 + 4;
+    let second = first + 1 + 4;
+    assert_eq!((swapped[first], swapped[second]), (b'a', b'b'));
+    swapped.swap(first, second);
+    assert_eq!(link_err(&swapped), Err(RefusalCode::AuthChainMalformed));
+    // Unknown change-scope tag.
+    let mut bad_change = two.encode();
+    bad_change[second + 1] = 2;
+    assert_eq!(link_err(&bad_change), Err(RefusalCode::AuthChainMalformed));
+
+    // Every link digest differs once any signed byte differs.
+    let d: LinkDigest = fx.leaf.digest();
+    let mut other = fx.leaf.clone();
+    other.caveats.expires_at_ms -= 1;
+    assert_ne!(other.digest(), d);
+}
diff --git a/crates/synapse-core/src/lib.rs b/crates/synapse-core/src/lib.rs
index 98799df..cf66bc0 100644
--- a/crates/synapse-core/src/lib.rs
+++ b/crates/synapse-core/src/lib.rs
@@ -44,6 +44,9 @@ pub enum RefusalCode {
     QuotaTooManyPaths,
     QuotaRateLimitExceeded,
     PaginationLimitExceeded,
+    /// The children of one capability link would together exceed the parent's rate, storage, or
+    /// footprint quota (ADR 0003 section 5.8, step F1).
+    QuotaPartitionExceeded,
 
     // Schema, path, and consistency refusals
     EnvelopeVersionUnsupported,
@@ -68,6 +71,26 @@ pub enum RefusalCode {
     AuthReplayDetected,
     AuthSelfReviewRefused,
     AuditChainCorrupt,
+    /// A capability chain does not link up: empty or too deep, a root that is not a trusted
+    /// repository authority, a parent digest that does not match the previous link (stripped or
+    /// reordered chain), or a link the server never granted (ADR 0003 section 5.8, step F1).
+    AuthChainBroken,
+    /// A capability link or chain is not in its one canonical binary encoding (step F1).
+    AuthChainMalformed,
+    /// A link is bound to another audience: its issuer is not its parent's audience, or the
+    /// request is presented by a key that is not the leaf link's audience (step F1).
+    AuthAudienceMismatch,
+    /// A derived link is wider than its parent in operations, paths, references, change scope,
+    /// quotas, or validity window (step F1).
+    AuthScopeEscalation,
+    /// A link of the chain was revoked at or before the request's `WalSeq` (step F1).
+    AuthGrantRevoked,
+    /// A request touches a path outside the chain's path scope (step F1).
+    AuthPathOutOfScope,
+    /// A request touches a reference kind outside the chain's reference scope (step F1).
+    AuthReferenceOutOfScope,
+    /// A request joins a `ChangeId` outside the chain's change scope (step F1).
+    AuthChangeOutOfScope,
 
     // Git and Radicle canonicality refusals
     GitObjectCorrupt,
@@ -325,6 +348,25 @@ impl fmt::Debug for IdempotencyKey {
     }
 }
 
+/// One unit of intended work across all its rewrites and retries (ADR 0003 section 5.1):
+/// 16 random bytes, not content-derived. Step F1 uses it only to name the `ChangeId`s a
+/// capability link's change scope allows its holder to join; binding a `ChangeId` to its
+/// creating chain is step B1.
+#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
+pub struct ChangeId(pub [u8; 16]);
+
+impl ChangeId {
+    pub fn to_hex(self) -> String {
+        hex::encode(self.0)
+    }
+}
+
+impl fmt::Debug for ChangeId {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        write!(f, "ChangeId({})", self.to_hex())
+    }
+}
+
 /// Human-facing GitHub Pull Request projection record.
 /// Merging a GitHub PR never by itself confers a `RadicleCanonicalHead`.
 #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
diff --git a/docs/F1_CAPABILITY_CHAINS.md b/docs/F1_CAPABILITY_CHAINS.md
new file mode 100644
index 0000000..4c717d9
--- /dev/null
+++ b/docs/F1_CAPABILITY_CHAINS.md
@@ -0,0 +1,63 @@
+# F1: Attenuated Capability Chains
+
+ADR 0003 section 9 step F1 (issue aien-spark/synapse#25). Section 5.8 "Agent identity and capabilities": grants become delegation chains issued from a repository authority, where each derived link may only narrow operations, path prefixes, reference scope, change scope, quotas, and validity window, and where request rate, storage, and footprint quotas are partitioned across children.
+
+Code: `crates/synapse-auth/src/chain.rs`, `crates/synapse-core/src/lib.rs` (`ChangeId` and chain refusal codes). Tests: `crates/synapse-auth/tests/f1_capability_chains.rs`. Evidence: `evidence/f1-capability-chains/`.
+
+## 1. Model and invariants
+
+| Concept | Meaning | Rule |
+| :--- | :--- | :--- |
+| `Capability` | `Read` (1), `Propose` (2), `Evaluate` (3), `Review` (4), `Publish` (5), `Undo` (6) | Bitmask in `OperationSet`; child bits must be a subset of parent bits |
+| `PathScope` | Canonical sorted set of repository-relative path prefixes (empty string means whole repository) | Prefix match on path segment boundaries (`""`, exact match, or followed by `/`); child prefixes must each be covered by a parent prefix |
+| `ReferenceScope` | Bitmask over `ReferenceKind::OwnDrafts` (1) and `ReferenceKind::CanonicalViaPromotionQueue` (2) | Child bits must be a subset of parent bits |
+| `ChangeScope` | `any` (`None`) or a strictly ascending list of `ChangeId`s (`Some(Vec<ChangeId>)`) | `any` narrows to `any` or `only(...)`; `only(P)` narrows only to `only(C)` with `C` a subset of `P` |
+| `ChainQuotas` | `max_ops_per_window`, `window_duration_ms`, `storage_bytes`, `footprint_paths`, `max_bytes_per_op` | `window_duration_ms` must equal parent's; `max_bytes_per_op` may only narrow; `max_ops_per_window`, `storage_bytes`, and `footprint_paths` are partitioned across granted children so child sums never exceed the parent's grant, and the parent keeps only its unallocated remainder |
+| `CapabilityLink` | One signed delegation link (`version`, `nonce`, `parent`, `repo_id`, `issuer_key`, `audience_key`, `caveats`, `signature`) | Root link has `parent = [0u8; 32]` and issuer in `trusted_authorities[repo_id]`; child link has `parent = parent_link.digest()` and `issuer_key = parent_link.audience_key` |
+| `CapabilityChain` | Root-first sequence of 1 to 16 `CapabilityLink`s | Every link must be granted at or before the request's `WalSeq`, unrevoked at `request_seq`, unexpired at `now_ms`, bound to `expected_repo_id`, and signed with strict Ed25519 verification |
+
+## 2. Operations and lifecycle
+
+* **Granting (`PolicyEnforcer::grant_link`)**: records the leaf link of a verified chain as granted at `seq`. Every ancestor link must already be granted at or before `seq` and unrevoked at `seq`. If the leaf has a parent link, its `max_ops_per_window`, `storage_bytes`, and `footprint_paths` are added to the parent's allocated totals; if any dimension would exceed the parent's quota, granting fails with `RefusalCode::QuotaPartitionExceeded` and state is unchanged.
+* **Revocation (`PolicyEnforcer::revoke_link`)**: marks a granted link revoked at `seq` (keeping the earliest revocation sequence if called more than once). Revocation is monotone and cannot be undone. Any chain containing a link with `revoked_at <= request_seq` is refused with `RefusalCode::AuthGrantRevoked`.
+* **Unallocated quota (`PolicyEnforcer::unallocated_quota`)**: returns a granted link's remaining `max_ops_per_window`, `storage_bytes`, and `footprint_paths` after subtracting what it has partitioned to granted children.
+* **Request authorization (`PolicyEnforcer::authorize_chain`)**: verifies the chain, checks that every link was granted at or before `request_seq` and unrevoked at `request_seq`, verifies that the presenting agent is the leaf link's audience and signed the canonical request transcript (`DOMAIN_CHAIN_REQUEST_V1`), checks required capability, path scope (segment boundary), reference scope, change scope, payload size, and the leaf's unallocated request rate window, checks mutation nonce replay, and appends an entry to the hash-chained audit log.
+
+## 3. Canonical binary layout (principle P5)
+
+All integers are little-endian. Counts and byte lengths are bounds-checked against caps and remaining buffer bytes before allocation. Any malformed byte sequence, unknown bit, non-canonical path or `ChangeId` ordering, or trailing byte fails closed with `RefusalCode::AuthChainMalformed`.
+
+`CapabilityLink` body:
+* `version`: `u16` (`1`)
+* `nonce`: `[u8; 32]`
+* `parent`: `[u8; 32]` (`LinkDigest`, zero for root)
+* `repo_id`: `u32` byte length + UTF-8 bytes (at most 128 bytes)
+* `issuer_key`: `[u8; 32]`
+* `audience_key`: `[u8; 32]`
+* `operations`: `u8` bitmask (bits 0..5)
+* `references`: `u8` bitmask (bits 0..1)
+* `paths`: `u32` count (at most 256) + each prefix as `u32` byte length + UTF-8 bytes in canonical order
+* `changes`: `u8` tag (`0` = any, `1` = `u32` count at most 1024 + strictly ascending 16-byte `ChangeId`s)
+* `quotas`: `max_ops_per_window: u32`, `window_duration_ms: u64`, `storage_bytes: u64`, `footprint_paths: u64`, `max_bytes_per_op: u64`
+* `issued_at_ms`: `u64`
+* `expires_at_ms`: `u64`
+
+Link signature: Ed25519 signature over `SYNAPSE_CAPABILITY_LINK_SIGN_V1\0 || body`.
+Encoded link: `body || signature` (64 bytes).
+Link digest (`LinkDigest`): `SHA-256(SYNAPSE_CAPABILITY_LINK_ID_V1\0 || encode())`.
+Encoded chain (`CapabilityChain`): `version: u16 (1) || count: u8 (1..=16) || (link_len: u32 || link_bytes)*`.
+
+## 4. Acceptance
+
+| Acceptance (ADR 0003 section 9, row 5) | Test | Result |
+| :--- | :--- | :--- |
+| Property test: no derived grant exceeds its parent in operations, paths, references, change scope, quotas, or expiry | `f1_property_no_derived_grant_exceeds_its_parent` (seeded SplitMix64 `0xF1F1_0003_0025_5EED`, 256 cases, 843 narrowed links accepted, widened links refused across all 6 dimensions) | pass |
+| Property test: child quotas never sum above the parent's | `f1_property_child_quotas_never_sum_above_the_parent` (256 cases, 1799 children accepted, 2297 refused with `QuotaPartitionExceeded`) | pass |
+| Forged, stripped, and reordered chains refused | `f1_forged_chains_are_refused`, `f1_stripped_chains_are_refused`, `f1_reordered_chains_are_refused` | pass |
+| Link bound to another repository or audience refused | `f1_link_bound_to_another_repository_is_refused`, `f1_link_bound_to_another_audience_is_refused` | pass |
+| Out-of-scope path refused | `f1_out_of_scope_path_is_refused` (plus reference and change scope checks and path traversal refusal) | pass |
+| Chain with an ancestor revoked at the request's `WalSeq` refused | `f1_chain_with_an_ancestor_revoked_at_the_request_walseq_is_refused` | pass |
+
+Additional tests: `f1_partitioned_rate_parent_keeps_only_what_it_has_not_handed_down`, `f1_link_and_chain_binary_encoding_is_canonical_and_malformed_bytes_are_refused`.
+
+Red then green logs: `evidence/f1-capability-chains/red-green/red.txt` (all 11 acceptance tests fail on assertion against stubs at commit `f377f41`) and `evidence/f1-capability-chains/red-green/green.txt` (all 11 pass).
diff --git a/evidence/f1-capability-chains/SHA256SUMS b/evidence/f1-capability-chains/SHA256SUMS
new file mode 100644
index 0000000..17187f9
--- /dev/null
+++ b/evidence/f1-capability-chains/SHA256SUMS
@@ -0,0 +1,2 @@
+4bfe0c7fedbe4f1c38ceacc61a1a49f3d43a1137a98896a856f17e036e2bf6a1  red-green/red.txt
+874e1c21d403958f42f43973a26e3dd8b750b19051b5b0a556932d151b08b518  red-green/green.txt
diff --git a/evidence/f1-capability-chains/red-green/green.txt b/evidence/f1-capability-chains/red-green/green.txt
new file mode 100644
index 0000000..fef1cd9
--- /dev/null
+++ b/evidence/f1-capability-chains/red-green/green.txt
@@ -0,0 +1,17 @@
+# Green (2026-10-14, implementation on top of red commit f377f41; workspace 239 passed, 0 failed; clippy -D warnings and fmt clean)
+# Command: cargo test -p synapse-auth --offline --test f1_capability_chains -- --nocapture --test-threads=1
+# Property seed 0xF1F1_0003_0025_5EED; 256 narrowing cases and 256 partition cases.
+
+running 11 tests
+test f1_chain_with_an_ancestor_revoked_at_the_request_walseq_is_refused ... ok
+test f1_forged_chains_are_refused ... ok
+test f1_link_and_chain_binary_encoding_is_canonical_and_malformed_bytes_are_refused ... ok
+test f1_link_bound_to_another_audience_is_refused ... ok
+test f1_link_bound_to_another_repository_is_refused ... ok
+test f1_out_of_scope_path_is_refused ... ok
+test f1_partitioned_rate_parent_keeps_only_what_it_has_not_handed_down ... ok
+test f1_property_child_quotas_never_sum_above_the_parent ... seed 0xf1f1000300255eed, 256 cases: 1799 children accepted, 2297 refused with QuotaPartitionExceeded
+test f1_property_no_derived_grant_exceeds_its_parent ... seed 0xf1f1000300255eed, 256 cases: 843 narrowed links accepted; widened links refused per dimension ["operations", "paths", "references", "change scope", "quotas", "expiry"] = [139, 133, 124, 107, 115, 143]
+test f1_reordered_chains_are_refused ... ok
+test f1_stripped_chains_are_refused ... ok
+test result: ok. 11 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 8.93s
diff --git a/evidence/f1-capability-chains/red-green/red.txt b/evidence/f1-capability-chains/red-green/red.txt
new file mode 100644
index 0000000..d515f31
--- /dev/null
+++ b/evidence/f1-capability-chains/red-green/red.txt
@@ -0,0 +1,156 @@
+# Red (2026-10-14, commit f377f41: F1 tests against stubs)
+# Command: cargo test -p synapse-auth --offline --test f1_capability_chains
+# Stubs: grant_link accepts every link unchecked, revoke_link records nothing, unallocated_quota returns None,
+#        authorize_chain admits (and audits) every request, link signature verification accepts, decoders return IoFailure.
+# Every failure below is an assertion on the behaviour under test (no compile error, no unrelated panic).
+
+   Compiling synapse-auth v0.1.0 (/home/drakestapleton/.t3/projects/synapse/.claude/worktrees/f1/crates/synapse-auth)
+432 |     pub fn decode(bytes: &[u8]) -> SynapseResult<Self> {
+560 |     pub fn decode(bytes: &[u8]) -> SynapseResult<Self> {
+    Finished `test` profile [unoptimized + debuginfo] target(s) in 0.44s
+     Running tests/f1_capability_chains.rs (target/debug/deps/f1_capability_chains-468298823d2ae46e)
+running 11 tests
+test f1_partitioned_rate_parent_keeps_only_what_it_has_not_handed_down ... FAILED
+test f1_property_child_quotas_never_sum_above_the_parent ... FAILED
+test f1_link_bound_to_another_repository_is_refused ... FAILED
+test f1_property_no_derived_grant_exceeds_its_parent ... FAILED
+test f1_link_bound_to_another_audience_is_refused ... FAILED
+test f1_forged_chains_are_refused ... FAILED
+test f1_out_of_scope_path_is_refused ... FAILED
+test f1_chain_with_an_ancestor_revoked_at_the_request_walseq_is_refused ... FAILED
+test f1_reordered_chains_are_refused ... FAILED
+test f1_stripped_chains_are_refused ... FAILED
+test f1_link_and_chain_binary_encoding_is_canonical_and_malformed_bytes_are_refused ... FAILED
+failures:
+---- f1_partitioned_rate_parent_keeps_only_what_it_has_not_handed_down stdout ----
+thread 'f1_partitioned_rate_parent_keeps_only_what_it_has_not_handed_down' panicked at crates/synapse-auth/tests/f1_capability_chains.rs:749:5:
+assertion `left == right` failed
+  left: Ok(LinkDigest([41, 152, 138, 161, 234, 199, 146, 57, 139, 50, 161, 152, 138, 51, 172, 24, 64, 218, 123, 128, 195, 106, 179, 183, 183, 160, 128, 42, 163, 58, 252, 14]))
+ right: Err(QuotaPartitionExceeded)
+note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
+---- f1_property_child_quotas_never_sum_above_the_parent stdout ----
+thread 'f1_property_child_quotas_never_sum_above_the_parent' panicked at crates/synapse-auth/tests/f1_capability_chains.rs:689:21:
+seed 0xf1f1000300255eed case 0: accepted child makes children sum Sum { ops: 31, storage: 396, footprint: 674 } above parent quotas ChainQuotas { max_ops_per_window: 73, window_duration_ms: 60000, storage_bytes: 1060, footprint_paths: 554, max_bytes_per_op: 1048576 }
+---- f1_link_bound_to_another_repository_is_refused stdout ----
+thread 'f1_link_bound_to_another_repository_is_refused' panicked at crates/synapse-auth/tests/f1_capability_chains.rs:976:5:
+assertion `left == right` failed
+  left: Ok(LinkDigest([163, 182, 60, 198, 56, 177, 19, 23, 162, 174, 255, 49, 240, 67, 255, 200, 10, 196, 128, 106, 54, 169, 45, 66, 221, 229, 218, 188, 236, 31, 232, 246]))
+ right: Err(AuthCrossRepoDenied)
+---- f1_property_no_derived_grant_exceeds_its_parent stdout ----
+thread 'f1_property_no_derived_grant_exceeds_its_parent' panicked at crates/synapse-auth/tests/f1_capability_chains.rs:536:29:
+seed 0xf1f1000300255eed case 0: accepted link exceeds ancestor 0 in change scope
+ child LinkCaveats {
+    operations: OperationSet(
+        34,
+    ),
+    paths: PathScope {
+        prefixes: [
+            "b/tests/src/tests",
+            "docs/ab/a",
+            "docs/src/a",
+        ],
+    },
+    references: ReferenceScope(
+        0,
+    ),
+    changes: ChangeScope {
+        only: Some(
+            [
+                ChangeId(02020202020202020202020202020202),
+                ChangeId(07070707070707070707070707070707),
+                ChangeId(7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f),
+            ],
+        ),
+    },
+    quotas: ChainQuotas {
+        max_ops_per_window: 48,
+        window_duration_ms: 60000,
+        storage_bytes: 17288663,
+        footprint_paths: 112215,
+        max_bytes_per_op: 14908,
+    },
+    issued_at_ms: 1255,
+    expires_at_ms: 118981,
+}
+ ancestor LinkCaveats {
+    operations: OperationSet(
+        38,
+    ),
+    paths: PathScope {
+        prefixes: [
+            "b/tests",
+            "docs/ab",
+            "docs/src",
+        ],
+    },
+    references: ReferenceScope(
+        0,
+    ),
+    changes: ChangeScope {
+        only: Some(
+            [
+                ChangeId(02020202020202020202020202020202),
+                ChangeId(07070707070707070707070707070707),
+                ChangeId(08080808080808080808080808080808),
+            ],
+        ),
+    },
+    quotas: ChainQuotas {
+        max_ops_per_window: 461,
+        window_duration_ms: 60000,
+        storage_bytes: 874486835,
+        footprint_paths: 875242,
+        max_bytes_per_op: 533753,
+    },
+    issued_at_ms: 1091,
+    expires_at_ms: 377742,
+}
+---- f1_link_bound_to_another_audience_is_refused stdout ----
+thread 'f1_link_bound_to_another_audience_is_refused' panicked at crates/synapse-auth/tests/f1_capability_chains.rs:1018:5:
+assertion `left == right` failed
+  left: Ok(())
+ right: Err(AuthAudienceMismatch)
+---- f1_forged_chains_are_refused stdout ----
+thread 'f1_forged_chains_are_refused' panicked at crates/synapse-auth/tests/f1_capability_chains.rs:839:5:
+assertion `left == right` failed
+  left: Ok(())
+ right: Err(AuthGrantSignatureInvalid)
+---- f1_out_of_scope_path_is_refused stdout ----
+thread 'f1_out_of_scope_path_is_refused' panicked at crates/synapse-auth/tests/f1_capability_chains.rs:1092:5:
+assertion `left == right` failed
+  left: Ok(())
+ right: Err(AuthPathOutOfScope)
+---- f1_chain_with_an_ancestor_revoked_at_the_request_walseq_is_refused stdout ----
+thread 'f1_chain_with_an_ancestor_revoked_at_the_request_walseq_is_refused' panicked at crates/synapse-auth/tests/f1_capability_chains.rs:1154:5:
+assertion `left == right` failed
+  left: Ok(())
+ right: Err(AuthGrantRevoked)
+---- f1_reordered_chains_are_refused stdout ----
+thread 'f1_reordered_chains_are_refused' panicked at crates/synapse-auth/tests/f1_capability_chains.rs:949:9:
+assertion `left == right` failed: order [0, 2, 1]
+  left: Ok(())
+ right: Err(AuthChainBroken)
+---- f1_stripped_chains_are_refused stdout ----
+thread 'f1_stripped_chains_are_refused' panicked at crates/synapse-auth/tests/f1_capability_chains.rs:919:9:
+assertion `left == right` failed: middle link dropped
+  left: Ok(())
+ right: Err(AuthChainBroken)
+---- f1_link_and_chain_binary_encoding_is_canonical_and_malformed_bytes_are_refused stdout ----
+thread 'f1_link_and_chain_binary_encoding_is_canonical_and_malformed_bytes_are_refused' panicked at crates/synapse-auth/tests/f1_capability_chains.rs:1212:5:
+assertion `left == right` failed
+  left: Err(IoFailure)
+ right: Ok(CapabilityLink { version: 1, nonce: [162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162], parent: LinkDigest([126, 158, 96, 62, 88, 184, 128, 18, 134, 170, 46, 169, 243, 246, 241, 118, 185, 65, 166, 52, 57, 249, 171, 82, 83, 125, 255, 250, 5, 0, 94, 104]), repo_id: RepoId("aien-spark/synapse"), issuer_key: [237, 73, 40, 198, 40, 209, 194, 198, 234, 233, 3, 56, 144, 89, 149, 97, 41, 89, 39, 58, 92, 99, 249, 54, 54, 193, 70, 20, 172, 135, 55, 209], audience_key: [202, 147, 172, 23, 5, 24, 112, 113, 214, 123, 131, 199, 255, 14, 254, 129, 8, 232, 236, 69, 48, 87, 93, 119, 38, 135, 147, 51, 219, 218, 190, 124], caveats: LinkCaveats { operations: OperationSet(3), paths: PathScope { prefixes: ["crates/synapse-auth"] }, references: ReferenceScope(1), changes: ChangeScope { only: Some([ChangeId(01010101010101010101010101010101)]) }, quotas: ChainQuotas { max_ops_per_window: 250, window_duration_ms: 60000, storage_bytes: 268435456, footprint_paths: 262144, max_bytes_per_op: 1048576 }, issued_at_ms: 1000, expires_at_ms: 100000 }, signature: [34, 71, 249, 230, 73, 32, 78, 224, 82, 220, 174, 21, 163, 197, 78, 111, 76, 77, 115, 120, 169, 144, 201, 187, 150, 251, 168, 109, 122, 195, 216, 142, 118, 142, 75, 221, 198, 131, 211, 131, 153, 175, 194, 23, 218, 213, 134, 136, 57, 22, 55, 22, 98, 21, 212, 20, 208, 155, 224, 81, 119, 51, 7, 3] })
+failures:
+    f1_chain_with_an_ancestor_revoked_at_the_request_walseq_is_refused
+    f1_forged_chains_are_refused
+    f1_link_and_chain_binary_encoding_is_canonical_and_malformed_bytes_are_refused
+    f1_link_bound_to_another_audience_is_refused
+    f1_link_bound_to_another_repository_is_refused
+    f1_out_of_scope_path_is_refused
+    f1_partitioned_rate_parent_keeps_only_what_it_has_not_handed_down
+    f1_property_child_quotas_never_sum_above_the_parent
+    f1_property_no_derived_grant_exceeds_its_parent
+    f1_reordered_chains_are_refused
+    f1_stripped_chains_are_refused
+test result: FAILED. 0 passed; 11 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
+error: test failed, to rerun pass `-p synapse-auth --test f1_capability_chains`