feat(api): Sentinel-2 STAC search service and scene resolver edge route #129

Merged
yuris merged 2 commits from feat/sentinel-stac-scene-api into main 2026-10-16 01:47:37 +00:00
Owner

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

Principles applied

  • principle-model-the-domain: Defined explicit satellite metadata models (SentinelSceneMetadata, SwirBandUrls, SatellitePlatform, SentinelSceneQueryOptions, SceneResolverResponse) in src/types/satellite.ts.
  • principle-boundary-discipline: Sanitized input coordinate formats (accepting both standard 4-element bounding boxes and point coordinate expansions) and validated cloud cover thresholds at the edge API boundary.
  • principle-subtract-before-you-add: Leveraged standard native fetch with AbortSignal timeouts without adding heavy external geospatial SDKs or STAC client wrappers.
  • principle-prove-it-works: Verified STAC API querying, cloud cover threshold evaluation, automatic Landsat-8/9 fallback, and Next.js Edge route responses with 15 automated vitest test cases.
  • principle-test-behavior-not-implementation: Asserted literal properties (id, datetime, cloudCover, platform, visualUrl, swirUrls, and HTTP caching headers) across sunny and degraded network conditions.

Impact

For the consumer: Enables real-time optical and Short-Wave Infrared (SWIR) satellite scene resolution for active hotspot fires, revealing burn fronts through smoke haze with seamless Landsat fallback.
For the maintainer: Lightweight, self-contained Next.js Edge route (/api/satellite/scene) and STAC client library in src/lib/services/sentinel.ts with comprehensive unit tests and zero external service credentials required.

Verification

  • pnpm test: 46 test files, 318 passing tests (sentinel.test.ts passed 7/7, route.test.ts passed 8/8).
  • pnpm exec tsc --noEmit: 0 TypeScript compiler errors.
  • pnpm exec vp check: 0 formatting or linting errors across 319 files.

Closes #69

Executed playbook: `skill://poteto-mode/playbooks/feature.md` ### Principles applied - principle-model-the-domain: Defined explicit satellite metadata models (`SentinelSceneMetadata`, `SwirBandUrls`, `SatellitePlatform`, `SentinelSceneQueryOptions`, `SceneResolverResponse`) in `src/types/satellite.ts`. - principle-boundary-discipline: Sanitized input coordinate formats (accepting both standard 4-element bounding boxes and point coordinate expansions) and validated cloud cover thresholds at the edge API boundary. - principle-subtract-before-you-add: Leveraged standard native `fetch` with AbortSignal timeouts without adding heavy external geospatial SDKs or STAC client wrappers. - principle-prove-it-works: Verified STAC API querying, cloud cover threshold evaluation, automatic Landsat-8/9 fallback, and Next.js Edge route responses with 15 automated vitest test cases. - principle-test-behavior-not-implementation: Asserted literal properties (`id`, `datetime`, `cloudCover`, `platform`, `visualUrl`, `swirUrls`, and HTTP caching headers) across sunny and degraded network conditions. ### Impact For the consumer: Enables real-time optical and Short-Wave Infrared (SWIR) satellite scene resolution for active hotspot fires, revealing burn fronts through smoke haze with seamless Landsat fallback. For the maintainer: Lightweight, self-contained Next.js Edge route (`/api/satellite/scene`) and STAC client library in `src/lib/services/sentinel.ts` with comprehensive unit tests and zero external service credentials required. ### Verification - `pnpm test`: 46 test files, 318 passing tests (`sentinel.test.ts` passed 7/7, `route.test.ts` passed 8/8). - `pnpm exec tsc --noEmit`: 0 TypeScript compiler errors. - `pnpm exec vp check`: 0 formatting or linting errors across 319 files. Closes #69
feat(api): Sentinel-2 STAC search service and scene resolver edge route
Some checks failed
CI / Verify Quality & Build (pull_request) Failing after 1m17s
8814319018
yuris-bot requested changes 2026-10-16 01:43:01 +00:00
Dismissed
yuris-bot left a comment

Code Review & CI Gate Failure: Sentinel-2 STAC Search Service

1. Turbopack / Next.js 16.4 Build Error

Forgejo Actions CI and local next build failed with:

Error: Turbopack build failed with 1 error:
./src/app/api/satellite/scene/route.ts:5:14
Error: Route segment config "runtime" is not compatible with `nextConfig.cacheComponents`. Please remove it.
  3 | import type { SentinelSceneQueryOptions } from "@/types/satellite";
  4 |
> 5 | export const runtime = "edge";
    |              ^^^^^^^

