moonbit_metrology

    Deterministic measurement planning and quality evidence for dimensional inspection.

    metrology
    measurement
    quality
    inspection
    Download zip
    Author
    Version
    0.2.0
    License
    MIT
    Last updated
    2 months ago
    Downloads
    37

    No dependencies

    #moonbitMetrology

    Deterministic measurement planning and quality evidence for dimensional inspection, implemented in MoonBit.

    #Project positioning

    moonbitMetrology is a domain library and small CLI for turning feature tolerances, calibrated devices, and observations into an explainable inspection plan. It is designed for offline planning, traceable review, and integration with CMM, laser, vision, and shop-floor adapters. It is not a 3D geometry kernel or a machine-control protocol.

    The public API keeps the core workflow explicit:

    1. describe features, tolerances, devices, and observations;
    2. validate the input contract;
    3. select a reachable device and a conservative strategy;
    4. estimate uncertainty, capability, effort, and execution order;
    5. classify evidence and export a report-ready audit trace.

    #Core capabilities

    • feature and device models for holes, shafts, planes, slots, circles, cylinders, and datums;
    • deterministic device ranking with accuracy, reachability, capability, and stable tie-breaking;
    • repeat-count selection, uncertainty estimation, capability indices, and bilateral-limit classification;
    • strict CSV parsing with row-level diagnostics and quoted-field support;
    • execution phases, device grouping, fixed-size batches, effort estimates, and schedule metrics;
    • observation statistics, control limits, outlier checks, quality trends, and evidence indexing;
    • audit traces, release gates, report manifests, text/CSV exports, and a runnable CLI;
    • focused boundary tests, native benchmarks, and multi-platform CI.

    #Quick start

    Requirements: MoonBit stable toolchain and Git.

    moon check --target all --deny-warn moon test --target all --deny-warn moon run src/cmd/metrology

    Library usage:

    let feature = {
    id: "H1",
    kind: @lsh775/moonbit_metrology.Hole,
    nominal: 10.0,
    lower: -0.1,
    upper: 0.1,
    datum: false,
    }
    let device = {
    id: "cmm-01",
    accuracy: 0.01,
    reach: 50.0,
    supported_kinds: [@lsh775/moonbit_metrology.Hole],
    }
    let plan = @lsh775/moonbit_metrology.plan(
    part_id="bracket-01",
    features=[feature],
    devices=[device],
    )

    The CSV examples in examples/ follow the contracts in docs/data-contract.md.

    #CLI

    The demonstration CLI exercises the same public planning, audit, statistics, and report layers as the library:

    moon run src/cmd/metrology

    It prints the selected device and strategy, coverage and capability, verdict counts, warnings, and per-feature statistics. Use the library APIs for application-specific CSV ingestion and adapter integration.

    #Architecture

    The source is organized around a dependency-light domain core:

    model -> rules -> selection/planner -> execution/scheduling | | observations audit/report/export | statistics/capability/trends

    Input validation and CSV diagnostics are kept separate from planning. MeasurementPlan is immutable from the caller's perspective; derived metrics, protocol summaries, release gates, and report manifests make operational decisions inspectable. See docs/architecture.md and docs/rules.md.

    #Benchmarks

    The repository contains a fixed 32-feature mixed workload, four devices, and 32 centered observations. Run the benchmark locally:

    moon bench --release moon bench --release --target native

    The recorded native results and measurement conditions are in docs/benchmarks.md. They are local engineering measurements, not hardware-independent guarantees.

    #Testing

    moon fmt --check moon check --target all --deny-warn moon test --target all --deny-warn moon test --enable-coverage --deny-warn moon coverage analyze

    Boundary coverage includes empty plans and inputs, invalid tolerances and devices, unreachable features, duplicate IDs, malformed and quoted CSV rows, zero/negative sample counts, missing observations, schedule limits, unstable evidence, and release-gate failures.

    The strict production-source count can be reproduced with:

    powershell -ExecutionPolicy Bypass -File scripts/count-production-moonbit.ps1

    The script excludes test files, benchmark files, generated interfaces, and build output; it counts nonblank .mbt lines only.

    #CI

    GitHub Actions checks the latest stable MoonBit toolchain on Ubuntu, macOS, and Windows. Each job runs formatting, all-target checking, interface regeneration checks, tests, and coverage analysis. A manual workflow_dispatch publish workflow is provided in .github/workflows/publish.yml.

    #License

    Released under the MIT License.

    AcceptancePolicy

    pub(all) struct AcceptancePolicy {
    warning_uncertainty_ratio : Double
    fail_uncertainty_ratio : Double
    minimum_cpk : Double
    minimum_samples : Int
    allow_unmeasured : Bool
    }

    Thresholds used to turn measurements into operational decisions.

    AdapterContract

    pub(all) struct AdapterContract {
    kind : AdapterKind
    supported_kinds : Array[FeatureKind]
    required_fields : Array[String]
    }

    Capability contract for a future measurement adapter.

    AdapterKind

    pub(all) enum AdapterKind {
    Cmm
    Vision
    Laser
    OpcUa
    } derive(Eq,
    Debug
    )

    Integration boundary supported by the planning library.

    AuditEntry

    pub(all) struct AuditEntry {
    feature_id : String
    device_id : String
    strategy : Strategy
    uncertainty : Double
    verdict : Verdict
    }

    One auditable planned operation and its observed verdict.

    AuditTrace

    pub(all) struct AuditTrace {
    part_id : String
    entries : Array[AuditEntry]
    warnings : Array[String]
    coverage : Double
    capability : Bool
    }

    Trace of a complete offline planning and observation pass.

    BatchQualityResult

    pub(all) struct BatchQualityResult {
    feature_id : String
    observed_count : Int
    defect_rate : Double
    cpk : Double
    decision : QualityDecision
    }

    Result of evaluating a batch summary against a policy.

    BatchSummary

    pub(all) struct BatchSummary {
    feature_id : String
    count : Int
    pass_count : Int
    fail_count : Int
    unmeasured_count : Int
    mean : Double
    minimum : Double?
    maximum : Double?
    range : Double
    standard_deviation : Double
    defect_rate : Double
    capability : CapabilitySummary
    }

    Aggregate quality statistics for a feature batch.

    CapabilitySummary

    pub(all) struct CapabilitySummary {
    cp : Double
    cpk : Double
    adequate : Bool
    sample_count : Int
    uncertainty : Double
    }

    Capability indices calculated for a feature and its values.

    Catalog

    pub(all) struct Catalog {
    features : Array[Feature]
    devices : Array[Device]
    }

    An immutable in-memory feature/device catalog used by planning adapters.

    ControlLimits

    pub(all) struct ControlLimits {
    center : Double
    lower : Double
    upper : Double
    sensitivity : Double
    }

    Control limits for a stable sequence of observed values.

    DashboardCard

    pub(all) struct DashboardCard {
    key : String
    label : String
    value : String
    status : String
    }

    One stable quality dashboard card.

    Device

    pub(all) struct Device {
    id : String
    accuracy : Double
    reach : Double
    supported_kinds : Array[FeatureKind]
    }

    A calibrated device available to the planner.

    Device::can_measure

    fn Device::can_measure(self : Device, feature : Feature) -> Bool

    Check whether a device can reach and measure a feature.

    DeviceCandidate

    pub(all) struct DeviceCandidate {
    device_id : String
    device : Device
    score : Double
    reason : SelectionReason
    }

    A candidate device with a deterministic score and reason.

    DeviceProfile

    pub(all) struct DeviceProfile {
    device : Device
    calibration_date : String
    calibration_expiry : String
    owner : String
    }

    Operational profile around a calibrated device record.

    Diagnostic

    pub(all) struct Diagnostic {
    code : String
    message : String
    index : Int
    severity : DiagnosticSeverity
    }

    A stable diagnostic emitted at an input position.

    DiagnosticSeverity

    pub(all) enum DiagnosticSeverity {
    Info
    Warning
    Error
    } derive(Eq,
    Debug
    )

    Severity attached to a validation or planning diagnostic.

    DurationEstimate

    pub(all) struct DurationEstimate {
    step_count : Int
    sample_count : Int
    seconds : Double
    setup_seconds : Double
    measurement_seconds : Double
    transfer_seconds : Double
    }

    Operational effort estimate for a measurement plan.

    The estimate is deliberately expressed in abstract seconds. It is a repeatable planning signal, not a promise about a particular machine.

    EvidenceIndex

    pub(all) struct EvidenceIndex {
    observation_count : Int
    unique_feature_count : Int
    duplicate_feature_count : Int
    sample_count : Int
    feature_ids : Array[String]
    }

    A compact index over observations used by audit and export layers.

    ExecutionPhase

    pub(all) struct ExecutionPhase {
    phase : PlanPhase
    steps : Array[MeasurementStep]
    device_id : String
    }

    A group of steps executed in one lifecycle phase.

    Feature

    pub(all) struct Feature {
    id : String
    kind : FeatureKind
    nominal : Double
    lower : Double
    upper : Double
    datum : Bool
    }

    Measurement feature definition.

    FeatureKind

    pub(all) enum FeatureKind {
    Hole
    Shaft
    Plane
    Slot
    Circle
    Cylinder
    Datum
    } derive(Eq)

    A geometric feature used by a measurement plan.

    FeatureResult

    pub(all) struct FeatureResult {
    feature_id : String
    verdict : Verdict
    deviation : Double
    risk : RiskLevel
    sample_count : Int
    }

    Per-feature classification and normalized deviation.

    MeasurementContext

    pub(all) struct MeasurementContext {
    operator : String
    instrument : String
    environment : String
    timestamp : String
    }

    Context carried by an observation batch.

    MeasurementPlan

    pub(all) struct MeasurementPlan {
    part_id : String
    steps : Array[MeasurementStep]
    summary : PlanSummary
    }

    Complete plan and optional observed results.

    MeasurementProtocol

    pub(all) struct MeasurementProtocol {
    part_id : String
    revision : String
    step_count : Int
    sample_count : Int
    duration_seconds : Double
    preconditions : Array[String]
    acceptance_checks : Array[String]
    warnings : Array[String]
    }

    A reviewable operational contract derived from a measurement plan.

    MeasurementStep

    pub(all) struct MeasurementStep {
    feature_id : String
    device_id : String
    strategy : Strategy
    direction : String
    uncertainty : Double
    }

    A planned measurement operation.

    Observation

    pub(all) struct Observation {
    feature_id : String
    value : Double
    sample_count : Int
    }

    Result of one observed measurement.

    ObservationAnalysis

    pub(all) struct ObservationAnalysis {
    feature_id : String
    count : Int
    summary : BatchSummary
    within_control_limit_count : Int
    outlier_count : Int
    mean_residual : Double
    trend : String
    repeat_consistent : Bool
    }

    Observation analysis combining specification and process views.

    ObservationBatch

    pub(all) struct ObservationBatch {
    feature_id : String
    observations : Array[Observation]
    context : MeasurementContext
    }

    A group of observations for one feature and measurement context.

    OptimizationGoal

    pub(all) enum OptimizationGoal {
    MinimizeDevices
    MinimizeTime
    MinimizeUncertainty
    } derive(Eq,
    Debug
    )

    Objective used to choose a deterministic schedule policy.

    OptimizationResult

    pub(all) struct OptimizationResult {
    goal : OptimizationGoal
    schedule : ScheduledPlan
    baseline_score : Double
    optimized_score : Double
    improvement : Double
    }

    Baseline and optimized schedule with a transparent score.

    ParsedFeatures

    pub(all) struct ParsedFeatures {
    features : Array[Feature]
    diagnostics : Array[Diagnostic]
    }

    Parsed feature rows plus all row-level diagnostics.

    ParsedObservations

    pub(all) struct ParsedObservations {
    observations : Array[Observation]
    diagnostics : Array[Diagnostic]
    }

    Parsed observation rows plus all row-level diagnostics.

    PlanExplanation

    pub(all) struct PlanExplanation {
    feature_id : String
    device_id : String
    reason : SelectionReason
    message : String
    }

    A human-readable explanation for one feature in a plan.

    PlanMetrics

    pub(all) struct PlanMetrics {
    step_count : Int
    single_count : Int
    repeated_count : Int
    scan_count : Int
    device_count : Int
    device_switches : Int
    estimated_samples : Int
    estimated_seconds : Double
    total_uncertainty : Double
    average_uncertainty : Double
    maximum_uncertainty : Double
    minimum_uncertainty : Double
    datum_count : Int
    normal_count : Int
    warning_count : Int
    }

    Plan-level counts useful for effort estimation and audit dashboards.

    PlanPhase

    pub(all) enum PlanPhase {
    EstablishDatum
    Calibrate
    Measure
    Verify
    Closeout
    } derive(Eq,
    Debug
    )

    A stable phase in the execution lifecycle.

    PlanSummary

    pub(all) struct PlanSummary {
    coverage : Double
    capability : Bool
    steps : Int
    warnings : Array[String]
    }

    Plan quality summary.

    ProgramSummary

    pub(all) struct ProgramSummary {
    feature_count : Int
    observed_feature_count : Int
    pass_count : Int
    fail_count : Int
    unmeasured_count : Int
    coverage : Double
    pass_rate : Double
    defect_rate : Double
    mean_cpk : Double
    minimum_cpk : Double
    high_risk_count : Int
    warning_count : Int
    }

    Program-wide quality and coverage summary.

    QualityDashboard

    pub(all) struct QualityDashboard {
    part_id : String
    summary : ProgramSummary
    cards : Array[DashboardCard]
    status : String
    }

    Dashboard assembled from the same plan and observations as reports.

    QualityDecision

    pub(all) enum QualityDecision {
    Pass
    Warning(reason~ : String)
    Fail(reason~ : String)
    } derive(Eq,
    Debug
    )

    Quality decision produced by a configurable acceptance policy.

    QualityScore

    pub(all) struct QualityScore {
    coverage : Double
    capability : Bool
    warning_count : Int
    score : Double
    }

    Aggregate quality score for a plan.

    QualityTrendSummary

    pub(all) struct QualityTrendSummary {
    batch_count : Int
    total_samples : Int
    total_defects : Int
    defect_rate : Double
    minimum_rate : Double
    maximum_rate : Double
    average_rate : Double
    }

    Aggregate quality trend over an ordered batch sequence.

    ReadinessReport

    pub(all) struct ReadinessReport {
    catalog_diagnostics : Array[Diagnostic]
    observation_diagnostics : Array[Diagnostic]
    plan_diagnostics : Array[Diagnostic]
    error_count : Int
    warning_count : Int
    ready : Bool
    }

    Joined validation result used before execution or release.

    ReleaseCheck

    pub(all) struct ReleaseCheck {
    name : String
    passed : Bool
    detail : String
    }

    One independently reviewable release criterion.

    ReleaseGate

    pub(all) struct ReleaseGate {
    part_id : String
    checks : Array[ReleaseCheck]
    ready : Bool
    risk : String
    }

    Evidence-backed readiness state for a measured part.

    ReplayIssue

    pub(all) struct ReplayIssue {
    kind : ReplayIssueKind
    index : Int
    message : String
    }

    One replay mismatch with an index and stable message.

    ReplayIssueKind

    pub(all) enum ReplayIssueKind {
    PartIdentifier
    StepCount
    FeatureIdentifier
    DeviceIdentifier
    Strategy
    Direction
    Uncertainty
    Coverage
    Capability
    } derive(Eq,
    Debug
    )

    Kind of deterministic replay mismatch.

    ReplayResult

    pub(all) struct ReplayResult {
    expected_part_id : String
    actual_part_id : String
    expected_steps : Int
    actual_steps : Int
    matches : Bool
    issues : Array[ReplayIssue]
    }

    Result of comparing an expected and actual plan.

    ReportManifest

    pub(all) struct ReportManifest {
    schema_version : Int
    application_version : String
    part_id : String
    feature_count : Int
    observation_count : Int
    step_count : Int
    warning_count : Int
    evidence_coverage : Double
    reproducible : Bool
    status : String
    }

    Machine-readable inventory for a generated acceptance report.

    ResultCollection

    pub(all) struct ResultCollection {
    feature_ids : Array[String]
    results : Array[FeatureResult]
    pass_count : Int
    fail_count : Int
    unmeasured_count : Int
    }

    Ordered results for all requested features.

    RiskLevel

    pub(all) enum RiskLevel {
    Low
    Medium
    High
    } derive(Eq,
    Debug
    )

    A coarse risk level used to prioritize review and execution.

    RiskMatrix

    pub(all) struct RiskMatrix {
    low_count : Int
    medium_count : Int
    high_count : Int
    total_count : Int
    }

    Counts of operational risk levels in a result collection.

    SchedulePolicy

    pub(all) struct SchedulePolicy {
    datum_first : Bool
    group_by_device : Bool
    max_batch_size : Int
    }

    Scheduling controls for deterministic execution planning.

    ScheduledPlan

    pub(all) struct ScheduledPlan {
    part_id : String
    steps : Array[MeasurementStep]
    phases : Array[ExecutionPhase]
    batches : Array[Array[MeasurementStep]]
    phase_count : Int
    device_switches : Int
    estimated_seconds : Double
    }

    A scheduled plan with operational cost and batches.

    SelectionReason

    pub(all) enum SelectionReason {
    Supported
    UnsupportedKind
    OutOfReach
    InsufficientCapability
    NoCandidate
    LowerScore
    StableTieBreak
    } derive(Eq,
    Debug
    )

    Reason explaining why a device was selected or rejected.

    Strategy

    pub enum Strategy {
    SinglePoint
    RepeatedPoint(count~ : Int)
    Scan(count~ : Int)
    }

    A measurement strategy selected for one feature.

    TraceEvent

    pub(all) struct TraceEvent {
    kind : TraceEventKind
    part_id : String
    feature_id : String
    step_index : Int
    message : String
    }

    One immutable trace event.

    TraceEventKind

    pub(all) enum TraceEventKind {
    PlanStarted
    PlanStep
    ObservationRecorded
    DecisionIssued
    WarningIssued
    PlanFinished
    } derive(Eq,
    Debug
    )

    Kind of event in an auditable measurement run.

    TraceLog

    pub(all) struct TraceLog {
    part_id : String
    events : Array[TraceEvent]
    }

    Ordered trace log for a plan run.

    TrendPoint

    pub(all) struct TrendPoint {
    batch_id : String
    sample_count : Int
    defect_count : Int
    }

    One quality observation aggregated at batch level.

    ValidationSummary

    pub(all) struct ValidationSummary {
    error_count : Int
    warning_count : Int
    is_valid : Bool
    first_error_code : String
    }

    Summary of a validation pass.

    ValueQualityResult

    pub(all) struct ValueQualityResult {
    feature_id : String
    value : Double
    normalized_deviation : Double
    uncertainty : Double
    decision : QualityDecision
    }

    Result of evaluating one value against a policy.

    Verdict

    pub enum Verdict {
    Pass
    Fail(reason~ : String)
    Unmeasured
    }

    Human-readable quality result.

    acceptance_policy

    fn acceptance_policy(warning_uncertainty_ratio~ : Double, fail_uncertainty_ratio~ : Double, minimum_cpk~ : Double, minimum_samples~ : Int, allow_unmeasured~ : Bool) -> AcceptancePolicy

    Create a policy with explicit thresholds.

    adapter_can_measure

    fn adapter_can_measure(contract : AdapterContract, kind : FeatureKind) -> Bool

    Return whether an adapter supports a feature kind.

    adapter_contract

    fn adapter_contract(kind : AdapterKind, supported_kinds : Array[FeatureKind]) -> AdapterContract

    Construct an adapter contract.

    adapter_contract_is_valid

    fn adapter_contract_is_valid(contract : AdapterContract) -> Bool

    Return whether a contract has a non-empty integration boundary.

    adapter_contract_summary

    fn adapter_contract_summary(contract : AdapterContract) -> String

    Render an adapter contract summary.

    adapter_for_kind

    fn adapter_for_kind(kind : FeatureKind) -> AdapterContract

    Choose a conservative default adapter for a feature kind.

    adapter_is_online

    fn adapter_is_online(kind : AdapterKind) -> Bool

    Return whether an adapter normally connects to a live system.

    adapter_kind_from_name

    fn adapter_kind_from_name(name : String) -> AdapterKind?

    Parse an adapter name.

    adapter_kind_intersection

    fn adapter_kind_intersection(left : AdapterContract, right : AdapterContract) -> Array[FeatureKind]

    Return the intersection of two adapter feature-kind lists.

    adapter_name

    fn adapter_name(kind : AdapterKind) -> String

    Return a stable adapter name.

    adapter_priority

    fn adapter_priority(kind : AdapterKind) -> Int

    Return a stable adapter priority for selection UI.

    adapter_required_field_count

    fn adapter_required_field_count(contract : AdapterContract) -> Int

    Return the number of required integration fields.

    adapter_requires_calibration

    fn adapter_requires_calibration(kind : AdapterKind) -> Bool

    Return whether an adapter requires calibration metadata.

    adapter_selection_reason

    fn adapter_selection_reason(contract : AdapterContract, kind : FeatureKind) -> String

    Explain an adapter/feature mismatch.

    adapter_supported_kind_count

    fn adapter_supported_kind_count(contract : AdapterContract) -> Int

    Return the number of feature kinds supported by a contract.

    adapter_supports_batch

    fn adapter_supports_batch(kind : AdapterKind) -> Bool

    Return whether an adapter can process batches offline.

    adapters_overlap

    fn adapters_overlap(left : AdapterContract, right : AdapterContract) -> Bool

    Return whether two contracts can serve a common feature kind.

    all_adapter_kinds

    fn all_adapter_kinds() -> Array[AdapterKind]

    Return all adapter kinds in stable order.

    all_feature_kinds

    fn all_feature_kinds() -> Array[FeatureKind]

    Return all feature kinds in public contract order.

    all_features_reachable

    fn all_features_reachable(catalog : Catalog) -> Bool

    Return whether every catalog feature has a reachable device.

    analysis_risk

    fn analysis_risk(analysis : ObservationAnalysis) -> RiskLevel

    Return a compact risk label for an analysis.

    analyze_observations

    fn analyze_observations(feature~ : Feature, observations~ : Array[Observation], uncertainty~ : Double) -> ObservationAnalysis

    Analyze feature observations with process and specification metrics.

    assess_readiness

    fn assess_readiness(features~ : Array[Feature], devices~ : Array[Device], plan~ : MeasurementPlan, observations~ : Array[Observation]) -> ReadinessReport

    Assess catalog, plan, and observation readiness together.

    audit_verdict_counts

    fn audit_verdict_counts(trace : AuditTrace) -> (Int, Int, Int)

    Count passing, failing, and unmeasured entries in a trace.

    average_step_duration

    fn average_step_duration(plan : MeasurementPlan) -> Double

    Return the average step cost, or zero for an empty plan.

    batch_is_clean

    fn batch_is_clean(summary : BatchSummary) -> Bool

    Return whether all observed values passed.

    batch_size_is_valid

    fn batch_size_is_valid(batches : Array[Array[MeasurementStep]], max_batch_size : Int) -> Bool

    Return whether all batches obey a positive maximum size.

    batch_trend

    fn batch_trend(values : Array[Double]) -> String

    Return a simple trend label based on the sequence of observed values.

    benchmark_devices

    fn benchmark_devices() -> Array[Device]

    Generate the fixed four-device benchmark catalog.

    benchmark_feature_csv

    fn benchmark_feature_csv() -> String

    Build the CSV representation used by the parser benchmark.

    benchmark_features

    fn benchmark_features() -> Array[Feature]

    Generate the fixed 32-feature benchmark catalog.

    benchmark_observations

    fn benchmark_observations() -> Array[Observation]

    Generate one centered observation per benchmark feature.

    benchmark_plan

    fn benchmark_plan() -> MeasurementPlan

    Build the deterministic benchmark plan.

    build_audit_trace

    fn build_audit_trace(plan~ : MeasurementPlan, observations~ : Array[Observation]) -> AuditTrace

    Build an audit trace when only step IDs and observations are available.

    build_audit_trace_with_features

    fn build_audit_trace_with_features(plan~ : MeasurementPlan, features~ : Array[Feature], observations~ : Array[Observation]) -> AuditTrace

    Build a trace with full feature-aware classification.

    build_dashboard

    fn build_dashboard(features~ : Array[Feature], observations~ : Array[Observation], plan~ : MeasurementPlan) -> QualityDashboard

    Build four stable cards for a plan run.

    build_evidence_index

    fn build_evidence_index(observations : Array[Observation]) -> EvidenceIndex

    Build a deterministic feature-to-observation index.

    build_report_manifest

    fn build_report_manifest(plan : MeasurementPlan, features : Array[Feature], observations : Array[Observation], application_version : String) -> ReportManifest

    Build a manifest from the exact inputs used for a report.

    build_risk_matrix

    fn build_risk_matrix(collection : ResultCollection) -> RiskMatrix

    Aggregate risk levels from feature results.

    calibration_is_current

    fn calibration_is_current(profile : DeviceProfile, date : String) -> Bool

    Return whether calibration covers a requested date.

    canonical_feature_line

    fn canonical_feature_line(feature : Feature) -> String

    Return the canonical CSV line for a feature.

    canonical_observation_line

    fn canonical_observation_line(observation : Observation) -> String

    Return the canonical CSV line for an observation.

    canonical_part_id

    fn canonical_part_id(part_id : String) -> String

    Return a stable part identifier suitable for report headers.

    capability_indices

    fn capability_indices(feature~ : Feature, values~ : Array[Double], uncertainty~ : Double) -> CapabilitySummary

    Calculate Cp/Cpk using sample spread plus stated uncertainty.

    capability_is_acceptable

    fn capability_is_acceptable(summary : CapabilitySummary) -> Bool

    Return whether a capability summary meets the common 1.33 threshold.

    capability_margin

    fn capability_margin(summary : CapabilitySummary) -> Double

    Return a conservative margin to the nearest capability threshold.

    capability_ok

    fn capability_ok(feature : Feature, uncertainty : Double) -> Bool

    Check if a device can resolve the feature tolerance.

    catalog_device_ids

    fn catalog_device_ids(catalog : Catalog) -> Array[String]

    Return device identifiers in source order.

    catalog_feature_ids

    fn catalog_feature_ids(catalog : Catalog) -> Array[String]

    Return feature identifiers in source order.

    catalog_from

    fn catalog_from(features~ : Array[Feature], devices~ : Array[Device]) -> Catalog

    Construct a catalog while preserving caller order.

    catalog_is_valid

    fn catalog_is_valid(catalog : Catalog) -> Bool

    Return whether structural validation has no errors.

    catalog_kind_count

    fn catalog_kind_count(catalog : Catalog) -> Int

    Count the number of unique feature kinds present in a catalog.

    choose_device

    fn choose_device(feature~ : Feature, devices~ : Array[Device]) -> DeviceCandidate?

    Select the first deterministic candidate, if one exists.

    classify

    fn classify(feature : Feature, observation : Observation?) -> Verdict

    Classify a measurement against bilateral limits.

    collect_feature_results

    fn collect_feature_results(features : Array[Feature], observations : Array[Observation]) -> ResultCollection

    Collect one feature result per input feature in source order.

    compare_plans

    fn compare_plans(expected : MeasurementPlan, actual : MeasurementPlan) -> ReplayResult

    Compare two plans field by field.

    confidence_label

    fn confidence_label(feature : Feature, uncertainty : Double) -> String

    Return a human-readable confidence band.

    control_limits

    fn control_limits(values~ : Array[Double], sensitivity~ : Double) -> ControlLimits

    Build symmetric control limits around the observed mean.

    csv_diagnostics

    fn csv_diagnostics(input : String) -> Array[Diagnostic]

    Collect strict feature CSV diagnostics.

    dashboard_card_status

    fn dashboard_card_status(dashboard : QualityDashboard, key : String) -> String

    Return a card status or an empty string if the key is unknown.

    dashboard_card_value

    fn dashboard_card_value(dashboard : QualityDashboard, key : String) -> String

    Return a card value or an empty string if the key is unknown.

    dashboard_failure_count

    fn dashboard_failure_count(dashboard : QualityDashboard) -> Int

    Return the number of cards with a failing status.

    dashboard_is_clean

    fn dashboard_is_clean(dashboard : QualityDashboard) -> Bool

    Return whether the dashboard has a clean batch outcome.

    dashboard_is_complete

    fn dashboard_is_complete(dashboard : QualityDashboard) -> Bool

    Return whether the dashboard has complete observations.

    dashboard_is_healthy

    fn dashboard_is_healthy(dashboard : QualityDashboard) -> Bool

    Return whether all dashboard health conditions pass.

    dashboard_status

    fn dashboard_status(dashboard : QualityDashboard) -> String

    Return a compact dashboard status where acceptance is healthy.

    dashboard_warning_count

    fn dashboard_warning_count(dashboard : QualityDashboard) -> Int

    Return the number of cards requiring review.

    datum_features

    fn datum_features(catalog : Catalog) -> Array[Feature]

    Return datum features in source order.

    datum_step_ratio

    fn datum_step_ratio(plan : MeasurementPlan) -> Double

    Return the fraction of steps that establish datums.

    default_acceptance_policy

    fn default_acceptance_policy() -> AcceptancePolicy

    Return a conservative default policy for offline acceptance screening.

    default_direction_for_kind

    fn default_direction_for_kind(kind : FeatureKind) -> String

    Return a default direction label for a feature kind.

    default_risk_for_kind

    fn default_risk_for_kind(kind : FeatureKind) -> RiskLevel

    Return a default review risk for a feature kind.

    default_schedule_policy

    fn default_schedule_policy() -> SchedulePolicy

    Return a conservative default scheduling policy.

    default_strategy_for_kind

    fn default_strategy_for_kind(kind : FeatureKind) -> Strategy

    Return the default strategy for a feature kind.

    defect_batch_count

    fn defect_batch_count(points : Array[TrendPoint]) -> Int

    Return the number of points with a non-zero defect rate.

    device_can_cover_catalog

    fn device_can_cover_catalog(profile : DeviceProfile, catalog : Catalog) -> Bool

    Return whether a profile covers every catalog feature.

    device_can_measure_with_profile

    fn device_can_measure_with_profile(profile : DeviceProfile, feature : Feature) -> Bool

    Return whether the profiled device can measure a feature.

    device_index

    fn device_index(catalog : Catalog, id : String) -> Int

    Return the first index of a device identifier, or -1.

    device_normalization_change_count

    fn device_normalization_change_count(devices : Array[Device]) -> Int

    Count devices whose identifiers change during normalization.

    device_profile

    fn device_profile(device~ : Device, calibration_date~ : String, calibration_expiry~ : String, owner~ : String) -> DeviceProfile

    Create a device profile with ISO-8601 date strings.

    device_profile_status

    fn device_profile_status(profile : DeviceProfile, date : String) -> String

    Return a stable calibration status label.

    device_switch_count

    fn device_switch_count(steps : Array[MeasurementStep]) -> Int

    Count device changes in an already ordered sequence.

    device_transfer_seconds

    fn device_transfer_seconds(previous : String, next : String) -> Double

    Return the transfer cost between two device IDs.

    diagnostic_codes

    fn diagnostic_codes(diagnostics : Array[Diagnostic]) -> Array[String]

    Return all diagnostic codes in source order.

    diagnostic_count

    fn diagnostic_count(diagnostics : Array[Diagnostic], severity : DiagnosticSeverity) -> Int

    Count diagnostics with the requested severity.

    diagnostics_have_code

    fn diagnostics_have_code(diagnostics : Array[Diagnostic], code : String) -> Bool

    Return whether diagnostics include a code.

    direction_change_count

    fn direction_change_count(values : Array[Double]) -> Int

    Return the number of adjacent direction changes.

    duration_band

    fn duration_band(estimate : DurationEstimate) -> String

    Return a stable operational band for dashboards and reports.

    duration_efficiency

    fn duration_efficiency(estimate : DurationEstimate, available_seconds : Double) -> Double

    Return a conservative score where lower effort is better.

    duration_fits

    fn duration_fits(estimate : DurationEstimate, available_seconds : Double) -> Bool

    Return whether the plan fits inside a positive time window.

    duration_has_replicates

    fn duration_has_replicates(estimate : DurationEstimate) -> Bool

    Return whether the estimate has enough samples for a stable summary.

    duration_utilization

    fn duration_utilization(estimate : DurationEstimate, available_seconds : Double) -> Double

    Return a utilization ratio against a positive available time window.

    error_diagnostic

    fn error_diagnostic(code~ : String, message~ : String, index~ : Int) -> Diagnostic

    Create an error diagnostic with a stable code and input index.

    estimate_plan_duration

    fn estimate_plan_duration(plan : MeasurementPlan) -> DurationEstimate

    Estimate setup, measurement, and device-transfer effort.

    estimate_uncertainty

    fn estimate_uncertainty(strategy : Strategy, device : Device) -> Double

    Estimate conservative uncertainty for a strategy.

    estimated_execution_seconds

    fn estimated_execution_seconds(plan : MeasurementPlan) -> Double

    Return estimated execution time in abstract seconds.

    evaluate_batch

    fn evaluate_batch(policy : AcceptancePolicy, summary : BatchSummary) -> BatchQualityResult

    Evaluate a complete batch summary.

    evaluate_release_gate

    fn evaluate_release_gate(plan : MeasurementPlan, features : Array[Feature], observations : Array[Observation]) -> ReleaseGate

    Evaluate the practical acceptance criteria for one plan and evidence set.

    evaluate_value

    fn evaluate_value(policy~ : AcceptancePolicy, feature~ : Feature, value~ : Double, uncertainty~ : Double) -> ValueQualityResult

    Evaluate one observed value and its stated uncertainty.

    evidence_density

    fn evidence_density(index : EvidenceIndex) -> Double

    Return a stable evidence-density ratio per unique feature.

    evidence_index_is_usable

    fn evidence_index_is_usable(index : EvidenceIndex) -> Bool

    Return whether the index contains useful, non-empty evidence.

    evidence_index_pass_rate

    fn evidence_index_pass_rate(index : EvidenceIndex, passed_observation_count : Int) -> Double

    Calculate the accepted-observation ratio against indexed samples.

    evidence_is_complete

    fn evidence_is_complete(index : EvidenceIndex, expected : Array[String]) -> Bool

    Return whether every expected feature has evidence.

    execution_order

    fn execution_order(plan : MeasurementPlan) -> Array[MeasurementStep]

    Return a stable execution order: datum steps first, then feature order.

    execution_phases

    fn execution_phases(plan : MeasurementPlan) -> Array[ExecutionPhase]

    Group plan steps into stable datum and measurement phases.

    explain_plan

    fn explain_plan(plan : MeasurementPlan) -> Array[PlanExplanation]

    Explain each planned feature and each plan-level warning.

    export_batch_summary_csv

    fn export_batch_summary_csv(summary : BatchSummary) -> String

    Export one batch summary as a single stable record.

    export_diagnostics_csv

    fn export_diagnostics_csv(diagnostics : Array[Diagnostic]) -> String

    Export diagnostics for machine review.

    export_features_csv

    fn export_features_csv(features : Array[Feature]) -> String

    Export features using the documented feature CSV contract.

    export_observations_csv

    fn export_observations_csv(observations : Array[Observation]) -> String

    Export observations with their sample counts.

    export_plan_csv

    fn export_plan_csv(plan : MeasurementPlan) -> String

    Export plan steps with stable strategy and uncertainty fields.

    export_trace_csv

    fn export_trace_csv(log : TraceLog) -> String

    Export a trace with lifecycle and step fields.

    failed_release_check_count

    fn failed_release_check_count(gate : ReleaseGate) -> Int

    Count failed release criteria.

    failed_release_check_names

    fn failed_release_check_names(gate : ReleaseGate) -> Array[String]

    Return the names of criteria that need reviewer attention.

    feature_fingerprint

    fn feature_fingerprint(feature : Feature) -> String

    Return a stable fingerprint for an input feature.

    feature_index

    fn feature_index(catalog : Catalog, id : String) -> Int

    Return the first index of a feature identifier, or -1.

    feature_kind_category

    fn feature_kind_category(kind : FeatureKind) -> String

    Return a broad semantic category.

    feature_kind_code

    fn feature_kind_code(kind : FeatureKind) -> String

    Return a stable short code suitable for reports.

    feature_kind_dimension

    fn feature_kind_dimension(kind : FeatureKind) -> Int

    Return the nominal degrees of freedom represented by a kind.

    feature_kind_from_name

    fn feature_kind_from_name(name : String) -> FeatureKind?

    Parse a stable feature kind name.

    feature_kind_is_datum

    fn feature_kind_is_datum(kind : FeatureKind) -> Bool

    Return whether a feature kind is itself a datum.

    feature_kind_is_rotational

    fn feature_kind_is_rotational(kind : FeatureKind) -> Bool

    Return whether a feature kind describes a rotational feature.

    feature_kind_is_surface

    fn feature_kind_is_surface(kind : FeatureKind) -> Bool

    Return whether a feature kind describes a surface or planar feature.

    feature_kind_name

    fn feature_kind_name(kind : FeatureKind) -> String

    Return the stable lowercase name of a feature kind.

    feature_result

    fn feature_result(feature~ : Feature, observation~ : Observation?) -> FeatureResult

    Build a per-feature result from an optional observation.

    features_of_kind

    fn features_of_kind(catalog : Catalog, kind : FeatureKind) -> Array[Feature]

    Return features of one kind in source order.

    find_device

    fn find_device(catalog : Catalog, id : String) -> Device?

    Find the first device with the requested identifier.

    find_feature

    fn find_feature(catalog : Catalog, id : String) -> Feature?

    Find the first feature with the requested identifier.

    grouped_execution_order

    fn grouped_execution_order(plan : MeasurementPlan) -> Array[MeasurementStep]

    Return a stable datum-first sequence while grouping adjacent device steps.

    has_errors

    fn has_errors(diagnostics : Array[Diagnostic]) -> Bool

    Return whether any diagnostic is an error.

    high_risk_rate

    fn high_risk_rate(matrix : RiskMatrix) -> Double

    Return the fraction of high-risk results.

    highest_risk

    fn highest_risk(matrix : RiskMatrix) -> RiskLevel

    Return the largest risk level in a matrix.

    ids_are_unique

    fn ids_are_unique(features : Array[Feature]) -> Bool

    Return whether feature identifiers are unique and non-blank.

    invalid_sample_observation_count

    fn invalid_sample_observation_count(observations : Array[Observation]) -> Int

    Return the number of observations with non-positive sample counts.

    is_canonical_catalog

    fn is_canonical_catalog(catalog : Catalog) -> Bool

    Return whether all identifiers are already canonical.

    is_non_decreasing

    fn is_non_decreasing(values : Array[Double]) -> Bool

    Return whether values are non-decreasing.

    is_non_increasing

    fn is_non_increasing(values : Array[Double]) -> Bool

    Return whether values are non-increasing.

    kind_requires_scan

    fn kind_requires_scan(kind : FeatureKind) -> Bool

    Return whether the kind normally requires scanning.

    kind_supports_touch_probe

    fn kind_supports_touch_probe(kind : FeatureKind) -> Bool

    Return whether a touch probe is a suitable default adapter.

    kind_supports_vision

    fn kind_supports_vision(kind : FeatureKind) -> Bool

    Return whether a vision adapter is a suitable default adapter.

    largest_batch_size

    fn largest_batch_size(schedule : ScheduledPlan) -> Int

    Return the largest batch size in a schedule.

    latest_trend_point

    fn latest_trend_point(points : Array[TrendPoint]) -> TrendPoint?

    Return the most recent point, when one exists.

    limit_margin

    fn limit_margin(feature : Feature, value : Double) -> Double

    Return the distance of a value from the nearest specification limit.

    limit_position

    fn limit_position(feature : Feature, value : Double) -> String

    Return which side of a feature's limits contains a value.

    low_risk_rate

    fn low_risk_rate(matrix : RiskMatrix) -> Double

    Return the fraction of low-risk results.

    lower_limit

    fn lower_limit(feature : Feature) -> Double

    Return the absolute lower measurement limit.

    manifest_counts_are_consistent

    fn manifest_counts_are_consistent(manifest : ReportManifest) -> Bool

    Return whether all recorded counts are internally consistent.

    manifest_evidence_label

    fn manifest_evidence_label(manifest : ReportManifest) -> String

    Return a warning label for manifests with incomplete evidence.

    manifest_has_plan_for_features

    fn manifest_has_plan_for_features(manifest : ReportManifest) -> Bool

    Return whether the manifest records at least one planned step per feature.

    manifest_is_attachable

    fn manifest_is_attachable(manifest : ReportManifest) -> Bool

    Return whether the manifest is safe to attach to a report.

    manifest_is_publishable

    fn manifest_is_publishable(manifest : ReportManifest) -> Bool

    Return whether a manifest can be stored as a release artifact.

    manifest_missing_feature_count

    fn manifest_missing_feature_count(manifest : ReportManifest) -> Int

    Return the number of features not represented by observations.

    manifest_readiness_reason

    fn manifest_readiness_reason(manifest : ReportManifest) -> String

    Return a compact readiness reason for operator-facing output.

    manifest_schema_is_current

    fn manifest_schema_is_current(manifest : ReportManifest) -> Bool

    Return whether a manifest has the current schema.

    manifest_step_density

    fn manifest_step_density(manifest : ReportManifest) -> Double

    Return the ratio of planned steps to reported features.

    matched_feature_count

    fn matched_feature_count(index : EvidenceIndex, expected : Array[String]) -> Int

    Return the number of indexed features represented in expected IDs.

    maximum

    fn maximum(values : Array[Double]) -> Double?

    Return the largest value, or None for an empty collection.

    maximum_step_duration

    fn maximum_step_duration(plan : MeasurementPlan) -> Double

    Return the maximum individual step cost in a plan.

    mean

    fn mean(values : Array[Double]) -> Double

    Return the arithmetic mean, or zero for an empty collection.

    measurement_time_ratio

    fn measurement_time_ratio(estimate : DurationEstimate) -> Double

    Return the fraction of effort spent collecting measurements.

    minimum

    fn minimum(values : Array[Double]) -> Double?

    Return the smallest value, or None for an empty collection.

    missing_feature_ids

    fn missing_feature_ids(index : EvidenceIndex, expected : Array[String]) -> Array[String]

    Return expected feature IDs that have no observation in the index.

    new_device

    fn new_device(id : String, accuracy : Double, reach : Double, supported_kinds : Array[FeatureKind]) -> Device

    Construct a calibrated device record.

    new_observation

    fn new_observation(feature_id : String, value : Double, sample_count : Int) -> Observation

    Construct an observed measurement record.

    normalization_change_count

    fn normalization_change_count(features : Array[Feature]) -> Int

    Count features whose identifiers change during normalization.

    normalization_changed

    fn normalization_changed(before : Feature, after : Feature) -> Bool

    Return whether two features differ in any field.

    normalize_catalog

    fn normalize_catalog(catalog : Catalog) -> Catalog

    Normalize all identifiers in a catalog while preserving array order.

    normalize_device

    fn normalize_device(device : Device) -> Device

    Return a trimmed device record without changing capability values.

    normalize_feature

    fn normalize_feature(feature : Feature) -> Feature

    Return a trimmed feature record without changing numeric values.

    normalize_identifier

    fn normalize_identifier(value : String) -> String

    Return a trimmed identifier, preserving case and semantic content.

    normalize_observation

    fn normalize_observation(observation : Observation) -> Observation

    Return a trimmed observation record without changing measured value.

    normalize_observations

    fn normalize_observations(observations : Array[Observation]) -> Array[Observation]

    Normalize a list of observations while preserving source order.

    observation_values_for

    fn observation_values_for(feature~ : Feature, observations~ : Array[Observation]) -> Array[Double]

    Return values belonging to a feature in observation order.

    observations_for

    fn observations_for(feature~ : Feature, observations~ : Array[Observation]) -> Array[Observation]

    Select observations belonging to a feature.

    optimization_delta

    fn optimization_delta(result : OptimizationResult) -> Double

    Return the score difference rounded conceptually as a raw deterministic value.

    optimization_goal_text

    fn optimization_goal_text(goal : OptimizationGoal) -> String

    Return a stable optimization goal label.

    optimization_improves

    fn optimization_improves(result : OptimizationResult) -> Bool

    Return whether an optimization improves its declared score.

    optimization_score

    fn optimization_score(result : OptimizationResult) -> Double

    Score a schedule according to its declared objective.

    optimize_plan

    fn optimize_plan(plan : MeasurementPlan, goal : OptimizationGoal) -> OptimizationResult

    Optimize execution grouping without changing measurements or devices.

    optimized_batch_count

    fn optimized_batch_count(result : OptimizationResult) -> Int

    Return the number of schedule batches after optimization.

    outlier_flags

    fn outlier_flags(values~ : Array[Double], limits~ : ControlLimits) -> Array[Bool]

    Return flags for values outside control limits.

    pad_right

    fn pad_right(value : String, width : Int) -> String

    Pad a string on the right to a minimum width.

    parse_feature_csv

    fn parse_feature_csv(input : String) -> Array[Feature] raise

    Parse a simple feature CSV: id,kind,nominal,lower,upper,datum.

    parse_feature_csv_strict

    fn parse_feature_csv_strict(input : String) -> ParsedFeatures

    Parse feature CSV without dropping malformed rows.

    parse_observation_csv_strict

    fn parse_observation_csv_strict(input : String) -> ParsedObservations

    Parse observation CSV without dropping malformed rows.

    pass_rate

    fn pass_rate(summary : BatchSummary) -> Double

    Return the pass rate for a summary.

    passed_release_check_count

    fn passed_release_check_count(gate : ReleaseGate) -> Int

    Return the number of passing criteria.

    plan

    fn plan(part_id~ : String, features : Array[Feature], devices : Array[Device]) -> MeasurementPlan

    Build a deterministic measurement plan from features and devices.

    plan_efficiency

    fn plan_efficiency(plan : MeasurementPlan) -> Double

    Return estimated samples per abstract execution second.

    plan_metrics

    fn plan_metrics(plan : MeasurementPlan) -> PlanMetrics

    Calculate deterministic effort metrics for a plan.

    plan_quality

    fn plan_quality(plan : MeasurementPlan) -> QualityScore

    Score coverage and capability while keeping warning count visible.

    plan_waste_count

    fn plan_waste_count(plan : MeasurementPlan) -> Int

    Count plan steps that cannot execute or carry warnings.

    planned_sample_count

    fn planned_sample_count(plan : MeasurementPlan) -> Int

    Return the total number of planned samples.

    policy_accepts

    fn policy_accepts(result : BatchQualityResult) -> Bool

    Return whether a policy result is acceptable for release.

    policy_is_valid

    fn policy_is_valid(policy : AcceptancePolicy) -> Bool

    Return whether a policy is structurally usable.

    population_stddev

    fn population_stddev(values : Array[Double]) -> Double

    Return population standard deviation.

    profile_accuracy_rank

    fn profile_accuracy_rank(profile : DeviceProfile) -> Double

    Return an accuracy rank where lower is better.

    profile_capacity

    fn profile_capacity(profile : DeviceProfile, catalog : Catalog) -> Int

    Count catalog features available to a profile.

    profile_is_ready

    fn profile_is_ready(profile : DeviceProfile, date : String) -> Bool

    Return whether the profile is both usable and currently calibrated.

    profile_is_usable

    fn profile_is_usable(profile : DeviceProfile) -> Bool

    Return whether the profile has positive physical capabilities.

    profile_needs_recalibration

    fn profile_needs_recalibration(profile : DeviceProfile, date : String) -> Bool

    Return whether the profile needs recalibration before a date.

    profile_reach_margin

    fn profile_reach_margin(profile : DeviceProfile, feature : Feature) -> Double

    Return the reach margin for a feature.

    profile_summary

    fn profile_summary(profile : DeviceProfile, date : String) -> String

    Render a stable device profile summary.

    profile_supported_kind_count

    fn profile_supported_kind_count(profile : DeviceProfile) -> Int

    Return the number of supported feature kinds.

    profile_unsupported_ids

    fn profile_unsupported_ids(profile : DeviceProfile, catalog : Catalog) -> Array[String]

    Return the list of unsupported catalog feature IDs.

    profile_warning

    fn profile_warning(profile : DeviceProfile, date : String) -> String

    Return a warning string for a profile/date pair.

    program_cpk_margin

    fn program_cpk_margin(summary : ProgramSummary) -> Double

    Return the Cpk gap to the common 1.33 target.

    program_defect_rate

    fn program_defect_rate(summary : ProgramSummary) -> Double

    Return the defect rate for a program summary.

    program_has_unmeasured

    fn program_has_unmeasured(summary : ProgramSummary) -> Bool

    Return whether a program has any unmeasured features.

    program_high_risk_count

    fn program_high_risk_count(summary : ProgramSummary) -> Int

    Return the number of features with high operational risk.

    program_is_acceptable

    fn program_is_acceptable(summary : ProgramSummary) -> Bool

    Return whether a program is acceptable for offline release.

    program_observation_count

    fn program_observation_count(summary : ProgramSummary) -> Int

    Return the count of all classified observations.

    program_pass_rate

    fn program_pass_rate(summary : ProgramSummary) -> Double

    Return the pass rate for a program summary.

    program_status

    fn program_status(summary : ProgramSummary) -> String

    Return a compact program status label.

    protocol_accepts

    fn protocol_accepts(protocol : MeasurementProtocol) -> Bool

    Return whether a protocol is ready for a downstream consumer.

    protocol_check_count

    fn protocol_check_count(protocol : MeasurementProtocol) -> Int

    Return the number of acceptance checks that are available.

    protocol_from_plan

    fn protocol_from_plan(plan : MeasurementPlan, revision : String) -> MeasurementProtocol

    Build an auditable protocol from the selected plan.

    protocol_is_operational

    fn protocol_is_operational(protocol : MeasurementProtocol) -> Bool

    Return whether the protocol has a complete operational envelope.

    protocol_risk

    fn protocol_risk(protocol : MeasurementProtocol) -> String

    Classify protocol readiness for risk dashboards.

    protocol_status

    fn protocol_status(protocol : MeasurementProtocol) -> String

    Return a compact protocol status for command-line reporting.

    protocol_text

    fn protocol_text(protocol : MeasurementProtocol) -> String

    Render a stable text representation suitable for an audit attachment.

    quality_decision_reason

    fn quality_decision_reason(decision : QualityDecision) -> String

    Return a human-readable decision reason.

    quality_decision_text

    fn quality_decision_text(decision : QualityDecision) -> String

    Render a stable decision label.

    range

    fn range(values : Array[Double]) -> Double

    Return max-min, or zero for an empty collection.

    rank_devices

    fn rank_devices(feature~ : Feature, devices~ : Array[Device]) -> Array[DeviceCandidate]

    Rank reachable devices that support the requested feature kind.

    readiness_catalog_is_valid

    fn readiness_catalog_is_valid(report : ReadinessReport) -> Bool

    Return whether a readiness report has catalog errors.

    readiness_diagnostics

    fn readiness_diagnostics(report : ReadinessReport) -> Array[Diagnostic]

    Return all readiness diagnostics in boundary order.

    readiness_error_count

    fn readiness_error_count(report : ReadinessReport) -> Int

    Return the number of readiness errors.

    readiness_is_green

    fn readiness_is_green(report : ReadinessReport) -> Bool

    Return whether there are no readiness warnings or errors.

    readiness_needs_review

    fn readiness_needs_review(report : ReadinessReport) -> Bool

    Return whether readiness requires human review but is not blocked.

    readiness_plan_is_valid

    fn readiness_plan_is_valid(report : ReadinessReport) -> Bool

    Return whether a readiness report has plan errors.

    readiness_status

    fn readiness_status(report : ReadinessReport) -> String

    Return a stable readiness label.

    readiness_warning_count

    fn readiness_warning_count(report : ReadinessReport) -> Int

    Return the number of readiness warnings.
    fn recommended_samples(feature : Feature, accuracy : Double) -> Int

    Recommend sample count using existing conservative planning rules.

    rejected_explanation_count

    fn rejected_explanation_count(explanations : Array[PlanExplanation]) -> Int

    Count explanations that represent a rejected or missing choice.

    relative_error

    fn relative_error(feature : Feature, value : Double) -> Double

    Return the normalized absolute deviation from nominal.

    release_evidence_is_explained

    fn release_evidence_is_explained(gate : ReleaseGate) -> Bool

    Return whether every criterion has a non-empty evidence detail.

    release_gate_status

    fn release_gate_status(gate : ReleaseGate) -> String

    Return a stable gate status for CLI and CI integration.

    release_gate_text

    fn release_gate_text(gate : ReleaseGate) -> String

    Render every criterion and its evidence detail.

    render_audit_report

    fn render_audit_report(trace~ : AuditTrace, summary~ : BatchSummary?) -> String

    Render a complete plan/trace report with stable keys.

    render_batch_summary

    fn render_batch_summary(summary : BatchSummary) -> String

    Render the stable fields of a batch summary.

    render_dashboard

    fn render_dashboard(dashboard : QualityDashboard) -> String

    Return a stable multi-line card rendering.

    render_dashboard_table

    fn render_dashboard_table(dashboard : QualityDashboard) -> String

    Render dashboard cards as an aligned table.

    render_diagnostics

    fn render_diagnostics(diagnostics : Array[Diagnostic]) -> String

    Render stable diagnostics with row indices.

    render_diagnostics_table

    fn render_diagnostics_table(diagnostics : Array[Diagnostic]) -> String

    Render diagnostic records as an aligned table.

    render_duration

    fn render_duration(estimate : DurationEstimate) -> String

    Return a compact deterministic duration label for CLI output.

    render_evidence_index

    fn render_evidence_index(index : EvidenceIndex) -> String

    Return a concise evidence index label for reports.

    render_key_values

    fn render_key_values(values : Array[(String, String)]) -> String

    Render key-value rows while preserving input order.

    render_metric

    fn render_metric(key : String, value : Double) -> String

    Render a one-line metric with a stable key.

    render_plan_table

    fn render_plan_table(plan : MeasurementPlan) -> String

    Render plan steps as an aligned table.

    render_readiness

    fn render_readiness(report : ReadinessReport) -> String

    Render readiness as stable key-value text.

    render_replay_issues

    fn render_replay_issues(result : ReplayResult) -> String

    Render replay issues as stable text.

    render_report

    fn render_report(plan : MeasurementPlan) -> String

    Render a compact text report suitable for a CLI or audit log.

    render_result_collection

    fn render_result_collection(collection : ResultCollection) -> String

    Render stable collection counts.

    render_risk_matrix

    fn render_risk_matrix(matrix : RiskMatrix) -> String

    Render a stable matrix summary.

    render_text_table

    fn render_text_table(rows : Array[Array[String]]) -> String

    Render a small aligned text table with no hidden sorting.

    render_trace_entries

    fn render_trace_entries(entries : Array[AuditEntry]) -> String

    Render stable one-line entries for an audit trace.

    render_trend_summary

    fn render_trend_summary(summary : QualityTrendSummary) -> String

    Return a compact trend label for reports.

    repeat_count

    fn repeat_count(feature : Feature, device : Device) -> Int

    Select a repeat count from the requested confidence and device accuracy.

    repeated_measurement_consistent

    fn repeated_measurement_consistent(feature~ : Feature, values : Array[Double]) -> Bool

    Check repeatability against the full bilateral tolerance width.

    repeated_step_count

    fn repeated_step_count(plan : MeasurementPlan) -> Int

    Count how many planned steps use repeated sampling.

    replay_has_issue

    fn replay_has_issue(result : ReplayResult, kind : ReplayIssueKind) -> Bool

    Return whether a replay contains a given issue kind.

    replay_is_idempotent

    fn replay_is_idempotent(plan : MeasurementPlan) -> Bool

    Return whether a replay has no differences.

    replay_issue_count

    fn replay_issue_count(result : ReplayResult) -> Int

    Return the number of replay issues.

    replay_issue_kind_text

    fn replay_issue_kind_text(kind : ReplayIssueKind) -> String

    Return stable labels for replay issue kinds.

    replay_plan

    fn replay_plan(plan : MeasurementPlan) -> ReplayResult

    Replay a plan against itself to verify deterministic construction.

    report_manifest_status

    fn report_manifest_status(manifest : ReportManifest) -> String

    Return the manifest state used by CLI and report headers.

    report_manifest_text

    fn report_manifest_text(manifest : ReportManifest) -> String

    Render a stable manifest summary.

    required_time_windows

    fn required_time_windows(estimate : DurationEstimate, window_seconds : Double) -> Int

    Return the number of whole windows needed for this estimate.

    residuals

    fn residuals(feature~ : Feature, values~ : Array[Double]) -> Array[Double]

    Return signed residuals from nominal values.

    resolve_strategy

    fn resolve_strategy(kind : FeatureKind, count : Int) -> Strategy

    Resolve a strategy from a feature kind and requested sample count.

    result_count

    fn result_count(collection : ResultCollection) -> Int

    Return the number of result records.

    result_coverage

    fn result_coverage(collection : ResultCollection) -> Double

    Return result coverage as a fraction of requested features.

    result_for_feature

    fn result_for_feature(collection : ResultCollection, feature_id : String) -> FeatureResult?

    Find the first result for a feature identifier.

    result_has_failure

    fn result_has_failure(collection : ResultCollection) -> Bool

    Return whether a collection has a hard failure.

    result_high_risk_count

    fn result_high_risk_count(collection : ResultCollection) -> Int

    Return the number of high-risk feature results.

    result_is_clean

    fn result_is_clean(collection : ResultCollection) -> Bool

    Return whether every classified feature passed.

    result_is_complete

    fn result_is_complete(collection : ResultCollection) -> Bool

    Return whether every feature has a classified result.

    risk_for_uncertainty

    fn risk_for_uncertainty(uncertainty : Double, tolerance : Double) -> RiskLevel

    Classify an uncertainty ratio into a planning risk level.

    risk_is_actionable

    fn risk_is_actionable(risk : RiskLevel) -> Bool

    Return whether a risk level requires action.

    risk_level_score

    fn risk_level_score(risk : RiskLevel) -> Int

    Convert risk to an ordered score.

    risk_level_text

    fn risk_level_text(risk : RiskLevel) -> String

    Return a stable risk label.

    risk_matrix_is_clear

    fn risk_matrix_is_clear(matrix : RiskMatrix) -> Bool

    Return whether all results are low risk.

    risk_matrix_needs_action

    fn risk_matrix_needs_action(matrix : RiskMatrix) -> Bool

    Return whether any matrix item needs action.

    risk_matrix_status

    fn risk_matrix_status(matrix : RiskMatrix) -> String

    Return a stable matrix status.

    rolling_defect_rates

    fn rolling_defect_rates(points : Array[TrendPoint], window : Int) -> Array[Double]

    Calculate a trailing defect rate for every point.

    rotational_kind_count

    fn rotational_kind_count(kinds : Array[FeatureKind]) -> Int

    Count rotational kinds in an array.

    sample_count_is_valid

    fn sample_count_is_valid(count : Int) -> Bool

    Return whether a sample count can support an uncertainty calculation.

    sample_stddev

    fn sample_stddev(values : Array[Double]) -> Double

    Return sample standard deviation, using zero for fewer than two values.

    schedule_establishes_datum

    fn schedule_establishes_datum(schedule : ScheduledPlan) -> Bool

    Return whether the schedule contains a datum phase.

    schedule_is_deterministic

    fn schedule_is_deterministic(plan : MeasurementPlan) -> Bool

    Return whether two executions of the same plan yield identical IDs/order.

    schedule_plan

    fn schedule_plan(plan : MeasurementPlan, policy : SchedulePolicy) -> ScheduledPlan

    Schedule a plan with phases, batches, and execution cost.

    schedule_policy

    fn schedule_policy(datum_first~ : Bool, group_by_device~ : Bool, max_batch_size~ : Int) -> SchedulePolicy

    Construct an explicit scheduling policy.

    scheduled_feature_ids

    fn scheduled_feature_ids(schedule : ScheduledPlan) -> Array[String]

    Return all scheduled feature IDs.

    scheduled_sample_count

    fn scheduled_sample_count(schedule : ScheduledPlan) -> Int

    Estimate total samples across schedule batches.

    seconds_per_sample

    fn seconds_per_sample(estimate : DurationEstimate) -> Double

    Return the estimated seconds per collected sample.

    selection_reason_text

    fn selection_reason_text(reason : SelectionReason) -> String

    Return a stable textual reason for a selection decision.

    signed_deviation

    fn signed_deviation(feature : Feature, value : Double) -> Double

    Return the signed deviation from a feature's nominal value.

    split_steps_into_batches

    fn split_steps_into_batches(steps : Array[MeasurementStep], max_batch_size : Int) -> Array[Array[MeasurementStep]]

    Split steps into non-empty fixed-size batches.

    step_duration_seconds

    fn step_duration_seconds(step : MeasurementStep) -> Double

    Return the estimated cost of a single step, including its setup.

    step_setup_seconds

    fn step_setup_seconds(step : MeasurementStep) -> Double

    Return the setup cost of a step, including datum alignment.

    strategy_can_resolve

    fn strategy_can_resolve(feature : Feature, strategy : Strategy, device : Device) -> Bool

    Return whether a strategy can support a feature's tolerance.

    strategy_cost

    fn strategy_cost(strategy : Strategy) -> Double

    Return a simple time cost for a strategy.

    strategy_duration_seconds

    fn strategy_duration_seconds(strategy : Strategy) -> Double

    Return the measurement time assigned to one strategy.

    strategy_is_repeated

    fn strategy_is_repeated(strategy : Strategy) -> Bool

    Return whether a strategy uses more than one sample.

    strategy_is_scan

    fn strategy_is_scan(strategy : Strategy) -> Bool

    Return whether a strategy is a scan.

    strategy_name

    fn strategy_name(strategy : Strategy) -> String

    Return a stable strategy label.

    strategy_risk

    fn strategy_risk(strategy : Strategy) -> RiskLevel

    Return a conservative risk for a strategy.

    strategy_sample_count

    fn strategy_sample_count(strategy : Strategy) -> Int

    Return the sample count represented by a strategy.

    summarize_batch

    fn summarize_batch(feature~ : Feature, observations~ : Array[Observation]) -> BatchSummary

    Summarize observed values and verdicts for one feature.

    summarize_program

    fn summarize_program(features~ : Array[Feature], observations~ : Array[Observation], plan~ : MeasurementPlan) -> ProgramSummary

    Aggregate all planned features and their observations.

    summarize_quality_trend

    fn summarize_quality_trend(points : Array[TrendPoint]) -> QualityTrendSummary

    Summarize samples, defects, and per-batch rates.

    supported_devices

    fn supported_devices(catalog : Catalog, feature : Feature) -> Array[Device]

    Return all devices that can measure a feature.

    supported_feature_count

    fn supported_feature_count(device : Device, features : Array[Feature]) -> Int

    Count catalog features supported by a device.

    table_column_count

    fn table_column_count(rows : Array[Array[String]]) -> Int

    Return the maximum number of columns in a table.

    table_is_rectangular

    fn table_is_rectangular(rows : Array[Array[String]]) -> Bool

    Return whether all rows have the same number of columns.

    tolerance_half_width

    fn tolerance_half_width(feature : Feature) -> Double

    Return half the bilateral tolerance width.

    tolerance_is_valid

    fn tolerance_is_valid(feature : Feature) -> Bool

    Return whether tolerance limits are ordered and non-zero in width.

    trace_append

    fn trace_append(log : TraceLog, event : TraceEvent) -> TraceLog

    Append an event to a trace log.

    trace_event_count

    fn trace_event_count(log : TraceLog, kind : TraceEventKind) -> Int

    Count events of one kind.

    trace_event_kind_text

    fn trace_event_kind_text(kind : TraceEventKind) -> String

    Return a stable label for a trace event kind.

    trace_feature_event_count

    fn trace_feature_event_count(log : TraceLog, feature_id : String) -> Int

    Return the number of events associated with a feature.

    trace_feature_ids

    fn trace_feature_ids(log : TraceLog) -> Array[String]

    Return feature IDs represented by trace step events.

    trace_has_feature

    fn trace_has_feature(log : TraceLog, feature_id : String) -> Bool

    Return whether a trace contains a feature step.

    trace_has_part

    fn trace_has_part(log : TraceLog, part_id : String) -> Bool

    Check whether every event belongs to a part identifier.

    trace_has_warning

    fn trace_has_warning(log : TraceLog) -> Bool

    Return whether a warning event is present.

    trace_is_complete

    fn trace_is_complete(log : TraceLog) -> Bool

    Check lifecycle markers and step index ordering.

    trace_log_from_plan

    fn trace_log_from_plan(plan : MeasurementPlan) -> TraceLog

    Create a trace log containing lifecycle and step events.

    trace_step_indices

    fn trace_step_indices(log : TraceLog) -> Array[Int]

    Return all step indices in trace order.

    trace_summary

    fn trace_summary(log : TraceLog) -> String

    Return a stable one-line trace summary.

    transfer_dominates

    fn transfer_dominates(estimate : DurationEstimate) -> Bool

    Return whether transfers dominate the operational estimate.

    transfer_time_ratio

    fn transfer_time_ratio(estimate : DurationEstimate) -> Double

    Return the fraction of effort spent moving between devices.

    trend_direction

    fn trend_direction(points : Array[TrendPoint]) -> String

    Classify the direction of the ordered defect-rate sequence.

    trend_is_within_limit

    fn trend_is_within_limit(points : Array[TrendPoint], limit : Double) -> Bool

    Return whether the aggregate rate is below a configured limit.

    trend_point

    fn trend_point(batch_id : String, sample_count : Int, defect_count : Int) -> TrendPoint

    Construct a bounded batch-level trend point.

    truncate_text

    fn truncate_text(value : String, limit : Int) -> String

    Truncate text with an ellipsis when it exceeds a limit.

    uncertainty_ratio

    fn uncertainty_ratio(feature : Feature, uncertainty : Double) -> Double

    Return the normalized uncertainty ratio.

    unmeasurable_features

    fn unmeasurable_features(catalog : Catalog) -> Array[Feature]

    Return features with no reachable supporting device.

    upper_limit

    fn upper_limit(feature : Feature) -> Double

    Return the absolute upper measurement limit.

    validate_batch_summary

    fn validate_batch_summary(summary : BatchSummary) -> Array[Diagnostic]

    Validate a batch summary's internal counts and rates.

    validate_catalog

    fn validate_catalog(features : Array[Feature], devices : Array[Device]) -> Array[Diagnostic]

    Validate all features and devices, including duplicate feature identifiers.

    validate_device

    fn validate_device(device : Device, index : Int) -> Array[Diagnostic]

    Validate a device without modifying it.

    validate_feature

    fn validate_feature(feature : Feature, index : Int) -> Array[Diagnostic]

    Validate a feature without modifying it.

    validate_observations

    fn validate_observations(features : Array[Feature], observations : Array[Observation]) -> Array[Diagnostic]

    Validate observation identity and sample counts against a feature set.

    validate_plan

    fn validate_plan(plan : MeasurementPlan, features : Array[Feature]) -> Array[Diagnostic]

    Validate that plan steps refer to the supplied features and summary.

    validate_protocol

    fn validate_protocol(protocol : MeasurementProtocol) -> Array[String]

    Validate protocol metadata before it is exported or executed.

    validation_can_plan

    fn validation_can_plan(diagnostics : Array[Diagnostic]) -> Bool

    Return whether a validation result can be used for planning.

    validation_status

    fn validation_status(diagnostics : Array[Diagnostic]) -> String

    Return a stable validation status label.

    validation_summary

    fn validation_summary(diagnostics : Array[Diagnostic]) -> ValidationSummary

    Summarize severity counts and the first error code.

    value_failure_count

    fn value_failure_count(results : Array[ValueQualityResult]) -> Int

    Count failures in a set of value results.

    value_is_failure

    fn value_is_failure(result : ValueQualityResult) -> Bool

    Return whether a value result is a hard failure.

    value_needs_review

    fn value_needs_review(result : ValueQualityResult) -> Bool

    Return whether a value result needs human review.

    value_warning_count

    fn value_warning_count(results : Array[ValueQualityResult]) -> Int

    Count warnings in a set of value results.

    verdict

    fn verdict(plan : MeasurementPlan, feature : Feature, observations : Array[Observation]) -> Verdict

    Find a matching observation and classify it.

    verdict_code

    fn verdict_code(verdict : Verdict) -> String

    Return a stable verdict code.

    verdict_is_failure

    fn verdict_is_failure(verdict : Verdict) -> Bool

    Return whether a verdict is a hard failure.

    verdict_is_pass

    fn verdict_is_pass(verdict : Verdict) -> Bool

    Return whether a verdict passed.

    verdict_reason

    fn verdict_reason(verdict : Verdict) -> String

    Return a stable verdict explanation.

    warning_diagnostic

    fn warning_diagnostic(code~ : String, message~ : String, index~ : Int) -> Diagnostic

    Create a warning diagnostic with a stable code and input index.

    within_control_limit_count

    fn within_control_limit_count(values~ : Array[Double], limits~ : ControlLimits) -> Int

    Count values inside control limits.

    within_tolerance

    fn within_tolerance(feature : Feature, value : Double) -> Bool

    Return whether a value is inside inclusive limits.

    worse_verdict

    fn worse_verdict(left : Verdict, right : Verdict) -> Verdict

    Return the better of two verdicts using fail > unmeasured > pass priority.

    worst_feature_result

    fn worst_feature_result(collection : ResultCollection) -> FeatureResult?

    Return the worst result by fail/unmeasured/pass priority.

    worst_verdict

    fn worst_verdict(verdicts : Array[Verdict]) -> Verdict

    Reduce a collection of verdicts to its worst outcome.