Skip to main content

Module booking_triage

Module booking_triage 

Source
Expand description

Booking triage contracts for deterministic review before agent drafting.

The app evaluates reservation readiness from policy/evidence first. Agents may draft review packets or customer-safe scripts only after the deterministic packet exposes the allowed review boundary; provider mutation, booking confirmation, customer sends, and payment movement remain blocked actions.

The typestate request machine models the safe sequence for triage evidence: intake, pet profile attachment, reservation fact attachment, deterministic review, and staff-ready handoff. The machine’s generated helper pages are a statum implementation detail; this module documents the operational contract here and on the source state variants so external readers understand that the generated Request/state APIs enforce evidence order rather than granting live booking authority.

use app::booking_triage as triage;

let vaccine_review = triage::rule::ReviewFinding::builder()
    .rule_id(triage::rule::Id::VaccineRequirements)
    .failure_code(triage::FailureCode::MissingOrUnverifiedVaccine)
    .readiness_bucket(triage::ReadinessBucket::VaccinePending)
    .human_approval_required(triage::ApprovalGate::MedicalDocumentReview)
    .evidence_refs(vec![triage::EvidenceRef::try_new(
        "gingr:reservation:fixture-123:vaccine-expired",
    )?])
    .build();

let deterministic = triage::DeterministicResult::evaluate(vec![
    triage::rule::Evaluation::needs_human_approval(vaccine_review),
]);

assert_eq!(deterministic.recommended_status(), triage::ReadinessBucket::VaccinePending);
assert!(deterministic.requires(triage::ApprovalGate::MedicalDocumentReview));
assert_eq!(deterministic.staff_decision_boundary(), triage::StaffDecisionBoundary::ReviewPacketOnly);
assert!(deterministic.blocked_actions().contains(&triage::BlockedAction::ConfirmBooking));
assert!(deterministic.blocked_actions().contains(&triage::BlockedAction::SendCustomerMessage));
assert!(deterministic.blocked_actions().contains(&triage::BlockedAction::MutateProviderRecord));

let packet = triage::StaffEvaluationPacket::new(
    triage::Reservation::try_new("reservation-fixture-123")?,
    deterministic,
);
let draft = triage::ConfirmationDraft::new(
    triage::CustomerMessageDraft::try_new("We can draft this only after staff review.")?,
);

assert_eq!(
    packet.try_with_confirmation_draft(draft).unwrap_err(),
    triage::ConfirmationDraftError::DeterministicGateNotReadyForDraft,
);

Modules§

reservation
Reservation identifiers used by booking-triage packets and review evidence.
rule
Deterministic booking rules that explain readiness findings and safe agent actions.

Structs§

AiRecommendation
Ai recommendation carried by the booking-readiness workflow; it keeps booking work grounded in deterministic policy evidence before any agent draft reaches staff.
ConfirmationDraft
Confirmation draft carried by the booking-readiness workflow; it keeps booking work grounded in deterministic policy evidence before any agent draft reaches staff.
CustomerMessageDraft
DeterministicResult
Deterministic result carried by the booking-readiness workflow; it keeps booking work grounded in deterministic policy evidence before any agent draft reaches staff.
EvidenceRef
Intake
PetProfile
Pet profile carried by the booking-readiness workflow; it keeps booking work grounded in deterministic policy evidence before any agent draft reaches staff.
PetProfileAttached
PolicyAttached
PolicyAttachedData
Policy attached data carried by the booking-readiness workflow; it keeps booking work grounded in deterministic policy evidence before any agent draft reaches staff.
PolicySnapshot
ReadyForPolicyDecision
RecommendationText
Request
Reservation
Service
Service carried by the booking-readiness workflow; it keeps booking work grounded in deterministic policy evidence before any agent draft reaches staff.
StaffEvaluationPacket
Staff evaluation packet carried by the booking-readiness workflow; it keeps booking work grounded in deterministic policy evidence before any agent draft reaches staff.

Enums§

AgentRecommendedAction
Classifies agent recommended action values that drive the booking-readiness workflow.
ApprovalGate
Human approval checkpoints that must clear before the workflow can advance.
AuditEventDraft
Classifies audit event draft values that drive the booking-readiness workflow.
BlockedAction
Actions the agent must never perform without a human/operator system of record.
ConfirmationDraftError
Classifies confirmation draft error values that drive the booking-readiness workflow.
CustomerMessageDraftError
Error
Classifies error values that drive the booking-readiness workflow.
EvidenceRefError
FailureCode
Classifies failure code values that drive the booking-readiness workflow.
PetProfileCompleteness
Classifies pet profile completeness values that drive the booking-readiness workflow.
PolicySnapshotError
ReadinessBucket
Deterministic booking status bucket used to prioritize staff review.
RecommendationTextError
RequestState
ReservationError
SafeAgentAction
Review-safe agent tasks allowed to save staff time without crossing mutation or send boundaries.
StaffDecisionBoundary
How far the packet may advance before a staff decision is required.

Traits§

RequestStateTrait

Type Aliases§

AppResult
Shared app result type used across the booking triage boundary.