Skip to content

Add Capability Authority Plane contracts and diagnostic storm-control schemas #97

@mdheller

Description

@mdheller

Intent

Convert the macOS/BearBrowser failure lessons into canonical SourceOS typed contracts so runtime components do not repeat the opaque capability-denial, registry-failure, and diagnostic-storm anti-patterns observed in the uploaded log evidence.

This belongs in sourceos-spec because it is the shared machine-readable contract layer consumed by downstream runtimes.

Evidence-derived failure classes to model

The current log evidence shows these recurring classes:

  1. Capability/permission denial loops

    • Full Disk Access/TCC-style denial
    • sandbox denied service lookup
    • locked/pre-unlock key material unavailable
    • denied pasteboard, analytics, LaunchServices/CoreServices, RunningBoard, FileProvider, network-settings, and diagnostic access
  2. Broken registry / package identity plane

    • missing LaunchServices/extension records
    • invalid bundle/product identity
    • missing receipts
    • extension discovery cancellation
    • missing namespace descriptors / treatment layers
  3. Diagnostic storm behavior

    • duplicate denial loops
    • retry spam without bounded state
    • network telemetry spam with nil device identifiers
    • missing causal continuity between the original denial and later degraded/crash behavior
  4. Network truth ambiguity

    • Wi-Fi/radio active but no connected network
    • DNS/DHCP events with nil device identifiers
    • no route to host despite apparently satisfied path
    • broken pipe and route already exists conditions
  5. Browser/runtime child-process failure

    • sandboxed WebContent/GPU/Networking helpers fail privileged lookups
    • pasteboard setup fails
    • LaunchServices/CoreServices and RunningBoard access fail
    • DB migration and plugin discovery failures surface as opaque runtime noise

Proposed new schemas

Add a capability-authority contract family under schemas/ with examples and catalog updates.

1. CapabilityContract.json

Purpose: declare what a component requires before runtime.

Required fields:

  • id: urn:srcos:capability-contract:<slug>
  • specVersion
  • componentRef
  • componentKind: app | daemon | agent | browser-child | terminal-helper | network-observer | file-monitor | extension-host | indexer | broker
  • declaredCapabilities[]
  • requiredBrokers[]
  • minimumBootPhase
  • degradedModePolicy
  • userVisibleImpact
  • evidenceRefs[]

2. CapabilityGrantState.json

Purpose: capture observed runtime state of each declared capability.

Required fields:

  • id: urn:srcos:capability-grant-state:<slug>
  • contractRef
  • observedAt
  • bootId
  • sessionId
  • permissionEpoch
  • capabilityStates[]

Each capability state should include:

  • capability
  • requestedOperation
  • subjectRef
  • objectRef
  • grantSource: policy | user-consent | broker | ambient-host | kernel | portal | inherited | unavailable
  • decision: granted | denied | ask | degraded | unavailable | unknown
  • policyRuleRef
  • fallback
  • userVisibleImpact
  • remediationHint

3. DiagnosticStormRecord.json

Purpose: normalize repeated logs into bounded evidence.

Required fields:

  • id: urn:srcos:diagnostic-storm:<slug>
  • firstSeen
  • lastSeen
  • repeatCount
  • signature
  • severity
  • sourceComponent
  • normalizedFailureClass
  • sampleEvents[]
  • suppressionPolicy
  • terminalState
  • linkedIncidentRef

4. NetworkTruthState.json

Purpose: replace boolean online/offline status with explicit layered network truth.

Required fields:

  • id: urn:srcos:network-truth:<slug>
  • observedAt
  • networkEpoch
  • radioState
  • associationState
  • authenticationState
  • dhcpState
  • dnsState
  • routeState
  • captivePortalState
  • internetReachability
  • localMeshReachability
  • vpnOrPrivacyOverlayState
  • trustedPeerPathState
  • evidenceRefs[]

5. RuntimeRegistryIntegrityRecord.json

Purpose: make the hidden desktop registry/package identity plane auditable.

Required fields:

  • id: urn:srcos:runtime-registry-integrity:<slug>
  • componentRef
  • bundleOrPackageIdentity
  • receiptState
  • extensionRecords[]
  • brokerRecords[]
  • manifestDigest
  • verificationVerdict: valid | degraded | missing | invalid | quarantined
  • remediationHint

6. BootSessionPhaseState.json

Purpose: prevent services from running before the required boot/session phase.

Required fields:

  • id: urn:srcos:boot-session-phase:<slug>
  • bootId
  • sessionId
  • phase: sealed-boot | pre-login | post-login-locked | unlocked-user-session | degraded-session | recovery-session
  • availableKeyrings[]
  • availablePortals[]
  • blockedComponents[]
  • allowedComponents[]
  • evidenceRefs[]

Acceptance tests

  1. Examples validate under JSON Schema draft 2020-12.
  2. schemas/README.md catalog includes the new family and URN prefixes.
  3. A denied capability can be represented without ambiguity.
  4. A repeated denial storm can be summarized without losing first/last/repeat count.
  5. A browser child-process denied pasteboard/LaunchServices access can be represented with broker fallback.
  6. A network state can distinguish radio-active/no-route/no-DNS/no-internet/local-mesh-only states.
  7. A pre-unlock service attempt can be rejected as phase-ineligible with a user-readable remediation hint.
  8. Runtime identity failures can distinguish missing receipt, invalid manifest, missing extension record, and quarantined plugin.

Downstream consumers

  • SourceOS-Linux/sourceos-shell: runtime doctor and shell diagnostics.
  • SocioProphet/meshrush: network truth and graph-traversal capability evidence.
  • BearBrowser/TurtleTerm surfaces when they land in their final runtime home.
  • SocioProphet/prophet-platform: evidence receipts, FogStack readiness, office/browser diagnostics.

Initial implementation slice

  • Add the six schemas.
  • Add one example per schema.
  • Update schemas/README.md.
  • Add a minimal validator/checker if this repo already has validation tooling.
  • Do not overfit to macOS names; preserve generic SourceOS contract semantics and allow platform-specific mappings through evidence refs and adapters.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions