Fix critique routing snapshot metrics - #562
Conversation
Read the documented critique snapshot keys while preserving legacy aliases, and surface missing metrics as null instead of zero. Prepared with AI assistance under maintainer pbakaus's standing automation authorization.
There was a problem hiding this comment.
Pull request overview
Fixes critique routing snapshot metrics by aligning context-signals.mjs with the documented critique snapshot frontmatter keys, while keeping backward compatibility and avoiding silent “0” fallbacks when metrics are absent.
Changes:
- Read
total_score,p0_count, andp1_count(with fallback to legacyscore,p0,p1) when summarizing the latest critique snapshot. - Treat missing critique metrics as
null(instead of convertingnull/missing to0via numeric coercion). - Add regression tests covering documented keys and missing-metrics behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| skill/scripts/context-signals.mjs | Fixes critique snapshot metric parsing (documented keys + legacy fallback + null for missing). |
| tests/context-signals.test.mjs | Adds coverage for documented critique keys and null behavior when metrics are absent. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Greptile SummaryCritique snapshot routing now prefers the documented metric names while retaining legacy aliases. Empty, missing, malformed, and non-finite metric values resolve to null instead of being interpreted as usable scores. Confidence Score: 5/5No blocking failure remains. Focused checks exercised documented-key precedence, legacy compatibility, missing and malformed values, and non-finite metrics. The context-signals test suite completed successfully.
What T-Rex did
Reviews (2): Last reviewed commit: "Reject empty critique metrics" | Re-trigger Greptile |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
Suppressed comments (1)
skill/scripts/context-signals.mjs:48
num()still coerces empty-string frontmatter values (e.g.total_score:with no value) to0becauseNumber('') === 0.parseFrontmatter()can produce''in this case, which would reintroduce the “plausible zero” failure mode for malformed/hand-edited snapshots. Treat empty/whitespace-only strings as missing and returnnull.
const num = (v) => {
if (v == null) return null;
const n = Number(v);
return Number.isFinite(n) ? n : null;
};
Treat empty and whitespace-only snapshot values as missing so malformed frontmatter cannot reintroduce plausible zeroes. Prepared with AI assistance under maintainer pbakaus's standing automation authorization.
|
Addressed Copilot's suppressed empty-value finding in Response prepared with AI assistance under maintainer @pbakaus's standing automation authorization. |
Closes #561.
What changed
total_score,p0_count, andp1_count) incontext-signals.mjs.score,p0, andp1snapshots.nullinstead of silently turning them into plausible zeroes.Reproduction
Before the fix, a stored
24/40critique with two P0 and five P1 findings producedscore: 0, p0: 0, p1: 0. The same reproduction now producesscore: 24, p0: 2, p1: 5.Validation
node --test tests/context-signals.test.mjs— 37/37 passedbun run build— passedbun run test— passed (core, detector/browser, live, framework, and plugin E2E; two documented live skips)git diff --check— passedbun run test:skill-behavior— executed as required; current-model stochastic scenarios reported unrelated failures, and every failing trace omittedcontext-signals.mjswhile the suite contains no critique/context-signals fixtureGenerated provider and root harness output was intentionally omitted under the source-first contribution policy.
Prepared with AI assistance under maintainer @pbakaus's standing automation authorization.
Note
Low Risk
Small, test-covered change to signal parsing for critique snapshots; no auth, persistence, or routing logic beyond metadata field names.
Overview
Fixes critique routing for bare
/impeccableby aligninglatestCritiqueincontext-signals.mjswith the snapshot format documented for critique storage (total_score,p0_count,p1_count), while still accepting legacyscore/p0/p1front matter.Numeric parsing now treats missing, blank, or non-numeric metadata as
nullinstead of coercing to0, so agents no longer see plausible zero scores when a snapshot actually has values like 24/40 with 2 P0 and 5 P1 findings.Adds unit tests for the documented keys, absent metrics, and empty/invalid values.
Reviewed by Cursor Bugbot for commit 357f358. Bugbot is set up for automated code reviews on this repo. Configure here.