Architecture
Contracts and Versioning
Alpha
DSAR is currently in alpha. APIs, package surfaces, configuration, and documentation may change as the project evolves.
This document defines the canonical contract taxonomy and semver policy for @dsar/schema.
Type taxonomy and stability
| Domain | Contract examples | Stability |
|---|---|---|
| Request | Request, RequestType, RequestStatus, IntakeSource, Requestor, Authority, CapturedIntake | Public-stable |
| Policy | PolicyPackVersion, JurisdictionCode, RequestClock, ClockSegment | Public-stable |
| Verification | VerificationLevel, VerificationCase | Public-stable |
| Fulfillment | FulfillmentArtifact, ArtifactManifest, FulfillmentManifest, RefusalReasonCode | Public-stable |
| Delivery | DeliveryPackage and delivery challenge/log contracts | Public-stable |
| Appeals | Appeal | Public-stable |
| Retention | RetentionPolicy | Public-stable |
| Audit/Event | AuditEvent, lifecycle transition contracts | Public-stable |
| Internal | helper metadata and utility schemas used to support public contracts | Internal-evolving |
Semver contract policy
- Additive fields and additive enum members are minor changes.
- Renaming or removing fields is a major change.
- Contract behavior changes (same shape, different semantics) require migration notes and are treated as major unless explicitly backward compatible.
- Optional metadata fields should be used when extension points are required without breaking public contracts.
Lifecycle transition contract
LifecycleTransition is the canonical transition payload and includes:
- state movement:
from,to - rationale:
reasonCode, optionalrationale - accountability: optional
actor - temporal context:
occurredAt - legal clock mutation details: optional
legalClockMutation - approval linkage: optional
approval
This contract is shared by backend runtime, audit/event pipelines, and downstream SDK/CLI workflows.
Public export map
All public symbols are exported from @dsar/schema (and mirrored via @dsar/schema/types for type-path compatibility):
- Request contracts:
RequestSchema,Request,RequestType,RequestStatus,IntakeSource,Requestor,Authority,CapturedIntake. - Policy/clock contracts:
PolicyPackVersion,JurisdictionCode,RequestClock,ClockSegment. - Verification contracts:
VerificationCase,VerificationLevel. - Fulfillment contracts:
FulfillmentArtifact,ArtifactManifest,FulfillmentManifest,RefusalReasonCode. - Delivery contracts:
DeliveryPackageand delivery challenge/log schemas. - Appeals contracts:
Appeal. - Retention contracts:
RetentionPolicy. - Audit contracts:
AuditEvent, hash-chain fields (prevHash,hash,hashAlg,sequence). - Cross-cutting contracts:
LifecycleTransition,ErrorEnvelope,ResponseMetadata.