Skip to main content

Crate mesofact_dev

Crate mesofact_dev 

Source
Expand description

mesofact-dev — the dev-tier affordances, and nothing else.

This crate is deliberately small. The serving engine (Server, SSR dispatch, the revalidate receiver, tenants, the same-origin proxy) used to live here, which meant the prod mesofact-serve binary — which shipped from this crate — linked the file watcher and the dev S3 surface. That broke the dev/prod crate boundary W225 §2 relies on for its security claim (“prod is clean by construction … the crate boundary already keeps it out of prod”). It wasn’t: cleanliness rested on linker dead-stripping.

The engine now lives in the mesofact facade and this crate depends on it, holding only the pieces that must never reach a prod binary:

  • watcher — the rebuild-on-change file watcher.
  • s3 — reads the camp-injected dev-tier S3 coordinates that stand in for R2 during dev (R584-T1; W225 §2 “local pond emulation”).
  • app — the library-tier dev entry point, serve_app: the dev counterpart of mesofact::serve_app for a consumer whose routes are Rust handlers rather than a built dist/ tree. Read its module doc for what the dev half of that tier is and, just as load-bearing, what it deliberately is not.
  • cli — the mes toolchain CLI, and the two bin targets over it.

cli carries the prod verbs (serve, publish, new) as well as the dev ones, so consumers learn one CLI — but it gets them by calling into mesofact::cli, which is the direction that costs the prod binary nothing. The boundary above is about what links into a binary, not about which verbs a binary spells.

Engine types are re-exported below so existing mesofact_dev::Server-style callsites keep working; new code should prefer mesofact::… directly.

@arch:see(.yah/docs/working/W225-mesofact-consumer-deployment-model.md)

Re-exports§

pub use app::serve_app;
pub use app::DevServer;
pub use app::DEV_STATE_DIR;
pub use s3::DevStore;
pub use s3::StoreProvenance;
pub use s3::EMBEDDED_BUCKET;
pub use watcher::BuildDriver;
pub use watcher::WatchOptions;
pub use watcher::Watcher;

Modules§

app
The library-tier dev entry point — serve_app, the counterpart to mesofact::serve_app for a consumer whose routes are Rust handlers.
cli
mes — the mesofact dev toolchain.
proxy
Same-origin reverse proxy for the dev server (R513-F10, W207 Gap #1).
revalidate
revalidate — the ephemeral revalidate receiver: the mesofact-native replacement for the standalone almanac-serve binary (W225 §3/§4).
s3
Dev-tier S3 store resolution (R584-T1, partly reversed 2026-09-17).
server
mesofact-dev — axum static-file server for mesofact-static workload artifacts, with optional file-watch + auto-rebuild + atomic pointer swap.
ssr
In-process SSR dispatch for mode:"ssr" routes (R449-F2; supersedes the bun-subprocess implementation R434-F3 shipped).
tenants
Multi-tenant tenants/<id>.toml registry for the revalidate receiver.
watcher
File-watch + auto-rebuild loop for mesofact-static workloads.

Structs§

DistPointer
Shared, atomically-swappable pointer to the currently-served html/ directory. Cheap to clone; reads take a short read-lock.
Identity
Logical identity of a running mesofact-dev: the (service, component) the camp/reconciler spawned it for. Served verbatim at /__mesofact/info so an adopter can confirm a listener on a given port is its dev server before adopting it, rather than blindly hijacking whatever holds the port (a cross-service host-port collision would otherwise silently serve the wrong site — R602-B4).
ProxyMap
An ordered set of prefix → backend base URL proxy routes. Matching is longest-prefix-first, so a more specific /auth/admin can shadow a broader /auth if both are present.
ProxyState
Shared proxy state: the route map plus a single reusable HTTP client. Held in the server state and cloned (cheaply — both are Arc-backed) per request.
ResiliencePolicy
W181 v1 — schema mirror of mesofact_core::manifest::ResiliencePolicy.
RetryPolicy
Server
Static-file dev server for one mesofact-static workload.
SsrChild
In-process SSR dispatch + the data the router needs to use it.
SsrSlot
Swappable holder for the SSR child. The router reads current() on every request; the watcher’s post-build hook installs (or rotates) the child after each successful gen flip. Cheap to clone.
SsrSpawnOptions
Options for spawn. The workload directory anchors the state dir; the gen_dir is the snapshot the SSR runtime should resolve entrypoints against.

Constants§

DEFAULT_PORT
Default port. Historically the local-static provider slot’s; kept as the bare-mesofact-dev default so an existing terminal habit still works.
DEFAULT_RESILIENCE_TIMEOUT_MS
Default per-attempt request timeout when resilience.timeout_ms is unset.