# Frontend L0/L1 Ownership Inventory

Status: Phase 2B final audit for #2383 after NexusCRM PR #2650 and #2656,
plus the PR3 seal follow-ups.

Normative basis: `docs/design/l0-l1-standard.md`. For frontend ownership,
the strong rule is:

> L0 frontend is runtime protocol, SDK, transport, codegen, and seal tooling.
> Product chrome, information architecture, design-system implementation, and
> app screens belong to the app or distribution owner.

This file replaces the older Phase 0 inventory. Historical claims that broad
`components/**`, `core/**`, or `contexts/**` were L0 just because they did not
spell "Salesforce" are no longer valid.

## Current Result

The CRM frontend source relocation is materially complete for UI/source
ownership:

- CRM screens, features, chrome, setup IA, and styled UI kit are source-owned
  in `nexuscrm-app-packs`, under
  `salesforce-crm-standard/frontend/src/**`.
- Nexus `frontend/src/features/**`, `frontend/src/pages/**`, and
  `frontend/src/types/**` are gone.
- Nexus no longer exposes `@nexuscrm/host-sdk/ui`.
- Nexus no longer exposes
  `@nexuscrm/platform-frontend/components/Layout`.
- The host SDK public surface is one module: `@nexuscrm/host-sdk`.
- The host default theme is a neutral runtime fallback, not the CRM indigo
  product theme.
- The external source/build gates exercise the real CRM package through the
  host SDK. P1x deleted the transitional non-product frontend package and its
  coexistence proof rather than treating it as a second App.
- The host permission read path is resource-shaped. CRM object permission
  convenience hooks live in the CRM app pack, not in Nexus runtime source.
- The sealed issue-tracker selected-root fixture has no frontend package,
  source manifest, shell, route, or theme contribution.

`frontend/src` is not empty. The remaining files are runtime, distribution,
generated contract, seal, or bundled-registration glue. They must not be
described as "L0 frontend product code."

## Exact Snapshot

Measured on `main` after the final frontend relocation seal (#2667):

| Metric | Count |
| --- | ---: |
| `frontend/src` TS/TSX files | 82 |
| non-test TS/TSX files | 61 |
| `frontend/src/host-sdk` non-test files | 36 |
| `frontend/src/host` non-test files | 16 |

Non-test top-level ownership counts:

| Entry | Count |
| --- | ---: |
| `host-sdk` | 36 |
| `host` | 16 |
| `generated` | 3 |
| root entry/test-env files | 5 |

Remaining top-level directories:

- `frontend/src/host-sdk/**`: public app-visible SDK surface.
- `frontend/src/host/**`: private host runtime and app-blind shell machinery.
- `frontend/src/generated/**`: generated platform contracts.
- `frontend/src/index.tsx`: consumes only generic distribution registration
  generated from the downstream-selected L1 source index.

The retired `components/**`, `core/**`, `contexts/**`, `registries/**`,
`infrastructure/**`, `features/**`, `pages/**`, and `types/**` source roots no
longer exist under Nexus `frontend/src`.

## Removed Ownership

Nexus PR #2656 removed the host-owned CRM chrome and design-system source:

- `components/Layout`
- `components/layout/**`
- `components/shell/AppLauncher`
- `components/shell/NotificationCenter`
- `components/UtilityBar`
- `components/WizardStepIndicator`
- `components/modals/**`
- `components/shared/PropRow`
- styled UI kit exports formerly exposed by `@nexuscrm/host-sdk/ui`

The relocated CRM constants are covered in app-packs source tests by
`salesforce-crm-standard/frontend/source-tests/relocated-chrome-constants.test.ts`.

## Remaining Buckets

| Path | Current owner | Status |
| --- | --- | --- |
| `frontend/src/host-sdk/**` | Nexus platform SDK | Keep only runtime/protocol primitives. Permission and navigation seams now use generic resource/target wording instead of host-sdk object permission/navigation vocabulary. |
| `frontend/src/host/**` | Nexus private host runtime | Not public L0 SDK. App packs must not import it directly. Keep app-blind and private. |
| `frontend/src/App.tsx`, `index.tsx`, `index.host.tsx` | Distribution entrypoints | The host remains L0; default composition imports only generated registration and names no concrete L1 package. |
| `frontend/src/generated/**` | Generated contracts | Generated from backend contracts. `generated/schema.ts` still carries Salesforce/CRM vocabulary and is gated by the backend contract split from #2378. |

## CI-Enforced Seals

The following checks are part of the final frontend seal:

- `npm run check:host-sdk-public-surface`:
  verifies that `@nexuscrm/host-sdk` is the only host SDK public module and
  that `@nexuscrm/host-sdk/ui` does not regrow.
- `npm run check:l0-sdk-boundary`:
  verifies the host SDK dependency closure stays free of CRM/Salesforce
  protocol and app source markers.
- `npm run check:frontend-relocation-backlog`:
  verifies retired `features/**` and `pages/**` source roots stay empty,
  rejects L0 imports of any product frontend package, rejects CRM feature
  aliases, and rejects CRM brand tokens in the
  host default theme.
- `npm run check:host-closure-sf-free` and `npm run build:host`:
  keep the host entrypoint closure app-blind. L1 owns its package build and
  source-test proofs; L2 selects the exact L1 frontend revision for a release.

## Completion Criteria

Frontend side of #2383 is complete when all of the following are true:

1. Nexus no longer owns CRM screens, feature modules, product chrome, setup IA,
   or styled design-system implementation source.
2. CRM app frontend source is owned by `salesforce-crm-standard/frontend` in
   app-packs, including chrome constants and tests.
3. `@nexuscrm/host-sdk` remains runtime/protocol only and has no styled UI
   subpath.
4. Host default theme is neutral and cannot regress to CRM brand colors through
   CI.
5. A non-CRM app has a real runtime proof with its own shell/design, and that
   proof runs together with CRM.
6. Remaining `frontend/src` files are documented as distribution/runtime,
   generated contract, seal tooling, or transition substrate with follow-up
   ownership criteria.

Known follow-ups that are outside the pure frontend source relocation PR:

- `frontend/src/generated/schema.ts` vocabulary depends on the backend contract split in
  #2378.
- The default Nexus frontend distribution shell can move to a distribution
  owner later. It is not L0, but it is also not CRM app source.
