Audience: maintainers and consumers of the serv8 SDK workspace.
The serv8 vertical's SDK workspace: one Cargo workspace holding the vertical's
contract crates and the serv8 facade crate. Every serv8 service (and external
consumer) imports through the facade, use serv8::ticket::contracts::Ticket
(namespace rule, sentin8/design/sentin8-architecture-principles.md §2.1). Zero
platform knowledge leaks the other way: sentin8 never references serv8 (§4.14).
The workspace carries wire types only. That keeps a consumer able to adopt the vertical's vocabulary without pulling the platform stack, and it keeps this repository's build fast enough to be a meaningful first gate.
| Crate | Purpose |
|---|---|
facade (package serv8) |
The namespace facade - every leaf crate nests under its service module |
crates/agent/contracts |
The autonomy ladder, risk classes, binding resolution, gate verdict |
crates/catalog/contracts |
Catalogue items, commitments, targets, escalation rules, calendars, the deadline request |
crates/ticket/contracts |
The ticket, channelled intake, the three clocks, the major incident |
crates/problem/contracts |
Problems, the known error database, the triage lookup |
crates/cmdb/contracts |
Configuration items, typed edges, bounded traversal, drift findings |
crates/change/contracts |
Change types, the auto-approval predicate, blast radius, deployments, health verdicts |
crates/secops/contracts |
Security cases, the separate verdict, tasks, containment actions |
crates/ops/contracts |
Availability and continuity, capacity, per-commitment breach risk, reports |
crates/supplier/contracts |
Suppliers, contracts, the vendor ticket bridge, customers, feedback |
crates/csi/contracts |
The improvement register, optimisation findings, evidence |
crates/mcp/contracts |
The declared tool registry entry, exposure rules, protocol errors |
[dependencies]
serv8 = { git = "https://github.com/serv-8/serv8-sdk", tag = "serv8-v1.0.0" }
use serv8::agent::contracts::{AutonomyLevel, GateVerdict};
use serv8::ticket::contracts::TicketState;
assert!(AutonomyLevel::Shadow.next_up() == Some(AutonomyLevel::Advise));
assert!(TicketState::New.is_open());
The contracts are not passive data shapes. Where a rule is stated in a service design document and can be expressed as a function, it is expressed here so the vertical holds exactly one implementation of it:
| Rule | Where it lives | Design reference |
|---|---|---|
| An autonomy level moves one step up at a time | AutonomyLevel::next_up |
serv8-agent/DESIGN.md §8 invariant 4 |
| A verdict that cannot be evaluated never allows | GateVerdict (park or deny only) |
serv8-agent/DESIGN.md §8 invariant 9 |
| A commitment holds no time value | ServiceLevel has no duration field |
serv8-catalog/DESIGN.md §8 invariant 3 |
A day or month target uses working-day arithmetic |
TargetUnit::is_working_day_mode |
serv8-catalog/DESIGN.md §3 |
| A selection fallback carries no criteria | SelectionRule::is_valid_fallback |
serv8-catalog/DESIGN.md §8 invariant 11 |
| The clock pauses iff the ticket waits on the requester | TicketState::pauses_clock |
serv8-ticket/DESIGN.md §8 invariant 6 |
| Customer-held time is excluded from elapsed time | ClockState::effective_elapsed_secs |
serv8-ticket/DESIGN.md §3 |
| The ticket lifecycle is closed | TicketState::may_move_to |
serv8-ticket/DESIGN.md §8 invariant 1 |
| Only a published known error is matched | KnownErrorState::is_matchable |
serv8-problem/DESIGN.md §8 invariant 2 |
| A positional edge carries ends on both sides or neither | CiEdge::ends_are_consistent |
serv8-cmdb/DESIGN.md §8 invariant 6 |
| A retired CI takes no new edge | CiLifecycle::admits_new_edges |
serv8-cmdb/DESIGN.md §8 invariant 9 |
| Only standard-plus-low-risk may auto-approve | may_auto_approve |
serv8-change/DESIGN.md §8 invariant 2 |
| Unknown health never completes a change | checks_permit_completion |
serv8-change/DESIGN.md §8 invariant 9 |
| A stale blast radius does not support approval | BlastRadius::supports_approval |
serv8-change/DESIGN.md §8 invariant 6 |
| A resolved security case never returns to open | case_may_move_to |
serv8-secops/DESIGN.md §8 invariant 4 |
| State and verdict are set together or not at all | SecurityIncident::state_and_verdict_agree |
serv8-secops/DESIGN.md §8 invariant 2 |
| Containment never executes before approval | ContainmentState::may_execute |
serv8-secops/DESIGN.md §8 invariant 1 |
| A recovery test needs evidence to pass | DrTest::may_pass |
serv8-ops/DESIGN.md §8 invariant 1 |
| Breach risk is scored per commitment | BreachRisk carries its metric |
serv8-ops/DESIGN.md §8 invariant 3 |
| A supplier credential is a reference | Supplier::credential_ref naming |
serv8-supplier/DESIGN.md §8 invariant 1 |
| A preference needs a lawful basis | CommunicationPreference::is_lawful |
serv8-supplier/DESIGN.md §8 invariant 2 |
| The register rejects orphan improvements | ImprovementEntry::is_admissible |
serv8-csi/DESIGN.md §8 invariant 1 |
| A realised return only follows completion | ImprovementState::admits_realised_return |
serv8-csi/DESIGN.md §8 invariant 6 |
| The MCP listener admits nothing while disabled | Exposure::admits_requests |
serv8-mcp/DESIGN.md §8 invariant 8 |
| Only two credential classes are accepted | CredentialClass::is_accepted |
serv8-mcp/DESIGN.md §8 invariant 10 |
cargo build --workspace --offline # wire types only: no network, no database
cargo test --workspace --offline
cargo clippy --workspace --all-targets -- -D warnings
cargo fmt --all
The workspace has no database, no TLS and no platform dependency, so it builds and tests in a clean container with no infrastructure.
Contracts only, no clients. SDK clients belong with the service crates that ship the endpoints they call. Keeping clients out of this repository means the contract types can be adopted by a consumer that will never speak HTTP to the vertical (a report generator, a migration tool), and it keeps the facade's dependency graph free of an HTTP stack.
Rules as functions, not documentation. A rule that lives only in prose is a rule a service can forget. Each invariant above is a method with a test, so the vertical gets one implementation and a consumer gets the check for free.
Closed enums, no catch-all strings. Channel, state, risk class, verdict and operator vocabularies are enums. A new member is a design change, which is the intent: these sets are contracts with auditors and customers, not preferences.
- Whether the contracts should grow
utoipaderives so the vertical can publish one OpenAPI document from the shared vocabulary. Today each service generates its own spec. - Whether the facade should re-export the per-service SDK clients as they land,
or keep clients a service-repo concern permanently. The design reference
(
architecture-principles.md§2.1) permits either; consistency across the tree argues for re-export.