Skip to content

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 identity into registry and fix the contracts -> ownership event 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 same people collection but lacking the business logic.
  • Recommendation: DELETE identity/. It creates confusion. Rename registry/ to identity/ OR move RegistryService to identity/ to align with the Domain Atlas ("Directory" subdomain).

B. The "Deed-Ownership" Disconnect

Directories: contracts/ vs ownership/

  • Finding: The DeedService contains 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.
  • DeedService should emit DEED_ISSUED.
  • OwnershipService should 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, OwnershipService should validate against AssetService to 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

  1. Deprecate identity/PeopleService.ts.
  2. Refactor registry/ -> identity/ (or strictly define registry as the sub-module name).
  3. Implement the DEED_ISSUED event handler in OwnershipService.