Skip to content

feat(routes-f): implement stubs for #336 #327 #328 #309#357

Merged
davedumto merged 1 commit intoStreamFi-x:devfrom
josephchimebuka:feat/routes-f-stubs-336-327-328-309
Feb 26, 2026
Merged

feat(routes-f): implement stubs for #336 #327 #328 #309#357
davedumto merged 1 commit intoStreamFi-x:devfrom
josephchimebuka:feat/routes-f-stubs-336-327-328-309

Conversation

@josephchimebuka
Copy link
Contributor

@josephchimebuka josephchimebuka commented Feb 26, 2026

Closes #336
Closes #327
Closes #328
Closes #309

Summary

This PR delivers 4 backend routes-f stubs in one branch:

What Changed

  • Added in-memory deterministic circuit breaker with per-key failure tracking and state transitions:
    • closed -> open at threshold
    • auto open -> half-open after cooldown
    • half-open -> closed on success, half-open -> open on failure
  • Added POST /api/routes-f/uploads/sign:
    • validates file metadata (fileName, fileType, fileSize)
    • enforces allowed MIME types and max size
    • returns fake signed URL response { url, expiresAt, method }
  • Added GET /api/routes-f/activity/daily?days=:
    • defaults to last 7 days when missing/invalid
    • enforces upper bound for requested days
    • returns total count and per-day buckets from mock data
  • Added GET /api/routes-f/deps:
    • returns stable typed dependency payload when healthy
    • uses route-level circuit breaker around dependency checks
    • returns short-circuit response with retry hint when breaker is open

Files Added

  • lib/routes-f/circuit-breaker.ts
  • lib/routes-f/activity.ts
  • lib/routes-f/deps.ts
  • app/api/routes-f/uploads/sign/route.ts
  • app/api/routes-f/activity/daily/route.ts
  • app/api/routes-f/deps/route.ts
  • lib/routes-f/__tests__/circuit-breaker.test.ts
  • app/api/routes-f/__tests__/uploads-sign.test.ts
  • app/api/routes-f/__tests__/activity-daily.test.ts
  • app/api/routes-f/__tests__/deps.test.ts

Acceptance Criteria Mapping

Validation

  • Implemented and committed all new route + helper tests.
  • Local Jest execution in this environment currently fails at startup with Bus error (core dumped) before suites run.
  • Existing repo-wide TypeScript check also has pre-existing unrelated errors (e.g. missing type declarations for framer-motion / react-icons) not introduced by this PR.

Notes

  • Circuit breaker is intentionally in-memory for now, per requirement.
  • No cloud provider integration for signed URLs yet (stub response only).

@vercel
Copy link

vercel bot commented Feb 26, 2026

@josephchimebuka is attempting to deploy a commit to the david's projects Team on Vercel.

A member of the Team first needs to authorize it.

@davedumto davedumto merged commit b506da9 into StreamFi-x:dev Feb 26, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants