Community Module: Structural Assessment
Date: 2026-01-29
Scope: packages/modules/community/src
Standard: ISO-SD-2026 (Domain Architecture)
1. Executive Summary
The directory structure allows for logical boundaries, but the implementation has drifted into redundancy and disconnection.
- Verdict: The boundaries are sound, but the wiring between them is broken or duplicated.
- Key Action: Consolidate
identityintoregistryand fix thecontracts->ownershipevent loop.
2. Detailed Findings
A. The "Identity" Duplication
Directories: identity/ vs registry/
- Finding:
RegistryService(registry/) is the robust, production-grade service handling Google Workspace sync, personas, and profiles.PeopleService(identity/) appears to be anemic/legacy code targeting the samepeoplecollection but lacking the business logic. - Recommendation: DELETE
identity/. It creates confusion. Renameregistry/toidentity/OR moveRegistryServicetoidentity/to align with the Domain Atlas ("Directory" subdomain).
B. The "Deed-Ownership" Disconnect
Directories: contracts/ vs ownership/
- Finding: The
DeedServicecontains commented-out code (// TODO: Re-implement ownership syncing) intended to update the ownership state when a deed is issued. - Architecture:
contracts/= The Source of Truth (The Legal Paper).ownership/= The Derived State (The Current Reality).- Recommendation: Keep Separate, but connect them via Events.
DeedServiceshould emitDEED_ISSUED.OwnershipServiceshould listen to this event and update its state.- Do not tightly couple them by importing one service into another.
C. The "Unit" Helper
Directory: property/
- Finding:
property/correctly manages the physical assets (Units). - Recommendation: Keep. Ideally,
OwnershipServiceshould validate againstAssetServiceto ensure the unit exists, but not strictly required if we trust the Deed.
3. Consolidation Plan (Proposed Structure)
packages/modules/community/src/
├── identity/ <-- MERGE (formerly registry + identity)
│ ├── service.ts (RegistryService)
│ ├── google.ts (GoogleWorkspaceService)
│ └── schema.ts
├── property/ <-- KEEP (Physical Assets)
│ ├── service.ts (AssetService)
│ └── schema.ts
├── governance/ <-- KEEP (Voting)
├── contracts/ <-- KEEP (Legal Sources)
│ ├── deed.ts
│ └── lease.ts
├── ownership/ <-- KEEP (Derived State)
│ ├── service.ts (OwnershipService)
│ └── listener.ts (NEW: Event Listener)
└── billing/ <-- NEW (Assessments/Occupancy?)
├── assessments/
└── occupancy/
4. Immediate Actions
- Deprecate
identity/PeopleService.ts. - Refactor
registry/->identity/(or strictly defineregistryas the sub-module name). - Implement the
DEED_ISSUEDevent handler inOwnershipService.