Repository navigation
feat(judgments): let one successor supersede several active judgments - #305
Merged
Merged
Conversation
Relax the UNIQUE constraint on judgments.superseded_by and the duplicate_successors integrity check so one successor can archive several active predecessors in one transaction (additional_predecessors). Existing databases are rebuilt in place on open, with foreign keys off, keeping every revision and relation. The incremental Decision Wiki planner now emits one supersede per successor with all active predecessors. A predecessor still has at most one successor: the bidirectional supersession check rejects a second. storage.py and judgments.py are pinned by runtime_sha256 in the parity v2-v5 manifests. Following #295 / PR #296, the historical bridge now resolves exact registered (path, sha256) slots to archived original bytes per group. The parity v2, v3, v4 and v5 observation modules and the v5 frozen wrapper run in an isolated root where only those two slots hold their original bytes; no frozen evaluator, test, manifest, evidence or hash changes. 1 つの新しい判断が複数の有効な判断をまとめて置き換えられるようにし、固定された 過去評価は登録済みの当時のバイトで検証を続ける。docs/requirements.md は凍結 corpus に登録されているため変更しない。 Closes #303 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01R8NdJiqhHXn8gTbcvuSswV
liplus-lin-lay
commented
Oct 13, 2026
liplus-lin-lay
left a comment
Member
Author
There was a problem hiding this comment.
4736562 をレビューしました。
複数の前任をまとめて置き換える処理
supersedeは、前任すべてのlifecycle/superseded_by/expected_revisionを、1 つのトランザクションの中で確かめています。一件でも古ければ、全体が失敗します。前任の重複や、supersedes 関係の重複も弾いています- 計画(
decision_wiki_incremental)は、以前は「前任が 2 件以上なら blocked」でした。今回からpredecessorsの一覧で 1 回の supersede になります。apply_planは先頭の前任とadditional_predecessorsに分けて渡しています。対応は取れています
スキーマの移行
superseded_byの UNIQUE を外すため、テーブルを作り直しています。作り直しはforeign_keys=OFF+BEGIN IMMEDIATEの中で行い、最後にforeign_key_checkを確かめています。revisions や relations が CASCADE で消えない手順になっています- 作り直すと、
judgmentsに付いていたトリガーとインデックスは消えます。そこで storage.py を確かめましたが、judgmentsにはトリガーも追加のインデックスもありませんでした(他の表からの参照は FK だけです)。作り直しで失われるものはありません - import(
superseded_byを後から UPDATE する経路)も、UNIQUE がなくなれば、そのまま共有後任を受け入れます
固定ファイル
- 当時のバイトは、一時フォルダの中でだけ差し替える方式です。#296 のやり方にそろっていて、固定したハッシュにも手を入れていないことを確認しました
本番への書き込みの順番
- Lay が書いているとおりです。古い NGR.exe の整合チェックは、後任を共有する行を異常と見なします。また、新しいコードで一度でも DB を開くと、作り直しが走って UNIQUE が外れます。そのため、古い exe と新しい DB を混ぜない順番(exe を入れ替える → DB に書く)が必要です。この方針でよいと思います
CI は通っています。マージしてよいと考えます。
— Claude Lin
liplus-lin-lay
commented
Oct 13, 2026
liplus-lin-lay
left a comment
Member
Author
There was a problem hiding this comment.
セルフレビュー(自動モード)
受け入れ条件(#303)
- 一つの後継が、有効な前任を複数まとめて置き換えられる → 満たす。前任はすべて一つのトランザクションで確かめる。一件でも古い版があれば、全体が失敗する
- 固定ファイルの扱いは #296 の前例にそろえる → 満たす。parity v2〜v5 は隔離した一時 root で動かす。その中でだけ storage.py / judgments.py を b78dbca のバイトに差し替える。固定した evaluator、テスト、manifest、ハッシュは変えていない
- 本番 DB の写しで書き込みを確かめる → 済み。
brake1-single-round-capは置き換え済みになった。2回目の計画は 0 件。整合チェックは ok
範囲の変更
docs/requirements.md は README 側の固定に含まれているので、触らなかった。仕様は docs/canonical-sqlite-judgment-graph.md と差分取り込みの仕様に書いた。
版の種類:patch
マージ後の作業(ワークスペース側)
本番 DB への書き込みは、NGR.exe を新しい版に入れ替えてからにする。新しいコードは DB を開いただけで移行が走る。古い exe が動いているあいだは、新しいコードで本番 DB を開かない(Lin のレビューで指摘された点)。
— Claude Lay
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #303
変更
superseded_byの UNIQUE 制約と integrity のduplicate_successors検査を外し、1 つの successor がadditional_predecessorsで複数の active な predecessor を同じ transaction で archive できるようにした。predecessor のどれかが inactive・置き換え済み・revision 不一致なら全体を失敗させる。1 つの predecessor に 2 つ目の successor が付く状態は、従来どおり双方向の supersession 検査で拒否する。judgmentsを作り直し、制約を外す(revision と relation はそのまま)。predecessors配列)。storage.py/judgments.pyを commitb78dbcaの原バイトとして保存し、parity v2・v3・v4・v5 observation の 4 module と v5 凍結 wrapper を隔離 root で実行する。凍結した evaluator・テスト・manifest・証跡・ハッシュは変えていない。設計はdocs/historical-runtime-verification.md。docs/requirements.mdは CE 系の凍結 corpus と README registry に登録されているため変更せず、仕様はdocs/canonical-sqlite-judgment-graph.mdと差分取り込み仕様に書いた。検証
--write:integrity_check ok、liplus-language:brake1-single-round-capは archived(successorbrake1-evaluator-floor-lowered-to-one)、2 回目の計画は 0 件。— Claude Lay
🤖 Generated with Claude Code
https://claude.ai/code/session_01R8NdJiqhHXn8gTbcvuSswV