DS3+DS4 reconcile: edge coloring via the centralized colorContract enforcer

Both sessions fixed the negative-edge-green bug; kept DS3's centralized
colorContract.edgeColor helper (removed DS4's local const), updated DS4's
source-assertion test to match. Same semantics, one enforcer.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Kev
2026-07-12 19:45:07 -04:00
parent db8f570ae5
commit bc5285d9e7
+7 -5
View File
@@ -107,11 +107,13 @@ describe('GradeResultCard — the letter is hero, edge is sign-colored', () => {
const src = read('components/vyndr/GradeResultCard.tsx');
test('a negative edge NEVER renders green — negative = var(--miss)', () => {
expect(src).toMatch(/edgeColor\s*=\s*d\.edge != null && d\.edge < 0 \? 'var\(--miss\)' : 'var\(--g-a\)'/);
// both the confidence strip and the projection row use edgeColor, not a
// hardcoded green.
expect(src).toContain('color: edgeColor');
expect(src).toMatch(/d\.edge != null \? edgeColor : 'var\(--text-2\)'/);
// DS3 superseded DS4's local const with the centralized colorContract
// enforcer — same semantics (negative → var(--miss)), now via the shared
// helper. Both the confidence strip and the projection row route edge
// through edgeColor(d.edge), never a hardcoded green.
expect(src).toMatch(/import \{ edgeColor.*\} from '@\/lib\/colorContract'/);
expect(src).toContain('color: edgeColor(d.edge)');
expect(src).toMatch(/d\.edge != null \? edgeColor\(d\.edge\) : 'var\(--text-2\)'/);
});
test('the grade LETTER is still the hero (largest element)', () => {