STEP 1840 · 2026-09-06 · Rei-AIOS comparator infrastructure · rei-aios commit cd7dbe4fb · rei-meta-mcp commit 112548a

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 NONCONFORM4 gate 全 CONFORM意図的反転

1. 修正対象 と 前提

rei-meta-mcp = C:\Users\user\rei-meta-mcp、 Python 3.13、 rei-aios とは 別 git repo。 したがって 作業は 3 段:

  1. rei-meta-mcp 側 (Python) で src/rei_meta_mcp/coherence.py 修正
  2. rei-aios 側 (TypeScript) で basisFromReiMetaCoherence adapter + enumerate.ts + test/step1838 fixture 追随
  3. 動作中の 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条件
coherentcoherent_on_basisreachable ≥ 2 かつ agree かつ comparedFields 非空 かつ uncheckedSources 空 (G1+G2+G3+G4 all pass)
(未定義)+insufficient_basisreachable ≥ 2 かつ agree だが comparedFields 空 or uncheckedSources 非空 (G1 or G4 blocked)
divergent=divergentpairwise 不一致あり (変更なし)
single_source=single_source1 reachable (変更なし)
unreachable=unreachable0 reachable (変更なし)

Breaking change: 従来 status == "coherent" を parse していた caller は 破壊されうる。 rei-aios 側 callsite grep で === "coherent" 実比較 0 件 と 事前確認済 (hit 4 は 全て module 内 comment / label)。 加えて positiveVerdictscoherent を 併存させて、 legacy caller (もし 将来 現れたら) も 破壊しない 後方互換 保持。

4. undetectable[] — 4 blind spot 常時宣言

G2 は 「content 未満 の 分離力 なら 見えない divergence class を 名指せ」。 rei-meta の 現状 (meet = record_count 1 scalar) では 少なくとも 4 種:

  1. record_count preservation blindness (同じ count で 内容 or id 差し替え は 検出不能)
  2. content-level record edits (id set 保持で body change) は content_hash 両側 無しでは 検出不能
  3. id-set replacement (同 count で id 差し替え) は id_set_hash 両側 無しでは 検出不能
  4. 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-audit3/3 CONFORM + rei_meta N/A
rei-aios tsc --strict on modified files0 errors

7. Honest scope

8. STEP 番号 collision 記録 (本 arc 全体)

番号私の 目的先取り者解決
11836comparison-basis 準備別タブ (mirror centralize)→ 1838 rename
21837B (rei-meta) 予約別タブ (cmix bpc corrigendum)→ 1839 予約変更
31839rei-meta 適合 (B)別タブ (Weaver Level B semantic)→ 1840 rename
41840 (一時)rei-meta 適合 rename 後別タブ (Weaver STS-B continuation、 同時発生)別タブ が 1841 に 移動、 1840 セーフ

学び: 番号は commit で 確定 する もので、 rename 作業中の 5 分でも 別タブが 取れる。 本 arc 4 回 の collision は 異常頻度、 STEP 番号 claim protocol の 強化 が 未来 STEP candidate。

9. 関連 STEP

10. 詳細 参照