aw-spec-cli 0.1.10 → 0.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/assets/.appweaver/ORCH-DIALECT.md +17 -5
  2. package/assets/.appweaver/orchestrator/README.md +1 -1
  3. package/assets/.appweaver/orchestrator/adapters/claude_agent_sdk.py +2 -2
  4. package/assets/.appweaver/orchestrator/adapters/google_antigravity.py +28 -6
  5. package/assets/.appweaver/orchestrator/modules/delta-spec.orch.yaml +13 -1
  6. package/assets/.appweaver/orchestrator/orchestrator.py +126 -39
  7. package/assets/.appweaver/orchestrator/workflows/aw-spec-adopt.orch.yaml +5 -0
  8. package/assets/.appweaver/orchestrator/workflows/aw-spec-characterize.orch.yaml +1 -0
  9. package/assets/.appweaver/orchestrator/workflows/aw-spec-onboard.orch.yaml +1 -0
  10. package/assets/.appweaver/orchestrator/workflows/aw-spec-specify.orch.yaml +888 -141
  11. package/assets/.appweaver/scripts/bash/aw-spec-actions.sh +826 -16
  12. package/assets/.appweaver/scripts/powershell/aw-spec-actions.ps1 +780 -12
  13. package/assets/.appweaver/stack-profiles/java-spring.json +3 -3
  14. package/assets/.appweaver/templates/spec-template.md +73 -62
  15. package/assets/.appweaver/templates/story-template.md +107 -0
  16. package/assets/guardrails/technology/java-spring/ai-rules.md +505 -0
  17. package/assets/guardrails/technology/java-spring/api-versioning.md +782 -0
  18. package/assets/guardrails/technology/java-spring/authorization.md +618 -0
  19. package/assets/guardrails/technology/java-spring/clean-architecture.md +960 -0
  20. package/assets/guardrails/technology/java-spring/coding-standards.md +821 -0
  21. package/assets/guardrails/technology/java-spring/dependency-policy.md +91 -0
  22. package/assets/guardrails/technology/java-spring/domain-driven-design.md +467 -0
  23. package/assets/guardrails/technology/java-spring/domain_abstraction.md +424 -0
  24. package/assets/guardrails/technology/java-spring/folder-structure.md +1537 -0
  25. package/assets/guardrails/technology/java-spring/global_exception_handler.md +247 -0
  26. package/assets/guardrails/technology/java-spring/logging.md +215 -0
  27. package/assets/guardrails/technology/java-spring/modular-monolith.md +77 -0
  28. package/assets/guardrails/technology/java-spring/persistence.md +316 -0
  29. package/assets/guardrails/technology/java-spring/problem_details.md +98 -0
  30. package/assets/guardrails/technology/java-spring/result_mapping.md +48 -0
  31. package/assets/guardrails/technology/java-spring/technology-constitution.md +168 -0
  32. package/assets/guardrails/technology/java-spring/testing.md +601 -0
  33. package/assets/guardrails/technology/java-spring/zero-trust.md +210 -0
  34. package/dist/index.js +0 -0
  35. package/dist/utils/config.d.ts +22 -0
  36. package/dist/utils/config.d.ts.map +1 -0
  37. package/dist/utils/config.js +76 -0
  38. package/dist/utils/config.js.map +1 -0
  39. package/dist/utils/copy-assets.d.ts.map +1 -1
  40. package/dist/utils/copy-assets.js +4 -11
  41. package/dist/utils/copy-assets.js.map +1 -1
  42. package/dist/utils/paths.d.ts.map +1 -1
  43. package/dist/utils/paths.js +11 -7
  44. package/dist/utils/paths.js.map +1 -1
  45. package/package.json +2 -1
  46. package/assets/guardrails/technology/java-spring/README.md +0 -62
  47. package/dist/commands/update.d.ts +0 -3
  48. package/dist/commands/update.d.ts.map +0 -1
  49. package/dist/commands/update.js +0 -142
  50. package/dist/commands/update.js.map +0 -1
  51. package/dist/utils/manifest.d.ts +0 -31
  52. package/dist/utils/manifest.d.ts.map +0 -1
  53. package/dist/utils/manifest.js +0 -91
  54. package/dist/utils/manifest.js.map +0 -1
  55. package/dist/utils/update-engine.d.ts +0 -52
  56. package/dist/utils/update-engine.d.ts.map +0 -1
  57. package/dist/utils/update-engine.js +0 -203
  58. package/dist/utils/update-engine.js.map +0 -1
