Skip to main content

ExportSpecSliceExt

Trait ExportSpecSliceExt 

Source
pub trait ExportSpecSliceExt {
    // Required methods
    fn has_when(&self, kind: ExportTrigger) -> bool;
    fn has_channel_kind(&self, kind: ChannelKind) -> bool;
    fn has_report_format(&self, kind: ReportFormat) -> bool;
    fn has_artifact_kind(&self, kind: ArtifactKind) -> bool;
    fn has_report_payload_shape(&self, kind: ReportPayloadShape) -> bool;
    fn has_applicable_at(&self, phase: ProcessPhase) -> bool;
}
Expand description

Slice-level (ExportTrigger, presence) probe on any &[ExportSpec] — the ONE substrate primitive that owns the .iter().any(|e| e.when == K) walk shape for the export-spec vector. Callers compose the answer they want on top: spec.lifetime.resolved_ephemeral().is_some_and(|e| e.exports.has_when(kind)) for the point-domain export-when-<kind> require-tag family, a coherence check that verifies “every Always export ships through a JetStream-backed channel”, an editor completion listing which ExportTrigger gates the operator authored — every future consumer reaches this ONE primitive through slice.has_when(k) instead of restating the .iter().any closure body.

§Fourth instance in the slice-level presence-probe algebra

Same axis, same shape, fourth instance in the workspace-wide slice-level closed-set-driven presence-probe algebra alongside crate::boundary::ConditionSliceExt::has_kind on &[Condition], crate::spec::DependsOnSliceExt::has_must_reach on &[DependsOn], and crate::compliance::ComplianceBindingSliceExt::has_verification_phase on &[ComplianceBinding]. All four live one composition boundary below the tagged-union-parent probes (crate::intent::Intent::has, crate::lifetime::Lifetime::has, crate::boundary::Boundary::has_condition_kind) at the (&self, K) → bool signature; a future normalization at the slice-level probe shape (widening the return to Option<&ExportSpec> for deeper diagnostics, adding a debug-build assertion on redundant duplicate (source, channel) pairs at the same trigger, switching to a linear scan that also counts matches) lands at ONE site here and every downstream slice.has_when(K) callsite picks it up mechanically.

§Compounding

The export-when-<kind> and channel-<kind> require-tag prefix families in tatara-reconciler::bin::tatara-check compose the Self::has_when and Self::has_channel_kind primitives with the closed-set FromStr autoderived on ExportTrigger + ChannelKind through the strip_and_classify_prefixed_kind substrate to publish the SEVENTH + EIGHTH closed-set-driven prefix families byte-for-byte symmetrical with intent-<kind> / lifetime-<kind> / condition-<kind> / must-reach-<kind> / sighup-<kind> / verification-phase-<kind>. The resolved_ephemeral projection on the parent crate::lifetime::Lifetime gates BOTH walks: a permanent Process (or an ambiguous one, or one without an :exports slot) returns false for every trigger kind AND every channel kind because the exports vector isn’t reachable — the same operator- facing answer as a resolved-ephemeral spec whose exports slot is present but empty. A future fourth ExportTrigger variant added to ExportTrigger::ALL (a hypothetical OnFirstFailure retry- scoped trigger, an OnAborted cancellation-scoped trigger) reaches every downstream through the SAME closed-set walk with no per-caller edit, as does a future fourth ChannelKind variant added to ChannelKind::ALL (a hypothetical KubernetesEventSink slot, a WebhookPost slot).

Peer to crate::lifetime::EphemeralLifetime::has_applicable_exports on the (ExportTrigger, ProcessPhase) → bool axis pair — that projection asks “does any export FIRE at this terminal phase” (a compound (when, phase) → fires_on(phase) walk that projects to a boolean the reconciler consumes in the Releasing gate); this primitive asks “does any export CARRY this trigger literal” (a direct when == kind equality walk that answers the operator’s :requires (export-when-<kind>) audit tag). The two surfaces answer distinct questions and coexist — has_applicable_exports composes the closed-set dispatch over ExportTrigger::fires_on, while has_when composes the closed-set discriminator equality on the raw when field.

Theory anchor: THEORY.md §II.1 invariant 5 — composition preserves proofs; the per-slice when walk lives at ONE substrate site so every downstream (require-tag classifier, coherence check, editor completion) binds through the SAME shape rather than restating the .iter().any(|e| e.when == K) closure body at each callsite. THEORY.md §VI.1 — generation over composition; a future ExportTrigger variant lands at ONE ALL entry + ONE as_str arm on the closed set and the presence probe picks it up mechanically without further per-consumer edits.

Required Methods§

Source

fn has_when(&self, kind: ExportTrigger) -> bool

