phase-1: scaffold platform foundation structure and architecture governance
This commit is contained in:
44
docs/architecture/foundation/Coding-Standards.md
Normal file
44
docs/architecture/foundation/Coding-Standards.md
Normal file
@@ -0,0 +1,44 @@
|
||||
# Coding Standards
|
||||
|
||||
Status: Mandatory
|
||||
Date: 2026-07-03
|
||||
|
||||
## Core Principles
|
||||
|
||||
- Keep modules small and cohesive.
|
||||
- Prefer pure functions where possible.
|
||||
- Prefer composition over inheritance.
|
||||
- Prefer configuration over conditionals.
|
||||
- Avoid duplication; extract shared behavior above 70 percent overlap.
|
||||
|
||||
## Type Safety
|
||||
|
||||
- No any in domain and configuration contracts.
|
||||
- Strict typing for API payloads and configuration schemas.
|
||||
- Use discriminated unions for widget and section types.
|
||||
|
||||
## Error Handling
|
||||
|
||||
- Errors normalized at service/integration boundaries.
|
||||
- UI displays user-safe messages from facades/view models.
|
||||
- No unhandled promise rejections.
|
||||
|
||||
## API and IO
|
||||
|
||||
- IO is performed in services/integrations only.
|
||||
- Use facades to orchestrate calls and map outputs.
|
||||
- Keep presentation layer side-effect free.
|
||||
|
||||
## Testing Expectations
|
||||
|
||||
- Unit tests for facades, services, and mapping logic.
|
||||
- Contract tests for bootstrap schema compatibility.
|
||||
- Boundary tests for forbidden imports.
|
||||
|
||||
## Review Checklist
|
||||
|
||||
- Does this code violate layer boundaries?
|
||||
- Is tenant behavior configuration-driven?
|
||||
- Is logic duplicated and extractable?
|
||||
- Are auth/payment contracts unchanged?
|
||||
- Is the app still compilable?
|
||||
Reference in New Issue
Block a user