Files
claude eec3d9bed2 /trace grows a turn-decisions table under the rule trace (V-564)
Both tables answer the same question, who won and who lost, one about nudges
and the other about utterances, so they share a page rather than splitting the
nav. A turn is one collapsible row; never_asked is coloured like a block,
because it usually is one. A read failure is logged and the rule trace above it
still renders: a daemon too old to know the method is the ordinary case during
a rolling deploy.
2026-08-06 00:52:58 +04:00

46 lines
2.2 KiB
HTML

{{template "shellTop" "trace"}}
<h1>Rule Trace</h1>
<div class="hint mb-4">{{.Tick.Now | ago}} — winner: <strong>{{if .Tick.Winner}}{{.Tick.Winner}}{{else}}nothing fired{{end}}</strong></div>
<div class=scroll><table class=mono>
<tr><th>rule<th>sev<th>predicate<th>gate<th>blocked by<th>detail<th>selected<th>lost to</tr>
{{range .Tick.Rules}}<tr>
<td>{{.RuleName}}</td>
<td>{{.Severity}}</td>
<td class={{if .PredicateResult}}green{{else}}gray{{end}}>{{.PredicateResult}}</td>
<td class={{if .GateResult}}green{{else if .GateBlockedBy}}red{{else}}gray{{end}}>{{.GateResult}}</td>
<td>{{.GateBlockedBy}}</td>
<td><details><summary>gate</summary>
<span class=hint>snooze_until:</span> {{.GateDetail.SnoozeUntil | fmtTime}}<br>
<span class=hint>cooldown_until:</span> {{.GateDetail.CooldownUntil | fmtTime}}<br>
<span class=hint>quiet_hours:</span> {{.GateDetail.QuietHours}}<br>
<span class=hint>calendar_busy:</span> {{.GateDetail.CalendarBusy}}<br>
<span class=hint>presence:</span> {{.GateDetail.Presence}}<br>
<span class=hint>inert_keys_missing:</span> {{if .GateDetail.InertKeysMissing}}{{join .GateDetail.InertKeysMissing ", "}}{{else}}—{{end}}
</details></td>
<td class={{if .WasSelected}}green{{end}}>{{.WasSelected}}</td>
<td>{{.LostTo}}</td>
</tr>{{end}}
</table></div>
<h1 class=mt-4>Turn Decisions</h1>
<div class="hint mb-4">Who claimed each utterance, who lost it, and who was never asked. In memory, newest first, cleared on restart.</div>
{{if not .Turns}}<div class=hint>no turn has run since the daemon started</div>{{end}}
{{range .Turns}}
<details class=mb-4>
<summary><span class=mono>{{.Utterance}}</span><strong>{{if .Winner}}{{.Winner}}{{else}}nobody{{end}}</strong> <span class=hint>{{.Ts | ago}}</span></summary>
<div class=scroll><table class=mono>
<tr><th>stage<th>claimant<th>would have been<th>score<th>outcome<th>why</tr>
{{range .Claims}}<tr>
<td>{{.Stage}}</td>
<td>{{.Claimant}}</td>
<td>{{if .Intent}}{{.Intent}}{{else}}—{{end}}</td>
<td>{{if .HasScore}}{{printf "%.3f" .Score}}{{else}}—{{end}}</td>
<td class={{if eq .Outcome "won"}}green{{else if eq .Outcome "never_asked"}}red{{else}}gray{{end}}>{{.Outcome}}</td>
<td>{{.Reason}}</td>
</tr>{{end}}
</table></div>
</details>
{{end}}
{{template "shellBottom"}}
</html>