feat(miner): rfc 0023 green pt2 — parse-failure reason telemetry (RFC0023.6) - #355
Conversation
…0023.6) ourios.miner.parse_failure.reason (weaver-registry enum: below_floor, empty_line, tokenizer_failure, degenerate_widening, line_too_long, template_ceiling) rides the existing parse_failures counter per the OTel error.type convention — one instrument, a cause dimension, no per-cause counters. Every §6.3 exit threads its reason through the shared emit helper; the §6.4 rejection's audit emit moves to its own helper (the reason arg had pushed attach_and_maybe_widen over the line budget again). RFC0023.6 green on the in-memory meter harness: ceiling saturation is diagnosable from telemetry alone. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Warning Review limit reached
Next review available in: 54 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR adds a ChangesParse-failure reason tagging
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
Adds a first-class “reason” dimension to miner parse-failure telemetry to make RFC0023.6 (ceiling saturation diagnosable via metrics) observable end-to-end, and updates miner control-flow to thread the reason through all parse-failure exits.
Changes:
- Introduces
ourios.miner.parse_failure.reasonas a semconv enum attribute and requires it onourios.miner.parse_failures. - Threads a
reasonthrough miner parse-failure recording paths (including ceiling divert, below-floor, long line, empty line, degenerate widening, tokenizer failure). - Implements RFC0023.6 test asserting
reason=template_ceilingincrements andtemplate.countreads the ceiling.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| semconv/registry/metrics.yaml | Requires the new reason attribute on the ourios.miner.parse_failures metric. |
| semconv/registry/attributes.yaml | Defines the ourios.miner.parse_failure.reason enum and its members. |
| crates/ourios-semconv/src/lib.rs | Adds the generated Rust constant for the new attribute key. |
| crates/ourios-miner/src/metrics.rs | Adds a reason attribute to parse-failure counter recording. |
| crates/ourios-miner/src/cluster.rs | Threads parse-failure reasons through all relevant miner exit paths and factors degenerate audit emission into a helper. |
| crates/ourios-miner/tests/rfc0023_bounded_memory.rs | Replaces the RFC0023.6 stub with an in-memory-metrics assertion test. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…tions Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…rief Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…e formats post-generate) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
🧹 Nitpick comments (2)
crates/ourios-miner/src/cluster.rs (1)
1288-1288: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick winConsider centralizing reason strings to guard against registry drift.
"template_ceiling"(and the other five reason literals across this file) are hand-typed&'static strvalues that must exactly match the weaver-generatedourios.miner.parse_failure.reasonenum members. Nothing at compile time ties these literals back to the registry — a typo in one call site (or a future rename of the registry enum member) would silently emit mismatched telemetry rather than fail a build. The stack outline for the semconv layer mentions adding only "the generated constant" (singular, the attribute key) toourios-semconv, suggesting the enum values themselves aren't generated as Rust constants.Consider defining a small local enum (e.g.
ParseFailureReasonwith anas_str()returning the six&'static strvalues) or a set ofpub(crate) conststrings in one place, so every call site (cluster.rslines 1238, 1256, 1288, 1354, 1391, 1753, plusrecord_tokenizer_failure's"tokenizer_failure") references a single source of truth instead of retyping the literal.Also applies to: 1354-1354
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@crates/ourios-miner/src/cluster.rs` at line 1288, Centralize the parse-failure reason literals used in cluster.rs so they cannot drift from the weaver registry. Introduce a single source of truth, such as a local ParseFailureReason enum with an as_str() method or a set of pub(crate) const strings, and update every call site including the code around record_tokenizer_failure and the parse-failure helpers to use those shared symbols instead of hand-typed &'static str values like "template_ceiling".crates/ourios-miner/tests/rfc0023_bounded_memory.rs (1)
267-340: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd metrics assertions for the other parse-failure reasons
template_ceilingis the onlyourios.miner.parse_failuresreason covered end-to-end here. Add at least one metrics-level assertion forempty_line,line_too_long,tokenizer_failure,below_floor, anddegenerate_widening(a parameterized case would work well) so each emittedreasonvalue is exercised in crate tests.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@crates/ourios-miner/tests/rfc0023_bounded_memory.rs` around lines 267 - 340, The test rfc0023_6_ceiling_saturation_is_observable only asserts the template_ceiling parse-failure reason, so expand it or add nearby test cases to exercise the remaining ourios.miner.parse_failures reasons. Add metrics-level assertions for empty_line, line_too_long, tokenizer_failure, below_floor, and degenerate_widening, ideally using a parameterized helper that ingests records triggering each path and verifies the exported reason attribute. Use the existing helpers like init_in_memory, MinerCluster::new, record, and the reason/tenant attribute checks to keep the assertions aligned with the current metrics style.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@crates/ourios-miner/src/cluster.rs`:
- Line 1288: Centralize the parse-failure reason literals used in cluster.rs so
they cannot drift from the weaver registry. Introduce a single source of truth,
such as a local ParseFailureReason enum with an as_str() method or a set of
pub(crate) const strings, and update every call site including the code around
record_tokenizer_failure and the parse-failure helpers to use those shared
symbols instead of hand-typed &'static str values like "template_ceiling".
In `@crates/ourios-miner/tests/rfc0023_bounded_memory.rs`:
- Around line 267-340: The test rfc0023_6_ceiling_saturation_is_observable only
asserts the template_ceiling parse-failure reason, so expand it or add nearby
test cases to exercise the remaining ourios.miner.parse_failures reasons. Add
metrics-level assertions for empty_line, line_too_long, tokenizer_failure,
below_floor, and degenerate_widening, ideally using a parameterized helper that
ingests records triggering each path and verifies the exported reason attribute.
Use the existing helpers like init_in_memory, MinerCluster::new, record, and the
reason/tenant attribute checks to keep the assertions aligned with the current
metrics style.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: de2489aa-adfc-4e0d-9a6a-27af1d15e826
📒 Files selected for processing (6)
crates/ourios-miner/src/cluster.rscrates/ourios-miner/src/metrics.rscrates/ourios-miner/tests/rfc0023_bounded_memory.rscrates/ourios-semconv/src/lib.rssemconv/registry/attributes.yamlsemconv/registry/metrics.yaml
|
Merging with Copilot's re-review of the final head outstanding, with rationale: CI is fully green on |
Discharges RFC0023.6: a ceiling-saturated tenant is diagnosable from telemetry alone.
ourios.miner.parse_failure.reason— a weaver-registry enum attribute (below_floor|empty_line|tokenizer_failure|degenerate_widening|line_too_long|template_ceiling) on the existingourios.miner.parse_failurescounter, per the OTel error.type convention (one instrument + a cause dimension, never per-cause counters). Registry checked withweaver registry check; constants regenerated viaweaver registry generate(semconv CI's no-diff gate covers drift).emit_string_parse_failurehelper — the six causes now cover the entire §6.3 exit surface, not just the RFC 0023 diverts, so the counter's cause split is complete rather than partial.attach_and_maybe_widenwent over the clippy line budget from the reason arg; the §6.4 rejection's audit emission moved toemit_rejected_degenerate_audit(a 1:1 payload mirror,too_many_argumentsallowed with the reason inline).rfc_internal.rspattern): assertsreason = template_ceilingincrements equal the diverted-line count andtemplate.countreads the ceiling.With this, RFC 0023 is six-of-seven green; only RFC0023.7 (the 16 GiB HDFS_v2 rerun under 8 GiB peak RSS on the hardware baseline) remains, which is a bench run rather than a code change.
Verification:
cargo fmt --all --check,weaver registry check,cargo clippy --all-targets --all-features -- -D warnings, miner/semconv/ingester suites — all green locally.🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes