← all branches

feat/energia-mod

safe
3716a44 · fullPR #299reviewed 2026-07-11 05:35 UTC0H · 0M · 5L · 2I
The branch
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
The changes (whole branch)
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+652domains/core+11packages/api+11
Blast
9 files, +74/-4 across platform app, core domain, and API schemas. All gated dark — no customer impact.
no-migration no-api-surface dark-by-default
typecheck· CI status not available via tokentests· 15/15 soft-launch tests pass per PR descriptioncoderabbit· CodeRabbit auto-summary present in PR

Findings · 7

security1

info

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

low

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

low

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.

low

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.

info

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

low

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.

low

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.