Skip to content

Comments

chore(deps): upgrade to request migration v2#2534

Open
subomi wants to merge 14 commits intomainfrom
subomi/feat/implement-requestmigrations-v2
Open

chore(deps): upgrade to request migration v2#2534
subomi wants to merge 14 commits intomainfrom
subomi/feat/implement-requestmigrations-v2

Conversation

@subomi
Copy link
Collaborator

@subomi subomi commented Jan 18, 2026

Summary

Upgrades requestmigrations from v0.4.0 to v2, switching from handler-based migrations to type-based migrations.

Key Changes

  • Type-based migrations: Migrations are now registered per type (e.g., models.CreateEndpoint, models.EndpointResponse) rather than per handler
  • New API: Handlers use h.Versioning.For(r) to get a Migrator, then call migrator.Unmarshal() / migrator.Marshal()
  • Runtime type detection: The library now detects concrete types in interface{} fields at runtime, enabling migrations to work correctly for PagedResponse.Content containing []EndpointResponse
  • Context propagation: Migration methods now receive context.Context for proper request scoping

Files Changed

  • api/handlers/handlers.go - Renamed RM to Versioning field
  • api/handlers/endpoint.go - Updated all handlers to use new v2 API
  • api/handlers/portal_link.go - Updated handlers to use new v2 API
  • api/api.go - Renamed rm to versioning field
  • api/migrations/*.go - Refactored migrations to implement TypeMigration interface with context.Context
  • go.mod - Upgrades requestmigrations to v2.1.0

Migration Behavior Preserved

  • v20240101: http_timeout and rate_limit_duration string↔uint64 conversion, advanced_signatures default
  • v20240401: urltarget_url and nametitle field renames
  • v20251124: owner_id validation for portal links

Test Plan

  • All migration unit tests pass (go test -v ./api/migrations/...)
  • Project builds successfully
  • Manual testing of versioned API requests

Note

Upgrades request versioning to requestmigrations v2 and refactors API to type-based migrations with per-type registration and new marshal/unmarshal flow.

  • Replace github.com/subomi/requestmigrations with v2; wire versioning into routers/handlers and rename RMVersioning
  • Handlers for endpoints and portal links now use Versioning.For(r) + migrator.Unmarshal/Marshal; adjust request body reading and wrap migrated payload in ServerResponse.Data
  • Introduce RegisterMigrations using generic Register[T] for CreateEndpoint, UpdateEndpoint, EndpointResponse, and portal link requests; remove legacy handler-oriented migrations
  • Implement context-aware, type-based migrations for 2024-01-01 (duration conversions, default advanced_signatures), 2024-04-01 (field renames), 2025-11-24 (portal link owner_id validation) with unit tests
  • go.mod updates: add new deps (e.g., minio, testcontainers modules), remove fatih/structs, bump to requestmigrations/v2

Written by Cursor Bugbot for commit 319b95b. This will update automatically on new commits. Configure here.

@convoy-engineering
Copy link
Contributor

@cursor review

@cursor
Copy link

cursor bot commented Jan 20, 2026

Skipping Bugbot: Bugbot is disabled for this repository

@frain-dev frain-dev deleted a comment from cursor bot Jan 20, 2026
@convoy-engineering
Copy link
Contributor

@cursor review

@convoy-engineering
Copy link
Contributor

@cursor review

@convoy-engineering
Copy link
Contributor

@cursor review

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

@subomi subomi changed the title chore: upgrade to request migration v2 chore(deps): upgrade to request migration v2 Feb 4, 2026
@subomi subomi force-pushed the subomi/feat/implement-requestmigrations-v2 branch from f10c521 to 5038d23 Compare February 20, 2026 04:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants