5 Commits

Author SHA1 Message Date
Head of Product & Engineering
6db500235b fix: resolve gosec findings G112 and G602
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
G112 (Slowloris): add ReadHeaderTimeout: 10s to http.Server
G602 (slice bounds): use explicit bounds-safe index for backoff slice
  (attempt is guarded but gosec can't prove it statically)

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-04-05 23:03:47 +02:00
Head of Product & Engineering
6a853f6566 fix: resolve all golangci-lint v2 failures
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Production fixes:
- cmd/server/main.go: refactor to run() helper to eliminate exitAfterDefer
  (os.Exit in main() no longer bypasses deferred s.Close)
- internal/cast/client.go: use _ = resp.Body.Close() (errcheck)
- internal/ghl/api.go: wrap both defers as func(){ _ = resp.Body.Close() }()

Test fixes:
- internal/cast/client_test.go: replace err.(*CastAPIError) type assertions
  with errors.As (errorlint)

Config:
- .golangci.yml: use explicit path regex .*_test\\.go and add errorlint
  to test-file exclusions

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-04-05 21:52:36 +02:00
Head of Product & Engineering
675f765cc0 fix: resolve golangci-lint failures and .gitignore scope issue
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
- cmd/server/main.go: acknowledge w.Write return value (errcheck)
- internal/store/mongo.go: use errors.Is for ErrNoDocuments (errorlint)
- .golangci.yml: add linter config scoped to relevant linters
- .gitignore: scope /server to root only (was blocking cmd/server/ directory)

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-04-05 21:22:03 +02:00
Head of Product & Engineering
d081875fce fix: add uninstall handler, idempotency guard, and OAuth error handling
GHL Marketplace submission blockers resolved:
- Add POST /api/ghl/v1/webhook/uninstall to delete token on app removal
- Add in-memory messageId deduplication (10-min TTL) to prevent duplicate SMS sends on webhook retries
- Handle ?error= param in OAuth callback for user-denied auth flows
- Pass store to WebhookHandler; update tests accordingly

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-04-04 17:52:09 +02:00
Head of Product & Engineering
a40a4aa626 feat: initial implementation of Cast GHL Provider
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Complete MVP implementation of the Cast GHL Conversation Provider bridge:
- Go module setup with chi router and mongo-driver dependencies
- Config loading with env var validation and defaults
- MongoDB token store with upsert, get, update, delete operations
- Cast.ph SMS client with 429 retry logic and typed errors
- Phone number normalization (E.164 ↔ Philippine local format)
- GHL OAuth 2.0 install/callback/refresh flow
- GHL webhook handler with ECDSA signature verification (async dispatch)
- GHL API client for message status updates and inbound message stubs
- Multi-stage Dockerfile, docker-compose with MongoDB, Woodpecker CI pipeline
- Unit tests for phone normalization, Cast client, GHL webhook, and OAuth handlers

Co-Authored-By: SideKx <sidekx.ai@sds.dev>
2026-04-04 17:27:05 +02:00