Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
[workspace]
resolver = "3"
members = ["crates/ourios-core"]
members = ["crates/ourios-core", "crates/ourios-miner"]
Comment thread
jensholdgaard marked this conversation as resolved.
Resolved

# Remaining members per CLAUDE.md §7 layout will be added as crates land:
# crates/ourios-miner
# crates/ourios-wal
# crates/ourios-parquet
# crates/ourios-ingester
Expand Down
12 changes: 12 additions & 0 deletions crates/ourios-miner/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[package]
name = "ourios-miner"
version = "0.0.0"
description = "Drain-derived online template miner for Ourios."
edition.workspace = true
rust-version.workspace = true
license.workspace = true
repository.workspace = true
publish = false

[lints]
workspace = true
1 change: 1 addition & 0 deletions crates/ourios-miner/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//! Drain-derived online template miner for Ourios.
88 changes: 88 additions & 0 deletions crates/ourios-miner/tests/hazards.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
//! RFC 0001 §5.1 — Hazards. Acceptance-criteria stubs for H1, H2,
//! H5, H7. Each `#[test]` carries the scenario id in its doc
//! comment so `grep -R "H1.1" .` resolves bidirectionally between
//! the RFC and the tests (`docs/verification.md` §2.3).

/// Scenario H1.1 — Semantically distinct templates do not silently merge.
/// See `docs/rfcs/0001-template-miner.md` §5.
#[test]
fn h1_1_login_and_logout_remain_distinct_at_default_threshold() {
todo!("RFC 0001 §6.4");
}

/// Scenario H1.2 — Lossy-zone match retains body.
/// See `docs/rfcs/0001-template-miner.md` §5.
#[test]
fn h1_2_lossy_zone_match_retains_body() {
todo!("RFC 0001 §6.6");
}

/// Scenario H1.3 — Every widening emits an audit event.
/// See `docs/rfcs/0001-template-miner.md` §5.
#[test]
fn h1_3_every_widening_emits_an_audit_event() {
todo!("RFC 0001 §6.4");
}

/// Scenario H2.1 — Oversized parameter triggers OVERFLOW marker and forced body retention.
/// See `docs/rfcs/0001-template-miner.md` §5.
#[test]
fn h2_1_oversized_parameter_triggers_overflow_marker() {
todo!("RFC 0001 §6.5");
}

/// Scenario H2.2 — Per-service overflow rate above 1% raises an alert.
/// See `docs/rfcs/0001-template-miner.md` §5.
#[test]
fn h2_2_per_service_overflow_rate_above_one_percent_alerts() {
todo!("RFC 0001 §6.5");
}

/// Scenario H5.1 — Wildcard widening increments `template_version` and emits `template_widened`.
/// See `docs/rfcs/0001-template-miner.md` §5.
#[test]
fn h5_1_wildcard_widening_increments_version_and_emits_template_widened() {
todo!("RFC 0001 §6.4");
}

/// Scenario H5.2 — Type expansion increments `template_version` and emits `template_type_expanded`.
/// See `docs/rfcs/0001-template-miner.md` §5.
#[test]
fn h5_2_type_expansion_increments_version_and_emits_template_type_expanded() {
todo!("RFC 0001 §6.4");
}

/// Scenario H5.3 — Drift query returns templates that gained a version in window.
/// See `docs/rfcs/0001-template-miner.md` §5.
#[test]
fn h5_3_drift_query_returns_templates_that_gained_a_version() {
todo!("RFC 0001 §6.7");
}

/// Scenario H7.1 — Reconstruction property holds across the corpus.
/// See `docs/rfcs/0001-template-miner.md` §5.
#[test]
fn h7_1_reconstruction_property_holds_across_corpus() {
todo!("RFC 0001 §6.6");
}

/// Scenario H7.2 — Tokenizer failure sets `lossy_flag = true` and retains body.
/// See `docs/rfcs/0001-template-miner.md` §5.
#[test]
fn h7_2_tokenizer_failure_sets_lossy_flag_and_retains_body() {
todo!("RFC 0001 §6.6");
}

/// Scenario H7.3 — Reader emits body verbatim when `lossy_flag` is true.
/// See `docs/rfcs/0001-template-miner.md` §5.
#[test]
fn h7_3_reader_emits_body_verbatim_when_lossy_flag_is_true() {
todo!("RFC 0001 §6.6");
}

/// Scenario H7.4 — Widened literal slot reconstructs via STR fallback.
/// See `docs/rfcs/0001-template-miner.md` §5.
#[test]
fn h7_4_widened_literal_slot_reconstructs_via_str_fallback() {
todo!("RFC 0001 §6.2");
}
68 changes: 68 additions & 0 deletions crates/ourios-miner/tests/invariants.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
//! RFC 0001 §5.2 — Invariants. Acceptance-criteria stubs for
//! CLAUDE.md §3.1, §3.2, §3.3, §3.5, §3.7. Each `#[test]` carries
//! the scenario id in its doc comment so `grep -R "§3.1.1" .`
//! resolves bidirectionally between the RFC and the tests
//! (`docs/verification.md` §2.3).

/// Scenario §3.1.1 — Default similarity threshold is 0.7.
/// See `docs/rfcs/0001-template-miner.md` §5.
#[test]
fn invariant_3_1_1_default_threshold_is_0_7() {
todo!("RFC 0001 §6.3");
}

/// Scenario §3.1.2 — Mandatory metric set is exposed.
/// See `docs/rfcs/0001-template-miner.md` §5.
#[test]
fn invariant_3_1_2_mandatory_metric_set_is_exposed() {
todo!("RFC 0001 §6.8");
}

/// Scenario §3.2.1 — Default per-parameter byte limit is 256.
/// See `docs/rfcs/0001-template-miner.md` §5.
#[test]
fn invariant_3_2_1_default_param_byte_limit_is_256() {
todo!("RFC 0001 §6.5");
}

/// Scenario §3.2.2 — Configured limit above 1 KiB is rejected at startup.
/// See `docs/rfcs/0001-template-miner.md` §5.
#[test]
fn invariant_3_2_2_param_limit_above_1_kib_rejected_at_startup() {
todo!("RFC 0001 §6.5");
}

/// Scenario §3.3.1 — Separators array captured on every successful tokenization.
/// See `docs/rfcs/0001-template-miner.md` §5.
#[test]
fn invariant_3_3_1_separators_captured_on_every_tokenization() {
todo!("RFC 0001 §6.6");
}

/// Scenario §3.5.1 — Snapshot format carries a leading version byte.
/// See `docs/rfcs/0001-template-miner.md` §5.
#[test]
fn invariant_3_5_1_snapshot_format_carries_leading_version_byte() {
todo!("RFC 0001 §6.9");
}

/// Scenario §3.5.2 — Unknown snapshot version triggers full WAL replay.
/// See `docs/rfcs/0001-template-miner.md` §5.
#[test]
fn invariant_3_5_2_unknown_snapshot_version_triggers_wal_replay() {
todo!("RFC 0001 §6.9");
}

/// Scenario §3.7.1 — Tenants' template trees never cross-pollinate.
/// See `docs/rfcs/0001-template-miner.md` §5.
#[test]
fn invariant_3_7_1_tenant_trees_never_cross_pollinate() {
todo!("RFC 0001 §6.1, §6.2");
}

/// Scenario §3.7.2 — Same structural template in two tenants gets distinct `template_id`s.
/// See `docs/rfcs/0001-template-miner.md` §5.
#[test]
fn invariant_3_7_2_same_template_two_tenants_distinct_template_ids() {
todo!("RFC 0001 §6.1");
}
61 changes: 61 additions & 0 deletions crates/ourios-miner/tests/rfc_internal.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
//! RFC 0001 §5.3 — RFC-internal design commitments. Acceptance-
//! criteria stubs for `RFC0001.x`. Each `#[test]` carries the
Comment thread
jensholdgaard marked this conversation as resolved.
Resolved
//! scenario id in its doc comment so `grep -R "RFC0001.1" .`
//! resolves bidirectionally between the RFC and the tests
//! (`docs/verification.md` §2.3).

/// Scenario RFC0001.1 — Fresh-leaf creation does not emit an audit event.
/// See `docs/rfcs/0001-template-miner.md` §5.
#[test]
fn rfc0001_1_fresh_leaf_creation_does_not_emit_audit_event() {
todo!("RFC 0001 §6.2");
}

/// Scenario RFC0001.2 — Degenerate-template guard rejects fully-wildcard widening.
/// See `docs/rfcs/0001-template-miner.md` §5.
#[test]
fn rfc0001_2_degenerate_template_guard_rejects_fully_wildcard_widening() {
todo!("RFC 0001 §6.4");
}

/// Scenario RFC0001.3 — Tokenizer is Unicode whitespace only; punctuation stays in tokens.
/// See `docs/rfcs/0001-template-miner.md` §5.
#[test]
fn rfc0001_3_tokenizer_is_unicode_whitespace_only() {
todo!("RFC 0001 §6.2");
}

/// Scenario RFC0001.4 — Confidence ratio = simSeq / threshold; decision boundary at 1.0.
/// See `docs/rfcs/0001-template-miner.md` §5.
#[test]
fn rfc0001_4_confidence_ratio_decision_boundary_at_one() {
todo!("RFC 0001 §6.3");
}

/// Scenario RFC0001.5 — Bare `template_id = X` spans all versions of leaf X.
/// See `docs/rfcs/0001-template-miner.md` §5.
#[test]
fn rfc0001_5_bare_template_id_spans_all_versions_of_leaf() {
todo!("RFC 0001 §6.7");
}

/// Scenario RFC0001.6 — Bare `template_id = X` does NOT follow alias chains.
/// See `docs/rfcs/0001-template-miner.md` §5.
#[test]
fn rfc0001_6_bare_template_id_does_not_follow_alias_chains() {
todo!("RFC 0001 §6.7");
}

/// Scenario RFC0001.7 — Combined widening + type-expansion increments version twice and emits two events in order.
/// See `docs/rfcs/0001-template-miner.md` §5.
#[test]
fn rfc0001_7_combined_widening_and_type_expansion_emits_two_events_in_order() {
todo!("RFC 0001 §6.2, §6.4");
}

/// Scenario RFC0001.8 — `confidence_p50` and `confidence_p01` are emitted as gauges.
/// See `docs/rfcs/0001-template-miner.md` §5.
#[test]
fn rfc0001_8_confidence_p50_and_p01_are_emitted_as_gauges() {
todo!("RFC 0001 §6.8");
}
2 changes: 1 addition & 1 deletion docs/rfcs/0001-template-miner.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
rfc: 0001
title: Template miner (Drain-derived online log parsing)
status: specified
status: red
author: Jens Holdgaard Pedersen <jens@holdgaard.org>
drafting-assistance: Claude
created: 2026-04-24
Expand Down
Loading