# Manifest Settings — Mandatory Safety Protocol

**NEVER create or update a Mystique manifest setting without following ALL these steps.**

## Fixed parameters (non-negotiable)
- `valueType`: `"JSON"` — always. Never `"LOB"` or `"STRING"`.
- `context`: `"ACCOUNT"` — always. Never `"RETAILER"`. `contextId`: `0`.
- Body goes in `lobValue` — NEVER `value` (255 char limit, silently truncates).
- `lobValue` must be raw JSON, not stringified. **Never `JSON.stringify()` — double-encodes, Mystique rejects with "invalid route".**
- **MCP `setting.upsert` requires explicit `valueType: "JSON"`** for manifest settings — without it, defaults to LOB which breaks manifests. Preferred paths: CLI `fluent module install --include settings` or GraphQL `createSetting`/`updateSetting`. Use MCP `setting.get` (with `outputFile`) to read/backup existing settings before modification.

## Before ANY setting create/update
1. **Backup** — Save existing setting to `accounts/<PROFILE>/manifests/backups/<setting-name>_<YYYY-MM-DD>.json`. Non-manifest backups: `accounts/<PROFILE>/settings/backups/`.
2. **Validate** — Run `/fluent-mystique-validate` on the manifest JSON.
3. **Ask for approval** — Present: setting name, action (CREATE/UPDATE), changes, backup path, rollback instructions. **DO NOT deploy until user approves.**

## Naming & related settings
- Main: `fc.mystique.manifest.<app>`, Fragments: `fc.mystique.manifest.<app>.fragment.<name>`
- **No `fc.mystique.apps` setting exists.** Manifest setting pattern: `fc.mystique.manifest.<appName>` where `<appName>` matches the app. Standard: **OMS App** → `fc.mystique.manifest.oms`, **Store App** → `fc.mystique.manifest.store`. Note: the `modules[]` value in workflow user actions comes from each app's `orchestrationAlias` (e.g., `"adminconsole"` for OMS App, `"servicepoint"` for Store App), NOT from the manifest setting suffix.
- Legacy settings with `RETAILER`/`LOB` — do NOT change without user approval.

## Manifest architecture: root vs fragments (CRITICAL)

**`plugins[]` go ONLY in the root manifest (`fc.mystique.manifest.<app>`), NEVER in fragments.**

| Setting type | Contains | Example |
|---|---|---|
| Root manifest (`fc.mystique.manifest.oms`) | `plugins[]` (JS bundles) + `routes[]` (references to fragments) + app shell config | `{ plugins: [{ type: "url", src: "http://localhost:3001/" }], routes: [{ type: "reference", settingName: "...fragment.ordermanagement" }] }` |
| Fragment (`fc.mystique.manifest.oms.fragment.*`) | `routes[]` ONLY (sections, pages, descendants) — **NO plugins** | `{ manifestVersion: "2.0", routes: [{ type: "section", ... }] }` |

To load a custom JS bundle (FieldRegistry, ComponentRegistry, TemplateRegistry), add it to the **root manifest's** `plugins[]` array. Fragments inherit the loaded bundles — they do NOT load their own.

## Plugin file precedence (CRITICAL)

OMS loads its main manifest from `/_plugins/oms/manifests/fc.mystique.manifest.oms.json`, NOT from the setting. To add custom sections, add them to an existing fragment loaded from settings (ordermanagement, products, stores, admin). You CANNOT add new fragment references to the main manifest. Fragment settings use same rules: `JSON`/`ACCOUNT`/`0`, deploy via `fluent module install --include settings --force`.
