Offline transactional history analysis with independently verifiable dependency-cycle witnesses
node dist/moontxnwitness.mjs --version
node dist/demo.mjsnode dist/moontxnwitness.mjs check examples/write-skew.json --profile balanced
node dist/moontxnwitness.mjs shrink examples/noisy-write-skew.json --profile balanced --history mini.json
node dist/moontxnwitness.mjs check mini.json --profile balanced --format markdown --output report.md --capsule case.json
node dist/moontxnwitness.mjs replay case.json
node dist/moontxnwitness.mjs compare-models examples/strict-realtime.json| 状态 | 退出码 | 含义 |
|---|---|---|
| consistent | 0 | 在提供的模型、观察及约束内有可行串行执行 |
| violation | 1 | 发现直接异常、依赖环或完整搜索无解 |
| invalid | 2 | 输入或约束不合法 |
| inconclusive | 3 | 观察不足或预算耗尽 |
moon add HhWw96/moontxnwitness@0.2.2import {analyzeWithOptions, shrinkWithOptions, replayReport} from './dist/sdk.mjs';
const report = analyzeWithOptions(history);
const reduced = shrinkWithOptions(history, {maxChecks: 256});
console.log(report.status, reduced.oneMinimal);
console.log(replayReport(reduced.reducedHistory, reduced.report));| 范围 | 默认入口 | balanced 入口 |
|---|---|---|
| 图分析 | 512 事务 / 10,000 操作 / 50,000 依赖 | 相同 |
| 精确串行补全 | 8 个提交事务 | 12 个提交事务 |
| 补全操作 / 初始键 | 512 / 128 | 相同 |
| 搜索前缀 / 操作检查 | 100,000 / 1,000,000 | 相同,可调低 |
| 缩减 | 64 事务 / 2,048 操作 / 128 次检查 | 512 事务 / 10,000 操作 / 256 次检查 |
node dist/moontxnwitness.mjs ingest capture-trace.json --history history.json
node dist/moontxnwitness.mjs check history.json --profile balanced --capsule case.json
node dist/postgres-demo.mjsnode examples/list-roundtrip.mjsnode examples/relation-roundtrip.mjsnpm run build
npm test
npm run packagepub(all) struct AnalysisOptions {
max_attempts : Int
max_operation_checks : Int
max_cached_states : Int
} derive(Eq)pub(all) struct AnalysisResult {
report : Report
options : AnalysisOptions
cache_hits : Int
cached_states : Int
} derive(Eq)pub(all) struct Edge {
from : String
to : String
kind : Dependency
key : String?
from_op : Int?
to_op : Int?
from_version : String?
to_version : String?
reason : String
} derive(Eq, Hash)pub(all) struct GraphInfo {
analyzed : Bool
components : Int
cyclic_components : Int
cyclic_transactions : Int
bfs_roots : Int
edge_budget_exceeded : Bool
} derive(Eq)pub(all) struct KeyCoverage {
key : String
committed_reads : Int
committed_final_writes : Int
unresolved_reads : Int
} derive(Eq)pub(all) struct ReductionResult {
reduction : Reduction
analysis : AnalysisResult
cached_checks : Int
max_checks : Int
} derive(Eq)pub(all) struct Report {
outcome : Outcome
model : Model
findings : Array[Finding]
edges : Array[Edge]
witness : Array[Edge]
serial_order : Array[String]
transaction_count : Int
committed_count : Int
operation_count : Int
inferred_orders : Map[String, Array[String]]
order_sources : Map[String, String]
search : SearchInfo
graph : GraphInfo
coverage : Array[KeyCoverage]
} derive(Eq)fn analysis_options(max_attempts? : Int, max_operation_checks? : Int, max_cached_states? : Int) -> AnalysisOptionsfn analyze_json(text : String) -> Stringfn capsule_content_json(text : String) -> Stringfn capsule_v3_content_json(text : String) -> Stringfn dislock_sql_v3_proof_json(text : String) -> Stringfn inspect_execution_failures_v3_json(text : String) -> Stringfn normalize_capture_json(text : String) -> Stringfn normalize_capture_v3_options_json(text : String, options_text : String) -> Stringfn normalize_presence_capture_json(text : String) -> Stringfn normalize_relation_capture_v3_json(text : String) -> Stringfn reduce_v3_json(text : String, options_text : String) -> Stringfn replay_report_json(history_text : String, report_text : String) -> Stringfn run_json(text : String, format : String) -> Stringfn verify_certificate_json(history_text : String, certificate_text : String) -> StringInstall
Download zipOffline transactional history analysis with independently verifiable dependency-cycle witnesses