Skip to main content

stack_ids/
ids.rs

1//! Opaque ID newtypes for cross-crate identity.
2//!
3//! Each newtype wraps a `String` and is intentionally opaque — callers
4//! should not parse the inner value. IDs are assigned by their respective
5//! authority crates; `stack-ids` only provides the type contract.
6
7use schemars::JsonSchema;
8use serde::{Deserialize, Serialize};
9use std::str::FromStr;
10
11/// Typed validation failures for canonical IDs.
12#[derive(Debug, Clone, PartialEq, Eq)]
13pub enum IdError {
14    Empty,
15    InvalidCharacter(char),
16    TooLong,
17}
18
19impl std::fmt::Display for IdError {
20    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
21        match self {
22            Self::Empty => f.write_str("ID must not be empty or whitespace"),
23            Self::InvalidCharacter(c) => write!(f, "ID contains invalid control character {c:?}"),
24            Self::TooLong => f.write_str("ID exceeds the 512 byte limit"),
25        }
26    }
27}
28impl std::error::Error for IdError {}
29
30fn validate_id(value: &str) -> Result<(), IdError> {
31    if value.trim().is_empty() {
32        return Err(IdError::Empty);
33    }
34    if value.len() > 512 {
35        return Err(IdError::TooLong);
36    }
37    if let Some(c) = value.chars().find(|c| c.is_control()) {
38        return Err(IdError::InvalidCharacter(c));
39    }
40    Ok(())
41}
42
43/// Macro to generate an opaque string-wrapper ID type with standard impls.
44macro_rules! define_id {
45    (
46        $(#[$meta:meta])*
47        $name:ident
48    ) => {
49        $(#[$meta])*
50        #[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, Serialize, JsonSchema)]
51        #[serde(transparent)]
52        pub struct $name(String);
53
54        impl $name {
55            /// Legacy constructor retained for source compatibility; validates input.
56            pub fn new(value: impl Into<String>) -> Self {
57                Self::try_new(value).expect("invalid ID; use a lifecycle constructor")
58            }
59            pub fn try_new(value: impl Into<String>) -> Result<Self, IdError> {
60                let value = value.into(); validate_id(&value)?; Ok(Self(value))
61            }
62            pub fn random(domain: &str) -> Self { Self::new(format!("v1:{domain}:{}", uuid::Uuid::new_v4())) }
63            pub fn deterministic(domain: &str, value: impl AsRef<str>) -> Result<Self, IdError> { Self::try_new(format!("v1:{domain}:det:{}", value.as_ref())) }
64            pub fn version(domain: &str, version: impl AsRef<str>, value: impl AsRef<str>) -> Result<Self, IdError> { Self::try_new(format!("v1:{domain}:{}:{}", version.as_ref(), value.as_ref())) }
65            pub fn imported(domain: &str, value: impl AsRef<str>) -> Result<Self, IdError> { Self::try_new(format!("v1:{domain}:import:{}", value.as_ref())) }
66            pub fn receipt(domain: &str, value: impl AsRef<str>) -> Result<Self, IdError> { Self::try_new(format!("v1:{domain}:receipt:{}", value.as_ref())) }
67            pub fn local(domain: &str, value: impl AsRef<str>) -> Result<Self, IdError> { Self::try_new(format!("v1:{domain}:local:{}", value.as_ref())) }
68            pub fn as_str(&self) -> &str { &self.0 }
69            pub fn is_empty(&self) -> bool { self.0.is_empty() }
70            /// Named adapter for unvalidated historical wire values.
71            pub fn from_legacy(value: impl Into<String>) -> Result<Self, IdError> { Self::try_new(value) }
72        }
73        impl std::fmt::Display for $name { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.write_str(&self.0) } }
74        impl From<&str> for $name { fn from(value: &str) -> Self { Self::new(value) } }
75        impl From<String> for $name { fn from(value: String) -> Self { Self::new(value) } }
76        impl AsRef<str> for $name { fn as_ref(&self) -> &str { &self.0 } }
77        impl FromStr for $name { type Err = IdError; fn from_str(value: &str) -> Result<Self, Self::Err> { Self::try_new(value) } }
78        impl<'de> Deserialize<'de> for $name {
79            fn deserialize<D: serde::Deserializer<'de>>(d: D) -> Result<Self, D::Error> {
80                let value = String::deserialize(d)?; Self::try_new(value).map_err(serde::de::Error::custom)
81            }
82        }
83    };
84}
85
86define_id!(
87    /// Opaque identifier for an import/export envelope.
88    ///
89    /// Assigned by the exporting authority (e.g. Forge). Stable across
90    /// re-exports of the same logical unit.
91    EnvelopeId
92);
93
94define_id!(
95    /// Opaque identifier for a claim (knowledge assertion).
96    ///
97    /// Assigned by the projection importer. Stable within a claim lineage.
98    ClaimId
99);
100
101define_id!(
102    /// Opaque identifier for a specific version of a claim.
103    ///
104    /// Each mutation to a claim's validity, status, or content produces
105    /// a new version with a new `ClaimVersionId`. The `ClaimId` remains
106    /// stable across versions.
107    ClaimVersionId
108);
109
110define_id!(
111    /// Opaque identifier for an entity (person, concept, code unit, etc.).
112    ///
113    /// The inner string is intentionally unstructured. Use domain-specific
114    /// constructors to create these (e.g. code_entity_id).
115    EntityId
116);
117
118define_id!(
119    /// Opaque identifier for an episode (causal record).
120    ///
121    /// Assigned by the episode creator. Stable within the episode's lifecycle.
122    EpisodeId
123);
124
125define_id!(
126    /// Opaque identifier for a logical retry family within one retry-owner boundary.
127    ///
128    /// One `AttemptId` exists per logical retry family. Retries inside that
129    /// boundary produce new `TrialId`s, NOT new `AttemptId`s. A new `AttemptId`
130    /// is created only when the retry owner changes (e.g. node-level retry
131    /// after transport retries are exhausted) or on explicit replay/re-enqueue.
132    AttemptId
133);
134
135define_id!(
136    /// Opaque identifier for a concrete execution within a logical retry family.
137    ///
138    /// Every retry within one owner boundary creates a new `TrialId` under
139    /// the same `AttemptId`. Each `TrialId` is globally unique (UUID v4).
140    TrialId
141);
142
143define_id!(
144    /// Opaque identifier for a stored artifact (patch, snapshot, file).
145    ///
146    /// Assigned by the artifact store. Stable across reads.
147    ArtifactId
148);
149
150define_id!(
151    /// Opaque identifier for a projection instance.
152    ///
153    /// Identifies a specific derived view (entity registry entry, temporal
154    /// claim set, etc.) within a scope.
155    ProjectionId
156);
157
158define_id!(
159    /// Opaque identifier for a relation (edge between entities).
160    ///
161    /// Assigned by the projection importer. Stable within a relation lineage.
162    /// Each mutation produces a new `RelationVersionId` under the same `RelationId`.
163    RelationId
164);
165
166define_id!(
167    /// Opaque identifier for a relation version.
168    ///
169    /// Each mutation to a relation produces a new version with a new
170    /// `RelationVersionId`. The `RelationId` remains stable across versions.
171    RelationVersionId
172);
173
174define_id!(
175    /// Opaque identifier for an import batch produced by the bridge.
176    ///
177    /// Assigned by the bridge transformation pipeline. Unique per batch.
178    ImportBatchId
179);
180
181define_id!(
182    /// Opaque identifier for a claim family spanning multiple claim versions.
183    ///
184    /// Assigned by the authoritative exporter when version lineage is known.
185    ClaimFamilyId
186);
187
188define_id!(
189    /// Opaque identifier for a higher-order assertion group.
190    ///
191    /// Used to preserve joint assertion meaning across export, bridge, and
192    /// deterministic compilation. The bridge preserves it; it does not invent it.
193    AssertionGroupId
194);
195
196define_id!(
197    /// Opaque identifier for a relation group exported by the authority.
198    ///
199    /// Relation groups allow the compiler to recover hyperedge structure without
200    /// flattening upstream semantics into pairwise folklore.
201    RelationGroupId
202);
203
204define_id!(
205    /// Opaque identifier for a joint evidence group.
206    ///
207    /// Used to tie multiple observations or assertions to a shared evidence basis.
208    JointEvidenceGroupId
209);
210
211define_id!(
212    /// Opaque identifier for a contradiction candidate group.
213    ///
214    /// Assigned upstream when the exporting authority exposes contradiction seed
215    /// structure. Kernel/runtime layers must not synthesize it from absence.
216    ContradictionGroupId
217);
218
219define_id!(
220    /// Opaque identifier for a mutual exclusion or constraint seed group.
221    ConstraintGroupId
222);
223
224define_id!(
225    /// Opaque identifier for a recursive kernel run.
226    ///
227    /// Assigned by the kernel execution layer for one bounded, rebuildable run.
228    KernelRunId
229);
230
231define_id!(
232    /// Opaque identifier for one `agent-graph` execution run.
233    ///
234    /// The graph runtime emits this type's stable textual representation at
235    /// its compatibility boundary, where run IDs are still stored as strings.
236    GraphRunId
237);
238
239define_id!(
240    /// Opaque identifier for one persisted `agent-graph` checkpoint attempt.
241    ///
242    /// This is distinct from the cross-runtime retry-lineage `AttemptId`.
243    GraphCheckpointAttemptId
244);
245
246define_id!(
247    /// Opaque identifier for a `job-queue` enqueue record.
248    ///
249    /// Its textual representation is retained at the queue storage boundary.
250    QueueJobId
251);
252
253define_id!(
254    /// Opaque identifier for an `ai-batch-queue` scheduled batch job.
255    ///
256    /// Its textual representation is retained at the queue storage boundary.
257    BatchJobId
258);
259
260define_id!(
261    /// Opaque identifier for a compiled constraint unit.
262    ConstraintId
263);
264
265define_id!(
266    /// Opaque identifier for a compiled hyperedge recovered from upstream grouping semantics.
267    HyperedgeId
268);
269
270define_id!(
271    /// Opaque identifier for a residual artifact emitted by bounded execution.
272    ResidualId
273);
274
275define_id!(
276    /// Opaque identifier for a stable syndrome signature emitted by the kernel.
277    SyndromeId
278);
279
280define_id!(
281    /// Opaque identifier for a witness artifact produced by execution or oracles.
282    WitnessId
283);
284
285define_id!(
286    /// Opaque identifier for a certificate artifact produced by execution or oracles.
287    CertificateId
288);
289
290define_id!(
291    /// Opaque identifier for a bounded oracle slice definition.
292    OracleSliceId
293);
294
295define_id!(
296    /// Opaque identifier for a bounded execution region.
297    RegionId
298);
299
300define_id!(
301    /// Opaque identifier for a stable digest of one bounded execution region.
302    RegionDigestId
303);
304
305define_id!(
306    /// Opaque identifier for a typed artifact transport crossing region boundaries.
307    ArtifactTransportId
308);
309
310define_id!(
311    /// Opaque identifier for syndrome-first repair routing.
312    RepairRouteId
313);
314
315define_id!(
316    /// Opaque identifier for one ranked local repair candidate.
317    RepairCandidateId
318);
319
320define_id!(
321    /// Opaque identifier for a nuisance-state artifact.
322    NuisanceStateId
323);
324
325define_id!(
326    /// Opaque identifier for a convergence-governance artifact.
327    ConvergenceReportId
328);
329
330define_id!(
331    /// Opaque identifier for a registered recursive operator contract.
332    OperatorId
333);
334
335define_id!(
336    /// Opaque identifier for a specific version of a registered operator contract.
337    ///
338    /// `OperatorId` stays stable across versions; `OperatorVersionId` changes when
339    /// the executable contract or policy-relevant operator surface changes.
340    OperatorVersionId
341);
342
343define_id!(
344    /// Opaque identifier for a structured refutation result artifact.
345    RefutationResultId
346);
347
348define_id!(
349    /// Opaque identifier for a structured calibration report artifact.
350    CalibrationReportId
351);
352
353define_id!(
354    /// Opaque identifier for a verification-control case.
355    VerificationCaseId
356);
357
358define_id!(
359    /// Opaque identifier for a canonical verification check plan.
360    CheckPlanId
361);
362
363define_id!(
364    /// Opaque identifier for a canonical control-plane receipt.
365    ControlReceiptId
366);
367
368define_id!(
369    /// Opaque identifier for an append-only verification ledger entry.
370    LedgerEntryId
371);
372
373define_id!(
374    /// Opaque identifier for a policy decision artifact.
375    PolicyDecisionId
376);
377
378define_id!(
379    /// Opaque identifier for a runtime execution permit.
380    ///
381    /// Minted only after policy, approval, and plan checks succeed for one
382    /// concrete execution surface.
383    ExecutionPermitId
384);
385
386define_id!(
387    /// Opaque identifier for an approval record artifact.
388    ApprovalRecordId
389);
390
391define_id!(
392    /// Opaque identifier for a typed constitutional approval grant.
393    ///
394    /// Grants carry scoped approval lineage for effectful tool dispatch.
395    ApprovalGrantId
396);
397
398define_id!(
399    /// Opaque identifier for a promotion decision artifact.
400    PromotionDecisionId
401);
402
403define_id!(
404    /// Opaque identifier for a refutation decision artifact.
405    RefutationDecisionId
406);
407
408define_id!(
409    /// Opaque identifier for a rollback plan artifact.
410    RollbackPlanId
411);
412
413define_id!(
414    /// Opaque identifier for a calibration snapshot artifact.
415    CalibrationSnapshotId
416);
417
418define_id!(
419    /// Opaque identifier for a versioned learning update artifact.
420    LearningUpdateId
421);
422
423define_id!(
424    /// Opaque identifier for a deterministic boundary repair record artifact.
425    BoundaryRepairRecordId
426);
427
428define_id!(
429    /// Opaque identifier for a semantics profile artifact.
430    SemanticsProfileId
431);
432
433define_id!(
434    /// Opaque identifier for a claim-state artifact.
435    ClaimStateId
436);
437
438define_id!(
439    /// Opaque identifier for a semantic diff artifact.
440    SemanticDiffId
441);
442
443define_id!(
444    /// Opaque identifier for a causal-attribution bundle artifact.
445    CausalAttributionBundleId
446);
447
448define_id!(
449    /// Opaque identifier for an explicit degradation record artifact.
450    DegradationRecordId
451);
452
453define_id!(
454    /// Opaque identifier for an exactness-budget artifact.
455    ExactnessBudgetId
456);
457
458define_id!(
459    /// Opaque identifier for one exported or imported support-set artifact.
460    ///
461    /// Stable for one snapshot of the support expression attached to a claim.
462    SupportSetId
463);
464
465define_id!(
466    /// Opaque identifier for one contradiction-witness artifact.
467    ///
468    /// Used to point at a stored explanation of why a claim is simultaneously
469    /// supported and refuted within one semantics profile.
470    ContradictionWitnessId
471);
472
473define_id!(
474    /// Opaque identifier for one retraction / supersession artifact.
475    ///
476    /// This identifies the transaction-time event that closes currentness for
477    /// a claim version without erasing historical visibility.
478    RetractionRecordId
479);
480
481define_id!(
482    /// Opaque identifier for an intervention bundle artifact.
483    InterventionId
484);
485
486define_id!(
487    /// Opaque identifier for an outcome-schema artifact.
488    OutcomeSchemaId
489);
490
491define_id!(
492    /// Opaque identifier for an experiment case artifact.
493    ExperimentCaseId
494);
495
496define_id!(
497    /// Opaque identifier for a cohort-contract artifact.
498    CohortContractId
499);
500
501define_id!(
502    /// Opaque identifier for a comparability-matrix artifact.
503    ComparabilityMatrixId
504);
505
506define_id!(
507    /// Opaque identifier for a counterfactual-slice artifact.
508    CounterfactualSliceId
509);
510
511define_id!(
512    /// Opaque identifier for a decision-trace artifact.
513    DecisionTraceId
514);
515
516define_id!(
517    /// Opaque identifier for a refuter-suite artifact.
518    RefuterSuiteId
519);
520
521define_id!(
522    /// Opaque identifier for a refuter-result artifact.
523    RefuterResultId
524);
525
526define_id!(
527    /// Opaque identifier for a rollout-decision artifact.
528    RolloutDecisionId
529);
530
531define_id!(
532    /// Opaque identifier for a rollback-decision artifact.
533    RollbackDecisionId
534);
535
536define_id!(
537    /// Opaque identifier for an experiment-budget artifact.
538    ExperimentBudgetId
539);
540
541define_id!(
542    /// Opaque identifier for an attestation-envelope artifact.
543    AttestationEnvelopeId
544);
545
546define_id!(
547    /// Opaque identifier for a trust-root-set artifact.
548    TrustRootSetId
549);
550
551define_id!(
552    /// Opaque identifier for an artifact-admission-policy artifact.
553    ArtifactAdmissionPolicyId
554);
555
556define_id!(
557    /// Opaque identifier for a transparency-receipt artifact.
558    TransparencyReceiptId
559);
560
561define_id!(
562    /// Opaque identifier for an attestation-revocation artifact.
563    AttestationRevocationId
564);
565
566define_id!(
567    /// Opaque identifier for an attestation-supersession artifact.
568    AttestationSupersessionId
569);
570
571define_id!(
572    /// Opaque identifier for a remote-oracle lease artifact.
573    RemoteOracleLeaseId
574);
575
576define_id!(
577    /// Opaque identifier for a remote-slice request artifact.
578    RemoteSliceRequestId
579);
580
581define_id!(
582    /// Opaque identifier for a remote-slice result artifact.
583    RemoteSliceResultId
584);
585
586define_id!(
587    /// Opaque identifier for a cross-runtime replay-ticket artifact.
588    CrossRuntimeReplayTicketId
589);
590
591define_id!(
592    /// Opaque identifier for a dispute-bundle artifact.
593    DisputeBundleId
594);
595
596define_id!(
597    /// Opaque identifier for a disclosure-policy artifact.
598    DisclosurePolicyId
599);
600
601define_id!(
602    /// Opaque identifier for a disclosure-budget artifact.
603    DisclosureBudgetId
604);
605
606define_id!(
607    /// Opaque identifier for a treaty bundle artifact.
608    TreatyBundleId
609);
610
611define_id!(
612    /// Opaque identifier for a runtime identity set artifact.
613    RuntimeIdentitySetId
614);
615
616define_id!(
617    /// Opaque identifier for a cross-runtime equivalence bundle artifact.
618    CrossRuntimeEquivalenceBundleId
619);
620
621define_id!(
622    /// Opaque identifier for a settlement case artifact.
623    SettlementCaseId
624);
625
626define_id!(
627    /// Opaque identifier for a shared disposition artifact.
628    SharedDispositionId
629);
630
631define_id!(
632    /// Opaque identifier for a local dissent record artifact.
633    LocalDissentId
634);
635
636define_id!(
637    /// Opaque identifier for a shared-view downgrade artifact.
638    SharedViewDowngradeId
639);
640
641define_id!(
642    /// Opaque identifier for a settlement receipt artifact.
643    SettlementReceiptId
644);
645
646define_id!(
647    /// Opaque identifier for a shared replay slice artifact.
648    SharedReplaySliceId
649);
650
651define_id!(
652    /// Opaque identifier for a shared divergence report artifact.
653    SharedDivergenceReportId
654);
655
656define_id!(
657    /// Opaque identifier for a treaty suspension artifact.
658    TreatySuspensionId
659);
660
661define_id!(
662    /// Opaque identifier for a mechanism bundle artifact.
663    MechanismBundleId
664);
665
666define_id!(
667    /// Opaque identifier for a theory version artifact.
668    TheoryVersionId
669);
670
671define_id!(
672    /// Opaque identifier for a theory library artifact.
673    TheoryLibraryId
674);
675
676define_id!(
677    /// Opaque identifier for a hypothesis library artifact.
678    HypothesisLibraryId
679);
680
681define_id!(
682    /// Opaque identifier for a simulation contract artifact.
683    SimulationContractId
684);
685
686define_id!(
687    /// Opaque identifier for a fit-run artifact.
688    FitRunId
689);
690
691define_id!(
692    /// Opaque identifier for a theory refuter suite artifact.
693    TheoryRefuterSuiteId
694);
695
696define_id!(
697    /// Opaque identifier for a rollout stability report artifact.
698    RolloutStabilityReportId
699);
700
701define_id!(
702    /// Opaque identifier for a discovery program artifact.
703    DiscoveryProgramId
704);
705
706define_id!(
707    /// Opaque identifier for a portfolio plan artifact.
708    PortfolioPlanId
709);
710
711define_id!(
712    /// Opaque identifier for an experiment campaign artifact.
713    ExperimentCampaignId
714);
715
716define_id!(
717    /// Opaque identifier for a campaign decision trace artifact.
718    CampaignDecisionTraceId
719);
720
721define_id!(
722    /// Opaque identifier for an information-value estimate artifact.
723    InformationValueEstimateId
724);
725
726define_id!(
727    /// Opaque identifier for a verification-load budget artifact.
728    VerificationLoadBudgetId
729);
730
731define_id!(
732    /// Opaque identifier for a charter bundle artifact.
733    CharterBundleId
734);
735
736define_id!(
737    /// Opaque identifier for a doctrine snapshot artifact.
738    DoctrineSnapshotId
739);
740
741define_id!(
742    /// Opaque identifier for an amendment proposal artifact.
743    AmendmentProposalId
744);
745
746define_id!(
747    /// Opaque identifier for an amendment decision artifact.
748    AmendmentDecisionId
749);
750
751define_id!(
752    /// Opaque identifier for an archive manifest artifact.
753    ArchiveManifestId
754);
755
756define_id!(
757    /// Opaque identifier for a compaction receipt artifact.
758    CompactionReceiptId
759);
760
761define_id!(
762    /// Opaque identifier for a historical query guarantee artifact.
763    HistoricalQueryGuaranteeId
764);
765
766define_id!(
767    /// Opaque identifier for a deprecation bundle artifact.
768    DeprecationBundleId
769);
770
771define_id!(
772    /// Opaque identifier for a retirement bundle artifact.
773    RetirementBundleId
774);
775
776define_id!(
777    /// Opaque identifier for a spec bundle artifact.
778    SpecBundleId
779);
780
781define_id!(
782    /// Opaque identifier for a normative AST artifact.
783    NormativeAstId
784);
785
786define_id!(
787    /// Opaque identifier for a generated schema bundle artifact.
788    GeneratedSchemaBundleId
789);
790
791define_id!(
792    /// Opaque identifier for a generated interpreter bundle artifact.
793    GeneratedInterpreterBundleId
794);
795
796define_id!(
797    /// Opaque identifier for a generated conformance corpus artifact.
798    GeneratedConformanceCorpusId
799);
800
801define_id!(
802    /// Opaque identifier for a generated migration plan artifact.
803    GeneratedMigrationPlanId
804);
805
806define_id!(
807    /// Opaque identifier for a proof-obligation set artifact.
808    ProofObligationSetId
809);
810
811define_id!(
812    /// Opaque identifier for a proof evaluation receipt artifact.
813    ProofEvaluationReceiptId
814);
815
816define_id!(
817    /// Opaque identifier for a human-veto bundle artifact.
818    HumanVetoBundleId
819);
820
821define_id!(
822    /// Opaque identifier for a meta-challenge bundle artifact.
823    MetaChallengeBundleId
824);
825
826define_id!(
827    /// Opaque identifier for a self-hosting build receipt artifact.
828    SelfHostingBuildReceiptId
829);
830
831define_id!(
832    /// Opaque identifier for an effect intent artifact.
833    EffectIntentId
834);
835
836define_id!(
837    /// Opaque identifier for an effect preflight report artifact.
838    EffectPreflightReportId
839);
840
841define_id!(
842    /// Opaque identifier for an effect execution window artifact.
843    EffectWindowId
844);
845
846define_id!(
847    /// Opaque identifier for an effect commit decision artifact.
848    EffectCommitDecisionId
849);
850
851define_id!(
852    /// Opaque identifier for an effect execution receipt artifact.
853    EffectExecutionReceiptId
854);
855
856define_id!(
857    /// Opaque identifier for an effect observation bundle artifact.
858    EffectObservationBundleId
859);
860
861define_id!(
862    /// Opaque identifier for a compensation plan artifact.
863    CompensationPlanId
864);
865
866define_id!(
867    /// Opaque identifier for a compensation execution receipt artifact.
868    CompensationExecutionReceiptId
869);
870
871define_id!(
872    /// Opaque identifier for an external effect ledger entry artifact.
873    ExternalEffectLedgerEntryId
874);
875
876define_id!(
877    /// Opaque identifier for a capability class artifact.
878    CapabilityClassId
879);
880
881define_id!(
882    /// Opaque identifier for an authority lease artifact.
883    AuthorityLeaseId
884);
885
886define_id!(
887    /// Opaque identifier for a delegation bundle artifact.
888    DelegationBundleId
889);
890
891define_id!(
892    /// Opaque identifier for an authority chain artifact.
893    AuthorityChainId
894);
895
896define_id!(
897    /// Opaque identifier for a separation-of-duties policy artifact.
898    SeparationOfDutiesPolicyId
899);
900
901define_id!(
902    /// Opaque identifier for a dual-control approval artifact.
903    DualControlApprovalId
904);
905
906define_id!(
907    /// Opaque identifier for a break-glass grant artifact.
908    BreakGlassGrantId
909);
910
911define_id!(
912    /// Opaque identifier for a delegation revocation artifact.
913    DelegationRevocationId
914);
915
916define_id!(
917    /// Opaque identifier for an acting-on-behalf receipt artifact.
918    ActingOnBehalfReceiptId
919);
920
921define_id!(
922    /// Opaque identifier for a conflict disclosure artifact.
923    ConflictDisclosureId
924);
925
926define_id!(
927    /// Opaque identifier for a deployment profile artifact.
928    DeploymentProfileId
929);
930
931define_id!(
932    /// Opaque identifier for an operating envelope artifact.
933    OperatingEnvelopeId
934);
935
936define_id!(
937    /// Opaque identifier for an assurance case artifact.
938    AssuranceCaseId
939);
940
941define_id!(
942    /// Opaque identifier for a hazard register artifact.
943    HazardRegisterId
944);
945
946define_id!(
947    /// Opaque identifier for a control mapping artifact.
948    ControlMappingId
949);
950
951define_id!(
952    /// Opaque identifier for a residual-risk acceptance artifact.
953    ResidualRiskAcceptanceId
954);
955
956define_id!(
957    /// Opaque identifier for a release-readiness decision artifact.
958    ReleaseReadinessDecisionId
959);
960
961define_id!(
962    /// Opaque identifier for a field monitoring plan artifact.
963    FieldMonitoringPlanId
964);
965
966define_id!(
967    /// Opaque identifier for a certification bundle artifact.
968    CertificationBundleId
969);
970
971define_id!(
972    /// Opaque identifier for a recertification trigger artifact.
973    RecertificationTriggerId
974);
975
976define_id!(
977    /// Opaque identifier for a service-level profile artifact.
978    ServiceLevelProfileId
979);
980
981define_id!(
982    /// Opaque identifier for an error-budget ledger artifact.
983    ErrorBudgetLedgerId
984);
985
986define_id!(
987    /// Opaque identifier for an incident case artifact.
988    IncidentCaseId
989);
990
991define_id!(
992    /// Opaque identifier for a containment decision artifact.
993    ContainmentDecisionId
994);
995
996define_id!(
997    /// Opaque identifier for a forensic freeze artifact.
998    ForensicFreezeId
999);
1000
1001define_id!(
1002    /// Opaque identifier for a recovery plan artifact.
1003    RecoveryPlanId
1004);
1005
1006define_id!(
1007    /// Opaque identifier for a recovery replay slice artifact.
1008    RecoveryReplaySliceId
1009);
1010
1011define_id!(
1012    /// Opaque identifier for a bounded continuity exception artifact.
1013    ContinuityExceptionId
1014);
1015
1016define_id!(
1017    /// Opaque identifier for a postmortem bundle artifact.
1018    PostmortemBundleId
1019);
1020
1021define_id!(
1022    /// Opaque identifier for a resilience exercise artifact.
1023    ResilienceExerciseId
1024);
1025
1026define_id!(
1027    /// Opaque identifier for an effect review case artifact.
1028    EffectReviewCaseId
1029);
1030
1031define_id!(
1032    /// Opaque identifier for an effect block receipt artifact.
1033    EffectBlockReceiptId
1034);
1035
1036define_id!(
1037    /// Opaque identifier for a delegation review case artifact.
1038    DelegationReviewCaseId
1039);
1040
1041define_id!(
1042    /// Opaque identifier for a release gate case artifact.
1043    ReleaseGateCaseId
1044);
1045
1046define_id!(
1047    /// Opaque identifier for a continuity review case artifact.
1048    ContinuityReviewCaseId
1049);
1050
1051define_id!(
1052    /// Opaque identifier for an effect policy profile artifact.
1053    EffectPolicyProfileId
1054);
1055
1056define_id!(
1057    /// Opaque identifier for a delegation policy profile artifact.
1058    DelegationPolicyProfileId
1059);
1060
1061define_id!(
1062    /// Opaque identifier for a release policy profile artifact.
1063    ReleasePolicyProfileId
1064);
1065
1066define_id!(
1067    /// Opaque identifier for a continuity policy profile artifact.
1068    ContinuityPolicyProfileId
1069);
1070
1071define_id!(
1072    /// Opaque identifier for an effect adjudication receipt artifact.
1073    EffectAdjudicationReceiptId
1074);
1075
1076define_id!(
1077    /// Opaque identifier for a release rollback decision artifact.
1078    ReleaseRollbackDecisionId
1079);
1080
1081define_id!(
1082    /// Opaque identifier for a tool effect dispatch receipt artifact.
1083    ToolEffectDispatchReceiptId
1084);
1085
1086define_id!(
1087    /// Opaque identifier for a privacy/retention profile artifact.
1088    PrivacyRetentionProfileId
1089);
1090
1091define_id!(
1092    /// Opaque identifier for a redaction rule-set artifact.
1093    RedactionRuleSetId
1094);
1095
1096define_id!(
1097    /// Opaque identifier for an access-purpose matrix artifact.
1098    AccessPurposeMatrixId
1099);
1100
1101define_id!(
1102    /// Opaque identifier for an audit extraction policy artifact.
1103    AuditExtractionPolicyId
1104);
1105
1106define_id!(
1107    /// Opaque identifier for a residency policy profile artifact.
1108    ResidencyPolicyProfileId
1109);
1110
1111define_id!(
1112    /// Opaque identifier for a tenant-boundary profile artifact.
1113    TenantBoundaryProfileId
1114);
1115
1116define_id!(
1117    /// Opaque identifier for a cross-boundary transfer class artifact.
1118    CrossBoundaryTransferClassId
1119);
1120
1121define_id!(
1122    /// Opaque identifier for a locality exception artifact.
1123    LocalityExceptionId
1124);
1125
1126define_id!(
1127    /// Opaque identifier for a role catalog artifact.
1128    RoleCatalogId
1129);
1130
1131define_id!(
1132    /// Opaque identifier for a delegation matrix artifact.
1133    DelegationMatrixId
1134);
1135
1136define_id!(
1137    /// Opaque identifier for an approval matrix artifact.
1138    ApprovalMatrixId
1139);
1140
1141define_id!(
1142    /// Opaque identifier for a conflict-class catalog artifact.
1143    ConflictClassCatalogId
1144);
1145
1146define_id!(
1147    /// Opaque identifier for a regulatory-regime profile artifact.
1148    RegulatoryRegimeProfileId
1149);
1150
1151define_id!(
1152    /// Opaque identifier for a requirement-to-control map artifact.
1153    RequirementControlMapId
1154);
1155
1156define_id!(
1157    /// Opaque identifier for an evidence collection plan artifact.
1158    EvidenceCollectionPlanId
1159);
1160
1161define_id!(
1162    /// Opaque identifier for a recertification schedule artifact.
1163    RecertificationScheduleId
1164);
1165
1166define_id!(
1167    /// Opaque identifier for a hazard library artifact.
1168    HazardLibraryId
1169);
1170
1171define_id!(
1172    /// Opaque identifier for a hazard scenario artifact.
1173    HazardScenarioId
1174);
1175
1176define_id!(
1177    /// Opaque identifier for a monitor catalog artifact.
1178    MonitorCatalogId
1179);
1180
1181define_id!(
1182    /// Opaque identifier for a mitigation playbook artifact.
1183    MitigationPlaybookId
1184);
1185
1186define_id!(
1187    /// Opaque identifier for a vendor certification adapter artifact.
1188    VendorCertificationAdapterId
1189);
1190
1191define_id!(
1192    /// Opaque identifier for a vendor evidence translation artifact.
1193    VendorEvidenceTranslationId
1194);
1195
1196define_id!(
1197    /// Opaque identifier for a vendor trust-root binding artifact.
1198    VendorTrustRootBindingId
1199);
1200
1201define_id!(
1202    /// Opaque identifier for a vendor revocation handling artifact.
1203    VendorRevocationHandlingId
1204);
1205
1206define_id!(
1207    /// Opaque identifier for an incident taxonomy artifact.
1208    IncidentTaxonomyId
1209);
1210
1211define_id!(
1212    /// Opaque identifier for a severity matrix artifact.
1213    SeverityMatrixId
1214);
1215
1216define_id!(
1217    /// Opaque identifier for a pager-route profile artifact.
1218    PagerRouteProfileId
1219);
1220
1221define_id!(
1222    /// Opaque identifier for an escalation-clock policy artifact.
1223    EscalationClockPolicyId
1224);
1225
1226define_id!(
1227    /// Opaque identifier for an applicability-context artifact.
1228    ApplicabilityContextId
1229);
1230
1231define_id!(
1232    /// Opaque identifier for a normalized profile-set artifact.
1233    ProfileSetId
1234);
1235
1236define_id!(
1237    /// Opaque identifier for a composition rule-set artifact.
1238    CompositionRuleSetId
1239);
1240
1241define_id!(
1242    /// Opaque identifier for a composition receipt artifact.
1243    CompositionReceiptId
1244);
1245
1246define_id!(
1247    /// Opaque identifier for an effective constitution artifact.
1248    EffectiveConstitutionId
1249);
1250
1251define_id!(
1252    /// Opaque identifier for a compiled obligation-set artifact.
1253    CompiledObligationSetId
1254);
1255
1256define_id!(
1257    /// Opaque identifier for a composition conflict-set artifact.
1258    CompositionConflictSetId
1259);
1260
1261define_id!(
1262    /// Opaque identifier for a profile exception bundle artifact.
1263    ProfileExceptionBundleId
1264);
1265
1266define_id!(
1267    /// Opaque identifier for a policy impact diff artifact.
1268    PolicyImpactDiffId
1269);
1270
1271impl AttemptId {
1272    pub fn generate() -> Self {
1273        Self::random("attempt")
1274    }
1275}
1276impl TrialId {
1277    pub fn generate() -> Self {
1278        Self::random("trial")
1279    }
1280}
1281
1282/// Backward-compatible generate() for all ID types that had it before ID-001.
1283/// These delegate to random() with a sensible domain prefix.
1284macro_rules! impl_generate {
1285    ($name:ident, $domain:literal) => {
1286        impl $name {
1287            pub fn generate() -> Self {
1288                Self::random($domain)
1289            }
1290        }
1291    };
1292}
1293
1294impl_generate!(ClaimId, "claim");
1295impl_generate!(ClaimVersionId, "claim_version");
1296impl_generate!(EpisodeId, "episode");
1297impl_generate!(RelationVersionId, "relation_version");
1298impl_generate!(FitRunId, "fit_run");
1299impl_generate!(CampaignDecisionTraceId, "campaign_decision");
1300impl_generate!(AmendmentDecisionId, "amendment_decision");
1301impl_generate!(ApprovalGrantId, "approval_grant");
1302impl_generate!(ArchiveManifestId, "archive_manifest");
1303impl_generate!(HistoricalQueryGuaranteeId, "historical_query");
1304impl_generate!(CompactionReceiptId, "compaction_receipt");
1305impl_generate!(ProofEvaluationReceiptId, "proof_eval_receipt");
1306impl_generate!(SelfHostingBuildReceiptId, "self_hosting_build");
1307impl_generate!(SettlementReceiptId, "settlement_receipt");
1308impl_generate!(SharedDivergenceReportId, "shared_divergence");
1309impl_generate!(SharedReplaySliceId, "shared_replay_slice");
1310impl_generate!(SharedViewDowngradeId, "shared_view_downgrade");
1311impl_generate!(TreatySuspensionId, "treaty_suspension");
1312impl_generate!(GeneratedConformanceCorpusId, "gen_conformance_corpus");
1313impl_generate!(GeneratedInterpreterBundleId, "gen_interpreter_bundle");
1314impl_generate!(GeneratedMigrationPlanId, "gen_migration_plan");
1315impl_generate!(GeneratedSchemaBundleId, "gen_schema_bundle");
1316impl_generate!(VerificationCaseId, "verification_case");
1317impl_generate!(ExecutionPermitId, "execution_permit");
1318impl_generate!(PolicyDecisionId, "policy_decision");
1319impl_generate!(CheckPlanId, "check_plan");
1320impl_generate!(ControlReceiptId, "control_receipt");
1321impl_generate!(LedgerEntryId, "ledger_entry");
1322impl_generate!(RepairCandidateId, "repair_candidate");
1323impl_generate!(RepairRouteId, "repair_route");
1324impl_generate!(EffectBlockReceiptId, "effect_block_receipt");
1325impl_generate!(EffectReviewCaseId, "effect_review_case");
1326impl_generate!(ContinuityReviewCaseId, "continuity_review_case");
1327impl_generate!(DelegationReviewCaseId, "delegation_review_case");
1328impl_generate!(ReleaseGateCaseId, "release_gate_case");
1329impl_generate!(ExactnessBudgetId, "exactness_budget");
1330impl_generate!(ArtifactTransportId, "artifact_transport");
1331impl_generate!(BoundaryRepairRecordId, "boundary_repair_record");
1332impl_generate!(CalibrationSnapshotId, "calibration_snapshot");
1333impl_generate!(NuisanceStateId, "nuisance_state");
1334impl_generate!(ApprovalRecordId, "approval_record");
1335impl_generate!(ApplicabilityContextId, "applicability_context");
1336impl_generate!(CompiledObligationSetId, "compiled_obligation_set");
1337impl_generate!(CompositionConflictSetId, "composition_conflict_set");
1338impl_generate!(CompositionReceiptId, "composition_receipt");
1339impl_generate!(CompositionRuleSetId, "composition_rule_set");
1340impl_generate!(EffectiveConstitutionId, "effective_constitution");
1341impl_generate!(PolicyImpactDiffId, "policy_impact_diff");
1342impl_generate!(ProfileSetId, "profile_set");
1343impl_generate!(PromotionDecisionId, "promotion_decision");
1344impl_generate!(RefutationDecisionId, "refutation_decision");
1345impl_generate!(RollbackPlanId, "rollback_plan");
1346
1347#[cfg(test)]
1348#[path = "ids_tests.rs"]
1349mod tests;