Skip to content

feat: add onion architecture preset to boundary rules#229

Merged
carlos-alm merged 1 commit into
mainfrom
feat/onion-preset
Mar 2, 2026
Merged

feat: add onion architecture preset to boundary rules#229
carlos-alm merged 1 commit into
mainfrom
feat/onion-preset

Conversation

@carlos-alm
Copy link
Copy Markdown
Contributor

Summary

  • Add onion preset with layers: domain-modeldomain-servicesapplicationinfrastructure
  • Enforces inward-only dependency direction, same as the other presets
  • Completes the four most popular layered architecture patterns: hexagonal, layered, clean, onion

Test plan

  • Unit test updated to verify all four presets
  • All 32 boundary tests pass

Add onion preset with layers: domain-model → domain-services →
application → infrastructure. Enforces inward-only dependency
direction like the other presets.
@claude
Copy link
Copy Markdown

claude Bot commented Mar 2, 2026

Claude finished @carlos-alm's task —— View job


PR Review: Onion Architecture Preset

Todo List

  • Read and understand the modified files
  • Analyze root cause - what problem this solves
  • Check implementation against existing patterns
  • Verify test integrity and coverage
  • Assess code quality and potential issues
  • Provide final rating and recommendation

Root Cause Analysis

Problem Being Solved: The PR adds support for onion architecture, completing the four most popular layered architecture patterns (hexagonal, layered, clean, onion). This addresses a gap in architectural preset coverage for teams using onion architecture.

Why This Approach: The implementation follows the exact same pattern as the existing three presets, maintaining consistency in the codebase. The onion layers (domain-modeldomain-servicesapplicationinfrastructure) follow standard onion architecture conventions.

Risk Assessment: Very low risk. This is a pure additive change with no modifications to existing functionality.

Implementation Analysis

Positive aspects:

  • Consistent pattern: Follows exact same structure as hexagonal, layered, and clean presets
  • Correct layer ordering: Inner-to-outer layers match onion architecture principles
  • Minimal change: Only 6 additions, 1 deletion - focused scope
  • Test coverage: Updated test from "all three presets" to "all four presets" with explicit assertion for onion
  • Standard naming: Uses conventional onion layer names (domain-model, domain-services, etc.)

Code quality:

  • Implementation at src/boundaries.js:61-64 is identical in structure to other presets
  • Test update at tests/unit/boundaries.test.js:187-191 properly validates the new preset exists
  • All existing functionality remains unchanged
  • The generatePresetRules() function will automatically work with the new preset

Critical Concerns

None identified. This is a straightforward, well-implemented addition.

Minor observations:

  • Layer naming uses kebab-case (domain-model) which is consistent with existing patterns
  • The description reuses "Inward-only dependency direction" which accurately describes the behavior
  • The test ensures all four presets have valid layers arrays

Final Recommendation

  • Rating: ⭐⭐⭐⭐☆ (4/5)
  • Action: APPROVE
  • Reasoning: Clean implementation that follows established patterns exactly, minimal scope, appropriate test coverage, and completes a logical set of architectural presets. This is exactly the kind of straightforward, focused change that should be approved quickly.

The only reason it's not 5 stars is that it's a simple addition rather than solving a complex problem, but it's executed very well.

@carlos-alm carlos-alm merged commit c47ae76 into main Mar 2, 2026
15 checks passed
@carlos-alm carlos-alm deleted the feat/onion-preset branch March 2, 2026 08:18
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Mar 2, 2026

Greptile Summary

Adds the onion architecture preset to complete support for the four most popular layered architecture patterns (hexagonal, layered, clean, and onion).

  • Added onion preset with four layers: domain-modeldomain-servicesapplicationinfrastructure
  • Enforces inward-only dependencies, consistent with other presets
  • Updated test to verify all four presets are defined

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • Simple additive change that follows existing patterns exactly. The new preset uses the same structure as the three existing presets, and the implementation correctly integrates with the existing generatePresetRules function. Test coverage is adequate and all 32 boundary tests pass according to the PR description.
  • No files require special attention

Important Files Changed

Filename Overview
src/boundaries.js Added onion preset with correct layer ordering: domain-model → domain-services → application → infrastructure
tests/unit/boundaries.test.js Updated test assertion from three to four presets, added check for onion preset

Last reviewed commit: a8c6fb9

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

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

2 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

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