|
| 1 | +# Runbook: Add a Config Field Safely |
| 2 | + |
| 3 | +Use this when introducing a new `pluginConfig` or dashboard setting field. |
| 4 | + |
| 5 | +## Goal |
| 6 | + |
| 7 | +Add a field without breaking defaults, migration behavior, settings persistence, or documentation parity. |
| 8 | + |
| 9 | +## Where to Change |
| 10 | + |
| 11 | +- `lib/config.ts` — runtime config resolution/defaults |
| 12 | +- `lib/schemas.ts` — env/config schema validation and typed field contracts |
| 13 | +- `lib/dashboard-settings.ts` or `lib/unified-settings.ts` — persisted settings shape |
| 14 | +- `lib/codex-manager/settings-hub.ts` and extracted settings helpers — interactive editing if user-facing |
| 15 | +- `docs/configuration.md` — user-facing config docs |
| 16 | +- `docs/reference/settings.md` — settings reference |
| 17 | +- `docs/development/CONFIG_FIELDS.md` — full field inventory |
| 18 | +- `test/config.test.ts`, `test/dashboard-settings.test.ts`, `test/unified-settings.test.ts` — behavior coverage |
| 19 | +- `test/documentation.test.ts` — docs parity |
| 20 | + |
| 21 | +## Safe Workflow |
| 22 | + |
| 23 | +1. Define the default in the owning config/settings module first. |
| 24 | +2. Thread it through persistence and loading paths before exposing UI controls. |
| 25 | +3. If user-facing, add the smallest possible settings UI path after the storage/config part is correct. |
| 26 | +4. Document the field in both user docs and maintainer inventory. |
| 27 | +5. Add tests for defaulting, persistence, and docs parity. |
| 28 | + |
| 29 | +## Compatibility Checks |
| 30 | + |
| 31 | +- New fields must have deterministic defaults. |
| 32 | +- Do not change existing default values in the same PR unless that is the actual feature. |
| 33 | +- Keep docs and code aligned in the same change. |
| 34 | +- Recheck the Windows persistence notes when the field is written to disk; `EBUSY` and `EPERM` retry behavior must stay documented and covered. |
| 35 | + |
| 36 | +## QA |
| 37 | + |
| 38 | +- `npm run typecheck` |
| 39 | +- `npm run lint -- lib/config.ts lib/dashboard-settings.ts lib/unified-settings.ts test/config.test.ts test/dashboard-settings.test.ts test/unified-settings.test.ts test/documentation.test.ts` |
| 40 | +- Run the targeted test files that cover the field |
| 41 | +- If the field is user-visible, exercise the real settings path manually |
0 commit comments