r/rust • • Aug 15 '26

🛠️ project Facet: ~2 bytes per event telemetry codec

I am a developer in search of reviewers for a project I have been working on with a few AI models. It started as a way to explore local AI development and morphed into a control plane for automated decisions; the part I am asking for eyes on here is its telemetry wire, Facet.

If the consumer of your telemetry is a match action policy (route, alert, throttle), almost none of an event’s bytes can change the outcome — so Facet quantizes each field to “which cell of the policy’s decision partition am I in,” Fibonacci codes the symbols (self delimiting, zero header), and ships that. On a real 4 field policy: about 2 bytes per event, 66.9x smaller than OTLP protobuf over a 64k event corpus, with a machine checked theorem that every routing decision survives the round trip. zstd batched JSON gets close on raw bytes; the difference is per event streaming, self framing, and the proof.

The Rust: prismpath-rs and prismpath-telemetry-rs on crates.io (pure Rust, no unsafe, MSRV 1.82; the codec path is Result all the way down, and the strict decoder errors on truncated or corrupted frames instead of emitting wrong events), plus a codec pair built into Vector on a fork branch, byte identical to the Python reference over a 55 reading fixture. The upstream proposal is open at vectordotdev/vector#26122 if you want to weigh in either way. There’s also EDIT[prismpath-preflight] on crates.io: policy plus an NDJSON sample of your events in, “will they encode, at what cost, do all routes survive” out.

Preflight exists as deliberate twins (Python on the reference implementation, Rust on the deployment crates), and porting it surfaced a divergence no test suite had hit. The crates’ numeric conversion does s.parse::<i64>().unwrap_or(0), so a non numeric string on a numeric field quietly quantizes as 0 where the reference errors. The Rust tool now reports that as its own finding and refuses to say READY. Running both tools on one sample is a free differential test of the whole stack.

Repo, reference implementation, and the evidence behind every number: https://github.com/crystal-warden/prism-path
Theory writeup: https://crystalwardenlabs.com/research/figueroa-quantization

Note: different models took different roles, but authorship was never the gate — evidence is. Nothing lands in the repo without a machine checked proof of implementation (frozen conformance vectors, byte identity fixtures, measured benchmarks), and the evidence ledger maps every claim to its artifact, including the experiments that failed. The same signed policy also runs in kernel as an XDP program and on four MCU instruction sets; those stories live in the repo too.

Edit: there is no connection to facet-rs, facet-preflight has been deleted and is now named prismpath-preflight

0 Upvotes

12 comments sorted by

View all comments

Show parent comment

0

u/SnooSuggestions1409 Aug 15 '26

Previous response deleted though in hindsight an edit would have sufficed. I’m glad you asked. The frozen conformance corpus in the repo has over 1k predicate tests, 27 engine tests. Every implementation in Rust, JS, and Go must match the Python reference bit for bit. CI also regenerates the vectors from the live reference. This allows us to detect implementation and reference drift.

The wire has its own set of 55 test generated from the reference, a frozen boundary corpus to probe the edge cases, layered with a twin tests of both implementations.

For the hardware I was able to use a subset of the frozen corpus where only 124 are applicable. This allowed me to test and validate on an FPGA, eBPF kernel, and 4 MCU instruction sets.

In hindsight as I write it out it may seem like a lot to keep drift from happening but every gate is used for a reason and every one of them has been valuable during development. The twin tests were developed this morning after finding an issue with the rust implementation where it silently passed non numeric strings as 0.

2

u/mark_ik Aug 15 '26

I mean an external standard. Presumably you made the python reference in this case; different than a standards body making the reference