Skip to main content

Module operations

Module operations 

Source
Expand description

Persistence records for app/domain operational rules.

This module documents the storage/public projection gate for the pet-resort AI program: portfolio seed facts, service-line offerings, core service rules, manager daily-brief labor outcomes, data-quality hygiene outcomes, and source-system ecosystem records. Storage code is allowed to speak in stable record codes, flattened optional fields, and JSON payloads, but promotion back into domain values is explicit and source-grounded.

The gate is deliberately narrow:

  • domain owns business meaning and invariants such as daycare eligibility, grooming cadence, training duration, source evidence, and review gates.
  • storage owns durable representations, discriminator checks, codec errors, and idempotent evidence records suitable for Postgres or fixtures.
  • app and runtime crates decide when a workflow may read or write records; storage records never authorize live provider writes or customer messaging.
  • integration adapters attach StoredSourceRecordRef values so a derived record can be audited back to Gingr, a warehouse export, or another source instead of becoming an invented operational fact.

Crosswalk navigation: this module backs the storage/persistence rows for outcome records, source refs, service offerings, portfolio records, and reporting groups. Use docs/entity-atlas/contract-crosswalk/storage-persistence.md from entity pages, workflow-packets.md from workflow pages, and the storage/API tests named there as the executable proof.

use storage::operations::{
    ServiceOfferingKindCode, ServiceOfferingRecord, StoredSourceRecordRef,
};

let source_ref = StoredSourceRecordRef {
    system: "gingr".to_owned(),
    record_type: "reservation_type".to_owned(),
    record_id: "reservation-type-42".to_owned(),
    observed_at: "2026-06-18T14:00:00Z".to_owned(),
    adapter_version: "gingr-fixture-v1".to_owned(),
};

let promoted_service = domain::operations::ServiceOffering::Daycare {
    format: domain::operations::DaycareFormat::AllDayPlay,
    eligibility_rules: vec![
        domain::operations::DaycareEligibilityRule::TemperamentReviewRequired,
        domain::operations::DaycareEligibilityRule::StaffToPetRatioRequired,
    ],
};

let stored = ServiceOfferingRecord::try_from(promoted_service.clone())?;
assert_eq!(stored.service_kind, ServiceOfferingKindCode::Daycare);
assert_eq!(source_ref.record_id, "reservation-type-42");

let encoded = stored.encode_json()?;
let decoded = ServiceOfferingRecord::decode_json(&encoded)?;
let demoted: domain::operations::ServiceOffering = decoded.try_into()?;
assert_eq!(demoted, promoted_service);

Re-exports§

pub use crate::service_line::grooming::StoredCadenceWeeksError;
pub use crate::service_line::training::StoredProgramDurationWeeks as StoredTrainingProgramDurationWeeks;
pub use crate::service_line::training::StoredProgramDurationWeeksError as StoredTrainingProgramDurationWeeksError;

Structs§

CoreServiceContractsRecord
Storage snapshot of the service-line rules enabled for a location.
DataQualityHygieneOutcomeRecord
Stored evidence for a data-quality hygiene action, including labor deltas, issue references, and resolution state.
DataQualityHygieneOutcomeRecordBuilder
Use builder syntax to set the inputs and finish with build().
DataQualityHygieneReportingGroup
Dimensions used to group data-quality hygiene outcomes by location, day, issue type, and owner role.
ManagerDailyBriefOutcomeRecord
Stored evidence for a manager daily-brief action, including before/after labor minutes and source references.
ManagerDailyBriefOutcomeRecordBuilder
Use builder syntax to set the inputs and finish with build().
ManagerDailyBriefReportingGroup
Dimensions used to aggregate manager daily-brief labor outcomes by location, day, action, and owner role.
PetResortPortfolioRecord
Storage shape for the pet-resort portfolio facts used to seed operating assumptions.
PetResortPortfolioRecordBuilder
Use builder syntax to set the inputs and finish with build().
ServiceOfferingRecord
Flattened storage shape for one service-line offering; only fields valid for its service_kind may be populated.
ServiceOfferingRecordBuilder
Use builder syntax to set the inputs and finish with build().
StoredBrandName
Non-empty pet-resort brand display name persisted beside the stable brand code.
StoredDataQualityHygieneLaborMinutes
Non-zero minute quantity persisted for data-quality hygiene labor evidence.
StoredManagerDailyBriefLaborMinutes
Non-zero minute quantity persisted for manager daily-brief labor evidence.
StoredResortCount
Positive resort count persisted for portfolio seed facts.
StoredSourceRecordRef
Provider provenance attached to stored evidence so facts can be audited back to Gingr or another source system.
StoredSourceRecordRefBuilder
Use builder syntax to set the inputs and finish with build().
TechnologyEcosystemRecord
Stored view of the systems that produce operational data and adjacent labor signals.
TechnologyEcosystemRecordBuilder
Use builder syntax to set the inputs and finish with build().

Enums§

AdjacentSystemCode
Stable codes for adjacent systems that provide labor, recruiting, marketing, or analytics evidence.
BusinessLineCode
Stable business-line codes for NVA portfolio membership.
CodecError
JSON codec failures at the storage gate.
CoreOperatingSystemCode
Stable codes for operational source systems that may feed NVA workflows.
DataAccessPatternCode
Stable codes for how operational facts are accessed from source systems.
DataQualityHygieneActionKindCode
Persisted data-quality actions used to quarantine, repair, or reconcile source evidence.
DataQualityHygieneOutcomeCode
Persisted outcome states for data-quality hygiene actions.
DataQualityHygienePersonaCode
Persisted personas accountable for data-quality hygiene work.
DataQualityResolutionStatusCode
Persisted lifecycle status for a data-quality issue after review.
Error
Errors raised while validating storage records, codecs, or domain-to-storage projection.
ManagerDailyBriefActionKindCode
Persisted manager daily-brief actions that can produce labor-minute evidence.
ManagerDailyBriefOutcomeCode
Persisted outcome states for manager daily-brief actions.
ManagerDailyBriefPersonaCode
Persisted staff personas accountable for manager daily-brief work.
OperatorCode
Stable operator code used in portfolio seed records.
PetResortBrandCode
Stable brand codes for NVA pet-resort banners.
PetResortBrandRecord
Stored pet-resort brand descriptor with code plus display name.
PortfolioStructureCode
Stable portfolio-structure codes for pet-resort operating assumptions.
RecordKind
Storage record families used in shape-validation diagnostics.
ServiceOfferingKindCode
Discriminator for the service-line variant represented by a flattened offering record.
ShapeMismatchReason
Reasons a flattened record cannot represent the requested domain variant.
StorageField
Persisted fields that can reject invalid domain values during storage conversion.
StoredResortCountError
Validation failures for persisted resort-count quantities.

Type Aliases§

Result
Result type returned by fallible storage projection and codec operations.