Commit 9e83069
fix(p5.K1): spec-diff round — close 4 spec gaps
Strict spec-diff against the original P5.K1 prompt surfaced four
gaps the initial implementation missed. Each fixed:
## #1 — snake_case property names (CRITICAL)
Spec lists snake_case property names verbatim: `amount_cents`,
`dev_id`, `latency_ms`, `take_cents`, `error_class`,
`error_message`, `alternatives_considered`, `fee_bps`. Initial
impl used camelCase throughout. Diverging would have created
permanent PostHog property drift between funnel events (P4.1
snake_case) and kernel events (would have been camelCase) — any
future cross-event analysis would silently fail to join.
Renamed all interface fields, sanitizer switch arms, kernel.ts
emit calls, sink-route denorm reads (`props.dev_id` not
`props.devId`), admin-route SQL JSON keys (`props ->> 'latency_ms'`
not `'latencyMs'`), and the test file. The original hostile audit
clause "(c) PostHog event names match the existing convention from
P4.1" was satisfied for event NAMES (kernel.X.Y dot/snake_case)
but missed event PROPERTIES — that gap is closed now.
## #2 — `kernel.routing_decision` adapter field documented
Spec lists `{ rail, reason, alternatives_considered, fee_bps }`
without `adapter`. Implementation kept `adapter` as enrichment
because the dashboard needs to filter routing decisions per
adapter without re-deriving. Added explicit JSDoc on
`KernelRoutingDecisionProps.adapter` calling out the deviation as
a documented enrichment beyond spec literal.
## #3 — current QPS + error rate added to overview
Spec §dashboard top-level: "current QPS, error rate, p50/p95/p99
latency per adapter". Initial impl had p50/p95/p99 + total counts
+ success rate but missed:
- QPS card (60s sliding window count of latency events ÷ 60)
- Error rate column (replaced success rate; aggregate error
rate also surfaced as a separate summary card)
## #5 — payout schedule status added to rails dashboard
Spec §dashboard rails: "rail-fee accumulation, payout schedule
status". Initial impl had rail-fee accumulation only. Added
`payoutStatus` to the rails API response and a 6-card panel on
the dashboard:
- mode (manual per 2026-04 ops decision)
- cron schedule (0 12 * * * — daily 12:00 UTC processor)
- next cron run (computed from current time)
- pending (count + amount)
- failed (24h)
- last success (date + amount)
Failed-24h card switches to a destructive border when count > 0.
## Verification
- npx tsc --noEmit (apps/web + packages/mcp): clean
- npx turbo run test: all packages pass; mcp 1834 tests
(kernel-telemetry: 30 tests still pass after rename), apps/web
3909 tests (no app-level unit tests touched).
- npx turbo run lint: 8/8, 0 errors.
- npx turbo run build: 13/13 packages.
Refs: P5.K1
Audits: spec-diff PASS (4 gaps closed; routing_decision deviation
explicitly documented inline), hostile PASS (snake_case
rename preserved sanitizer / PII redaction logic), tests
PASS
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 846fab2 commit 9e83069
7 files changed
Lines changed: 363 additions & 101 deletions
File tree
- apps/web/src/app
- admin/kernel-health
- rails
- api
- admin/kernel-health
- telemetry/kernel
- packages/mcp/src
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| 32 | + | |
31 | 33 | | |
32 | 34 | | |
33 | 35 | | |
| |||
108 | 110 | | |
109 | 111 | | |
110 | 112 | | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
111 | 129 | | |
112 | | - | |
113 | | - | |
| 130 | + | |
| 131 | + | |
114 | 132 | | |
115 | | - | |
116 | | - | |
| 133 | + | |
| 134 | + | |
117 | 135 | | |
| 136 | + | |
118 | 137 | | |
119 | 138 | | |
120 | 139 | | |
| |||
139 | 158 | | |
140 | 159 | | |
141 | 160 | | |
142 | | - | |
| 161 | + | |
143 | 162 | | |
144 | 163 | | |
145 | 164 | | |
| |||
148 | 167 | | |
149 | 168 | | |
150 | 169 | | |
151 | | - | |
152 | | - | |
| 170 | + | |
153 | 171 | | |
154 | 172 | | |
155 | 173 | | |
156 | 174 | | |
157 | 175 | | |
158 | 176 | | |
159 | | - | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
160 | 180 | | |
161 | 181 | | |
162 | 182 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
18 | 33 | | |
19 | 34 | | |
20 | 35 | | |
21 | 36 | | |
22 | 37 | | |
| 38 | + | |
23 | 39 | | |
24 | 40 | | |
25 | 41 | | |
| |||
89 | 105 | | |
90 | 106 | | |
91 | 107 | | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | 108 | | |
97 | | - | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
98 | 122 | | |
99 | 123 | | |
100 | 124 | | |
101 | 125 | | |
102 | 126 | | |
103 | 127 | | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
104 | 190 | | |
105 | 191 | | |
106 | 192 | | |
| |||
0 commit comments