# Simplify Multiple-Select Option Visibility Implementation Plan
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
**Goal:** Replace unpublished expression-based `optionShowRules` with declarative visibility metadata on each static option while preserving the confirmed F2-107-7 scene/brand matrix across rendering, stale-value cleanup, and save paths.
**Architecture:**`getVisibleFieldOptions` will evaluate option-level `baseSceneCode`, `brandId`, `filterBrandId`, and an AND-composed `hideWhen` object using normalized `pageContext` scene and brand IDs. Conditional options fail closed when required context is absent. The converter will emit the metadata directly into F2-107-7 options for both daily and production IDs, so the option-only `$hasNonFiveRealmBrand` resolver and expression engine integration can be removed.
**Tech Stack:** JavaScript ES modules, Node.js built-in test runner, Python 3 `unittest`, Excel-to-schema converter fixtures.
## Global Constraints
- Work on branch `SAAS+V5.8.5`.
- Do not retain compatibility for `optionShowRules`; it has not been published.
- Preserve the confirmed mixed-brand behavior: positive five-realm options remain visible, while `已交付引荐` is hidden in light scenes when any non-five-realm brand exists.
- Preserve unrelated working-tree changes in `packageDynamicForm/utils/daily-report-calendar.js` and its plan document.
- This is a local form-engine fix and does not require the repository migration manifest gate.
- Consumes: `getVisibleFieldOptions(field, pageContext)` and `filterMultipleSelectValueByVisibleOptions(field, value, pageContext)`.
- Produces: executable expectations for option-level `baseSceneCode`, `brandId`, `filterBrandId`, `hideWhen`, missing-context fail-closed behavior, mixed brands, object selections, and stale-value cleanup.
-[]**Step 1: Replace expression-rule fixtures with option metadata**
Use literal options where `已拉群`, `首保维保客户`, and `事故车客户` carry light-scene `baseSceneCode` plus five-realm `brandId`, and `已交付引荐` carries `hideWhen.baseSceneCode` plus `hideWhen.filterBrandId`.
-[]**Step 2: Run the focused tests and verify RED**
An option with `baseSceneCode` requires a scene intersection; an option with `brandId` requires a brand intersection; an option with top-level `filterBrandId` requires at least one current brand outside the configured list.
-[]**Step 2: Implement `hideWhen` as an AND-composed negative condition**
Every configured property inside `hideWhen` must match before the option is hidden. Missing context required by either positive metadata or `hideWhen` hides the conditional option.
-[]**Step 3: Remove the option-only expression resolver and update stale-value guards**
Delete `resolveOptionShowRuleContextValue` and make cleanup conditional on option-level visibility metadata rather than `field.optionShowRules`.
- Produces: environment-correct metadata directly on the four conditional F2-107-7 options.
-[]**Step 1: Change converter and schema expectations first**
Assert that generated options contain the exact declarative metadata and that `optionShowRules`, `fiveRealmBrandIds`, and `$hasNonFiveRealmBrand` are absent.
-[]**Step 2: Run converter/schema tests and verify RED**
Expected: FAIL while the converter still emits expression rules.
-[]**Step 3: Implement the option metadata builder and validation**
Attach positive metadata to three five-realm options and `hideWhen` metadata to `已交付引荐`; validate supported option visibility properties as arrays/objects without expression dependency validation.
-[]**Step 4: Regenerate daily and production fixtures from the latest workbook**
Use the converter's existing CLI and environment mapping so only brand IDs differ between outputs.
-[]**Step 5: Run converter/schema tests and verify GREEN**
-[]**Step 5: Inspect scope and commit only related files**
Run: `git diff --check` and `git status --short`, then stage the files listed in this plan while leaving unrelated daily-report calendar changes untouched.