Layer-3 observation datum: value + time + provenance, the Env comonad. No tokio, no sqlx, no I/O -- buildable for WASM/CI/edge targets unmodified.
| Tier | foundation |
| Role | unclassified (baselined) |
| Path | crates/foundation/observation |
| Edition | 2021 |
| Targets | foundation_observation |
| Public items | 6 across 0 modules |
| Tests | 7 |
What it is for
Layer-3 observation datum, per docs/planning/MEASUREMENT-LAYERS-DECOMPOSITION.md must never claim a cause.
Observation<T> is the Env comonad (coreader): it composes downward via Observation::map/Observation::extend and deliberately has no bind/flatten/join — joining observations of different measurands is meaningless, so the type does not offer a way to do it.
No tokio, no sqlx, no filesystem or network I/O. This crate is pure data plus two operations, buildable for WASM, CI, an edge function, or a future no_std target without modification.
Capabilities
Observation
Layer-3 observation datum, per docs/planning/MEASUREMENT-LAYERS-DECOMPOSITION.md
| Item |
|---|
pub struct Observation<T> |
Observation<T>
Layer-3 observation datum, per docs/planning/MEASUREMENT-LAYERS-DECOMPOSITION.md
| Item |
|---|
Observation<T> :: fn new(value : T, occurred_at : DateTime <Utc>, provenance : Provenance) -> Self |
Observation<T> :: fn extract(& self) -> & T |
Observation<T> :: fn map <U>(self, f : impl FnOnce(T) -> U) -> Observation <U> |
Observation<T> :: fn extend <U>(& self, f : impl Fn(& Observation <T>) -> U) -> Observation <U> where T : Clone, |
Provenance
Layer-3 observation datum, per docs/planning/MEASUREMENT-LAYERS-DECOMPOSITION.md
| Item |
|---|
pub struct Provenance |
How to use it
No examples/ target and no doctest in this crate's rustdoc. The tests listed under Verification are the closest executable usage.
Module structure
No public modules: the crate root is its whole surface.
Public surface
`crate root`
| Item | What it is |
|---|---|
pub struct Provenance | Where a measurement came from — enough to judge whether to trust it, never enough to claim why it happened |
pub struct Observation<T> | Layer 3's datum: value + time + provenance, nothing else |
Observation<T> :: fn new(value : T, occurred_at : DateTime <Utc>, provenance : Provenance) -> Self | Build an observation |
Observation<T> :: fn extract(& self) -> & T | The one way out of the envelope: the payload, and nothing else. |
Observation<T> :: fn map <U>(self, f : impl FnOnce(T) -> U) -> Observation <U> | Transform the payload; time and provenance pass through unchanged. |
Observation<T> :: fn extend <U>(& self, f : impl Fn(& Observation <T>) -> U) -> Observation <U> where T : Clone, | Comonadic extend: build a new observation whose payload is computed from the whole current observation (value, time, and provenance all visible to f), carried at the same time/provenance as self. |
No pub use re-exports: every item above is declared in this crate.
Boundary
Depends on no other workspace tier.
Shares tier foundation with 27 other crates: foundation-audit-log, foundation-basemodels, foundation-bounded-io, foundation-conversation-closure, foundation-crypto-sign, foundation-decisioning, foundation-encounter-vocabulary, foundation-fs-metadata, … (27 total).
_What this crate deliberately does NOT own is a judgment. No committed registry records one for it, so none is stated here._
Where it sits
| Tier (ontology) | foundation |
| Architectural role (taxonomy) | unclassified (baselined) |
| Location | crates/foundation/observation |
| Vocabulary in force (lexicon) | current |
Dependencies
Runtime, from outside the workspace.
| Crate | Requirement | Features | Optional | Only on |
|---|---|---|---|---|
chrono | ^0.4 | serde | no | always |
serde | ^1 | derive | no | always |
Development, from outside the workspace.
| Crate | Requirement | Features | Optional | Only on |
|---|---|---|---|---|
serde_json | ^1 | — | no | always |
Build. None.
Depended on by. Nothing in this workspace.
Feature flags
No Cargo features are defined: every capability is unconditional, so no consumer can receive a half-wired crate.
Targets
| Kind | Name | Source |
|---|---|---|
| lib | foundation_observation | `src/lib.rs` |
Error model
No public error type was detected: no public item declares a type named *Error, and no public signature returns one.
Operational characteristics
| Property | Evidence |
|---|---|
| async public surface | none detected |
| async runtime | none detected |
| database access | none detected |
| network I/O | none detected |
| unsafe code | none detected |
| environment variables | none detected |
No unsafe block, unsafe fn, unsafe impl or unsafe trait was found by the parser anywhere in this crate's source.
Configuration
No environment variable is read with a literal name anywhere in this crate. A variable whose key is computed at run time cannot be listed here, and is not claimed to be absent.
Related capabilities
No workspace crate depends on this one.
Verification
| Kind | Count |
|---|---|
| Unit tests | 7 |
| Integration tests | 0 |
| Examples | 0 |
| Doctests | 0 |
Evidence by module. How often each public module is named by something executable.
| Module | Tests | Examples | Consumers |
|---|---|---|---|
crate root | 2 | 0 | 0 |
What the tests establish, by name:
different_payload_types_preserve_the_same_laws—src/lib.rsextend_associativity_law—src/lib.rsextend_left_identity_law—src/lib.rsextend_right_identity_law—src/lib.rsextract_returns_the_payload_and_nothing_else—src/lib.rsmap_preserves_time_and_provenance_only_transforms_the_payload—src/lib.rsserde_round_trip_never_regenerates_a_field—src/lib.rs
Documentation coverage
| Measure | Documented | Total |
|---|---|---|
| Public items with rustdoc | 6 | 6 |
Public modules with a //! block | 0 | 0 |
pie showData
title Public items with rustdoc
"Documented" : 6
"No rustdoc detected" : 0
Metrics
| Metric | Value |
|---|---|
| Rust source files | 1 |
| Source lines | 182 |
| Code lines | 122 |
| Public API items | 6 |
| Public modules | 0 |
| Tests | 7 |
| Examples | 0 |
| Cargo features | 0 |
| Direct runtime dependencies | 2 |
| Workspace reverse dependencies | 0 |
pie showData
title Public API by kind
"method" : 4
"struct" : 2
pie showData
title Rust source composition
"Code" : 122
"Blank or comment" : 60
Generation
Rendered by tools-corpus corpus readme from repository evidence alone, renderer schema 2, lexicon current. No model, network service or database was consulted. Regenerate with tools-corpus corpus readme --write; verify with --check.