feat(engine): deterministic peat fire danger scoring and cluster inspection drawer (Issue 4) #14
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/issue-4-danger-scoring-drawer"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Implements Issue 4: Deterministic peat fire danger scoring engine and cluster drawer.
danger-score.tsimplementing the 100-point deterministic formula:danger-score.test.tswith 22 tests passing across all boundary conditions and brackets (KRITIS, TINGGI, SEDANG, RENDAH).spatial-clustering.tsgrouping points within ~2.7 km (0.025 deg).ClusterDetailDrawerwith keyboard accessibility (Escape to close), administrative metadata, dominant peat depth, plain-language explanation, and horizontal telemetry progress bars (RiskFactorBreakdown).Closes #4
Review: Issue 4 - Deterministic peat fire danger scoring engine and cluster drawer
Verdict: APPROVE
Five-Axis Review Summary
1. Correctness
src/lib/domain/danger-score.ts:< -40\text{ cm} \to 35,[-40, 0] \to \text{round}((|\text{TMAT}|/40)*35),> 0 \to 0, fallback20.3+ \to 30,1\text{–}2 \to 15,0 \to 0.> 500\text{ cm} \to 20,300\text{–}500 \to 17,100\text{–}300 \to 12,< 100 \to 6, mineral\to 0.> 20\text{ km/h} \land < 60\% \to 15,10\text{–}20 \to 8, calm\to 2.danger-score.test.ts) contains 22 tests passing across all boundary conditions, brackets, and interpolation formulas.FireClusterstate and opens the inspection drawer.2. Readability & Simplicity
danger-score.ts), spatial clustering (spatial-clustering.ts), and display components (cluster-detail-drawer.tsx,risk-factor-breakdown.tsx).3. Architecture
MapViewuses ref forwarding (onSelectClusterRef) to prevent map lifecycle re-instantiation when drawer selection handlers update.src/lib/domain/with zero coupling to React or MapLibre.4. Security & Hardening
0 \le \text{score} \le 100).5. Accessibility & UX
ClusterDetailDrawerprovides full keyboard accessibility (Escapekey closes drawer).role="dialog",aria-modal="true", and explicitaria-labelelements.Ponytail Audit
vitestadded as devDependency for testing, fully aligned with test-driven development mandate.Verification
pnpm test: All 22 Vitest unit tests passed (790ms).vp check: Clean across 92 files (0 errors, 0 warnings).next build: Standalone production build compiled successfully.