---
name: step-03b-layer1-seed
description: "Layer 1: Seed data (navigation, permissions, roles)"
model: opus
parent_step: steps/step-03-execute.md
---

## Layer 1 — Seed Data (DEDICATED LAYER — sequential, agent principal)

### Task Progress
TaskUpdate(taskId: layer1_task_id, status: "in_progress")
TaskUpdate(taskId: progress_tracker_id,
  description: "Module: {module_code}. Current: step-03 (Execute), Layer 1",
  activeForm: "Executing Layer 1")

> This layer is required. Seed data makes modules visible in the UI. Without it, the module exists in code but is invisible to users. Reference: `references/core-seed-data.md` (loaded above) for complete C# templates.

### Application-Level Seed Data (ONCE per application)

```
1. NavigationApplicationSeedData.cs
   → Application-level navigation entry (MUST be first)
   → 4 language translations (fr, en, it, de)

2. ApplicationRolesSeedData.cs
   → 4 roles: admin, manager, contributor, viewer
   → References NavigationApplicationSeedData.ApplicationId
```

### Per-Module Seed Data

```
3. NavigationModuleSeedData.cs
   → 4 languages (fr, en, it, de), GetModuleEntry() + GetTranslationEntries()
   → If sections defined: GetSectionEntries() + GetSectionTranslationEntries()
   → If resources defined: GetResourceEntries() + resource translations
   → Query actual parent from DB for FK (NOT deterministic GUID)

4. Permissions.cs
   → MCP generate_permissions (PRIMARY tool)
   → Static constants: public static class {Module} { public const string Read = "..."; }
   → Permission paths MUST use kebab-case matching NavRoute codes

5. PermissionsSeedData.cs
   → MCP generate_permissions first, fallback template
   → Paths match Permissions.cs, wildcard + CRUD

6. RolesSeedData.cs
   → Admin=wildcard(*), Manager=CRU, Contributor=CR, Viewer=R
   → Code-based role mapping (not deterministic GUIDs for roles)
   → Look up roles by Code at runtime
```

### Infrastructure Provider (ONCE per application)

```
7. {App}SeedDataProvider.cs
   → Implements IClientSeedDataProvider
   → SeedNavigationAsync(): Application → Module → Section → Resource + translations
   → SeedRolesAsync(): application-scoped roles from ApplicationRolesSeedData
   → SeedPermissionsAsync(): permission entries from PermissionsSeedData
   → SeedRolePermissionsAsync(): maps roles to permissions (by Code, NOT by GUID)
   → DI: services.AddScoped<IClientSeedDataProvider, {App}SeedDataProvider>()
```

<!-- TODO A4: Replace direct seed generation with MCP scaffold_seed_data when B1 is ready. This will eliminate the need for references/core-seed-data.md (1464 lines). -->

### Post-Layer 1 Build Gate

```bash
dotnet build
```

Must pass before Layer 2.

TaskUpdate(taskId: layer1_task_id, status: "completed",
  metadata: { build_gate: "pass" })

### Layer 1 Commit

```
feat({module}): [seed] navigation, permissions, roles
```

> **Context release:** `references/core-seed-data.md` is no longer needed after Layer 1. Its templates have been consumed. Do not reference it in Layer 2+.

---

## NEXT SUB-STEP

Load `steps/step-03c-layer2-backend.md`
