🐛 Fix local TDD dimension mismatch handling (#222)#224
Conversation
Avoid overwriting baselines when honeydiff reports a width mismatch in local TDD. Keep baseline/current reviewable and mark comparison as failed with a dimension-mismatch reason.
Vizzly - Visual Test Results
|
Code ReviewSummaryThis PR fixes a critical bug where dimension mismatches in local TDD mode were silently overwriting baselines instead of presenting them as reviewable failures. The fix aligns local behavior with cloud behavior and improves the developer experience. Code Quality ✅Excellent refactoring:
Good defensive programming:
Potential Issues 🔍1. Missing properties from buildFailedComparison (Minor) Looking at
Your mock only provides
Suggested fix (src/tdd/tdd-service.js:1432-1435): honeydiffResult: {
isDifferent: true,
diffClusters: [],
diffPercentage: 0,
diffPixels: 0,
totalPixels: 0,
aaPixelsIgnored: 0,
aaPercentage: 0,
boundingBox: null,
heightDiff: 0,
intensityStats: null,
},This would make the comparison result more complete and prevent potential UI rendering issues. 2. Test coverage is thorough ✅ The test update is excellent:
Performance ✅No performance concerns. The refactoring doesn't add any new operations. Security ✅No security concerns. This is purely comparison logic. Test Coverage ✅The test update comprehensively covers the new behavior. Nice work tracking the Architecture Alignment ✅Excellent alignment:
This is exactly the right approach per CLAUDE.md's philosophy: "Avoid over-engineering. Only make changes that are directly requested or clearly necessary." Recommendations
Verdict: ✅ Approve with minor suggestionThis is a well-executed bug fix that solves a real user pain point (#222). The code is clean, well-tested, and properly documented. The only minor concern is ensuring all comparison result properties are populated to prevent potential UI issues. Great work! The refactoring is thoughtful and the test coverage is solid. |
Summary
Local TDD was auto-overwriting the baseline when honeydiff threw a dimension mismatch.
This changes that path to keep the comparison reviewable instead of silently replacing the baseline.
History / Context
b7cf403(2025-10-22, multi-variant local TDD).b4c579a(2025-12-13).Image dimensions don't matchfor width mismatches; variable height is supported.What Changed
src/tdd/tdd-service.jsstatus: failed) so it remains reviewable in the TDD UI.difftonull.reason: 'dimension-mismatch'and preserve the error message.Why This Keeps Compare Behavior Aligned
Tests
npm run lintnode --test tests/tdd/tdd-service.test.jsnode --test tests/server/handlers/tdd-handler.test.jsUser Impact