b63ab46f54
Tests / Integration Tests (push) Successful in 1m11s
Tests / Unit Tests (push) Failing after 11m56s
Anti-EAV Lint + Quality Gate / anti-eav-lint (push) Failing after 12m7s
Tests / PHPStan (push) Failing after 14m37s
Tests / PHPCS (push) Failing after 14m46s
Tests / PHP Lint (push) Failing after 14m57s
- readme.txt(WP 外掛目錄格式,隨 ZIP 發佈):Stable tag 對齊 1.0.0, changelog 補 1.0.0 條目 - CONTEXT.md(領域詞彙表):Status 區塊改寫為 v1.0.0 實況; HPCT_INTERCEPTORS 與 HivePress Adapter 兩節標註「已搬到 AddOn,核心無此常數」 - docs/:ENTITY_ADAPTER_COOKBOOK、2 篇 ADR、INTEGRATION_PATTERN_DECISION、 anti-eav-lint.yml.template - cookbook 修掉兩個死連結(ANTI_EAV_PLAYBOOK 在來源外掛就不存在) - INTEGRATION_PATTERN_DECISION 加 v1.0.0 後記:結論已被 AddOn 拆分取代 - template 改 wpdev/2meet-data-optimizer + ref v1.0.0 + wp tmdo lint - README.md 文件索引補上以上 7 個檔案 前綴改寫刻意只動類別/函式/slug(WPDO_→TMDO_、wp-data-optimizer→2meet-...), wpdo_ option/cron/hook/表名與 wpdo/v1 REST namespace 一律保留 —— 這是資料層 零遷移的前提。
66 lines
2.5 KiB
Markdown
66 lines
2.5 KiB
Markdown
# ADR-002: Acknowledge 'dual_write' naming collision between Mode_Manager and Feature_Flags FSMs
|
|
|
|
**Status:** Accepted — deferred rename
|
|
**Date:** 2026-05-15
|
|
**Deciders:** wpdev
|
|
|
|
---
|
|
|
|
## Context
|
|
|
|
Two distinct FSMs in the codebase both use the string `'dual_write'`:
|
|
|
|
| FSM | Class | Constant | Stored in | Semantics |
|
|
|-----|-------|----------|-----------|-----------|
|
|
| Entity Bridge | `TMDO_Mode_Manager` | `MODE_DUAL_WRITE` | `wpdo_bridge_modes` | Writes go to both UAE flat table AND `wp_*meta` |
|
|
| Zone Migration | `TMDO_Feature_Flags` | `STATUS_DUAL_WRITE` | `wpdo_features` | Writes go to both Zone A/B/C table AND `wp_postmeta` |
|
|
|
|
The two FSMs are orthogonal — a post type can be in Zone `dual_write`
|
|
(actively migrating) while the Entity Bridge is in `aeav_only` mode, or vice
|
|
versa. The collision was introduced when the Entity Bridge FSM was added in
|
|
v2.5.x alongside the pre-existing Zone Migration FSM.
|
|
|
|
---
|
|
|
|
## Decision
|
|
|
|
**Defer the rename. Document the collision instead.**
|
|
|
|
Renaming either constant (e.g. Mode_Manager → `bridge_dual`) would require:
|
|
|
|
1. Updating ~85 call sites across 30+ files.
|
|
2. Writing a DB migration to translate stored option values (`'dual_write'` →
|
|
`'bridge_dual'` in `wp_options['wpdo_bridge_modes']`).
|
|
3. Updating all WP-CLI commands that accept mode strings as user input.
|
|
4. Updating all admin UI dropdowns and confirmation messages.
|
|
5. Handling sites that run the old code against a DB that has already been
|
|
migrated (or the reverse — new code on an un-migrated DB).
|
|
|
|
The risk of introducing bugs via a mechanical rename outweighs the naming
|
|
improvement at the current stage of the project.
|
|
|
|
The collision is mitigated by:
|
|
- A disambiguating docblock in `class-tmdo-mode-manager.php` (added 2026-05-15)
|
|
- This ADR, which explains the overlap to future developers
|
|
- The two FSMs operating on different option keys and being unreachable from
|
|
each other's code paths
|
|
|
|
---
|
|
|
|
## Consequences
|
|
|
|
- **Future rename path**: When a DB migration is warranted (e.g. alongside
|
|
another schema change), rename `MODE_DUAL_WRITE → 'bridge_dual'` and add a
|
|
migration in `TMDO_Installer::maybe_upgrade()` that rewrites the stored string.
|
|
- **Linter**: If PHPStan or a custom rule ever flags string literal comparisons
|
|
across FSMs, this ADR is the canonical explanation for why the overlap is
|
|
intentional.
|
|
|
|
---
|
|
|
|
## Related
|
|
|
|
- `includes/engine/class-tmdo-mode-manager.php` — naming note in class docblock
|
|
- `includes/class-tmdo-feature-flags.php` — Zone FSM (7 states)
|
|
- P1-10 from full-review report (2026-05-15)
|