Skip to content

refactor(ports): remove type pollution with explicit boundary DTOs#122

Open
kangeunchan wants to merge 2 commits intoaltuslabsxyz:mainfrom
kangeunchan:refactor/ports-dto-type-safety
Open

refactor(ports): remove type pollution with explicit boundary DTOs#122
kangeunchan wants to merge 2 commits intoaltuslabsxyz:mainfrom
kangeunchan:refactor/ports-dto-type-safety

Conversation

@kangeunchan
Copy link
Collaborator

Enhancement Description

Remove type pollution from ports by replacing untyped boundaries with explicit DTO contracts.

Summary

This PR replaces interface{}-style boundary payloads with typed request/response DTOs in targeted port paths.

Previously, untyped payloads made contract drift harder to catch:

  • boundary breakages could surface late at runtime
  • call-site intent was less explicit
  • test and review signal was weaker for boundary changes

Now boundary contracts are explicit and compile-time checked.

What Changed

1) Introduced explicit typed DTO contracts at ports

Updated:

  • internal/application/ports/repositories.go
  • internal/application/ports/services.go

2) Migrated use cases and adapters to typed contracts

Updated:

  • internal/application/devnet/export.go
  • internal/application/upgrade/execute.go
  • internal/application/upgrade/resumable_execute.go
  • internal/infrastructure/export/repository.go

3) Updated DI wiring for new typed boundaries

Updated:

  • internal/di/container.go
  • internal/di/providers/upgrade.go

4) Tests

Added/updated tests:

  • internal/application/devnet/export_test.go
  • internal/infrastructure/export/repository_test.go

Why This Is Needed

This is a type-safety and maintainability refactor.
Typed boundaries reduce runtime surprises and make boundary evolution safer.

Behavior Notes / Regression Impact

No intentional user-facing behavior change.
The primary impact is stronger compile-time contract validation.

Validation Performed

  • go test ./internal/application/...
  • go test ./internal/infrastructure/...
  • go test ./...
  • golangci-lint run

Signed-off-by: kangeunchan <kangeunchan080310@gmail.com>
Signed-off-by: kangeunchan <kangeunchan080310@gmail.com>
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.

1 participant