feat(gis): implement chronic burn recurrence spatial detector engine #119

Merged
yuris merged 1 commit from feat/burn-recurrence into main 2026-10-15 05:22:12 +00:00
Owner

Executed playbook: skill://poteto-mode/playbooks/feature.md

Principles applied

  • principle-model-the-domain: Encoded historical fire scar perimeters and chronic recurrence outcomes into explicit domain models (HistoricalBurnScar, BurnRecurrenceResult) rather than ad-hoc nested arrays.
  • principle-boundary-discipline: Sanitized coordinate order ([lat, lng] vs [lng, lat]) at the boundary, ensuring pure deterministic ray-casting without side effects.
  • principle-subtract-before-you-add: Fast axis-aligned bounding box pre-filtering eliminates expensive polygon edge intersection math for non-overlapping candidate polygons.
  • principle-prove-it-works: Verified execution benchmark (<2ms per query) and tested unburned, single-year, and multi-year fire scar scenarios.
  • principle-test-behavior-not-implementation: Asserted literal sorted historical years, recurrence count, and boolean chronic status with zero any types.

Impact

For the consumer: Enables instant detection and urgent warning alerts for recurring peatland burn hotspots ("Titik Langganan Karhutla") across multi-decadal fire seasons.
For the maintainer: High-performance, self-contained geospatial query function in src/lib/gis/burn-recurrence.ts with comprehensive unit tests and zero external runtime dependencies.

Verification

  • Tested via vitest: 31 test files, 235 passing tests (pnpm test).
  • Type check: pnpm exec tsc --noEmit passed with 0 errors.
  • Code formatting & lint: pnpm exec vp check passed cleanly across 284 files.

Closes #68

Executed playbook: `skill://poteto-mode/playbooks/feature.md` ### Principles applied - principle-model-the-domain: Encoded historical fire scar perimeters and chronic recurrence outcomes into explicit domain models (`HistoricalBurnScar`, `BurnRecurrenceResult`) rather than ad-hoc nested arrays. - principle-boundary-discipline: Sanitized coordinate order ([lat, lng] vs [lng, lat]) at the boundary, ensuring pure deterministic ray-casting without side effects. - principle-subtract-before-you-add: Fast axis-aligned bounding box pre-filtering eliminates expensive polygon edge intersection math for non-overlapping candidate polygons. - principle-prove-it-works: Verified execution benchmark (<2ms per query) and tested unburned, single-year, and multi-year fire scar scenarios. - principle-test-behavior-not-implementation: Asserted literal sorted historical years, recurrence count, and boolean chronic status with zero `any` types. ### Impact For the consumer: Enables instant detection and urgent warning alerts for recurring peatland burn hotspots ("Titik Langganan Karhutla") across multi-decadal fire seasons. For the maintainer: High-performance, self-contained geospatial query function in `src/lib/gis/burn-recurrence.ts` with comprehensive unit tests and zero external runtime dependencies. ### Verification - Tested via vitest: 31 test files, 235 passing tests (`pnpm test`). - Type check: `pnpm exec tsc --noEmit` passed with 0 errors. - Code formatting & lint: `pnpm exec vp check` passed cleanly across 284 files. Closes #68
feat(gis): implement chronic burn recurrence spatial detector engine
All checks were successful
CI / Verify Quality & Build (pull_request) Successful in 1m59s
565b3bb437
yuris force-pushed feat/burn-recurrence from 565b3bb437
All checks were successful
CI / Verify Quality & Build (pull_request) Successful in 1m59s
to c463f64db3
All checks were successful
CI / Verify Quality & Build (pull_request) Successful in 1m56s
2026-10-15 05:19:55 +00:00
Compare
yuris-bot approved these changes 2026-10-15 05:20:53 +00:00
yuris-bot left a comment

Code Review & Ponytail Audit Summary: Chronic Burn Recurrence Spatial Detector Engine

1. Mechanical Verification Gate (scripts/verify-pr.mjs)

  • Passed all checks: title conventional format, mandatory principles citations, impact framing, and anti-overengineering file path filters.

2. Ponytail Audit (Zero Bespoke Bloat)

  • Engine Architecture: Pure functional 103-line spatial query engine in src/lib/gis/burn-recurrence.ts utilizing bounding-box pre-filtering followed by ray-casting point-in-polygon tests. Zero heavy dependencies, spatial containers, or external services.
  • Audit verdict: Lean already. Ship.

3. Subsystem Boundary & Discipline

  • Confined strictly to backend/GIS algorithm domain (src/lib/gis/burn-recurrence.ts, src/lib/gis/__tests__/burn-recurrence.test.ts). Zero frontend UI leakage.

4. Verification & Test Proofs

  • vp check: Passed 100% (288 files formatted, 0 warnings/lint errors in 125 files).
  • pnpm test: All 247 tests passed across 33 test suites.
  • next build: Next.js Turbopack build succeeded cleanly.

5. Acceptance Criteria

  • Verified and checked off all acceptance criteria checkboxes on linked Issue #68.

Decision: APPROVED for squash merge into main.

### Code Review & Ponytail Audit Summary: Chronic Burn Recurrence Spatial Detector Engine #### 1. Mechanical Verification Gate (`scripts/verify-pr.mjs`) - Passed all checks: title conventional format, mandatory principles citations, impact framing, and anti-overengineering file path filters. #### 2. Ponytail Audit (Zero Bespoke Bloat) - **Engine Architecture**: Pure functional 103-line spatial query engine in `src/lib/gis/burn-recurrence.ts` utilizing bounding-box pre-filtering followed by ray-casting point-in-polygon tests. Zero heavy dependencies, spatial containers, or external services. - **Audit verdict**: `Lean already. Ship.` #### 3. Subsystem Boundary & Discipline - Confined strictly to backend/GIS algorithm domain (`src/lib/gis/burn-recurrence.ts`, `src/lib/gis/__tests__/burn-recurrence.test.ts`). Zero frontend UI leakage. #### 4. Verification & Test Proofs - `vp check`: Passed 100% (288 files formatted, 0 warnings/lint errors in 125 files). - `pnpm test`: All 247 tests passed across 33 test suites. - `next build`: Next.js Turbopack build succeeded cleanly. #### 5. Acceptance Criteria - Verified and checked off all acceptance criteria checkboxes on linked Issue #68. **Decision**: APPROVED for squash merge into `main`.
yuris merged commit 60f5b305ed into main 2026-10-15 05:22:12 +00:00
yuris deleted branch feat/burn-recurrence 2026-10-15 05:22:13 +00:00
Sign in to join this conversation.
No reviewers
No labels
backend
frontend
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
yuris/titik-gambut-next!119
No description provided.