True iff at least one ExportSpec in this slice carries the given ExportTrigger on its ExportSpec::when slot. The single-slice presence probe every consumer of the (&[ExportSpec], ExportTrigger) -> bool shape composes against.

Source

fn has_channel_kind(&self, kind: ChannelKind) -> bool

True iff at least one ExportSpec in this slice ships through a VectorChannel whose ChannelKind::select-populated slot matches the given ChannelKind. Composes the closed-set ChannelKind::select projection with the same .iter().any(|e| …) walk shape Self::has_when publishes on the when axis, opening a second closed-set-driven presence probe on the SAME &[ExportSpec] slice. The ChannelKind::select projection is the ONE substrate owner of the “is the slot populated” answer for a tagged-union carrier, so a future fourth ChannelKind variant reaches this walk through the ALL sweep + one select arm alone — no per-consumer edit here.

Note that an ambiguous VectorChannel (two or more slots populated — a schema-invalid state that VectorChannel::variant rejects) STILL answers true for every kind whose slot is populated because the walk reads the raw Option<…> slot rather than the validated tagged-union resolver. Callers whose invariant is “the spec is valid” reach the same answer through the validation gate rather than this primitive; callers whose invariant is “is this kind’s slot present at all” (require-tag classifier, editor completion, coherence check that flags a stdout export as non-guaranteed-delivery) reach through THIS primitive.

Source

fn has_report_format(&self, kind: ReportFormat) -> bool

True iff at least one ExportSpec in this slice carries an ArtifactSource::test_report populated with a TestReportSource whose TestReportSource::format equals the given ReportFormat. Composes the nested-Option projection past source.test_report with the same .iter().any(|e| …) walk shape Self::has_when and Self::has_channel_kind publish, opening a THIRD closed-set- driven presence probe on the SAME &[ExportSpec] slice — the first probe on this trait that reads a NESTED-Option scalar (Option<TestReportSource> past ArtifactSource, then ReportFormat equality on the populated slot) rather than a tagged-union carrier (has_channel_kind on VectorChannel) or a direct closed-set field (has_when on ExportTrigger). A future fifth ReportFormat variant reaches this walk through the ReportFormat::ALL sweep alone — the equality body reads the raw format field so no per-variant substrate edit lands here.

Note that an export whose source has NO test_report slot populated (a receipts / process_snapshot / run_marker export) contributes false for EVERY ReportFormat kind — the outer nested-Option projection collapses before the equality on format fires, so the default ReportFormat::Raw (which the empty projection would spuriously compare to a hand-authored Raw-tagged report) never leaks through. Callers whose invariant is “does any test-report export declare THIS payload format” (require-tag classifier, coherence check like “every JUnit report ships through JetStream”, editor completion) reach this ONE primitive rather than restating the e.source.test_report.as_ref().is_some_and(|tr| tr.format == K) two-step chain at each callsite.

Source

fn has_artifact_kind(&self, kind: ArtifactKind) -> bool

