ADR-0002: Shared primitives consumed, never re-implemented¶
- Status: Accepted
- Deciders: Platform engineering
- Context: Constitution Principle I; specs 107 / 108 (RW-761)
Context¶
Cross-cutting value types and contracts — TenantId, Money, the event envelope, RFC 7807
problem types, and (later) auth primitives (TOTP, OIDC client, at-rest encryption) — are needed
by every service. If each service defines its own copy, they drift: subtly different validation,
serialization, or rounding leads to interop bugs that unit tests within one service cannot catch.
Decision¶
These primitives live once in resortwise-shared and are consumed by every service.
Re-declaring a shared primitive locally is forbidden and enforced by the shared-usage gate
(a creds-free static scan wired into check, spec 108 / RW-761). resortwise-shared keeps its
public surface framework-light (Spring/Jackson as compileOnly) so consumers are not forced into
a particular framework version.
Consequences¶
- One definition of each primitive → consistent behaviour across core/pms/finance/sales.
- A change to a shared primitive is a coordinated, versioned release consumed by services; cross-repo refactors must repin the shared dependency (services-core resolves it via a pinned repo-resource ref, not a live feed).
- The gate adds a hard failure if a service reintroduces a local copy — cheap insurance against silent divergence.