rlg implementation plan: 10/10 in every category
Status: Accepted with the maintainer’s decisions of 2026-11-27 and 2026-11-28 (section 5). Supersedes
IMPLEMENTATION-PLAN-v0.1.0.md, which is kept because ADRs 0003 to 0014 cite its phase numbers.Baseline: rlg 0.0.20 (
mainat1f95916). Every finding below was raised by the 2026-11-27 audit; those marked verified were reproduced by running code or confirmed by reading it, the rest are audit findings still to be confirmed by the work package’s fail-first test.Audience: maintainers and contributors picking up a work package, and adopters who want to know what rlg commits to.
How to read this plan
- Section 1 defines the ten categories, scores rlg today, and states
the measurable condition for 10/10 in each, plus the CI gate
that keeps it there. A category is 10/10 only when every condition
holds and its gate is required on
main. - Section 2 lists the ceilings that code cannot lift.
- Section 3 is the work: 37 work packages (WP) grouped into nine milestones across twelve releases, two of them breaking. Every WP names the problem with its evidence, the change, the files, the public API (with code), the fail-first test, the gate, and the semver impact.
- Section 4 maps milestones to releases; section 5 records the maintainer’s decisions and what 0.0.21 shipped; section 6 is the final definition of done.
Every WP follows AGENTS.md: work lands on feat/v<next> and
reaches main through one release PR; commits are signed with an
Assisted-by: trailer; a bug fix starts with a test seen to fail;
complexity ceilings (cyclomatic 10, cognitive 15, Halstead 30, 60
lines per function, 500 per file) hold for touched code; the hot path
(ingest()) takes no lock and does no formatting; decisions that
will be questioned get an ADR.
1. Categories, scores and the 10/10 bar
Scores are the auditors’ judgement on a 0 to 10 scale against the 2026 best-in-class baseline (tracing-subscriber with tracing-appender, fastrace, logforth, spdlog-rs, the OpenTelemetry Rust SDK 0.33, Vector).
| # | Category | Today | Main reasons |
|---|---|---|---|
| C1 | Correctness and standards conformance | 4 | Double newline, OTLP logs off-spec, CEF/GELF/MCP/journald off-spec, init() format ignored |
| C2 | Architecture and extensibility | 5 | Closed sink enum, config never reaches the pipeline, one global everything |
| C3 | Reliability and delivery guarantees | 3 | Silent drops, no stats API, shutdown is terminal, exit loses records, flusher panic invisible |
| C4 | Performance and resource efficiency | 6 | Fast enqueue, but formatting at build time, 2 syscalls per record, eviction on the producer |
| C5 | Security and hardening | 5 | MCP reads any file, log and journald injection, OTLP request-line injection, world-readable files |
| C6 | Supply chain and release integrity | 8 | Scorecard 8.3; 172 vet exemptions; unsigned images; unpinned mcp-publisher |
| C7 | Observability | 5 | Good span context and OTLP spans; no engine metrics, logs export manual, no EventName |
| C8 | Developer experience and documentation | 5 | Journald-by-default surprise, stale tutorial, docs drift, RUST_LOG flattened |
| C9 | Verification depth | 6 | Miri, loom, Kani and fuzz exist but test models, not the real queue or outputs |
| C10 | Operations and packaging | 6 | Signed releases and distroless image; PKGBUILD skips checksums, no SBOM in image, no rotation |
C1. Correctness and standards conformance: the 10/10 bar
- Every record is framed exactly once: one
\nper record on stdout and file; journald uses the native protocol with binary framing for values containing newlines. LogFormat::OTLPand rlg-otlp’s log export validate against the OTLP/JSON protobuf mapping (opentelemetry-protov1.x schema):timeUnixNanoandobservedTimeUnixNanoas decimal strings, attributes asKeyValue[],severityNumberon the 1 to 24 scale, ids omitted when absent,eventNamewhen set.- Every named format either follows its specification (CEF 25,
GELF 1.1, ECS 8.x, MCP
notifications/message, logfmt quoting rules) or is removed or renamed. No invented “ELF” or “W3C” lines. - Every builder setting takes effect on every path (
Log::fire,logfacade,tracing, macros). - Every output parses back with rlg’s own reader (
rlg-cli), for every format that has a reader.
Gate: conformance CI job: an OTLP collector container
(otel/opentelemetry-collector-contrib, pinned by digest) receives
rlg’s logs and spans and its debug exporter output is checked;
snapshot tests per format; a fuzz target that renders random records
in every format and re-parses them.
C2. Architecture and extensibility: the 10/10 bar
- Sinks are a trait; stdout, file, rotating file, journald, os_log, OTLP and test capture are implementations; fan-out is a sink.
Configdrives the whole pipeline (sink, format, level, filters, rotation, retention) and hot-reload re-applies it.- Filtering is per target (
RUST_LOGdirective grammar) and reloadable without restarting the flusher. - Public enums that will grow are
#[non_exhaustive]; internal fields are private; no feature-dependent variants on public enums. - No dependency cycles between workspace crates.
Gate: cargo semver-checks (already required), a public-api
diff check in CI, cargo hack check --each-feature, and an ADR for
every change to these rules.
C3. Reliability and delivery guarantees: the 10/10 bar
accepted == written + dropped + pendingholds at all times and is observable throughENGINE.stats().- The overflow policy is chosen by the user (
DropNewestdefault,DropOldest,Block { timeout }), documented with its cost. flush(timeout)drains without stopping the engine; shutdown counts late records;log::Log::flushis real.- A flusher panic is caught, counted and the flusher restarted; a failed sink write is counted, never silent.
- Exit paths are documented: what
FlushGuard,process::exit,panic = "abort"and signals lose, and how to avoid it.
Gate: a reliability test suite (saturation, kill-the-flusher,
failing sink, shutdown race under loom), required in CI.
C4. Performance and resource efficiency: the 10/10 bar
- Producer path: no formatting and at most one allocation per non-static attribute; measured with a counting allocator.
- Flusher: one
writeper drained batch (up to 64 records). - Published, reproducible numbers on one machine, against tracing-appender non-blocking, fastrace, logforth and spdlog-rs: p50, p99 and p999 per call (1 and 8 producers), end-to-end drain time to a file, drop rate at a sustained rate, RSS.
- No regression over 5% on any tracked benchmark between releases.
- Idle CPU: the flusher does not wake more than 10 times a second when nothing is logged.
Gate: bench-publish.yml runs the suite on a fixed runner class
and fails on a regression past the threshold; docs/BENCHMARKS.md
is generated from its output.
C5. Security and hardening: the 10/10 bar
- No input can forge a record or a field in any format or sink (fuzzed).
- rlg-mcp reads only under an explicit root, with size, line, file and time limits; non-loopback binds require a token.
- Network clients validate every byte they put on the wire and refuse credentials over plaintext to non-local hosts unless the caller opts in; TLS is available behind a feature.
- Files are created
0640withO_NOFOLLOW; rotation never overwrites an archive; retention is bounded. - Redaction can be enforced engine-wide and covers the common secret and PII classes plus key-based rules.
SECURITY.mdis current; a threat model (docs/THREAT-MODEL.md) names every trust boundary.
Gate: fuzz targets for every parser and renderer in
fuzz-smoke.yml; CodeQL and Scorecard with zero open alerts;
cargo deny with yanked = "deny".
C6. Supply chain and release integrity: the 10/10 bar
- Every release artifact, the container images and the crates have Sigstore signatures and SLSA build provenance attached to the GitHub release (Scorecard Signed-Releases 10 requires the provenance files on the release).
- SBOM (CycloneDX) for binaries and images.
- Every tool downloaded in CI is pinned by version and digest.
- cargo-vet exemptions shrink every release (target: under 40, all network and parsing crates audited or imported from trusted audit sets).
- OpenSSF Best Practices: Silver, then Gold when the ceilings in section 2 allow.
Gate: Scorecard in CI with a minimum per check; cargo vet
with a committed exemption count that can only shrink.
C7. Observability: the 10/10 bar
- Logs, traces and engine metrics leave through OTLP from one configuration, without the OpenTelemetry SDK.
- Log records carry trace context on every path, and
EventNamefor event-style records (OpenTelemetry’s replacement for span events). - The engine exports its own metrics: accepted, written, dropped, write errors, queue depth, flusher restarts.
- Resource attributes (
service.name,service.version,deployment.environment.name, host) are configurable and follow semantic conventions.
Gate: the C1 conformance job also checks metrics and resource attributes.
C8. Developer experience and documentation: the 10/10 bar
rlg::init()with no arguments prints readable output to stdout on every OS, honouringRUST_LOGper target.- Every public item has a compiling doc example (no
ignore;no_runonly where it needs a network or a socket). - Every claim in the READMEs and docs is backed by a test or a benchmark, and a docs check fails on version or feature drift.
- Each satellite is either complete or labelled experimental in its README, Cargo description and docs.rs page.
- Error messages name the cause and the fix (
RlgErrorhelp text extended toInitError, config and sink errors).
Gate: cargo test --doc with a count of ignore blocks that
can only fall to zero; scripts/check-doc-versions.sh extended to
feature tables; link and lint checks (already required).
C9. Verification depth: the 10/10 bar
- loom runs the real
ShardedQueueand the real park/wake handshake, not a model. - Kani proves the overflow accounting invariant and the timestamp and severity mappings.
- Fuzz targets cover every renderer, every parser, the journald encoder, the OTLP endpoint parser and the MCP path guard.
- Property tests: render then parse is the identity for every format with a reader.
- Coverage tests are replaced by behaviour tests with assertions; line coverage stays at or above 90% with no test that asserts nothing.
Gate: loom, Kani, Miri and fuzz-smoke required on main;
a lint (scripts/check-assertions.py) that fails on a test function
with no assertion.
C10. Operations and packaging: the 10/10 bar
- File output rotates by size, time or date with retention, and
survives external rotation (reopen on
SIGHUPor inode change). - Packages (PKGBUILD, Debian, Nix, container) are reproducible, checksummed and install every binary.
- Container images are signed, carry an SBOM and run as non-root with a read-only root filesystem.
- A runbook (
docs/how-to/operate.md) covers sizing the buffer, reading the metrics, journald limits and upgrades.
Gate: the existing make install and reproducible-package jobs,
plus an image signature and SBOM check in release.yml.
2. Ceilings code cannot lift
These are recorded so that “10/10” is honest. Each needs a people or organisation change, not a pull request.
| Item | Today | Ceiling while rlg has one maintainer | What lifts it |
|---|---|---|---|
| Scorecard Code-Review | 0 | 0 | A second maintainer approving pull requests |
| Scorecard Branch-Protection | 3 | 4 to 5 (rulesets make enforced rules visible) | Required approvals, possible only with a second reviewer |
| Scorecard Contributors | 0 | 0 | Contributors from at least three organisations |
| OpenSSF Best Practices Gold | Passing | Silver | Gold needs two unassociated significant contributors |
Alerts #6 and #76 were dismissed as “won’t fix” on 2026-11-27 for this reason, and decision 4 keeps it so until after 0.0.27. WP-S6 below moves the protection rules into a repository ruleset so the parts that are enforced become visible.
3. Work packages
Each WP lists: Problem (with evidence), Change, Files, API, Test first, Gate, Semver. “Verified” means reproduced on 2026-11-27.
Milestone M1 (0.0.21): security release, nothing breaks
A lean release: the fixes users need now, with no API change. WP-S1 goes through a private security advisory (open decision 6); WP-S2 to WP-S6 land publicly on feat/v0.0.21. Because the escapers from WP-S2 ship here, the renderer rework in WP-C5 builds on them one release later instead of on a parallel fork.
WP-S1. rlg-mcp reads only under a root (verified)
- Problem:
crates/rlg-mcp/src/ops.rs:26,48,68,97,104open any path or glob;tail_logkeeps every record;tail_logs_globreads whole files; no auth on HTTP transports. Classified as a vulnerability: handled through a GitHub private security advisory (SECURITY.md), fixed on the advisory’s private fork, released, then disclosed. The merge process is open decision 6 (section 5). - Change:
#![allow(unused)]
fn main() {
pub struct Root(PathBuf); // canonical, from --root or RLG_MCP_ROOT
impl Root {
pub fn resolve(&self, requested: &Path) -> Result<PathBuf, Refused> {
let full = self.0.join(requested).canonicalize()
.map_err(|_| Refused::NotFound)?; // generic error
if !full.starts_with(&self.0) { return Err(Refused::OutsideRoot); }
let meta = std::fs::symlink_metadata(&full).map_err(|_| Refused::NotFound)?;
if !meta.is_file() { return Err(Refused::NotARegularFile); }
if meta.len() > MAX_FILE_BYTES { return Err(Refused::TooLarge); }
Ok(full)
}
}
}
Limits: 64 MiB per file, 1 MiB per line (reuse
transport/bounded_lines.rs), 1,000 files per glob, n <= 10,000,
tail through a VecDeque ring; tool I/O in spawn_blocking with
a 10 s timeout; a non-loopback bind requires --allow-remote and
--token <file> (bearer check in transport/guard.rs).
- Test first:
../, absolute paths, symlinks out of the root,/dev/zero, a FIFO and a glob of/**/*each refused. - Gate: a fuzz target over
Root::resolve. - Semver: decided 2026-11-27: in 0.0.21
--rootdefaults to the current directory and the server warns at start that it should be set; it becomes required in 0.0.22 (the planned breaking release). The path guard blocks escapes from the default root from day one.
WP-S2. No injection in any renderer
- Change: one escaping module (
crates/rlg/src/log/escape.rs) used by every text format: C0 and C1 controls (including ESC) as\u{..}in text formats; XML entities; CEF rules; logfmt quoting when a value contains space,=,",\or a control character; attribute keys restricted to[A-Za-z0-9_.-](others are percent-encoded). - Test first: a fuzz target
render_roundtripthat renders random records in every format and asserts one record per line and no field the input did not contain.
WP-S3. OTLP endpoint and credentials
- Problem:
rlg-otlp/src/http.rs:183writes the endpoint path into the request line unchecked; auth headers go in plaintext to any host; DNS resolution runs outside the deadline (blocking_http.rs:60);OTEL_EXPORTER_OTLP_HEADERSis not percent-decoded. - Change:
Endpoint::parserejects bytes<= 0x20,0x7fand non-ASCII in host and path; headers to a non-loopback, non-private address require.allow_insecure_remote(); DNS on a helper thread bounded by the timeout; percent-decode header values per the OTel spec and report malformed pairs as an error fromfrom_env. - Test first:
http://c:4318/v1 HTTP/1.1\r\nX: yrefused.
WP-S4. Files created safely, rotation without loss
OpenOptionsExt::mode(0o640)andcustom_flags(O_NOFOLLOW | O_CLOEXEC)on every log file;DirBuilder::mode(0o750).- Archive names gain a sequence suffix and are created with
O_EXCL;max_filesandmax_total_bytesretention. Count(0)rejected by validation.- Test first: two rotations in the same second keep both archives; a symlinked target is refused.
WP-S5. Secrets out of config and requests
Config::expand_env_varsvalues are redacted inDebug,diffand never written bysave_to_file;TryFrom<env::Vars>reads onlyRLG_-prefixed variables.- rlg-tower: trace header values validated against W3C and truncated; query strings dropped from the logged path by default.
WP-S6. CI and repository hardening
- Pin
mcp-publisherby version and SHA-256 inpublish-mcp.yml; pass workflow values torun:throughenv:;persist-credentials: falseon every checkout; restrictworkflow_dispatchimage pushes to tags. - Sign container images with cosign and attach
provenance: mode=maxand an SBOM. - Add
.dockerignore; remove the duplicate rootDockerfileor make it the single source. deny.toml:yanked = "deny",unmaintained = "workspace"; correct the rustls comment.- Move
mainprotection into a repository ruleset (Scorecard reads rulesets) without bypass actors. SECURITY.md: supported versions generated byscripts/check-doc-versions.sh; document everyunsafesite (sink FFI and rlg-ebpf).- New
docs/THREAT-MODEL.md: trust boundaries (application input, config files, environment, network collector, MCP clients, log files read by tools).
Milestone M2 (0.0.22): correct output and the one API reset
The first of two planned breaking releases. Every caller-facing change that can land together does: the output fixes, the Sink trait, the overflow policy, the API reset, the format cuts and the stdout default. Upgrade notes cover all of them in one place.
WP-C1. One newline per record (verified)
- Problem:
engine.rs:248formats withwriteln!, thensink.rs:221-226and:246write another\n; journald getsMESSAGE=...\n\n. A JSON log file reads}\n\n{. - Change:
emitformats withwrite!; each sink adds the framing it needs.PlatformSink::Filewraps aBufWriterflushed when the queue drains and at shutdown. - Files:
crates/rlg/src/engine.rs,crates/rlg/src/sink.rs. - Test first:
tests/test_set_sink.rsreads the file back and assertswritten.matches('\n').count() == recordsand no"\n\n". - Gate: the test; a fuzz target asserting framing for random payloads.
- Semver: none (output fix, noted in CHANGELOG).
WP-C2. Spec-conformant OTLP log records (verified)
- Problem:
log.rs:425-449writestimeUnixNanoas ISO-8601, attributes as a JSON map,severityNumberon rlg’s scale (INFO 6, ERROR 8), and""ids;rlg-otlp/src/lib.rs:363-388hard-codesservice.name = "rlg". - Change: a
crate::otlpmodule shared by the renderer and rlg-otlp; a resource builder in rlg-otlp.
#![allow(unused)]
fn main() {
/// OTLP SeverityNumber (logs data model, 1..=24).
pub const fn otlp_severity(level: LogLevel) -> u8 {
match level {
LogLevel::TRACE => 1,
LogLevel::DEBUG | LogLevel::VERBOSE => 5,
LogLevel::INFO => 9,
LogLevel::WARN => 13,
LogLevel::ERROR => 17,
LogLevel::FATAL | LogLevel::CRITICAL => 21,
_ => 0, // SEVERITY_NUMBER_UNSPECIFIED
}
}
}
Records carry the time as nanoseconds from WP-P1 (0.0.25); until
then the renderer parses Log::time back to nanoseconds once. Keep
that parser to one small function with its own tests, marked for
deletion in WP-P1, so removing it is painless. Attributes go
through the same AnyValue encoder as rlg-otlp/src/traces.rs.
- Files:
crates/rlg/src/log.rs, newcrates/rlg/src/otlp.rs,crates/rlg-otlp/src/lib.rs,crates/rlg-otlp/src/traces.rs. - API:
rlg_otlp::Resource::builder().service_name(..) .service_version(..).attribute(k, v); both exporters take it. - Test first: a snapshot test that decodes the JSON with the
opentelemetry-protoserde types (dev-dependency) and fails on today’s output. - Gate: the
conformanceCI job (section 1, C1). - Semver: output change;
serialise_batchgains a&Resourceparameter (breaking, 0.0.x).
WP-C3. Builder settings reach every path (verified)
- Problem:
Log::buildhard-codesLogFormat::MCP(log.rs:158-167);RlgSubscriber::eventnever sets a format; afterbuilder().format(JSON).init(),Log::info().fire()prints an MCP envelope.rlg_time_it!andrlg_span!force their own formats. - Change: an engine-wide default format (
AtomicU8in the engine, set byinit());LogcarriesOption<LogFormat>; the flusher resolvesNoneto the default. Macros stop forcing a format. - Files:
crates/rlg/src/log.rs,engine.rs,init.rs,tracing.rs,macros.rs. - API:
Log.formatbecomesOption<LogFormat>(field), withLog::format(fmt)unchanged for builders. - Test first: the reproducer from the audit as an integration
test:
init(JSON)thenLog::info().fire()must produce JSON. - Semver: breaking for code reading
log.formatdirectly.
WP-C4. caller correct on every path (verified for log)
- Problem:
logger.rs:84,tracing.rs:92andrlg-tower/src/lib.rs:268callfire()from inside rlg, socalleris rlg’s own line (rlg/src/logger.rs:84observed). - Change: those paths ingest with
LogEvent::newand setcallerfromlog::Record::file()/line(), tracing metadata, or (tower) leave it out. - Test first:
log::info!from a test file must give that file and line. - Semver: none.
WP-C5. Formats follow their specs or go
- Problem: CEF header misassigned and unescaped
(
log.rs:258-268); “ELF” and “W3C” invented (:270-292); Apache puts the level in the status slot (:294-304); GELFtimestampis a string andleveluses rlg’s scale; MCP usesnotifications/loginstead ofnotifications/message; logfmt escapes neither\nor newlines. - Change: decided 2026-11-27: remove ELF and W3C; make CLF real
NCSA Common Log Format; keep Apache only as true Combined Log
Format for HTTP records (rlg-tower); fix CEF, GELF, ECS, logfmt and
MCP against their specs. An ADR records the decision, then one
renderer module per kept format under
crates/rlg/src/log/format/, built on the WP-S2 escapers that ship in 0.0.21. - Test first: per-format conformance snapshots, starting with a
CEF record whose description contains
|and\n. - Semver: breaking (
LogFormatvariants change);LogFormatbecomes#[non_exhaustive]in the same release.
WP-C6. journald native protocol
- Problem:
sink.rs:328-335sendsPRIORITYandMESSAGEas text, so a newline in the payload forges fields; noSYSLOG_IDENTIFIER; datagrams overSO_SNDBUFfail silently. - Change: binary framing for values containing
\n,SYSLOG_IDENTIFIER(default: program name), structured fields (RLG_COMPONENT,CODE_FILE,CODE_LINE,TRACE_ID), and a memfd fallback (memfd_create+SCM_RIGHTS) for large records, counted in stats if it fails.
#![allow(unused)]
fn main() {
fn push_field(buf: &mut Vec<u8>, key: &[u8], value: &[u8]) {
buf.extend_from_slice(key);
if value.contains(&b'\n') {
buf.push(b'\n');
buf.extend_from_slice(&(value.len() as u64).to_le_bytes());
buf.extend_from_slice(value);
} else {
buf.push(b'=');
buf.extend_from_slice(value);
}
buf.push(b'\n');
}
}
- Test first: encode
"x\nPRIORITY=0"and assert the datagram decodes to oneMESSAGEfield (a small decoder in the test). - Semver: none.
WP-C7. Small correctness fixes
SpanExporter::flushuses blockingsendand can wait past its timeout (rlg-otlp/src/spans.rs:111): usetry_sendand fall back to waiting with the remaining timeout. Test with a full queue.- Per-record
std::env::varin the journald and os_log sinks (sink.rs:263,:312): decide once at construction. LogLevelordering putsNONE/DISABLEDbelowTRACE(log_level.rs:147-158): reorder soNONEfilters everything; property test thatincludesmatches the engine gate.parse_rust_logignoresoff: parse it.
WP-A1. Sink trait and fan-out
- Problem:
PlatformSinkis a closed enum holding a bareFile(sink.rs:46), so rotation, test capture, network sinks, OTLP log export and fan-out cannot plug in. - Change: an ADR, then:
#![allow(unused)]
fn main() {
pub trait Sink: Send + 'static {
/// Called once per drained batch, records already formatted and
/// framed for this sink.
fn write_batch(&mut self, records: &[Record<'_>]) -> std::io::Result<()>;
/// Make buffered records durable (called when the queue drains
/// and at flush and shutdown).
fn flush(&mut self) -> std::io::Result<()> { Ok(()) }
/// Per-sink format; `None` uses the engine default.
fn format(&self) -> Option<LogFormat> { None }
}
pub struct Record<'a> {
pub level: LogLevel,
pub bytes: &'a [u8],
pub log: &'a Log,
}
pub struct Fanout(Vec<Box<dyn Sink>>);
}
PlatformSink variants become StdoutSink, FileSink,
RotatingFileSink (from rotation.rs), JournaldSink,
OsLogSink; set_sink takes impl Sink; rlg-test gains a
CaptureSink that finally captures records fired by code under
test.
- Gate:
cargo semver-checks; the reliability suite (WP-R1) runs against every built-in sink. - Semver: breaking;
PlatformSinkkept one release as a deprecated alias that builds the matching sink.
WP-R1. Stats and an overflow policy
#![allow(unused)]
fn main() {
#[non_exhaustive]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum OverflowPolicy {
/// Refuse the new record, count it. O(1) on the producer.
DropNewest,
/// Evict the oldest record (today's behaviour).
DropOldest,
/// Wait for space, at most `timeout`, then drop and count.
Block { timeout: std::time::Duration },
}
#[non_exhaustive]
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq)]
pub struct EngineStats {
pub accepted: u64,
pub written: u64,
pub dropped: u64,
pub write_errors: u64,
pub queue_depth: u64,
pub flusher_restarts: u64,
}
impl LockFreeEngine {
pub fn stats(&self) -> EngineStats { /* Relaxed loads */ }
pub fn set_overflow_policy(&self, policy: OverflowPolicy) { /* AtomicU8 + timeout */ }
}
}
- Counters live in a cache-line-padded struct
(
crossbeam_utils::CachePadded) so producers and the flusher do not share a line; producers touch onlyacceptedanddropped. DropNewestbecomes the default: it keeps the producer O(1) and frees nothing on the producer thread (todaypush_evictingfrees evicted records on the caller,sharded_queue.rs:115-134).- Test first: saturate with a sink that sleeps; assert
accepted == written + dropped + queue_depthafter flush, for each policy; a sink returning errors raiseswrite_errors. - Semver: additive, but the default policy changes (CHANGELOG).
WP-Q3. One API reset (moved forward from WP-Q2)
- Problem:
LogEvent’s fields are public (engine.rs:44-55);LogFormat,LogLevelandPlatformSinkare exhaustive, andPlatformSinkhas a feature-dependent variant;FastSerializerand engine counter methods (inc_format,inc_spans) are public. Fixing these later would add another breaking release. - Change: in the same release as the
Sinktrait and the format cuts:LogEventfields private behind a constructor and accessors;#[non_exhaustive]onLogFormat,LogLevel,OverflowPolicy,EngineStatsand sink error types;FastSerializerand the counter methods becomepub(crate)or move to a#[doc(hidden)]internal module; the feature-dependentPlatformSinkvariant goes away with the sink trait. - Test first: a
cargo public-apisnapshot committed in this release; CI fails on any later unplanned change to it. - Semver: breaking, planned for 0.0.22.
WP-D1. Defaults that work on first run
- Decided 2026-11-27: the default sink is stdout on every OS;
journald and os_log are chosen explicitly (
set_sink, config, orRLG_SINK=journald). An ADR records it, since it reverses the native-first default. Lands in 0.0.22 with the other breaking changes. - macOS: real
os_logthroughos_log_createwith a subsystem, or document that the sink is syslog and rename it. - Fix
docs/tutorials/getting-started.md(journalctl -t rlgonceSYSLOG_IDENTIFIERexists, the macOS predicate, the fallback).
Milestone M3 (0.0.23): lifecycle and config
WP-R2. Flush, shutdown, panics, exit
ENGINE.flush(timeout) -> Result<(), FlushTimeout>: the flusher drains, flushes sinks and acknowledges through a one-shot; the engine keeps running.RlgLogger::flushcalls it.ingestafter shutdown counts the record as dropped (shutdown_flagchecked withRelaxed, no lock).- Close the shutdown race: the flusher re-checks the queue after seeing the flag (loom test on the real queue, WP-V1).
- The flusher body runs under
catch_unwind; a panic incrementsflusher_restartsand restarts the loop with a fresh sink handle; thread spawn failure leaves the engine in a “no flusher” state thatstats()reports instead of poisoningENGINE. FlushGuardstays;docs/how-to/operate.mddocuments exit paths (process::exitandpanic = "abort"lose the queue; install the guard inmain; optionalrlg::install_panic_flush()hook that flushes from the panic hook with a bounded timeout).
WP-A2. Config drives the pipeline
- Problem:
apply_configsets only the level (engine.rs:371);from_configandRotatingFileare used only by tests; hot-reload swaps anArcnothing reads;Networkdestinations are skipped. - Change:
ENGINE.apply(&Config)builds aFanoutfromlogging_destinations(file with rotation and retention, stdout, journald, OTLP once WP-O1 lands), sets format, level and filters, and swaps the sink in the flusher through a reload slot (thesink_slotfrom 0.0.20 generalised to aArcSwap-style handoff the flusher checks between batches). Hot-reload callsapplyand reports errors through a callback instead of swallowing them.Networkis rejected by validation until it exists. - Test first: load a config naming a file and
Size(1 KiB)rotation, log 10 KiB, assert archives exist. - Semver: behaviour change for configs that relied on being ignored (CHANGELOG, migration note).
Milestone M4 (0.0.24): filters and one tracing path
WP-A3. Per-target filtering
- Parse the
RUST_LOGdirective grammar (target=level,off, span-name filters later) into a sorted directive table held in anArcSwap; the hot path does one atomic load plus a prefix match on&'static strtargets, cached per callsite. RlgLayerusestracing_subscriber::layer::Filter(per-layer filtering) so it no longer filters other layers throughenabled; level changes calltracing_core::callsite::rebuild_interest_cache.- The
logfacade’sset_max_levelfollows the table’s maximum. - Test first:
warn,mycrate=debugletsmycratedebug through and stopshyperinfo.
WP-A4. init() installs RlgLayer
- With the
tracing-layerfeature,init()installsregistry().with(RlgLayer)so span context, scrub, span export andtraceparentwork without hand-built setup;RlgSubscriberis deprecated in 0.0.24 and removed in 0.0.25, the second planned breaking release.
Milestone M5 (0.0.25): producer-path performance
The second and last planned breaking release: Log changes shape, and RlgSubscriber is removed.
WP-P1. No formatting on the producer
- Problem:
Log::buildformats an ISO timestamp and allocates (log.rs:161,datetime.rs:144-164), copies the description, andwith()runsserde_json::to_valueper attribute. - Change:
Log.timebecomes aTimestamp(u64)(Unix nanos fromSystemTime, or a TSC-calibrated clock behind a feature), formatted on the flusher;description: Cow<'static, str>; attributes inSmallVec<[(Key, Value); 4]>withKey = Cow<'static, str>;Valuea small enum (Str,I64,U64,F64,Bool,Json) so integers and static strings never touchserde_json. - Test first: a counting allocator test (
#[global_allocator]in a dedicated test binary):Log::info("static").fire()performs 0 allocations on the caller; onewith("k", 1u64)performs 0. - Gate: the allocation test in CI; the bench regression gate.
- Semver: breaking (
Logfields); a migration note.
WP-P2. Buffer sizing and memory
- Capacity configurable at engine start (
RLG_BUFFER,Config::buffer_capacity); default stays 65,536. LogEventsize tracked by aconstassertion (target: 64 bytes after WP-P1).
Milestone M6 (0.0.26): flusher, layer and exporter performance
WP-P3. Batch writes
- The flusher formats a whole drained batch into
fmt_bufand callsSink::write_batchonce;FileSinkandStdoutSinkissue onewrite_allper batch; stdout is locked once per batch. - Park without the 5 ms timeout when the queue is empty (the
flusher_idlehandshake already wakes it); keep a 100 ms backstop. - Drain
fast-queueshards round-robin (sharded_queue.rs:146-153).
WP-P4. RlgLayer without per-event cloning
- Span fields stored as
Arc<[(Key, Value)]>snapshots rebuilt onon_record; events holdArcs to their scope’s snapshots instead of cloning maps (layer.rs:149); ids cloned for the innermost span only;componentandspanas&'static str;callerdeferred as(&'static str, u32); scrub moves to the flusher (WP-O2). - Gate: a bench with three nested spans and five fields each,
compared with
tracing_subscriber::fmtintoio::sink.
WP-P5. Exporter efficiency
- Keep-alive connections reused across batches (drop
Connection: close, read the response body to completion), cachedEndpointand resolved address, retries scheduled by the worker without blocking new spans (a retry queue with deadlines), and a streaming encoder writing JSON directly (serde::Serializestructs or hand-written writers) instead ofserde_json::Valuetrees. - Gate: an exporter bench (spans per second to a local collector) in the suite.
Milestone M7 (0.0.27): measured and verified
WP-B1. A reproducible benchmark suite
- New
crates/rlg/benches/suite/with criterion and anhdrhistogramlatency harness:- per-call latency p50, p99, p999 with 1, 4 and 8 producers;
- end-to-end: time to drain 1,000,000 records into a file;
- sustained rate: records per second until drops begin, and drop rate at 2x that rate;
RlgLayerwith nested spans; OTLP export throughput;- RSS after start and after a burst.
- Competitors on the same machine:
tracingwithtracing-appender::non_blocking,fastrace,logforth,spdlog-rs. Method, hardware and versions committed indocs/BENCHMARKS.md, generated from the run. bench-publish.ymlfails on a regression over 5% against the stored baseline.
WP-V1. Verification that tests the real code
- loom: run
ShardedQueue,pushand theflusher_idlepark/wake handshake under--cfg loom(the queue gains a loom-compatible atomics shim), replacing theMutex<Vec>model intests/loom_engine.rs. - Kani: prove
accepted == written + dropped + depthfor the counter logic, the OTLP severity mapping, and timestamp conversion. - Fuzz:
render_roundtrip(WP-S2),journald_encode(WP-C6),otlp_endpoint(WP-S3),mcp_root(WP-S1); all infuzz-smoke.ymland proposed to OSS-Fuzz (docs/OSS-FUZZ.md). - Property tests: render then parse is the identity for JSON, NDJSON, logfmt, OTLP and MCP.
- Replace
tests/test_coverage_*.rswith behaviour tests; addscripts/check-assertions.py(fails on a test with no assertion).
Milestone M8 (0.0.28 to 0.0.29): observability that leads
WP-O1. OTLP logs and metrics from the engine
rlg_otlp::OtlpSinkimplementsSink: batches formatted records as OTLP log records (WP-C2), with resource attributes, retries and stats; logs fromLog::fireand thelogfacade carry the current trace context whenRlgLayeris installed (a thread-local “current span ids” the layer maintains on enter and exit).Log::event(name)sets OTLPeventName(OpenTelemetry’s replacement for span events).rlg_otlp::MetricsExporterexportsEngineStatsandSpanExportStatsas OTLP sums and gauges every 30 s.- One configuration:
rlg_otlp::install_from_env()reads the standardOTEL_*variables and wires logs, traces and metrics. - Gate: the conformance job checks all three signals.
WP-O2. Redaction enforced engine-wide
ENGINE.set_scrub(impl Scrub)runs in the flusher for every record on every path;RlgLayer::with_scrubkeeps working for span attributes.- rlg-redact packs:
Redactor::secrets()(OpenAI and Anthropicsk-, GitHubghp_/gho_/ghs_/github_pat_, Slackxox, Stripesk_live_, GoogleAIza, PEM private keys, Basic auth, URL credentials, AWS secret keys),Redactor::pii()(email, phone, IPv4, IPv6, card numbers with a Luhn check); key-based rules (password,passwd,secret,token,api_key,authorization,cookie,set-cookie) that replace the whole value;Cowfast path that allocates only on a match. - Test first: every pattern with a positive and a negative case;
a
Log::firerecord withpassword=hunter2is scrubbed with the engine hook set.
Milestone M9 (0.0.30 to 0.0.32): differentiators and finish
WP-X1. TLS behind a feature
- A
tlsfeature in rlg-otlp usingrustlswithwebpki-rootsor platform verification;https://accepted when the feature is on. ADR superseding 0015 (local-collector transport stays the documented default).
WP-X2. rlg-mcp for agents
- Bearer-token auth for HTTP transports (the token from a file, constant-time comparison); loopback stays the default bind. OAuth 2.1 is out of scope (decision 1: no hosted MCP server is planned). Idle session reaping; stdin line cap lowered to 1 MiB.
- Emit the OpenTelemetry MCP semantic conventions (development
status; pinned to a version through
OTEL_SEMCONV_STABILITY_OPT_IN). - Read every rlg output format (MCP envelopes, logfmt, OTLP, ECS) in
rlg-cli::parse_record. - Fix
glama.json(volume mount, tool count).
WP-X4. Finish or label every satellite
uring: implement batched submission or remove the variant.- rlg-ebpf: real eBPF enrichment or mark experimental.
- rlg-wasm: build the WASI 0.2 component, update
rlg.witto the current version, or mark experimental. - rlg-test:
CaptureSink(WP-A1) delivers the missing capture. - Each decision in an ADR; experimental crates say so in their
Cargo
description, README and crate docs.
WP-D2. Documentation to match
- Rewrite the root README feature table (the
configdefault),COMPARISON.md(span context now exists),crates/rlg/README.md(empty config files,${NAME}substitution claim,TuiMetricsfield names), and fix the#capabilities-in-0011anchor. - Every
ignoredoc block compiles or becomesno_runwith a reason;InitErrorand sink errors get help text likeRlgError. docs/how-to/operate.md(runbook) anddocs/THREAT-MODEL.md.- Extend
scripts/check-doc-versions.shto feature tables andSECURITY.md.
WP-K1. Packaging
- PKGBUILD with real
sha256sumsand every binary (rlg,rlg-report,rlg-mcp); Debian packaging fromdebian/updated or removed; Nix flake outputs checked in CI. - Release assets: SLSA provenance (
*.intoto.jsonl) attached to the GitHub release (lifts Scorecard Signed-Releases from 8 to 10), CycloneDX SBOMs, cosign signatures for images. - File sink reopens on
SIGHUPor when the inode changes, for external rotators.
WP-Q1. cargo-vet burn-down
- Import audit sets from Mozilla, Google, Bytecode Alliance and
cargo-vet’s registry; audit the network and parsing crates (rmcp, axum, hyper, tokio, serde_json, regex) or trust their publishers explicitly; commit the exemption count inscripts/vet-exemptions.txtand fail CI if it grows. Target: under 40 exemptions by 0.0.32.
WP-Q2. Architecture debt
- Break the
rlgtorlg-clidev-dependency cycle: move the round-trip tests intorlg-cli’s own tests. - The API items that used to be here moved to WP-Q3 (0.0.22), so callers adapt once.
cargo hack check --each-feature --no-dev-depsin CI.- A
public-apisnapshot (cargo public-api) committed and diffed in CI.
Deferred
- WP-X3, audit mode (
OverflowPolicy::Blockwith a write-ahead, hash-chainedAuditFileSink): dropped from this roadmap by decision 1 (2026-11-27). The EU AI Act Article 12 logging duty applies from 2027-12-02 for Annex III systems; revisit when a user asks for it.OverflowPolicy::Blockitself still ships in WP-R1. - OAuth 2.1 for rlg-mcp: dropped from WP-X2 by decision 1.
4. Release map
| Release | Milestone | Work packages | Breaking | Categories lifted |
|---|---|---|---|---|
| 0.0.21 | M1 | S1 to S6 | No | C5, C6 |
| 0.0.22 | M2 | C1 to C7, A1, R1, Q3, D1 | Yes (planned) | C1, C2, C3, C8 |
| 0.0.23 | M3 | R2, A2 | No (behaviour: config now applies) | C3, C2, C10 |
| 0.0.24 | M4 | A3, A4 | No (RlgSubscriber deprecated) | C2, C8 |
| 0.0.25 | M5 | P1, P2 | Yes (planned, last) | C4 |
| 0.0.26 | M6 | P3, P4, P5 | No | C4 |
| 0.0.27 | M7 | B1, V1 | No | C4, C9 |
| 0.0.28 | M8 | O1 | No | C7 |
| 0.0.29 | M8 | O2 | No | C5, C7 |
| 0.0.30 | M9 | X1, X2 | No | C5, C7 |
| 0.0.31 | M9 | X4, D2, K1, Q2 | No | C8, C10, C2 |
| 0.0.32 | M9 | Q1 | No | C6 |
Two breaking releases, announced in advance: 0.0.22 (output, sink
trait, overflow policy, API reset, formats, stdout default, --root
required) and 0.0.25 (Log shape, RlgSubscriber removed). A
breaking change found later waits for the next planned break unless
it fixes a vulnerability.
Every release also clears the hygiene gate (Dependabot, alerts,
audit) before its own work, ships a CHANGELOG section and release
highlights, and keeps the satellites in lockstep. 0.0.22 is large;
it reaches main through its one release PR, built as a series of
reviewed commits on feat/v0.0.22.
Dependencies between packages: WP-S2 (0.0.21) before WP-C5 and WP-C6 (0.0.22); WP-C2 before WP-O1; WP-A1 before WP-R1, WP-A2, WP-O1, WP-K1 (rotation reopen) and WP-X4 (rlg-test); WP-P1 before WP-P4 and the final WP-B1 numbers.
5. Decisions
Made on 2026-11-27
-
Business model: purely open source, for now. WP-X3 (audit mode) and the OAuth half of WP-X2 are dropped (see “Deferred”). WP-B1 and rlg-mcp stay, for adoption.
-
Default sink: stdout everywhere (WP-D1, in 0.0.22). journald and os_log become explicit choices.
-
Formats: remove ELF and W3C; rework CLF and Apache to their real specs (WP-C5, in 0.0.22).
-
Second maintainer: not now. The section 2 ceilings stay recorded; revisit once the library is stable and in production use, after 0.0.27.
-
rlg-mcp
--root: the current directory with a warning in 0.0.21, required from 0.0.22 (WP-S1). -
The rlg-mcp fix ships publicly (2026-11-28). The plan had already described the issue on a public branch, so WP-S1 is fixed on
feat/v0.0.21with full CI instead of through a private advisory fork; an advisory and CVE request can point to the fix afterwards.
What 0.0.21 shipped, and what moved
0.0.21 kept its promise of no breaking change, so parts of the security work moved to the 0.0.22 breaking release:
- WP-S1: the root, the read limits, one refusal message and the
non-loopback warning shipped. Moved:
--rootrequired, and a bearer token required for a non-loopback bind (0.0.22, with WP-X2’s token support). Dropped: running tool I/O on a blocking thread with a timeout; refusing non-regular files and capping every read removes the ways a tool could block. - WP-S2: shipped, with the journald binary framing from WP-C6 and a JSON fix the new fuzz target found (DEL and C1 left raw in attribute values).
- WP-S3: endpoint validation, DNS within the deadline and header decoding shipped. Dropped: refusing credentials over plaintext to non-local hosts, which cannot tell a Compose service or a DaemonSet address from a remote one before DNS; WP-X1 (TLS) is the fix.
- WP-S4:
0640/0750modes and rotation without overwriting shipped. Moved to 0.0.22:O_NOFOLLOW(breaks deliberate symlinked log paths) and retention limits (with WP-A2). - WP-S5:
env_varsvalues hidden fromDebuganddiff, and rlg-tower trace-header validation, shipped. Moved to 0.0.22: not writing expanded values insave_to_file(needs a private field onConfig) and theRLG_prefix for environment config. - WP-S6: shipped except the repository ruleset, which is a settings change made separately.
6. Definition of done for 10/10
rlg rates 10/10 in a category when:
- every condition in its section 1 bar holds on
main; - its gate is a required status check;
- the last two releases kept it (no regression waivers);
- its claims in the docs point to the test or benchmark that proves them.
The plan is complete when all ten categories meet that bar, and the section 2 ceilings are either lifted or still recorded with their reason.