shiplog_schema/lib.rs
1#![warn(missing_docs)]
2//! Canonical event model and data types for the shiplog pipeline.
3//!
4//! Defines event envelopes, event payloads (pull requests, reviews, manual entries),
5//! coverage manifests, workstream definitions, and bundle metadata.
6//! All other crates depend on these types.
7//!
8//! # Examples
9//!
10//! Build an [`event::EventEnvelope`] from scratch:
11//!
12//! ```
13//! use shiplog_schema::event::*;
14//! use shiplog_schema::coverage::TimeWindow;
15//! use shiplog_ids::EventId;
16//! use chrono::{TimeZone, Utc};
17//!
18//! let ts = Utc.with_ymd_and_hms(2025, 6, 1, 12, 0, 0).unwrap();
19//! let envelope = EventEnvelope {
20//! id: EventId::from_parts(["github", "pr", "acme/widgets", "42"]),
21//! kind: EventKind::PullRequest,
22//! occurred_at: ts,
23//! actor: Actor { login: "octocat".into(), id: Some(1) },
24//! repo: RepoRef {
25//! full_name: "acme/widgets".into(),
26//! html_url: Some("https://github.com/acme/widgets".into()),
27//! visibility: RepoVisibility::Public,
28//! },
29//! payload: EventPayload::PullRequest(PullRequestEvent {
30//! number: 42,
31//! title: "Add feature".into(),
32//! state: PullRequestState::Merged,
33//! created_at: ts,
34//! merged_at: Some(ts),
35//! additions: Some(100),
36//! deletions: Some(20),
37//! changed_files: Some(5),
38//! touched_paths_hint: vec!["src/lib.rs".into()],
39//! window: None,
40//! }),
41//! tags: vec!["feature".into()],
42//! links: vec![],
43//! source: SourceRef {
44//! system: SourceSystem::Github,
45//! url: None,
46//! opaque_id: None,
47//! },
48//! };
49//!
50//! // Round-trips through JSON:
51//! let json = serde_json::to_string(&envelope).unwrap();
52//! let back: EventEnvelope = serde_json::from_str(&json).unwrap();
53//! assert_eq!(envelope, back);
54//! ```
55
56/// Bundle metadata types for checksums and archive manifests.
57pub mod bundle;
58/// Coverage manifest types for tracking query completeness.
59pub mod coverage;
60/// Core event model: envelopes, payloads, actors, and source provenance.
61pub mod event;
62/// Per-source freshness receipts for cache/fetch attribution.
63pub mod freshness;
64/// Workstream definitions and the top-level workstreams file format.
65pub mod workstream;