2. Required Fix

  • In src/app/api/satellite/scene/route.ts, remove export const runtime = "edge";.
  • Under Next.js 16.4 with cacheComponents enabled, segment-level runtime = "edge" is incompatible and rejected by Turbopack during production build.
  • Standard Route Handlers in Next.js App Router execute natively without this segment export (matching existing routes in src/app/api/*).
  • Rebase on origin/main (at d876fb5), run pnpm test && pnpm build, and push the update to feat/sentinel-stac-scene-api.
### Code Review & CI Gate Failure: Sentinel-2 STAC Search Service #### 1. Turbopack / Next.js 16.4 Build Error Forgejo Actions CI and local `next build` failed with: ```text Error: Turbopack build failed with 1 error: ./src/app/api/satellite/scene/route.ts:5:14 Error: Route segment config "runtime" is not compatible with `nextConfig.cacheComponents`. Please remove it. 3 | import type { SentinelSceneQueryOptions } from "@/types/satellite"; 4 | > 5 | export const runtime = "edge"; | ^^^^^^^ ``` #### 2. Required Fix - In `src/app/api/satellite/scene/route.ts`, remove `export const runtime = "edge";`. - Under Next.js 16.4 with `cacheComponents` enabled, segment-level `runtime = "edge"` is incompatible and rejected by Turbopack during production build. - Standard Route Handlers in Next.js App Router execute natively without this segment export (matching existing routes in `src/app/api/*`). - Rebase on `origin/main` (at `d876fb5`), run `pnpm test && pnpm build`, and push the update to `feat/sentinel-stac-scene-api`.
yuris force-pushed feat/sentinel-stac-scene-api from 8814319018
Some checks failed
CI / Verify Quality & Build (pull_request) Failing after 1m17s
to b91b2ba0ba
All checks were successful
CI / Verify Quality & Build (pull_request) Successful in 1m52s
2026-10-16 01:44:54 +00:00
Compare
yuris-bot approved these changes 2026-10-16 01:47:30 +00:00
yuris-bot left a comment

Code Review & Ponytail Audit Summary: Sentinel-2 STAC Search Service & Scene Resolver API

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

  • Passed all checks: title conventional format, description conventions, issue linking via Closes #69.

2. Subsystem Boundary & Discipline

  • Scope strictly backend API routes, services, and types: src/types/satellite.ts, src/lib/services/sentinel.ts, src/app/api/satellite/scene/route.ts, and unit test suites.
  • Zero frontend UI leakage.

3. Ponytail Audit & Implementation Quality

  • Dead weight removed: Removed incompatible route-level edge runtime export, standardizing with Next.js 16.4 cacheComponents architecture. Pure fetch STAC queries without bloated external SDKs.
  • Model the domain: Strict TypeScript contracts (SentinelSceneMetadata, SwirBandUrls, SatellitePlatform, SentinelSceneQueryOptions, SceneResolverResponse).
  • Resilience: Automatic fallback from Sentinel-2 to Landsat 8/9 when cloud cover exceeds threshold.

4. Verification Gates

  • vp check: All 321 files correctly formatted, 0 warnings or lint errors.
  • pnpm test: All 324 tests passed across 47 test files.
  • next build: Turbopack production build succeeded cleanly across all 15 routes.
  • Forgejo CI: Workflow run 3956 passed with success.

5. Acceptance Criteria

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

Decision: APPROVED for squash merge into main.

### Code Review & Ponytail Audit Summary: Sentinel-2 STAC Search Service & Scene Resolver API #### 1. Mechanical Verification Gate (`scripts/verify-pr.mjs`) - Passed all checks: title conventional format, description conventions, issue linking via `Closes #69`. #### 2. Subsystem Boundary & Discipline - Scope strictly backend API routes, services, and types: `src/types/satellite.ts`, `src/lib/services/sentinel.ts`, `src/app/api/satellite/scene/route.ts`, and unit test suites. - Zero frontend UI leakage. #### 3. Ponytail Audit & Implementation Quality - **Dead weight removed**: Removed incompatible route-level edge runtime export, standardizing with Next.js 16.4 `cacheComponents` architecture. Pure `fetch` STAC queries without bloated external SDKs. - **Model the domain**: Strict TypeScript contracts (`SentinelSceneMetadata`, `SwirBandUrls`, `SatellitePlatform`, `SentinelSceneQueryOptions`, `SceneResolverResponse`). - **Resilience**: Automatic fallback from Sentinel-2 to Landsat 8/9 when cloud cover exceeds threshold. #### 4. Verification Gates - `vp check`: All 321 files correctly formatted, 0 warnings or lint errors. - `pnpm test`: All 324 tests passed across 47 test files. - `next build`: Turbopack production build succeeded cleanly across all 15 routes. - Forgejo CI: Workflow run 3956 passed with success. #### 5. Acceptance Criteria - Verified and checked off all acceptance criteria checkboxes on linked Issue #69. **Decision**: APPROVED for squash merge into `main`.
yuris merged commit 6ecb5d62b0 into main 2026-10-16 01:47:37 +00:00
yuris deleted branch feat/sentinel-stac-scene-api 2026-10-16 01:47:37 +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!129
No description provided.