@@ -0,0 +1,247 @@
1
+ # Global Exception Handler Component Architectural Specification (Rule)
2
+
3
+ ## 1. Purpose
4
+
5
+ The Global Exception Handler is a centralized mechanism for handling exceptions that reach the HTTP/framework exception-handling boundary. Its primary flow is:
6
+
7
+ Exception → Global Exception Handler → Problem Details → HTTP Error Response
8
+
9
+ The component MUST separate exception interception and handling from standardized HTTP error representation.
10
+
11
+ ## 2. Applicability
12
+
13
+ This cross-cutting concern applies to centralized handling of exceptions that reach the HTTP/framework exception-handling boundary in a Java/Spring application. It does not apply to exceptions that are intentionally handled locally when local recovery is required.
14
+
15
+ ## 3. Component Responsibilities
16
+
17
+ The component MUST:
18
+
19
+ - Centrally intercept exceptions that reach the HTTP/framework exception-handling boundary.
20
+ - Identify the exception type/category.
21
+ - Determine the appropriate handling path for supported exception categories.
22
+ - Handle known exception categories according to the established application exception model.
23
+ - Provide a safe fallback path for unexpected exceptions.
24
+ - Delegate standardized HTTP error representation to the Problem Details component.
25
+ - Prevent common exception-handling logic from being duplicated across controllers/endpoints.
26
+ - Support appropriate diagnostic handling without exposing sensitive internal information.
27
+
28
+ The component MUST NOT:
29
+
30
+ - Implement business rules.
31
+ - Generate business exceptions.
32
+ - Perform validation.
33
+ - Implement Result Mapping.
34
+ - Construct its own Problem Details representation.
35
+ - Implement logging infrastructure.
36
+ - Implement metrics.
37
+ - Implement distributed tracing.
38
+ - Make authentication or authorization decisions.
39
+
40
+ ## 4. Exception Categories
41
+
42
+ The rule MUST support the established application exception model. Exception categories may include established categories such as:
43
+
44
+ - Domain exceptions
45
+ - Application exceptions
46
+ - Infrastructure exceptions
47
+ - Validation exceptions
48
+ - Not-found exceptions
49
+ - Conflict exceptions
50
+ - Unauthorized exceptions
51
+
52
+ The Global Exception Handler MUST determine handling behavior from the established exception semantics.
53
+
54
+ The component MUST NOT invent additional exception categories.
55
+
56
+ The rule MUST NOT require a separate handler implementation for every exception class when multiple exception types can legitimately share a handling strategy.
57
+
58
+ ## 5. Problem Details Integration
59
+
60
+ Problem Details is a separate cross-cutting concern.
61
+
62
+ The responsibility boundary MUST remain:
63
+
64
+ - Global Exception Handler: Exception interception, exception classification/handling path, and providing the exception/error context required by the Problem Details capability.
65
+ - Problem Details: Standardized HTTP error representation.
66
+
67
+ The Global Exception Handler MUST delegate standardized HTTP error representation to the approved Problem Details capability.
68
+
69
+ It MUST NOT:
70
+
71
+ - Construct Problem Details itself.
72
+ - Duplicate Problem Details fields.
73
+ - Define another HTTP error-response schema.
74
+ - Create a second standardized error representation.
75
+ - Bypass Problem Details for exceptions handled by the global flow.
76
+
77
+ ## 6. Unexpected Exceptions and Security
78
+
79
+ The component MUST provide a safe fallback for unexpected exceptions.
80
+
81
+ Unexpected exceptions MUST:
82
+
83
+ - Be handled centrally.
84
+ - Follow the Problem Details error-response flow.
85
+ - Avoid exposing internal implementation details to clients.
86
+ - Avoid exposing stack traces to clients in production by default.
87
+ - Avoid exposing credentials, tokens, secrets, database details, or other sensitive internal information.
88
+ - Provide sufficient diagnostic information for internal investigation through the approved Logging capability.
89
+
90
+ The rule MUST clearly distinguish internal diagnostic information from client-facing error information. The exact standardized HTTP error representation remains the responsibility of Problem Details.
91
+
92
+ ## 7. Separation from Result Mapping
93
+
94
+ Result Mapping is a separate cross-cutting concern responsible for Application Result → HTTP Response.
95
+
96
+ The Global Exception Handler is responsible for Exception reaching HTTP/framework boundary → Error-handling flow.
97
+
98
+ The Global Exception Handler MUST NOT:
99
+
100
+ - Replace Result Mapping.
101
+ - Duplicate Result Mapping logic.
102
+ - Determine application Result success/failure.
103
+ - Become a Result Mapper.
104
+ - Introduce an Exception → Result → Result Mapping flow unless such a flow is explicitly required by the established application architecture.
105
+ - Convert arbitrary exceptions into successful HTTP responses.
106
+
107
+ ## 8. Validation Integration
108
+
109
+ Validation is a separate cross-cutting concern.
110
+
111
+ The Global Exception Handler MUST NOT perform validation rules.
112
+
113
+ It MAY handle validation exceptions/errors produced by the Validation capability and route them through Problem Details.
114
+
115
+ The responsibility boundary MUST remain:
116
+
117
+ - Validation: Validate input/data → Validation error
118
+ - Global Exception Handler: Handle validation error → Problem Details
119
+ - Problem Details: Standardized HTTP error representation
120
+
121
+ ## 9. Logging Integration
122
+
123
+ Logging is a separate cross-cutting concern.
124
+
125
+ The Global Exception Handler MAY integrate with the approved Logging capability for diagnostic information.
126
+
127
+ It MUST NOT:
128
+
129
+ - Implement logging infrastructure.
130
+ - Create a custom logger.
131
+ - Create a custom logging abstraction.
132
+ - Configure the logging framework.
133
+ - Duplicate Logging responsibilities.
134
+
135
+ Diagnostic logging SHOULD be performed at an appropriate centralized boundary to avoid redundant multi-layer logging. Sensitive exception information MUST follow the Logging component's sensitive-data protection policy.
136
+
137
+ ## 10. Architectural Layer Placement
138
+
139
+ The Global Exception Handler is a Technical/Infrastructure HTTP cross-cutting concern. Its implementation, configuration, and framework integration MUST belong to the Infrastructure boundary.
140
+
141
+ The Domain layer MUST remain independent of the Global Exception Handler and HTTP exception-handling infrastructure.
142
+
143
+ ## 11. Hexagonal Architecture
144
+
145
+ ### Domain/Core
146
+
147
+ The Domain MUST NOT depend on the Global Exception Handler, HTTP response types, Spring Web, Servlet APIs, Problem Details, or framework-specific exception-handling mechanisms. Domain exceptions MAY exist as part of the Domain's business error model, but the Domain MUST NOT know how its exceptions are converted into HTTP responses.
148
+
149
+ ### Inbound Ports
150
+
151
+ Inbound Ports MUST NOT depend on the Global Exception Handler, HTTP response types, Problem Details, or framework-specific exception handling.
152
+
153
+ ### Outbound Ports
154
+
155
+ Outbound Ports MUST NOT depend on the Global Exception Handler, HTTP response types, or framework-specific exception handling.
156
+
157
+ ### Application
158
+
159
+ The Application layer MAY produce application exceptions. It MUST NOT construct framework-specific HTTP error responses.
160
+
161
+ ### Inbound Adapters / Presentation
162
+
163
+ Inbound Adapters / Presentation MAY participate in the framework's exception-handling mechanism. Controllers/endpoints SHOULD NOT duplicate common exception-handling logic that is already handled globally.
164
+
165
+ ### Infrastructure
166
+
167
+ Infrastructure provides and configures the Global Exception Handler and its framework integration.
168
+
169
+ ## 12. Centralization and Local Overrides
170
+
171
+ Exception handling MUST be centralized for common exception categories. Controllers/endpoints MUST NOT duplicate common handling logic for exception categories supported by the Global Exception Handler.
172
+
173
+ Local exception handling MAY still be used when an operation requires specific recovery behavior that cannot reasonably be handled by the global mechanism. The Global Exception Handler MUST NOT prevent legitimate local exception recovery.
174
+
175
+ ## 13. Configuration
176
+
177
+ The component MUST provide externalized configuration where environment-specific behavior is required.
178
+
179
+ Configuration MAY control environment-specific error disclosure behavior.
180
+
181
+ Stack traces MUST NOT be exposed to clients in production by default.
182
+
183
+ Internal diagnostic details MAY be available to the appropriate diagnostic/logging mechanism.
184
+
185
+ Whether development environments expose additional diagnostic details is an implementation/configuration decision.
186
+
187
+ Production configuration MUST prioritize safe error disclosure. Environment-specific behavior MUST NOT require source-code changes. The component MUST NOT introduce configuration for unrelated concerns.
188
+
189
+ ## 14. Dependencies
190
+
191
+ Dependencies MUST be limited to those required for Java/Spring exception-handling integration, the established application exception model, integration with the approved Problem Details capability, and integration with the approved Logging capability where diagnostic logging is required.
192
+
193
+ Dependencies MUST be managed through centralized dependency management or an approved BOM where applicable. Unnecessary dependencies MUST NOT be introduced. Dependency versions MUST NOT be hardcoded in the rule.
194
+
195
+ ## 15. Reliability and Performance
196
+
197
+ Exception handling MUST NOT alter business rules, domain state, or business outcomes.
198
+
199
+ The configuration SHOULD avoid expensive processing during error handling, unbounded error payloads, recursive exception handling, excessive diagnostic information, and unnecessary duplicate logging.
200
+
201
+ If the exception-handling mechanism itself encounters an unexpected failure, it MUST have a safe fallback that does not expose sensitive internal information.
202
+
203
+ ## 16. Separation from Other Cross-Cutting Concerns
204
+
205
+ The Global Exception Handler MUST NOT implement or assume responsibility for Problem Details construction, Result Mapping, Validation, Logging infrastructure, Metrics, Distributed tracing, Authentication, Authorization, Business audit logging, APM, or Business rules.
206
+
207
+ It MAY integrate with these capabilities where required, but responsibility MUST remain separated.
208
+
209
+ ## 17. Prohibited Behavior
210
+
211
+ - The component MUST NOT construct its own Problem Details representation.
212
+ - The component MUST NOT create a custom HTTP error-response schema.
213
+ - The component MUST NOT duplicate Result Mapping logic.
214
+ - The component MUST NOT perform validation.
215
+ - The component MUST NOT implement logging infrastructure.
216
+ - The component MUST NOT implement distributed tracing.
217
+ - The component MUST NOT implement metrics.
218
+ - The component MUST NOT expose stack traces to clients in production by default.
219
+ - The component MUST NOT expose secrets or unsafe internal exception details.
220
+ - The component MUST NOT move HTTP-specific exception handling into the Domain.
221
+ - The component MUST NOT generate business exceptions.
222
+ - The component MUST NOT unnecessarily duplicate controller-level exception handling.
223
+
224
+ ## 18. Implementation Boundary
225
+
226
+ The rule defines architectural behavior and constraints. The component MUST NOT dictate implementation details unless strictly required by the architectural standard.
227
+
228
+ The following remain implementation details: exact Java class names, exact package structures, exact Spring annotations, exact configuration class names, exact exception-handler method signatures, exact Problem Details implementation, exact Logging implementation, and exact dependency versions.
229
+
230
+ The Java/Spring implementation MUST provide the behavior defined by this rule using appropriate framework mechanisms.
231
+
232
+ ## 19. Acceptance Criteria
233
+
234
+ - [ ] Exceptions that reach the HTTP/framework exception-handling boundary are centrally intercepted.
235
+ - [ ] Known exception categories are handled according to the established application exception model.
236
+ - [ ] Unexpected exceptions have a safe fallback handling path.
237
+ - [ ] Exceptions handled by the Global Exception Handler use the approved Problem Details capability for standardized HTTP error representation.
238
+ - [ ] The Global Exception Handler does not construct or duplicate Problem Details.
239
+ - [ ] Validation is not implemented inside the Global Exception Handler.
240
+ - [ ] Result Mapping responsibilities are not duplicated.
241
+ - [ ] Logging infrastructure is not implemented inside the Global Exception Handler.
242
+ - [ ] Sensitive internal exception information is not exposed to clients.
243
+ - [ ] Stack traces are not exposed to clients in production by default.
244
+ - [ ] The Domain layer and Ports remain independent of HTTP exception handling.
245
+ - [ ] Controllers do not need to duplicate common global exception handling logic.
246
+ - [ ] The Global Exception Handler is integrated through the standard Java/Spring framework mechanism.
247
+ - [ ] Environment-specific error disclosure behavior can be externally configured where required.
@@ -0,0 +1,215 @@
1
+ # Logging Component Architectural Specification (Rule)
2
+
3
+ ## 1. Purpose
4
+
5
+ The purpose of the Logging component is to standardize logging behavior and configuration across the Java/Spring application. It provides a stable, technology-neutral Logging Contract to enable Logging Provider pluggability while leveraging the mature Java logging ecosystem (defaulting to SLF4J as the Logging API / Facade) for structured, context-aware, and secure diagnostic telemetry.
6
+
7
+ ## 2. Applicability
8
+
9
+ This rule applies when the Logging cross-cutting concern is developed as a reusable capability for the application.
10
+
11
+ ## 3. Component Responsibilities
12
+
13
+ The component is responsible for providing:
14
+
15
+ - **Contract/Abstraction:** A stable, technology-neutral Logging Contract to support Logging Provider pluggability without exposing underlying technology-specific types.
16
+
17
+ - **Configuration:** Standardized configuration for the selected Logging Backend / Implementation to provide structured logging and standardized log levels.
18
+
19
+ - **Framework Integration:** Integration with existing request, correlation, and tracing context so that available Trace ID, Span ID, and Correlation ID values can be included in the logging context.
20
+
21
+ - **Security Integrations:** Configurable masking/redaction mechanisms applied before sensitive information is emitted to the Logging Backend / Implementation.
22
+
23
+ - **Delegation:** The component MUST provide the stable Logging Contract and the provider integration mechanism required to select and configure an approved Logging Provider. SLF4J (Logging API / Facade) with an approved SLF4J-compatible implementation (Logging Backend / Implementation) MUST be the default configuration. The selected Logging Provider MUST be determined through the project's approved provider-selection and dependency-management mechanism. Runtime logging behavior MUST be configurable without requiring changes to application business logic.
24
+
25
+ ## 4. Required Functionality
26
+
27
+ ### 4.1 Structured Logging
28
+
29
+ The component MUST configure the application to emit logs in a machine-readable structured format (e.g., JSON).
30
+
31
+ ### 4.2 Standard Log Levels
32
+
33
+ The component MUST support and correctly configure the following standard levels: TRACE, DEBUG, INFO, WARN, and ERROR.
34
+
35
+ Semantic usage guidance:
36
+
37
+ - ERROR: failures requiring attention
38
+ - WARN: abnormal but recoverable conditions
39
+ - INFO: significant application events
40
+ - DEBUG: diagnostic information
41
+ - TRACE: highly detailed diagnostic information
42
+
43
+ ### 4.3 Standard Log Schema
44
+
45
+ The component MUST define a standardized structured log schema. At a minimum, the schema MUST support the following fields where applicable:
46
+
47
+ - timestamp
48
+ - level
49
+ - logger/source
50
+ - message
51
+ - application/service
52
+ - environment
53
+ - traceId, when available
54
+ - spanId, when available
55
+ - correlationId, when available
56
+ - exception information, when applicable
57
+
58
+ The component MUST NOT invent unnecessary mandatory fields.
59
+
60
+ ### 4.4 Contextual Logging
61
+
62
+ Context propagation across execution boundaries such as HTTP, messaging, asynchronous execution, scheduled execution, or batch execution belongs to the appropriate context-propagation or tracing mechanism.
63
+
64
+ The Logging component only consumes available context and includes it in log records. It MUST NOT implement distributed tracing.
65
+
66
+ ### 4.5 Exception Logging
67
+
68
+ The component MUST support exception logging with stack traces, diagnostic context, and sensitive-data protection. Application code SHOULD avoid redundant logging of the same failure across multiple layers unless additional logging provides materially different diagnostic information.
69
+
70
+ ### 4.6 Timestamp and Timezone
71
+
72
+ Log timestamps MUST use a consistent machine-readable representation. UTC SHOULD be used as the default timezone unless another organizational standard is explicitly defined.
73
+
74
+ ## 5. Dependencies
75
+
76
+ ### 5.1 Dependency Management
77
+
78
+ Logging dependencies MUST be managed through centralized dependency management or an approved BOM. The component MUST NOT independently introduce conflicting versions of shared logging dependencies.
79
+
80
+ ### 5.2 Selected Provider Dependencies
81
+
82
+ - The component MUST declare or provide the dependencies required by the selected Logging Provider, including its required Logging API / Facade and Logging Backend / Implementation, subject to the application's centralized dependency-management policy.
83
+ - Alternative Logging Provider dependencies are included only when that Logging Provider is explicitly selected and approved.
84
+
85
+ ### 5.3 Conditional Dependencies
86
+
87
+ The component MAY conditionally rely on:
88
+
89
+ - **Structured logging encoder/support** when not provided natively
90
+ - **Tracing/context integration** when tracing is enabled
91
+ - **Payload interception dependencies** when Payload Logging is enabled
92
+ - **AOP/interception dependencies** when Execution-Time Logging is enabled
93
+
94
+ ## 6. Configuration Requirements
95
+
96
+ The component MUST provide externalized configuration mechanisms. Environments (Development, Test, Production) MUST be able to define different log levels and configurations without requiring application source-code changes.
97
+
98
+ The default logging destination MUST be standard output. Destinations MAY be overridden through externalized configuration where permitted by the deployment/environment standard.
99
+
100
+ ## 7. Architectural Layer Placement
101
+
102
+ The Logging Provider, Logging API / Facade integration, Logging Backend / Implementation, and logging configuration belong strictly to the Infrastructure boundary.
103
+
104
+ The stable Logging Contract MUST be located at a dependency boundary that can be consumed by Application-facing code without creating a dependency on Infrastructure.
105
+
106
+ It MUST NOT be part of the Domain model or business ports.
107
+
108
+ It MUST NOT create a dependency from the Application layer into the Infrastructure layer.
109
+
110
+ The Application, Presentation, Inbound Adapter, and Outbound Adapter layers MAY consume the stable, technology-neutral Logging Contract.
111
+
112
+ ## 8. Domain Dependency Restrictions
113
+
114
+ Logging is a Technical/Infrastructure cross-cutting concern.
115
+
116
+ The Domain layer MUST remain strictly independent of the Logging component, the Logging Contract, SLF4J, Logback, Spring logging infrastructure, another Logging API / Facade, or any concrete Logging Backend / Implementation.
117
+
118
+ ## 9. Hexagonal Architecture Position
119
+
120
+ - Domain/Core MUST NOT depend on Logging, the Logging Contract, SLF4J, or concrete Logging Backend / Implementations.
121
+ - Inbound Ports MUST remain technology-independent and MUST NOT depend on Logging infrastructure.
122
+ - Outbound Ports MUST remain technology-independent and MUST NOT depend on Logging infrastructure.
123
+ - Application Services MAY consume the technology-neutral Logging Contract.
124
+ - Inbound Adapters MAY consume the technology-neutral Logging Contract.
125
+ - Outbound Adapters MAY consume the technology-neutral Logging Contract.
126
+ - Presentation MAY consume the technology-neutral Logging Contract.
127
+ - Infrastructure configures/provides the concrete Logging Provider and Logging Backend / Implementation.
128
+
129
+ ## 10. Optional Features
130
+
131
+ Optional features MUST NOT become mandatory dependencies of the core Logging capability.
132
+
133
+ ### 10.1 Payload Logging
134
+
135
+ A framework integration (e.g., HTTP filter) that logs request/response payloads.
136
+
137
+ If implemented, it MUST be explicitly enabled, disabled by default in production, and comply with the same sensitive-data protection requirements.
138
+
139
+ ### 10.2 Execution-Time Logging
140
+
141
+ A framework integration (e.g., Spring AOP aspect) for diagnostic method duration logging.
142
+
143
+ If implemented, it MUST be explicitly enabled and MUST NOT replace metrics or APM.
144
+
145
+ ## 11. Security Requirements
146
+
147
+ The component MUST provide configurable masking/redaction for known sensitive fields and configured sensitive patterns.
148
+
149
+ Applications MUST NOT intentionally log passwords, credentials, authentication tokens, API keys, or secrets.
150
+
151
+ Payload Logging MUST comply with the same sensitive-data protection requirements.
152
+
153
+ The component does not guarantee that arbitrary secrets can always be automatically detected.
154
+
155
+ ## 12. Reliability and Performance Requirements
156
+
157
+ Logging MUST remain observational and MUST NOT alter business rules, domain state, business outcomes, or transaction behavior.
158
+
159
+ Logging failures MUST NOT normally cause business operations or transactions to fail, unless an explicitly approved critical compliance or security policy requires otherwise.
160
+
161
+ The configuration SHOULD avoid unbounded payloads, excessive logging volume, unnecessary high-cardinality fields, and unnecessary application-thread blocking.
162
+
163
+ ## 13. Separation from Other Cross-Cutting Concerns
164
+
165
+ The Logging component MUST NOT implement:
166
+
167
+ - distributed tracing
168
+ - metrics
169
+ - business audit logging
170
+ - alerting
171
+ - centralized log aggregation infrastructure
172
+ - APM
173
+
174
+ ## 14. Prohibited Behavior
175
+
176
+ - A custom logging abstraction MUST NOT be created merely because Logging is a cross-cutting concern. However, because Logging Provider substitution is required, a stable technology-neutral Logging Contract MAY be provided so application code does not depend directly on the Logging Provider or Logging API / Facade.
177
+
178
+ - The Logging Contract MUST remain technology-neutral and MUST NOT expose SLF4J-specific types, Logback-specific types, or any other Logging Provider-specific types.
179
+
180
+ - The component MUST NOT call the Logging Contract `AppLogger`, `AppLoggerImpl`, or `IAppLogger`.
181
+
182
+ - The component MUST NOT invent a Logging Contract unless it is actually necessary for the Logging Provider pluggability requirement.
183
+
184
+ - The component MUST NOT implement a custom logging framework.
185
+
186
+ ## 15. Implementation Boundary
187
+
188
+ The rule defines architectural behavior and constraints.
189
+
190
+ The component MUST NOT dictate implementation details unless strictly required by the architectural standard.
191
+
192
+ The following remain implementation details configurable by the component:
193
+
194
+ - exact interface/class names for the Logging Contract
195
+ - exact configuration file names (e.g., `logback.xml` vs `logback-spring.xml`)
196
+ - specific JSON encoder libraries
197
+ - specific masking libraries
198
+ - specific AOP libraries
199
+ - specific MDC key names
200
+ - specific async logging implementations
201
+
202
+ ## 16. Acceptance Criteria
203
+
204
+ - [ ] A stable technology-neutral Logging Contract is available to application-facing layers where Logging Provider pluggability requires it.
205
+ - [ ] The stable Logging Contract does not expose types specific to SLF4J, Logback, or any other concrete Logging Provider.
206
+ - [ ] Application business logic does not directly depend on SLF4J, Logback, or another concrete Logging API / Facade or Logging Backend / Implementation.
207
+ - [ ] SLF4J is the default Logging API / Facade, and an approved SLF4J-compatible implementation is the default Logging Backend / Implementation.
208
+ - [ ] An alternative approved Logging Provider can be selected through the supported provider-selection and dependency-management mechanism.
209
+ - [ ] Switching the Logging Provider does not require changes to application business logic.
210
+ - [ ] Structured logging remains standardized regardless of the selected Logging Provider.
211
+ - [ ] Domain, Inbound Ports, and Outbound Ports remain independent of all logging technology and infrastructure.
212
+ - [ ] Trace ID, Span ID, and Correlation ID are included when available.
213
+ - [ ] Sensitive information is masked according to the configured policy.
214
+ - [ ] Optional Payload Logging and Execution-Time Logging remain independently configurable.
215
+ - [ ] Log levels and configuration remain externally configurable.
@@ -0,0 +1,77 @@
1
+ # Modular Monolith Strategy
2
+
3
+ ## Overview
4
+
5
+ The backend is structured as a **modular monolith**: a single deployable Spring Boot application internally divided into independent, cohesive modules that map to DDD bounded contexts.
6
+
7
+ ---
8
+
9
+ ## Module Boundaries
10
+
11
+ Each module is a self-contained package that:
12
+ - Owns its own domain model, use cases, ports, and adapters
13
+ - Has its own database tables (no shared tables across modules)
14
+ - Exposes a well-defined public API surface (application service interfaces)
15
+ - Does not allow other modules to directly call its repository or domain internals
16
+
17
+ ```text
18
+ com.company.project
19
+ ├── module_a/ ← Example Module A
20
+ ├── module_b/ ← Example Module B
21
+ ├── module_c/ ← Example Module C
22
+ └── shared/ ← Shared kernel (value objects, utilities, base types)
23
+ ```
24
+
25
+ ---
26
+
27
+ ## Inter-Module Communication Rules
28
+
29
+ | Rule | Detail |
30
+ |------|--------|
31
+ | Allowed | Module A calls Module B's **application service interface** (port) |
32
+ | Allowed | Module A fires a **domain/application event** that Module B listens to |
33
+ | Allowed | Modules share **value types** via the `shared` kernel |
34
+ | **Forbidden** | Module A directly calls Module B's repository |
35
+ | **Forbidden** | Module A accesses Module B's domain entities directly |
36
+ | **Forbidden** | Cross-module JPA joins in queries |
37
+
38
+ ### Preferred Inter-Module Integration Patterns
39
+
40
+ 1. **Direct service call**: Module A injects Module B's port interface (defined in Module B's application layer). Used for synchronous query needs (e.g., Module A queries Module B for specific details).
41
+ 2. **Application events (Spring Events)**: Used for fire-and-forget side effects (e.g., Action completed in Module A → Module B listens and triggers a side-effect). Spring's `ApplicationEventPublisher` is sufficient for MVP1 (in-process, synchronous).
42
+ 3. **Read-only ID references**: When Module A only needs to reference an entity from Module B, it stores the foreign ID and calls Module B's service to fetch details as needed.
43
+
44
+ ---
45
+
46
+ ## Shared Kernel (`shared` package)
47
+
48
+ The shared kernel contains only:
49
+ - Common value objects (e.g., `Money`, `EmailAddress`, `UserId`, `TenantId`)
50
+ - Common base types (e.g., `AuditableEntity`, `DomainEvent`)
51
+ - Utility classes (e.g., pagination types, response wrappers)
52
+ - Cross-cutting annotations or constants
53
+
54
+ The shared kernel must not contain business logic belonging to any specific module.
55
+
56
+ ---
57
+
58
+ ## Database Table Ownership
59
+
60
+ Each module owns and manages its own tables via its own Flyway migration scripts.
61
+
62
+ | Module | Table Prefix (suggested) |
63
+ |--------|--------------------------|
64
+ | module_a | `moda_*` |
65
+ | module_b | `modb_*` |
66
+ | module_c | `modc_*` |
67
+ | shared | `shared_*` (if applicable) |
68
+
69
+ ---
70
+
71
+ ## Future Microservice Extraction
72
+
73
+ The modular monolith is designed so that a module can be extracted to a standalone service by:
74
+ 1. Externalising the module's in-process application event bus to a message broker (e.g., Kafka, RabbitMQ, or Service Bus).
75
+ 2. Replacing the module's direct service call ports with HTTP/gRPC adapters.
76
+ 3. Moving the module's tables to a separate database instance.
77
+