Public declaration syntax from forge-rs/harness-spec/src/error.rs Original source SHA-256: edf95e0c72d9b41828ce610c46edfbba721e1e744bd5be00659b91de7a08fbfa Function bodies and constant values are omitted. This is not the complete implementation. Source line 9 #[derive(Debug, Error)] pub enum SpecError { /// The manifest is not well-formed TOML or violates the strict serde /// schema (unknown tables, unknown keys, unknown enum variants, wrong /// scalar types). This is the first §5.16 fail-closed layer. #[error("manifest parse failed: {0}")] Parse(#[from] toml::de::Error), /// The manifest parsed but violated one or more §5 validation rules. #[error("manifest validation failed:\n{0}")] Validation(#[from] ValidationError), /// The canonical JSON projection could not be produced. Unreachable for /// derive-only manifests; reserved for defensive completeness. #[error("canonical projection failed: {0}")] Canonicalization(#[from] serde_json::Error), } Source line 31 #[derive(Debug, Clone, PartialEq, Eq)] pub struct ValidationError { } Source line 42 pub fn violations(&self) -> &[Violation]; Source line 47 pub fn contains(&self, code: ViolationCode) -> bool; Source line 69 #[derive(Debug, Clone, PartialEq, Eq)] pub struct Violation { /// Machine-checkable rule code. pub code: ViolationCode, /// Dotted manifest path of the offending value (e.g. `tools.deny_default`). pub path: String, /// Human-readable explanation, including the governing spec section. pub message: String } Source line 80 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub enum ViolationCode { /// `spec_version` is absent or not `"0.1"` (§5.1). InvalidSpecVersion, /// A URI-shaped field is malformed (§5.3, §5.4). InvalidUri, /// An OAS DID field is malformed (§5.3). InvalidDid, /// A `*_env` field is not a valid environment variable name (§5.2 /// discipline: env names, never values, live in manifests). InvalidEnvVarName, /// A required string field is empty. EmptyField, /// A tool identifier is not `/` shaped (§5.9). InvalidToolIdentifier, /// A tool identifier does not resolve against the host registry /// supplied via [`crate::ValidationContext`] (§5.9). UnresolvableToolReference, /// A harness with a non-empty tool allowlist declares no capability /// grants (§5.4). EmptyCapabilityGrants, /// `tools.deny_default` is absent or `false` (§5.9, §5.16). DenyDefaultViolation, /// `tools.approval_required` names a tool absent from `tools.allow`. ApprovalOutsideAllowlist, /// `verification.gates` is empty for a harness with a non-empty tool /// allowlist (§5.10 static approximation of the mutation rule). EmptyVerificationGates, /// A budget is absent, non-finite, or non-positive (§5.8, §5.16). NonFiniteBudget, /// `inference.route_policy` is neither `catalog:live` nor a `model:` /// pin (§5.8). InvalidRoutePolicy, /// A meter key is not exactly two dot-separated segments (§5.11, Garden /// v4 `validate_meter_key`). InvalidMeterKey, /// `telemetry.event_prefix` does not match the Cambium v1 grammar /// (§5.12). InvalidTelemetryPrefix, /// `telemetry.event_prefix` requests a privileged prefix /// (`policy`/`capability`/`approval`/`billing`) that a manifest must /// not claim (§5.12). PrivilegedTelemetryPrefix, /// A `telemetry.emit` entry is not `.` shaped (§5.12). InvalidTelemetryEvent, /// `loop.strategy` names no registered strategy (§5.13). UnregisteredLoopStrategy, /// `spawn.child_budget_fraction_max` is non-finite or outside `(0, 1]` /// (§5.13). InvalidBudgetFraction, /// `identity.max_child_depth` exceeds the runtime maximum derivation /// depth (§5.3). ChildDepthExceedsMaximum, /// `[perception].require_signed_ir` is absent or `false` (§5.14, §5.16). UnsignedPerceptionIr, /// `[perception].modalities` is empty (§5.14). EmptyModalities, /// `[perception].modalities` contains duplicates and is therefore not a /// set (§5.14). DuplicateModalities, /// `[perception].max_media_bytes` exceeds the provider ingest cap /// (§5.14: a manifest may be stricter, never looser). MediaCapExceeded, /// A capability grant or tool binding targets the voice surface, /// violating voice zero-authority (§5.15, §5.16). VoiceAuthorityGrant, /// A `[voice]` rule was violated: `constrained_verbalization` not /// `true`, or another §5.15 MUST (§5.15, §5.16). VoiceRuleViolation, /// `[voice].faithfulness_sampling` is non-finite or outside `[0, 1]` /// (§5.15). InvalidSamplingFraction, }