Commit 5184493
fix(graph-analysis): handle NaN in quality scoring for graphs with no edges
CHANGES:
- backend/services/local-graph-analysis.cjs:
- Add isNaN() checks for modularity (lines 307, 313-315)
- Default NaN values to 0 to prevent quality score from being NaN
- backend/tests/results/.gitkeep:
- Create results directory for test outputs (fixes CI failures)
BEFORE:
- Graphs with isolated nodes (no edges) produced NaN quality scores
- drive-webhook.test.cjs and google-workspace-validation.test.cjs failed on CI due to missing results directory
AFTER:
- Quality scores default to 0 when graph has no edges
- structure-lens-v2.test.cjs passes (8/8 tests)
- Results directory exists for test outputs
VERIFICATION:
node backend/tests/structure-lens-v2.test.cjs → 8 passed, 0 failed
IMPACT: Fixes test failures in PR #52 and #53
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>1 parent 57d3ecf commit 5184493
2 files changed
Lines changed: 6 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
304 | 304 | | |
305 | 305 | | |
306 | 306 | | |
307 | | - | |
| 307 | + | |
308 | 308 | | |
309 | 309 | | |
310 | 310 | | |
311 | 311 | | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
312 | 317 | | |
313 | 318 | | |
314 | 319 | | |
| |||
Whitespace-only changes.
0 commit comments