{
  "schema": "lattice.agents/governance-audit-events/v1",
  "audit_records": [
    {
      "id": "admin-audit-record",
      "type": "LatticeAdminAuditRecord",
      "fields": [
        "operation_id",
        "outcome",
        "action",
        "actor_subject_id",
        "actor_tenant",
        "actor_kind",
        "target_scope",
        "target_kind",
        "target_id",
        "anchor_tree_id",
        "anchor_key",
        "anchor_base_version",
        "anchor_base_hash",
        "anchor_value_hash",
        "committed_revision_hlc",
        "reason_code",
        "detail",
        "origin_region",
        "timestamp_utc",
        "completed_utc"
      ],
      "emitting_component": "Administration facades through LatticeAdminAudit and DurableLatticeAdminAuditTrail (auth admin, tenant admin, tenant directory, tenant policy, tenant access, tenant grants, tenant regions, apps control, tree-admin aliases); AdminAuditReconciler for intents left pending",
      "sinks": [
        "sys-auth-admin-audit"
      ],
      "source": "src/lattice/AdminAudit/LatticeAdminAuditRecord.cs"
    },
    {
      "id": "app-activation-failure-log",
      "type": "ILogger warning",
      "fields": [
        "operation",
        "tenant",
        "slug",
        "failure",
        "diagnostic"
      ],
      "emitting_component": "AppActivationEngine",
      "source": "src/lattice.apps/Activation/AppActivationEngine.cs"
    },
    {
      "id": "app-activation-fault-log",
      "type": "ILogger warning",
      "fields": [
        "operation",
        "tenant",
        "slug",
        "exception"
      ],
      "emitting_component": "AppActivationEngine",
      "source": "src/lattice.apps/Activation/AppActivationEngine.cs"
    },
    {
      "id": "app-activation-status-write-warning",
      "type": "ILogger warning",
      "fields": [
        "tenant",
        "slug",
        "exception"
      ],
      "emitting_component": "AppActivationEngine",
      "source": "src/lattice.apps/Activation/AppActivationEngine.cs"
    },
    {
      "id": "app-registry-snapshot-warning",
      "type": "ILogger warning",
      "fields": [
        "exception"
      ],
      "emitting_component": "CompiledAppRegistrySnapshotMaintainer",
      "source": "src/lattice.apps/Registry/CompiledAppRegistrySnapshotMaintainer.cs"
    },
    {
      "id": "app-startup-reconcile-app-warning",
      "type": "ILogger warning",
      "fields": [
        "tenant",
        "slug",
        "failure",
        "exception"
      ],
      "emitting_component": "AppStartupReconciler",
      "source": "src/lattice.apps/Activation/AppStartupReconciler.cs"
    },
    {
      "id": "app-startup-reconcile-host-warning",
      "type": "ILogger warning",
      "fields": [
        "exception"
      ],
      "emitting_component": "AppStartupReconciler",
      "source": "src/lattice.apps/Activation/AppStartupReconciler.cs"
    },
    {
      "id": "app-subscription-handler-warning",
      "type": "ILogger warning",
      "fields": [
        "subscription",
        "app",
        "tenant",
        "exception"
      ],
      "emitting_component": "AppSubscriptionRouter",
      "source": "src/lattice.apps/Subscriptions/AppSubscriptionRouter.cs"
    },
    {
      "id": "app-subscription-routing-warning",
      "type": "ILogger warning",
      "fields": [
        "app",
        "tenant",
        "reasons",
        "exception"
      ],
      "emitting_component": "AppSubscriptionRouter",
      "source": "src/lattice.apps/Subscriptions/AppSubscriptionRouter.cs"
    },
    {
      "id": "auth-allowed-log",
      "type": "ILogger event 2",
      "fields": [
        "subject_id",
        "operation",
        "tree_id",
        "key",
        "matched_rule_id",
        "policy_epoch"
      ],
      "emitting_component": "LoggerLatticeAuthAuditSink",
      "source": "src/lattice.auth/LoggerLatticeAuthAuditSink.cs"
    },
    {
      "id": "auth-audit-sink-failure-log",
      "type": "ILogger event 1",
      "fields": [
        "sink_type",
        "exception"
      ],
      "emitting_component": "LatticeAuthDecisionObserver",
      "source": "src/lattice.auth/LatticeAuthDecisionObserver.cs"
    },
    {
      "id": "auth-decision-event",
      "type": "LatticeAuthDecisionEvent",
      "fields": [
        "subject_id",
        "operation",
        "tree_id",
        "effect",
        "policy_epoch",
        "timestamp_utc",
        "key",
        "range_start",
        "range_end",
        "matched_rule_id",
        "matched_scope_kind",
        "matched_scope_value",
        "reason"
      ],
      "emitting_component": "PolicyAccessGate through LatticeAuthDecisionObserver",
      "sinks": [
        "DurableAuthAuditTrailSink",
        "LoggerLatticeAuthAuditSink"
      ],
      "source": "src/lattice.auth/LatticeAuthDecisionEvent.cs"
    },
    {
      "id": "auth-denied-log",
      "type": "ILogger event 1",
      "fields": [
        "subject_id",
        "operation",
        "tree_id",
        "key",
        "matched_rule_id",
        "policy_epoch",
        "reason"
      ],
      "emitting_component": "LoggerLatticeAuthAuditSink",
      "source": "src/lattice.auth/LoggerLatticeAuthAuditSink.cs"
    },
    {
      "id": "auth-posture-log",
      "type": "ILogger information",
      "fields": [
        "default_effect",
        "all_trees_grants_enabled",
        "access_administration_delegation_enabled"
      ],
      "emitting_component": "AuthPostureLogger",
      "source": "src/lattice.auth/AuthPostureLogger.cs"
    },
    {
      "id": "compiled-auth-snapshot-warning",
      "type": "ILogger warning",
      "fields": [
        "exception"
      ],
      "emitting_component": "CompiledPolicySnapshotMaintainer",
      "source": "src/lattice.auth/CompiledPolicySnapshotMaintainer.cs"
    },
    {
      "id": "grpc-apps-auth-failure-log",
      "type": "ILogger error",
      "fields": [
        "method",
        "exception"
      ],
      "emitting_component": "LatticeAppsApiGrpcAuthInterceptor",
      "source": "src/lattice.api.apps.grpc/Security/LatticeAppsApiGrpcAuthInterceptor.cs"
    },
    {
      "id": "grpc-apps-interceptor-rejection-log",
      "type": "ILogger warning",
      "fields": [
        "method"
      ],
      "emitting_component": "LatticeAppsApiGrpcAuthInterceptor",
      "source": "src/lattice.api.apps.grpc/Security/LatticeAppsApiGrpcAuthInterceptor.cs"
    },
    {
      "id": "grpc-apps-service-failure-log",
      "type": "ILogger error",
      "fields": [
        "method",
        "exception"
      ],
      "emitting_component": "LatticeAppsGrpcService",
      "source": "src/lattice.api.apps.grpc/LatticeAppsGrpcService.cs"
    },
    {
      "id": "grpc-apps-service-invalid-log",
      "type": "ILogger warning",
      "fields": [
        "method",
        "exception"
      ],
      "emitting_component": "LatticeAppsGrpcService",
      "source": "src/lattice.api.apps.grpc/LatticeAppsGrpcService.cs"
    },
    {
      "id": "grpc-auth-interceptor-rejection-log",
      "type": "ILogger warning",
      "fields": [
        "method"
      ],
      "emitting_component": "LatticeAuthApiGrpcAuthInterceptor",
      "source": "src/lattice.api.auth.grpc/Security/LatticeAuthApiGrpcAuthInterceptor.cs"
    },
    {
      "id": "grpc-tenantadmin-interceptor-rejection-log",
      "type": "ILogger warning",
      "fields": [
        "method"
      ],
      "emitting_component": "LatticeTenantAdminApiGrpcAuthInterceptor",
      "source": "src/lattice.api.tenantadmin.grpc/Security/LatticeTenantAdminApiGrpcAuthInterceptor.cs"
    },
    {
      "id": "mcp-app-tool-activation-warning",
      "type": "ILogger warning",
      "fields": [
        "app_slug",
        "app_version",
        "reason"
      ],
      "emitting_component": "AppMcpToolSource",
      "source": "src/lattice.api.mcp.apps/AppMcpToolSource.cs"
    },
    {
      "id": "mcp-app-tool-resolution-warning",
      "type": "ILogger warning",
      "fields": [
        "exception"
      ],
      "emitting_component": "AppMcpToolSource",
      "source": "src/lattice.api.mcp.apps/AppMcpToolSource.cs"
    },
    {
      "id": "tenant-placement-snapshot-warning",
      "type": "ILogger warning",
      "fields": [
        "exception"
      ],
      "emitting_component": "TenantPlacementSnapshotMaintainer",
      "source": "src/lattice.tenancy/TenantPlacementSnapshotMaintainer.cs"
    },
    {
      "id": "tenant-policy-snapshot-warning",
      "type": "ILogger warning",
      "fields": [
        "exception"
      ],
      "emitting_component": "CompiledTenantPolicySnapshotMaintainer",
      "source": "src/lattice.tenancy/CompiledTenantPolicySnapshotMaintainer.cs"
    },
    {
      "id": "tenant-residency-snapshot-warning",
      "type": "ILogger warning",
      "fields": [
        "exception"
      ],
      "emitting_component": "TenantResidencySnapshotMaintainer",
      "source": "src/lattice.tenancy/TenantResidencySnapshotMaintainer.cs"
    },
    {
      "id": "tenant-usage-index-warning",
      "type": "ILogger warning",
      "fields": [
        "exception"
      ],
      "emitting_component": "TenantUsageIndexMaintainer",
      "source": "src/lattice.tenancy/TenantUsageIndexMaintainer.cs"
    }
  ],
  "metrics": [
    {
      "id": "api-mcp-tool-client-errors",
      "name": "orleans.lattice.api.mcp.tool.client_errors",
      "instrument": "Counter<long>",
      "tags": [
        "tool",
        "reason"
      ],
      "source": "src/lattice.api.mcp/LatticeApiMcpMetrics.cs"
    },
    {
      "id": "auth-admin-audit-write-failures",
      "name": "orleans.lattice.auth.admin_audit.write_failures",
      "instrument": "Counter<long>",
      "tags": [
        "tenant"
      ],
      "source": "src/lattice.auth/LatticeAuthMetrics.cs"
    },
    {
      "id": "auth-decision-duration",
      "name": "orleans.lattice.auth.decision.duration",
      "instrument": "Histogram<double>",
      "tags": [
        "operation",
        "tree",
        "tenant",
        "effect"
      ],
      "source": "src/lattice.auth/LatticeAuthMetrics.cs"
    },
    {
      "id": "auth-decisions",
      "name": "orleans.lattice.auth.decisions",
      "instrument": "Counter<long>",
      "tags": [
        "operation",
        "tree",
        "tenant",
        "effect"
      ],
      "source": "src/lattice.auth/LatticeAuthMetrics.cs"
    },
    {
      "id": "auth-snapshot-age",
      "name": "orleans.lattice.auth.snapshot.age",
      "instrument": "ObservableGauge",
      "tags": [],
      "source": "src/lattice.auth/AuthSnapshotGaugeRegistry.cs"
    },
    {
      "id": "auth-snapshot-epoch",
      "name": "orleans.lattice.auth.snapshot.epoch",
      "instrument": "ObservableGauge",
      "tags": [],
      "source": "src/lattice.auth/AuthSnapshotGaugeRegistry.cs"
    },
    {
      "id": "auth-snapshot-rebuilds",
      "name": "orleans.lattice.auth.snapshot.rebuilds",
      "instrument": "Counter<long>",
      "tags": [],
      "source": "src/lattice.auth/LatticeAuthMetrics.cs"
    },
    {
      "id": "auth-snapshot-subjects",
      "name": "orleans.lattice.auth.snapshot.subjects",
      "instrument": "ObservableGauge",
      "tags": [],
      "source": "src/lattice.auth/AuthSnapshotGaugeRegistry.cs"
    },
    {
      "id": "backup-cross-tree-fence-drain-wait",
      "name": "orleans.lattice.backup.cross_tree_fence.drain_wait",
      "instrument": "Histogram<double>",
      "tags": [],
      "source": "src/lattice.backup/BackupMetrics.cs"
    },
    {
      "id": "backup-cross-tree-fence-drained-in-flight",
      "name": "orleans.lattice.backup.cross_tree_fence.drained_in_flight",
      "instrument": "Counter<long>",
      "tags": [],
      "source": "src/lattice.backup/BackupMetrics.cs"
    },
    {
      "id": "backup-cross-tree-fence-retries",
      "name": "orleans.lattice.backup.cross_tree_fence.retries",
      "instrument": "Counter<long>",
      "tags": [],
      "source": "src/lattice.backup/BackupMetrics.cs"
    },
    {
      "id": "backup-cross-tree-fence-selections",
      "name": "orleans.lattice.backup.cross_tree_fence.selections",
      "instrument": "Counter<long>",
      "tags": [
        "tree_count"
      ],
      "source": "src/lattice.backup/BackupMetrics.cs"
    },
    {
      "id": "membership-directory-search-duration",
      "name": "orleans.lattice.membership.directory.search.duration",
      "instrument": "Histogram<double>",
      "tags": [
        "tenant"
      ],
      "source": "src/lattice.membership/LatticeMembershipMetrics.cs"
    },
    {
      "id": "membership-directory-search-hits",
      "name": "orleans.lattice.membership.directory.search.hits",
      "instrument": "Counter<long>",
      "tags": [
        "tenant"
      ],
      "source": "src/lattice.membership/LatticeMembershipMetrics.cs"
    },
    {
      "id": "membership-directory-search-misses",
      "name": "orleans.lattice.membership.directory.search.misses",
      "instrument": "Counter<long>",
      "tags": [
        "tenant"
      ],
      "source": "src/lattice.membership/LatticeMembershipMetrics.cs"
    },
    {
      "id": "membership-resolution-cache-hits",
      "name": "orleans.lattice.membership.resolution_cache.hits",
      "instrument": "Counter<long>",
      "tags": [
        "tenant"
      ],
      "source": "src/lattice.membership/LatticeMembershipMetrics.cs"
    },
    {
      "id": "membership-resolution-cache-misses",
      "name": "orleans.lattice.membership.resolution_cache.misses",
      "instrument": "Counter<long>",
      "tags": [
        "tenant"
      ],
      "source": "src/lattice.membership/LatticeMembershipMetrics.cs"
    },
    {
      "id": "replication-grpc-insecure-channel",
      "name": "orleans.lattice.replication.grpc.insecure_channel",
      "instrument": "Counter<long>",
      "tags": [
        "peer",
        "transport"
      ],
      "source": "src/lattice.replication.grpc/LatticeReplicationGrpcMetrics.cs"
    },
    {
      "id": "tenancy-overage-bytes",
      "name": "orleans.lattice.tenancy.overage.bytes",
      "instrument": "ObservableGauge",
      "tags": [
        "tenant"
      ],
      "source": "src/lattice.tenancy/LatticeTenantMetrics.cs"
    },
    {
      "id": "tenancy-overage-keys",
      "name": "orleans.lattice.tenancy.overage.keys",
      "instrument": "ObservableGauge",
      "tags": [
        "tenant"
      ],
      "source": "src/lattice.tenancy/LatticeTenantMetrics.cs"
    },
    {
      "id": "tenancy-overage-memory-bytes",
      "name": "orleans.lattice.tenancy.overage.memory_bytes",
      "instrument": "ObservableGauge",
      "tags": [
        "tenant"
      ],
      "source": "src/lattice.tenancy/LatticeTenantMetrics.cs"
    },
    {
      "id": "tenancy-overage-trees",
      "name": "orleans.lattice.tenancy.overage.trees",
      "instrument": "ObservableGauge",
      "tags": [
        "tenant"
      ],
      "source": "src/lattice.tenancy/LatticeTenantMetrics.cs"
    },
    {
      "id": "tenancy-quota-burst-percent",
      "name": "orleans.lattice.tenancy.quota.burst_percent",
      "instrument": "ObservableGauge",
      "tags": [
        "tenant"
      ],
      "source": "src/lattice.tenancy/LatticeTenantMetrics.cs"
    },
    {
      "id": "tenancy-quota-bytes",
      "name": "orleans.lattice.tenancy.quota.bytes",
      "instrument": "ObservableGauge",
      "tags": [
        "tenant"
      ],
      "source": "src/lattice.tenancy/LatticeTenantMetrics.cs"
    },
    {
      "id": "tenancy-quota-keys",
      "name": "orleans.lattice.tenancy.quota.keys",
      "instrument": "ObservableGauge",
      "tags": [
        "tenant"
      ],
      "source": "src/lattice.tenancy/LatticeTenantMetrics.cs"
    },
    {
      "id": "tenancy-quota-memory-bytes",
      "name": "orleans.lattice.tenancy.quota.memory_bytes",
      "instrument": "ObservableGauge",
      "tags": [
        "tenant"
      ],
      "source": "src/lattice.tenancy/LatticeTenantMetrics.cs"
    },
    {
      "id": "tenancy-quota-trees",
      "name": "orleans.lattice.tenancy.quota.trees",
      "instrument": "ObservableGauge",
      "tags": [
        "tenant"
      ],
      "source": "src/lattice.tenancy/LatticeTenantMetrics.cs"
    },
    {
      "id": "tenancy-tenants",
      "name": "orleans.lattice.tenancy.tenants",
      "instrument": "ObservableGauge",
      "tags": [
        "tenant"
      ],
      "source": "src/lattice.tenancy/LatticeTenantMetrics.cs"
    },
    {
      "id": "tenancy-usage-bytes",
      "name": "orleans.lattice.tenancy.usage.bytes",
      "instrument": "ObservableGauge",
      "tags": [
        "tenant"
      ],
      "source": "src/lattice.tenancy/LatticeTenantMetrics.cs"
    },
    {
      "id": "tenancy-usage-keys",
      "name": "orleans.lattice.tenancy.usage.keys",
      "instrument": "ObservableGauge",
      "tags": [
        "tenant"
      ],
      "source": "src/lattice.tenancy/LatticeTenantMetrics.cs"
    },
    {
      "id": "tenancy-usage-memory-bytes",
      "name": "orleans.lattice.tenancy.usage.memory_bytes",
      "instrument": "ObservableGauge",
      "tags": [
        "tenant"
      ],
      "source": "src/lattice.tenancy/LatticeTenantMetrics.cs"
    },
    {
      "id": "tenancy-usage-trees",
      "name": "orleans.lattice.tenancy.usage.trees",
      "instrument": "ObservableGauge",
      "tags": [
        "tenant"
      ],
      "source": "src/lattice.tenancy/LatticeTenantMetrics.cs"
    }
  ],
  "audit_controls": [
    {
      "id": "auth-admin-audit-max-pending-age",
      "field": "LatticeAuthOptions.AdminAuditMaxPendingAge",
      "default": "01:00:00",
      "source": "src/lattice.auth/LatticeAuthOptions.cs"
    },
    {
      "id": "auth-admin-audit-reconcile-interval",
      "field": "LatticeAuthOptions.AdminAuditReconcileInterval",
      "default": "00:01:00",
      "source": "src/lattice.auth/LatticeAuthOptions.cs"
    },
    {
      "id": "auth-admin-audit-reconcile-lease",
      "field": "LatticeAuthOptions.AdminAuditReconcileLease",
      "default": "00:02:00",
      "source": "src/lattice.auth/LatticeAuthOptions.cs"
    },
    {
      "id": "auth-admin-audit-switch",
      "field": "LatticeAuthOptions.EnableAdminAuditTrail",
      "default": true,
      "source": "src/lattice.auth/LatticeAuthOptions.cs"
    },
    {
      "id": "auth-admin-audit-ttl",
      "field": "LatticeAuthOptions.AdminAuditTrailTimeToLive",
      "default": null,
      "source": "src/lattice.auth/LatticeAuthOptions.cs"
    },
    {
      "id": "auth-audit-sampling",
      "field": "LatticeAuthOptions.AuditSamplingRatio",
      "default": 1.0,
      "source": "src/lattice.auth/LatticeAuthOptions.cs"
    },
    {
      "id": "auth-audit-switch",
      "field": "LatticeAuthOptions.EnableAuditSink",
      "default": false,
      "source": "src/lattice.auth/LatticeAuthOptions.cs"
    },
    {
      "id": "auth-audit-verbosity",
      "field": "LatticeAuthOptions.AuditVerbosity",
      "default": "DenyOnly",
      "source": "src/lattice.auth/LatticeAuthOptions.cs"
    },
    {
      "id": "auth-durable-trail",
      "field": "LatticeAuthOptions.EnableDurableAuditTrail",
      "default": false,
      "source": "src/lattice.auth/LatticeAuthOptions.cs"
    }
  ],
  "uncertainties": []
}