True iff at least one ExportSpec in this slice carries an ArtifactSource whose ArtifactKind::select-populated slot matches the given ArtifactKind. Composes the closed-set ArtifactKind::select projection with the same .iter().any(|e| …) walk shape Self::has_when + Self::has_channel_kind + Self::has_report_format publish, opening a FOURTH closed-set-driven presence probe on the SAME &[ExportSpec] slice — the second probe on this trait whose closure reads a TAGGED-UNION carrier (peer of Self::has_channel_kind on VectorChannel; the ArtifactKind::select projection is the ONE substrate owner of the “is the slot populated” answer for the four-slot ArtifactSource carrier, so a future fifth ArtifactKind variant reaches this walk through the ArtifactKind::ALL sweep + one select arm alone — no per-consumer edit here.

Note that an ambiguous ArtifactSource (two or more slots populated — a schema-invalid state that ArtifactSource::variant rejects) STILL answers true for every kind whose slot is populated because the walk reads the raw Option<…> slot rather than the validated tagged-union resolver. Callers whose invariant is “the spec is valid” reach the same answer through the validation gate rather than this primitive; callers whose invariant is “is this kind’s slot present at all” (require-tag classifier, editor completion, coherence check like “every ephemeral export ships a receipts artifact”) reach through THIS primitive.

Distinct from Self::has_report_format on ONE dimension: has_report_format reads a NESTED-Option scalar (Option<TestReportSource> past ArtifactSource, then ReportFormat equality on the populated slot) while has_artifact_kind reads the OUTER tagged-union carrier directly (Option<T> past ArtifactSource) — a receipts-only export answers true for has_artifact_kind(Receipts) but false for every has_report_format(k) kind because the test_report slot is empty.

Source

fn has_report_payload_shape(&self, kind: ReportPayloadShape) -> bool

True iff at least one ExportSpec in this slice carries an ArtifactSource with a populated TestReportSource whose ReportFormat::payload_shape projection lowers to the given ReportPayloadShape. Composes the closed-set ReportFormat::payload_shape typed projection with the same .iter().any(|e| …) walk shape Self::has_when + Self::has_channel_kind + Self::has_report_format + Self::has_artifact_kind publish, opening a FIFTH closed-set- driven presence probe on the SAME &[ExportSpec] slice — the SECOND probe on this trait whose closure reads a NESTED-Option scalar past ArtifactSource::test_report (peer of Self::has_report_format on the SAME carrier), distinct on ONE dimension: Self::has_report_format compares the raw ReportFormat discriminator (a 4-arm closed set) directly, while this probe compares the DERIVED ReportPayloadShape (a 2-arm closed set) reached through the typed projection ReportFormat::payload_shape — the projection is many-to-one (ReportFormat::NdJson alone lowers to ReportPayloadShape::NdJsonLines; ReportFormat::Junit + ReportFormat::TapV13 + ReportFormat::Raw all lower to ReportPayloadShape::OpaqueBytes), so has_report_payload_shape(OpaqueBytes) answers true on THREE distinct ReportFormat variants and has_report_payload_shape(NdJsonLines) answers true on ONE.

Callers whose invariant is “does any test-report export lower to THIS payload shape at the export-worker embed site” (require-tag classifier report-payload-shape-<kind>, a coherence check like “every ephemeral test-report export lowers to NdJsonLines so shinryu can splice the events”, editor completion listing which payload shapes the operator’s exports resolve to) reach this ONE primitive rather than restating the e.source.test_report.as_ref().is_some_and(|tr| tr.format.payload_shape() == K) three-step chain at each callsite.

A future ReportFormat variant that lowers to a new ReportPayloadShape reaches THIS primitive through the ONE ReportFormat::payload_shape arm alone — no per-consumer edit at this walk or at any downstream report-payload-shape- <kind> callsite.

Source

fn has_applicable_at(&self, phase: ProcessPhase) -> bool

True iff at least one ExportSpec in this slice would fire on the given terminal-reached ProcessPhase — the compound (ExportTrigger, ProcessPhase) → fires_on(phase) walk lifted to ONE slice-level substrate primitive past the ★★ PRIME-DIRECTIVE ≥ 2 duplication threshold. Composes the closed-set ExportTrigger::fires_on dispatch with the same .iter().any(|e| …) walk shape Self::has_when + Self::has_channel_kind + Self::has_report_format + Self::has_artifact_kind + Self::has_report_payload_shape publish, opening a SIXTH closed-set-driven presence probe on the SAME &[ExportSpec] slice — the FIRST probe on this trait whose closed-set discriminator is ProcessPhase (the peer five probes discriminate over ExportTrigger, ChannelKind, ReportFormat, ArtifactKind, and ReportPayloadShape respectively) and the FIRST probe whose closure body composes a DERIVED phase-dispatch projection rather than a raw equality on a stored field.

Semantics — DERIVED fires_on, not raw when equality: has_applicable_at(Attested) returns true for a spec whose when is OnAttested OR Always (both fire on Attested); has_when(OnAttested) returns true only for the exact OnAttested variant. The two probes coexist because they answer distinct operator questions: has_when asks “does any export CARRY this trigger literal” (raw discriminator equality), while has_applicable_at asks “would any export FIRE at this phase” (compound fires_on projection). An Always-triggered export answers false for has_when(OnAttested) but true for has_applicable_at(Attested).

A future fourth ExportTrigger variant reaches this walk through the ONE ExportTrigger::fires_on arm alone — the equality body reads the fires_on(phase) projection so no per-variant substrate edit lands here. A future twelfth ProcessPhase variant is handled by the exhaustive match inside ExportTrigger::fires_on — either the new phase gets a per-trigger fire rule (an OnRetryExhausted reaching a hypothetical RetryExhausted phase) or the closed-set match tail collapses it to false (every non-terminal phase).

Callers whose invariant is “does any declared export fire when we reach THIS phase” — the reconciler’s Attested → Releasing gate, the operator’s :requires (exports-fire-on-<phase>) audit tag, a future coherence check that flags an ephemeral env whose exports never fire on Attested (a common author-error where every export is OnFailed and successful runs leave no trace) — reach this ONE primitive rather than restating the .iter().any(|e| e.when.fires_on(phase)) two-step chain at each callsite.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl ExportSpecSliceExt for [ExportSpec]

Implementors§