Commit 14a3e75
feat(report-runner): integrity tracker + threshold abort + IntegrityBadge (GLOOK-13) (#50)
* docs(glook-13): design spec for report-integrity hardening
Add an IntegrityTracker + skip classifier + threshold evaluator inside
runReport(). Persist a run_metadata JSON column with every SKIP and
non-fatal error classified as expected / auto-flagged / unknown.
Threshold logic counts only unknown SKIPs: auto-abort at >=5 AND >=10%
of org, degraded badge at >=3 OR >=5%. Expand withRetry() to cover
transient 5xx + network errors; 404 stays non-retryable so the auth-
loss signal that caused 5/28 still surfaces.
Out of scope: GitHub-side investigation, Splunk alerting, mid-run
interrupt, 401-fatal handling, 404 retries.
* docs(glook-13): implementation plan for report-integrity hardening
* feat(db): reports.run_metadata + report_skip_allowlist (GLOOK-13)
Adds the canonical schema + idempotent runtime ALTERs for both
MySQL and SQLite. Seeds report_skip_allowlist with @oshpak (the
persistent expected SKIP).
Broadens the mysql-ready ordering regex to also accept INSERT IGNORE
so the new seed call inside the migration IIFE still validates as a
gated pre-SELECT statement.
* feat(report-runner): integrity types (GLOOK-13)
* feat(report-runner): IntegrityTracker (GLOOK-13)
Accumulates SKIPs + non-fatal errors during a report run; dedupes
skips by login (last-write-wins); truncates messages to 500 chars.
* feat(report-runner): skip classifier + threshold evaluator (GLOOK-13)
loadSkipClassifier() runs 2 SELECTs at the top of each report and
returns a hot closure (allowlist ⊃ auto-flagged ⊃ unknown).
evaluateIntegrity() is pure: counts only unknown SKIPs against the
abort (AND) and degraded (OR) thresholds defined in DEFAULT_THRESHOLDS.
* feat(github): retry transient 5xx + network errors (GLOOK-13)
Extends withRetry() to cover 5xx HTTP + transient network errors
(ECONNRESET, ETIMEDOUT, EAI_AGAIN, ENOTFOUND) with shallow backoff
(3 attempts x 1s/2s/4s). 404 stays non-retryable - that's the signal
the report-integrity threshold depends on. 403/429 rate-limit
behavior is unchanged.
* feat(report-runner): wire integrity tracker + threshold abort (GLOOK-13)
L1/L2/L3 catches now record into IntegrityTracker. After the gather
loop, evaluateIntegrity() decides ok/degraded/failed; on failed we
write run_metadata + UPDATE reports.status='failed' and short-circuit
the rest of the run. ok/degraded paths persist run_metadata alongside
the existing 'completed' update.
* feat(report): surface run_metadata on getReport (GLOOK-13)
* feat(ui): IntegrityBadge component (GLOOK-13)
Renders nothing for state='ok' (silent), an inline amber pill for
'degraded' (click-to-expand detail panel with skipped + errors),
or a full red banner for 'failed'.
* feat(report-page): wire IntegrityBadge into team + org pages (GLOOK-13)
* feat(api): skip-allowlist CRUD (GLOOK-13)
GET (entries + auto-flagged candidates), POST (add/upsert), DELETE.
Admin-only via requireAdmin(). Auto-flagged candidates computed from
the same last-5-runs query the report-runner classifier uses.
* feat(settings): Skip Allowlist tab (GLOOK-13)
Lists current allowlist entries, inline add/remove form, and an
'auto-flagged candidates' section listing logins that SKIPped on
4+ of the last 5 reports with a one-click 'Promote' action.
* fix(report-runner): inline LIMIT in classifier (GLOOK-13)
mysql2's prepared-statement binary protocol rejects bound LIMIT params
with 'Incorrect arguments to mysqld_stmt_execute', breaking every
report run after T6. AUTO_FLAG_RECENT_RUNS is a module constant, not
user input — inlining is safe.
* fix(glook-13): PR #50 review — critical correctness (GLOOK-13)
- auth: read added_by from extractUser(headers).email (x-amzn-oidc-data
JWT), not the non-existent x-amzn-oidc-identity header
- sqlite: add report_skip_allowlist to translator's conflictCols map
so ON DUPLICATE KEY UPDATE upserts correctly on the default DB
- normalize github_login (.trim()) before insert; validate reason
is non-empty after trim
- gate all failed-report data surfaces (org page body, team Teams
view, exports CSV/Sheet/PDF) — keep partial rows for forensics
but never render them when state='failed'
- drop the duplicate red banner — header badge now renders only for
non-failed states; failed state surfaces a single banner in body
- bound the retry total-attempt count at 12 across all error mixes
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* fix(glook-13): instrument review-count + branch-compare catches (GLOOK-13)
Two existing catches in report-runner silently dropped data without
recording into IntegrityTracker — exactly the failure class this PR
targets. Add recordError calls so they surface in run_metadata.errors.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* polish(glook-13): PR #50 review — quality + UX polish (GLOOK-13)
- IntegrityBadge: drop dead 'developerCount' prop; surface
'N of M' using metadata.expectedCount in the detail panel
- IntegrityTracker.snapshot(): drop redundant double cast
- evaluateIntegrity accepts a snapshot directly (avoid double-take
in the runner) + test adjustments
- extract loadRecentSkipCounts() shared helper used by both the
classifier and the settings GET endpoint (was duplicated)
- Settings UI: format added_at via toLocaleString, surface mutation
errors inline, align promote-reason wording with the actual rule
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: msogin <msogin@users.noreply.github.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent d8f72b9 commit 14a3e75
22 files changed
Lines changed: 3217 additions & 34 deletions
File tree
- docs/superpowers
- plans
- specs
- src
- app
- api/settings/skip-allowlist
- [login]
- report/[id]
- org
- team
- settings
- components
- lib
- __tests__/unit
- db
- report-runner
- report
Lines changed: 1865 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 267 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 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 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
14 | 25 | | |
15 | 26 | | |
16 | 27 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
0 commit comments