You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Spec 038 — rule_fired trace event for Tier-3 rule fires
Closes the EC3-final watch-item: per-rule firing-rate audits are now a
1-line `jq '.kind=="rule_fired"'` over the trace file instead of a
multi-step content scan against `events.jsonl` agent tool outputs.
- `Suggestion.IsRule` (default false) discriminates Tier-3 from Tier-2.
- `TraceWriter.WriteRuleFired` emits `{ts, kind, rule, code, confidence,
evidence, file, line, mode}` with the same 1024-char evidence
truncation + path sanitization as diag rows.
- `CheckCommand.EmitDiagnostics` writes the event whenever a
rule-flagged suggestion attaches; Tier-2 hits stay off the trace
(their firing rate is visible via the opt-in MUR_TELEMETRY channel).
- 5 new unit tests: schema, evidence-truncation, path-sanitization,
end-to-end pipeline emit-on-rule + no-emit-on-tier2.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* Address Copilot CR feedback on #251
- Dispose JsonDocument instances explicitly in the new pipeline test;
detach the rule_fired row via JsonElement.Clone() so assertions
outlive the parsed doc without leaking pooled buffers.
- Fix the jq one-liner example: `'.kind=="rule_fired"'` evaluates the
expression on every row (outputting a boolean), not filters to
matching rows. Correct form is `'select(.kind=="rule_fired")'`.
Fixed in both the spec/tasks watch-item entry and the TraceWriter
test comment.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
│ ├─ for each rule: TargetsResolve (else self-disable callback)
376
376
│ └─ TryMatch; pick highest confidence
377
377
│ RULE WINS over tier2Best (spec §6)
378
-
└─ trace.Write (optional, --trace; records all parsed diagnostics + rule self-disables)
378
+
└─ trace.Write (optional, --trace; records all parsed diagnostics + rule self-disables + rule fires)
379
379
```
380
380
381
381
The `Suggestion` (highest-confidence above threshold, rule preferred over Tier-2) is attached to the `Diag` for line formatting in `Diag.Format`.
@@ -456,7 +456,11 @@ Phases 0–2 are merged to `main`. Phase 3 is in flight on `eval/spec-038-ec3-20
456
456
457
457
### Phase 0 — instrumentation (merged)
458
458
459
-
-`--trace <path>` flag on `mur check`. Writes a JSONL stream of every parsed diagnostic, one row per diagnostic. Schema: `{ts, code, severity, file, line, col, msg, receiver_type?, member?, mode}`. Trace is opt-in, never written by default, never includes source code text, never includes absolute paths outside the project root.
459
+
-`--trace <path>` flag on `mur check`. Writes a JSONL stream, one row per parsed diagnostic (plus auxiliary structured events). Trace is opt-in, never written by default, never includes source code text, never includes absolute paths outside the project root. Row kinds:
-**command header** (`kind: "command"`): `{ts, kind, argv, mode}` — full effective `dotnet build` argv at the head of the trace.
462
+
-**rule self-disabled** (`kind: "rule_self_disabled"`): `{ts, kind, rule, unresolved_target, mode}` — emitted when a Tier-3 rule's declared target fails to resolve against the live compilation. Dedup'd per-invocation per-rule.
463
+
-**rule fired** (`kind: "rule_fired"`): `{ts, kind, rule, code, confidence, evidence, file, line, mode}` — emitted whenever a Tier-3 rule attaches a suggestion to a diagnostic. Tier-2 hits do not emit this row; their firing rate is visible via the opt-in `MUR_TELEMETRY=1` channel.
460
464
- Folder structure: `src/Reactor.Cli/Check/{Suggesters,Rules}/` with README pointers; mirrored test folders.
461
465
- A smoke fixture (`tests/Reactor.IntegrationTests/MurCheck/Fixtures/SmokeFixture/`) plus a smoke test that drives the end-to-end pipeline.
Copy file name to clipboardExpand all lines: docs/specs/tasks/038-mur-check-did-you-mean-implementation.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -545,7 +545,7 @@ Clean rerun after the EC3-original watch-items closed: template typo fix (`Micrs
545
545
-**Class-A rule exercise.** Targeted-prompt batch at `C:\temp\mur-targeted-prompt-spec.md` is still the empirical question on the three new Class-A rules. Author or curate prompts that surface CS1955/`GridSize.Auto`, CS0117/`GridSize.Pixel|Pixels|Fixed`, and CS1061/CS0117 on `TextBlockElement.Style`. The clean-PASS doesn't change that this batch left the rules' token impact unmeasured.
546
546
-**§11 risk-row guardrail retrofit.** Move EC3-final criterion #3 from "low-confidence audit" to "verified" by adding a post-run analysis pass that runs `mur check --final` against the run's final workspace and compares against iteration-mode suggestions. Same instrument the EC3-original results section called for; still open.
547
547
-**Tier-2 SKILL.md trims.** Now empirically de-risked by EC3-final's PASS. The drag-and-drop relocation to `reactor-input` and the Context-pattern trim could push `reactor-getting-started` another ~65 lines lighter. Separate PR; no blockers.
548
-
-**`rule_fired` trace event.**One-line addition to `TraceWriter.cs` + the orchestrator emission point would make per-rule firing-rate audits a one-line grep against the trace file instead of multi-step content scan against `events.jsonl` agent tool outputs. Cheap; lands before the targeted-prompt batch ideally.
548
+
-**`rule_fired` trace event — LANDED 2026-05-12.**`TraceWriter.WriteRuleFired(rule, code, confidence, evidence, file, line)` emits `{kind: "rule_fired", rule, code, confidence, evidence, file, line, mode}`. `Suggestion.IsRule` (default false) discriminates Tier-3 hits from Tier-2; `CheckCommand.EmitDiagnostics` writes the trace event whenever a rule-flagged suggestion attaches. Three new unit tests in `TraceWriterTests.cs` (schema, evidence-truncation, path-sanitization) + two pipeline tests in `CheckCommandPipelineTests.cs` (writes-on-rule, no-write-on-tier2) lock the contract. Tier-2 hits stay off the trace by design — telemetry channel still owns Tier-2 rate; the trace event exists specifically to make Tier-3 firings discoverable without telemetry opt-in. Targeted-prompt batch is now a 1-line `jq 'select(.kind=="rule_fired")'` over the trace file.
0 commit comments