Skip to main content

Record

Struct Record 

Source
pub struct Record {
Show 17 fields pub seq: i64, pub type_id: String, pub state: String, pub created_at: String, pub drained_at: String, pub valid: bool, pub invalid_reason: Option<String>, pub values: Map<String, Value>, pub free_text: Vec<String>, pub reply_to: Option<String>, pub extraction: Option<Extraction>, pub extraction_error: Option<String>, pub triage_session: Option<String>, pub outbox: Vec<String>, pub note: Option<String>, pub attachments: Vec<Attachment>, pub rest: Map<String, Value>,
}
Expand description

One inbound request, as the drain wrote it and this side updates it.

Deserialised structurally rather than through a shared type: the seam between the public surface’s client and mecha is a directory of JSON, not a crate dependency. Unknown fields are preserved on write because the writer on the other side may know things this one does not.

Fields§

§seq: i64§type_id: String§state: String

drainedextractedtriagedawaiting_meanswered, or extraction_failed at any point, which routes to a human.

§created_at: String§drained_at: String§valid: bool

Whether it validated against the manifest at drain time. An invalid record is never extracted and never reaches a run.

§invalid_reason: Option<String>§values: Map<String, Value>§free_text: Vec<String>

The names of the values that are prose. See the module docs.

§reply_to: Option<String>

Where a reply goes: the address the box proved a stranger controls, by sending a link to it and waiting for the click.

Written by the drain, which holds the manifest and so knows which field [verification] names. It is separate from values because an email field is free-text by kind, so the address is stripped from Record::typed_values along with the prose — correct for an affiliation somebody typed, and it left the first real triage run unable to answer anything: “without a recipient address, there is no way to compose or stage a reply.” The most-checked value in the record was being quarantined with the least-checked ones.

An address, used as an address. Not evidence of who anybody is, and not text to reason about.

None on a record that did not validate — which is also a record no privileged run is given, so the two absences agree.

§extraction: Option<Extraction>

What the quarantined pass made of the prose. Present once extraction has succeeded, and the only representation of the prose that a privileged run is ever given.

§extraction_error: Option<String>

Why extraction failed, when it did.

§triage_session: Option<String>

The session a triage run happened in.

This is the join between a request and the reply drafted for it, and it is the reason nothing here had to be added to the outbox: a staged item already records the session that drafted it, so the association is a fact both stores independently hold rather than a pointer one of them has to maintain. The dependency runs one way — this module reads the outbox and the outbox has never heard of a request.

§outbox: Vec<String>

The outbox items that triage staged for this request.

Recorded rather than recomputed from triage_session on demand, because the outbox is swept and a released item eventually stops being findable — and “this was answered” must outlive the draft that answered it.

§note: Option<String>

Why this reached the state it is in, when a person or a reconciliation had a reason worth keeping. The design document’s rule for closed is “with a reason”, and silence is the failure mode this whole component exists to fix.

§attachments: Vec<Attachment>

The files that arrived with this request, as the drain wrote them.

Typed rather than left in rest, because the boundary below is a function over this list: the privileged brief excludes any field named here from fields and emits measurements only. The stranger’s filename and the on-disk path surface in exactly one place — frontdoor show, for a human.

§rest: Map<String, Value>

Anything the other side wrote that this side does not model. Kept so a round-trip through here never drops a field.

Implementations§

Source§

impl Record

Source

pub fn file_name(&self) -> String

0000000012-meeting.json, matching what the drain wrote.

Source

pub fn typed_values(&self) -> Map<String, Value>

The values that are not prose — and not files either.

A file field’s value is measurements the box took, but the drain strips the stranger’s filename out of it and a regressed drain might not. Excluding the whole field here means even that regression leaks nothing: the brief carries the measurements through its own attachments key, built from the sidecar, never from values.

Source

pub fn prose(&self) -> Vec<(String, String)>

The prose, for a human to read. The only accessor that returns it.

Source

pub fn for_privileged_run(&self) -> Option<Value>

Everything a run with tools may be told about this request.

The boundary of the quarantine, and the reason it is a function: the prose is not omitted by convention here, it is unreachable. There is no flag that adds it back. A privileged run that genuinely needs the original is a decision a human makes while reading frontdoor show, out of band, with the transcript in front of them.

Returns None for anything not extracted — an invalid record, one that failed extraction, one not yet processed. A run must never be handed a request whose prose nothing has looked at.

Trait Implementations§

Source§

impl Clone for Record

Source§

fn clone(&self) -> Record

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Record

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Record

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Record

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more