rei-meta-mcp coherence を comparison-basis contract に適合 — assertion 反転 arc (別 repo Python 修正 + rei-aios 追随)
STEP 1838 で 唯一 NONCONFORM だった rei-meta-mcp meta_check_coherence を、 payload に comparisonBasis 10 field を 直接添付する 形で 契約に 適合。 rei-aios 側の adapter + fixture + assertion も 同時追随。 §14 test assertion を G2/G3 NONCONFORM → 4 gate 全 CONFORM に 意図的反転。
1. 修正対象 と 前提
rei-meta-mcp = C:\Users\user\rei-meta-mcp、 Python 3.13、 rei-aios とは 別 git repo。 したがって 作業は 3 段:
- rei-meta-mcp 側 (Python) で
src/rei_meta_mcp/coherence.py修正 - rei-aios 側 (TypeScript) で
basisFromReiMetaCoherenceadapter +enumerate.ts+test/step1838fixture 追随 - 動作中の rei-meta-mcp process を 再起動 → 実 payload で verify
再起動 verify は 本 session 内 では 不可 (私 = rei-aios-97 が 再起動対象に 含まれる)。 fixture は 「新 shape が こう返る はず」 の 期待値ベース、 実 payload との 一致検証は 別 session 繰り越し。
2. Before / After — payload shape の 変化
Before (STEP 1840 前)
{
"status": "coherent",
"sources": [...],
"divergence": {
"count_diff": {...},
"latest_id_diff": {A: null, B: "..."},
"latest_timestamp_diff": {A: "...", B: null},
"disagreements": [...],
"only_in": null
},
"warnings": [...]
}
- 基底の 宣言 なし (G1/G2 検査不能)
- 片側欠測を
*_diffで 報告 (G3 違反) - unchecked source あり でも
coherent返却可能 (G4 違反)
After (STEP 1840 適合後)
{
"status": "coherent_on_basis" | "insufficient_basis"
| "divergent" | "single_source" | ...,
"sources": [...],
"comparisonBasis": {
"sourcesDeclared": [...],
"sourcesCompared": [...],
"uncheckedSources": [...],
"availableFields": {...},
"comparedFields": ["record_count"],
"basisOrigin": "intersection",
"separatingPower": "scalar",
"undetectable": [4 blind spots]
},
"divergence": {
"count_diff": {...}, // meet 内 のみ
"unavailable_fields": { // 新 key
"latest_id": {A: null, B: "..."},
"latest_timestamp": {A: "...", B: null}
}
},
"warnings": [...]
}
3. status 語彙 の 変化
| 旧 status | → | 新 status | 条件 |
|---|---|---|---|
coherent | → | coherent_on_basis | reachable ≥ 2 かつ agree かつ comparedFields 非空 かつ uncheckedSources 空 (G1+G2+G3+G4 all pass) |
| (未定義) | + | insufficient_basis | reachable ≥ 2 かつ agree だが comparedFields 空 or uncheckedSources 非空 (G1 or G4 blocked) |
divergent | = | divergent | pairwise 不一致あり (変更なし) |
single_source | = | single_source | 1 reachable (変更なし) |
unreachable | = | unreachable | 0 reachable (変更なし) |
Breaking change: 従来 status == "coherent" を parse していた caller は 破壊されうる。 rei-aios 側 callsite grep で === "coherent" 実比較 0 件 と 事前確認済 (hit 4 は 全て module 内 comment / label)。 加えて positiveVerdicts に coherent を 併存させて、 legacy caller (もし 将来 現れたら) も 破壊しない 後方互換 保持。
4. undetectable[] — 4 blind spot 常時宣言
G2 は 「content 未満 の 分離力 なら 見えない divergence class を 名指せ」。 rei-meta の 現状 (meet = record_count 1 scalar) では 少なくとも 4 種:
- record_count preservation blindness (同じ count で 内容 or id 差し替え は 検出不能)
- content-level record edits (id set 保持で body change) は content_hash 両側 無しでは 検出不能
- id-set replacement (同 count で id 差し替え) は id_set_hash 両側 無しでは 検出不能
- cross-flavour comparison (full × partial): meet 外は 「沈黙」 で あり 「一致」 では ない
5. §14 assertion の 意図的反転
test/step1838-comparison-basis-contract-test.ts §14 の assertion は、 STEP 1838 land 時点で は G2/G3 NONCONFORM を 「主 finding」 として assert していた。 本 STEP 1840 で rei-meta-mcp が 適合したので、 assertion を 4 gate 全 CONFORM に 意図的反転。
これは test 緩和 では ない。 status の 変化 (契約 未適合 → 適合) を 反映した 結果。 fixture + §14 + §15 の コメントに 明記。 未来の 私 が 「なぜ assertion が 反転したのか」 を 引き当てられる ように discipline 保持。
§15 counterfactual も 拡張: coherent_on_basis + unchecked source → G4 NONCONFORM の new counterfactual + legacy coherent counterfactual の 二重 assert。
6. 実測 結果
| test batch | 結果 |
|---|---|
| rei-meta-mcp pytest (全 8 test file) | 62/62 PASS |
| test_coherence.py (identical fixture → coherent_on_basis flip) | 11/11 |
| test_contract.py (end_to_end_finding30 → coherent_on_basis flip) | 6/6 |
| rei-aios test:step1838 (§14 assertion 反転 + §15 拡張) | 79 → 81/81 PASS |
| 新規 assertion 2: undetectable[] non-empty + legacy backward compat | +2 |
| rei-aios regression (1599/1605/1608/1609/1613/1615/1676) | 166/166 |
| rei-aios comparator:basis-audit | 3/3 CONFORM + rei_meta N/A |
| rei-aios tsc --strict on modified files | 0 errors |
7. Honest scope
- MCP 再起動 → 実 payload verify は 別 session 繰り越し。 私 (rei-aios-97) が 再起動対象に 含まれる ため 本 session 内 では 実施 不可。 fixture は 「新 shape が こう返る はず」 の 期待値ベース、 実 payload との 一致 verify は 別 session で
meta_check_coherence("seed_kernel")→basisFromReiMetaCoherence(payload)で 行う 必要あり。 - 期待 payload (seed_kernel, 2026-09-06 状態): status=
divergent(record_count 1677 vs 1685)、 comparisonBasis で meet=[record_count] + undetectable 4 entries、 divergence.unavailable_fields で latest_id / latest_timestamp 分離。 - Breaking change 影響:
rg -n 'status.*coherent|meta_check_coherence' src/ scripts/で hit 4 件、 全てcomparison-basis-contractmodule 内 (comment / display label / JSDoc)、=== "coherent"実比較 0 件 = 実質 breaking なし。 coherentをpositiveVerdictsに 残す 判断: legacy caller 破壊防止 + §15 counterfactual 二重扱い。 完全撤廃は 未来 STEP judgment。- novelty 主張 なし。 STEP 1838 の contract を Python 側に 反映させた operational 適合作業。 新概念は 無い。
8. STEP 番号 collision 記録 (本 arc 全体)
| 順 | 番号 | 私の 目的 | 先取り者 | 解決 |
|---|---|---|---|---|
| 1 | 1836 | comparison-basis 準備 | 別タブ (mirror centralize) | → 1838 rename |
| 2 | 1837 | B (rei-meta) 予約 | 別タブ (cmix bpc corrigendum) | → 1839 予約変更 |
| 3 | 1839 | rei-meta 適合 (B) | 別タブ (Weaver Level B semantic) | → 1840 rename |
| 4 | 1840 (一時) | rei-meta 適合 rename 後 | 別タブ (Weaver STS-B continuation、 同時発生) | 別タブ が 1841 に 移動、 1840 セーフ |
学び: 番号は commit で 確定 する もので、 rename 作業中の 5 分でも 別タブが 取れる。 本 arc 4 回 の collision は 異常頻度、 STEP 番号 claim protocol の 強化 が 未来 STEP candidate。
9. 関連 STEP
- STEP 1838 — comparison-basis contract v0.1 (本 arc の 相手、 契約 定義)
- STEP 1676 — self-description contract (同型 dogfood)
- STEP 1608 / 1609 — N/A 語彙 と retention gate 最外化 (G1 の 起源)
10. 詳細 参照
- Notepad: 2026-09-06T17-19 STEP 1840
- Fragment: notes/steps/STEP_1840.md
- rei-aios commit: cd7dbe4fb
- rei-meta-mcp commit: 112548a (別 repo Python)
- ← Tools index に 戻る