feat/energia-mod
safe3716a44 · fullPR #299reviewed 2026-07-11 05:35 UTC0H · 0M · 5L · 2I- Purpose
- Scaffold the energia enterprise module as a dark, per-org entitlement-gated surface — the first rung of portfolio-wide energy management (findings ledger, budget/forecast).
- Goal
- Ship the module key, route, nav entry, and admin toggle dark; no customer can reach it until a Batu admin explicitly entitles their org.
- Sub-goals
- SG-1: Domain + schema — ORG_MODULES and OrgModuleKeySchema widened to include 'energia'
- SG-2: Soft-launch wiring — GATED_PATH_MODULES + GREYED + navState + sidebar + admin toggle + tests
- What
- 9 files changed (+74/-4): new /energia page (teaser only), sidebar nav entry (greyed), admin toggle in OrgDetailPanel, soft-launch gate entry, ORG_MODULES/OrgModuleKeySchema widened, translations (en+es), soft-launch tests extended.
- Why
- Establishes the module scaffold so subsequent PRs (findings backend, findings ledger UI) can land behind it incrementally without a big-bang reveal.
- Areas
- apps/platform+65−2domains/core+1−1packages/api+1−1
- Blast
- 9 files, +74/-4 across platform app, core domain, and API schemas. All gated dark — no customer impact.
Findings · 7
security1
Client-side gate deferral — intentional, documented
apps/platform/src/lib/soft-launch.ts:50
Static teaser with zero data fetching; ensureModuleEntitled deferred safely. Must be wired before any real data surface lands in /energia.
conventions1
Multi-paragraph docstring on scaffold page
apps/platform/src/app/[locale]/(dashboard)/energia/page.tsx:7
CLAUDE.md: no comments unless the WHY is non-obvious. Belongs in the PR description, not source.
tests3
No prefix-boundary false-positive test for /energia
apps/platform/src/lib/__tests__/soft-launch.test.ts:49
An analogous /energia-something check would catch a typo in GATED_PATH_MODULES for this module specifically.
No direct cross-module non-reveal for energia in navState block
apps/platform/src/lib/__tests__/soft-launch.test.ts:113
Covered implicitly by the no-drift invariant 'others' loop. Direct assertion would make intent explicit.
Single child-path tested for /energia — fine for scaffold
apps/platform/src/lib/__tests__/soft-launch.test.ts:36
Extend when real sub-routes land.
improvement2
4 registration points per module — discuss registry before 5th module
apps/platform/src/app/[locale]/(dashboard)/admin/_components/OrgDetailPanel.tsx:85
Modules now touch: ORG_MODULES, OrgModuleKeySchema, soft-launch, OrgDetailPanel. Not urgent at 4.
navState bindings grow linearly with module count
apps/platform/src/components/DashboardSidebar.tsx:80
~8 lines per module; still readable at 4. Consider config-driven map at 5-6.