- title
- SRBC Theory Validation Program — Round 10:Concurrency / MVCC / Multi-Writer Conflict
- author
- Neo.K with Aletheia (GPT-5.6 Sol)
- institution
- EveMissLab / 一言諾科技有限公司
- version
- v0.1
- date
- 2026-09-23
- language
- zh-TW
- document_type
- Multi-Writer MVCC / Concurrency Validation Report
- status
- Round 10 completed
SRBC Theory Validation Program — Round 10
Concurrency / MVCC / Multi-Writer Conflict
作者: Neo.K with Aletheia (GPT-5.6 Sol)
機構: EveMissLab / 一言諾科技有限公司
日期: 2026-09-23
版本: v0.1
Canonical Source Note
本輪把 PQRSRC 從 single-writer persistent runtime 推進到 multi-writer MVCC。
所有 writer mutation 在 base snapshot 上先被 canonicalize 成 absolute patch,再進行 CAS / optimistic read-footprint validation。這一點很重要:若 transaction 只保存「toggle / increment」而不保存 base-relative intent,stale rebase 的語義可能改變。
0. 問題
兩個 agent:
同時從:
開始。
如果 A 先 commit,B 還拿著舊 base:
系統要回答:
- B 一律拒絕?
- B 可不可以 rebase?
- 哪些 dependency 被 A 改了?
- A/B 是否其實互不影響?
- reader 是否仍看到自己的 old snapshot?
- 只靠 write-write conflict 夠不夠?
1. Pairwise Test
建立五類 transaction pairs,每類 1000:
| class | n | OCC conflicts | policy classification correct |
|---|---|---|---|
| random | 1000 | 26 | 1000 |
| dependency_stale | 1000 | 1000 | 1000 |
| evidence_vs_semantic | 1000 | 1000 | 1000 |
| nuisance_vs_semantic | 1000 | 0 | 1000 |
| same_key | 1000 | 1000 | 1000 |
總:
pairs。
MVCC/OCC classification:
符合 read-footprint policy。
2. CAS-only
兩個 writer 都從同一 base 開始。
A commit 後,B 的 base hash 必然 stale。
純 CAS 因此:
全部拒絕第二 writer。
安全,但其中其實有:
個 transaction 可安全 rebase。
比例:
所以 CAS-only 會浪費大量可合併 work。
3. Blind overwrite
對 direct write key 不同的 pairs,共:
組。
若完全不做 CAS / MVCC,而讓 B 把自己從舊 base 算出的 snapshot 直接覆蓋 HEAD:
組全部發生 lost update。
rate:
這不是說所有真實 workload 都會 100% lost update,而是這個控制實驗故意比較:
B-only stale snapshot vs A→B serial state。
只要 A 有非重疊變更,B-only publish 就把 A 丟掉。
4. Direct write-write heuristic
只看:
結果:
| heuristic | precision | recall | FP | FN |
|---|---|---|---|---|
| direct write overlap | 100.00% | 33.48% | 0 | 2013 |
| affected-set overlap | 98.18% | 100.00% | 56 | 0 |
direct write overlap precision:
但 recall 只有:
漏掉:
個 OCC conflicts。
典型:
random: A=random-A-8, B=random-B-8, stale reads=['sd::MH-C1']random: A=random-A-168, B=random-B-168, stale reads=['sd::BER-C2']random: A=random-A-233, B=random-B-233, stale reads=['sd::BG-C2']random: A=random-A-254, B=random-B-254, stale reads=['sd::BER-C1']random: A=random-A-346, B=random-B-346, stale reads=['sd::MH-C1']random: A=random-A-442, B=random-B-442, stale reads=['sd::TE-C3']
這些 transaction 沒寫同一 key,但讀取 dependency 已 stale。
5. Affected-set overlap heuristic
如果只看:
recall:
但有:
個 false positives。
例:
random: A=random-A-0, B=random-B-0random: A=random-A-15, B=random-B-15random: A=random-A-19, B=random-B-19random: A=random-A-68, B=random-B-68random: A=random-A-69, B=random-B-69random: A=random-A-93, B=random-B-93
這些 pair 雖然最後需要重算某些相同 certificates,但 transaction read footprint 沒失效,因此仍可用 serial rebase 合法合併。
所以:
是很好的保守 prefilter,
但不是 final conflict criterion。
6. Dependency stale control
1000 組:
例如:
direct write keys 不同。
但 child transaction read:
所以:
被 OCC 正確判 conflict。
這正是 write-write detector 會漏掉的核心類型。
7. Evidence vs Semantic
同一 certificate:
- A 改 semantic state;
- B 只更新 evidence。
B transaction 在開始時讀:
A commit 後:
改變。
因此:
正確 conflict。
證據不能悄悄附著到另一個 semantic epoch。
8. Nuisance vs Semantic
同一 certificate:
- A 改 semantic;
- B 改 rendering / nuisance metadata。
nuisance transaction 不讀 semantic digest。
所以:
conflict。
這再次顯示:
9. Safe rebase 的 commutativity
對雙向 read footprint 都穩定的 pairs:
組。
比較:
與:
failure:
因此這批 safe merge 不只可序列化,而且在此 workload 中實際 commute。
10. 1000 rounds × 5 concurrent writers
每 round:
個 writers 全部從同一 base snapshot 開始。
共:
writer attempts。
OCC/MVCC:
- accepted:
- conflicted:
- accepted rate:
每次 accepted commit 都和「依 commit order 重放 absolute patches」的 serial oracle 比較。
failure:
11. Snapshot reader
reader 在 epoch 0 pin 一份 snapshot。
接著 current HEAD 連續 advance:
步。
old reader snapshot:
current HEAD 已改變。
所以第一代 MVCC reader isolation 成立:
12. Write Skew / Predicate Dependency
這輪又故意做一個 synthetic global invariant:
MH source root 與 MH observed-query root 不得同時進入 revised state。
兩個 transaction:
- A 改 source;
- B 改 query。
direct keys 完全不同。
如果 transaction read footprint 沒宣告這個跨 key predicate:
加入 predicate dependency footprint 後:
因此:
跨 key / range / graph invariant 必須是一等 read dependency。
13. Same-Intent Conflict
1000 組 same-key transaction:
A 與 B 從同一 base 寫同一 absolute target。
conservative OCC:
都 conflict。
但從 closure-state semantics 看:
可辨識為 idempotent same-intent write。
所以可選擇:
ALREADY_APPLIED / COALESCED
而不必要求 B 重算。
但這個優化只對 pure closure-state write 安全。
如果 transaction 還有外部 side effect,必須用 txid / outbox / idempotency key。
14. Transaction Intent
Round 10 因此正式要求 transaction 不只是:
而是:
其中:
是 canonical intent digest。
這使:
- same-intent dedup;
- stale rebase;
- audit;
- conflict explanation;
都有穩定 identity。
15. MVCC Conflict 不等於 Semantic Contradiction
B 被 OCC reject,只表示:
B 的 base assumptions / reads 已經 stale。
不表示:
有些 transaction rebase 後可能完全合法,只是需要人/agent 再確認新 context。
因此 conflict artifact 應保存:
conflict:
stale_reads:
- ...
semantic_contradiction: unknown
不能把 concurrency conflict 偷換成 logic refutation。
16. Round 10 核心結果
CAS
安全,但過度拒絕:
個安全 rebase opportunity。
Blind overwrite
lost update control:
Direct WW
precision 高但 recall 低:
Affected overlap
recall 高:
但有 false positive。
Read-footprint OCC
pair policy:
Multi-writer serialization
attempts,serial oracle:
failures。
Predicate guard
write-skew control 成功被攔截。
17. 本輪沒有證明什麼?
這仍然是 single-process shared-memory MVCC simulator。
沒有證明:
- distributed consensus;
- network partition;
- clock / lease correctness;
- real database MVCC implementation;
- external side-effect exactly-once;
- arbitrary semantic predicate discovery;
- automatic human-intent equivalence。
本輪證據是:
18. 下一輪
Round 11 最自然的是:
也就是不只 conflict / reject,而是對兩個 diverged semantic branches:
建立:
- common ancestor;
- semantic diff;
- query-sensitive conflict;
- automatically mergeable commitments;
- non-mergeable commitments;
- conflict certificate;
- human / agent resolution patch;
- post-merge QRC / QRU / QDU re-evaluation。
這會把 SREG 一直講的:
真正做成機器原生 semantic merge。
附錄 A:Pair Classes
| class | n | conflict | classification correct |
|---|---|---|---|
| random | 1000 | 26 | 1000 |
| dependency_stale | 1000 | 1000 | 1000 |
| evidence_vs_semantic | 1000 | 1000 | 1000 |
| nuisance_vs_semantic | 1000 | 0 | 1000 |
| same_key | 1000 | 1000 | 1000 |
附錄 B:Heuristic Comparison
| heuristic | precision | recall | FP | FN |
|---|---|---|---|---|
| direct write overlap | 100.00% | 33.48% | 0 | 2013 |
| affected-set overlap | 98.18% | 100.00% | 56 | 0 |
附錄 C:Machine Results
{
"base": {
"round": "SRBC Theory Validation Round 10",
"pair_tests": 5000,
"classes": {
"random": {
"n": 1000,
"conflict": 26,
"merge_ok": 1000
},
"dependency_stale": {
"n": 1000,
"conflict": 1000,
"merge_ok": 1000
},
"evidence_vs_semantic": {
"n": 1000,
"conflict": 1000,
"merge_ok": 1000
},
"nuisance_vs_semantic": {
"n": 1000,
"conflict": 0,
"merge_ok": 1000
},
"same_key": {
"n": 1000,
"conflict": 1000,
"merge_ok": 1000
}
},
"cas": {
"stale_second_writer_rejected": 5000,
"failures": 0
},
"mvcc_occ": {
"expected_classifications_correct": 5000,
"failures": 0
},
"blind_overwrite": {
"direct_disjoint_candidates": 3987,
"lost_update_cases": 3987,
"lost_update_rate": 1.0
},
"heuristics": {
"direct_write_overlap": {
"precision": 1.0,
"recall": 0.33476536682088565,
"tp": 1013,
"fp": 0,
"tn": 1974,
"fn": 2013
},
"affected_overlap": {
"precision": 0.981829980532122,
"recall": 1.0,
"tp": 3026,
"fp": 56,
"tn": 1918,
"fn": 0
}
},
"commutativity": {
"safe_bidirectional_rebase_pairs": 1960,
"failures": 0
},
"same_intent": {
"same_key_pairs": 1000,
"occ_conflicts": 1000,
"note": "Conservative OCC rejects even idempotent same-intent writes unless transaction identity/intent dedup is added."
},
"predicate_write_skew_control": {
"without_predicate_guard_invariant_violated": true,
"with_predicate_footprint_second_writer_conflicted": true
},
"snapshot_reader": {
"steps": 1000,
"pinned_snapshot_stable": true,
"pinned_hash": "913da29d5bc4b2847a5e0d69d4b82e32467d19a440c44282171d2d069ec3ab50",
"current_head_hash": "bcf345f9cc58194af9bae68d826419386728283cf143ed5afe384375ae372b19",
"head_advanced": true
}
},
"extended": {
"multi_writer": {
"rounds": 1000,
"writers_per_round": 5,
"writer_attempts": 5000,
"accepted": 4701,
"conflicted": 299,
"serial_oracle_failures": 0,
"accept_rate": 0.9402
},
"same_intent_coalescing": {
"tests": 1000,
"normal_occ_conflicts": 1000,
"semantically_idempotent_coalescible": 1000,
"coalescible_rate": 1.0,
"boundary": "Safe only for closure-state semantics; external side effects require tx-id/idempotency-key rules."
},
"pairwise_capacity": {
"occ_conflicts": 3026,
"safe_rebases": 1974,
"safe_rebase_rate": 0.3948,
"cas_only_would_reject_safe_rebases": 1974
}
}
}
附錄 D:Artifacts
SRBC_Theory_Validation_Round10_Report_v0.1_2026-09-23.mdSRBC_Core_Patch_v0.10_2026-09-23.mdpqrsrc_mvcc_protocol_v010.yamlround10_mvcc_runtime.pyresults_round10.jsonresults_round10_extended.jsonresults_round10_combined.jsonpair_results_round10.jsonlmultiwriter_round10.jsonlinput_certificates_v07/*.jsonvalidation.json