Skip to content

refactor(architecture): restore clean architecture dependency direction via ports and DI#121

Open
kangeunchan wants to merge 1 commit intoaltuslabsxyz:mainfrom
kangeunchan:refactor/clean-architecture-dependency-rule
Open

refactor(architecture): restore clean architecture dependency direction via ports and DI#121
kangeunchan wants to merge 1 commit intoaltuslabsxyz:mainfrom
kangeunchan:refactor/clean-architecture-dependency-rule

Conversation

@kangeunchan
Copy link
Collaborator

Enhancement Description

Restore clean architecture dependency direction by removing application-layer infrastructure coupling and enforcing port-driven boundaries.

Summary

This PR removes dependency-direction violations in the application layer and moves concrete wiring to DI/composition boundaries.

Previously, parts of the application layer depended on infrastructure details:

  • outbound dependencies leaked into use-case packages
  • ports were not the exclusive boundary contract in some flows
  • architectural review and refactoring safety were reduced

Now application packages depend on ports/interfaces, and infrastructure stays at outer layers.

What Changed

1) Replaced outward dependencies with port-based contracts

Updated application/ports boundaries in:

  • internal/application/ports/export_dependencies.go
  • internal/application/ports/provisioner.go
  • internal/application/ports/repositories.go

2) Moved concrete wiring to DI/composition roots

Updated:

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

Concrete adapter selection now remains in composition, not use cases.

3) Updated affected use-case and command paths

Updated:

  • internal/application/devnet/provision.go
  • internal/application/devnet/docker_deploy.go
  • internal/application/devnet/export.go
  • internal/application/service.go
  • cmd/devnet-builder/commands/manage/deploy.go

4) Tests

Added/updated tests:

  • internal/application/devnet/export_test.go

Why This Is Needed

This is an architectural correctness refactor.
It restores dependency inversion, reduces coupling, and improves testability and review confidence.

Behavior Notes / Regression Impact

No intentional runtime behavior change.
The change is focused on dependency boundaries and wiring location.

Validation Performed

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

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