Repository navigation
feat(core): discussion ledger, an append-only resumable state machine (#588 part 1b) - #667
Merged
Merged
Conversation
…#588 part 1b) Adds tole_core::discussion_log: every step is one JSONL line, the state and the next step are folded from it, each step is checked against what must come next and the gate is computed from the ledger. Steps take a lock.
🔍 Cora AI Code Review✅ No issues found. Code looks good! Review powered by cora-code · BYOK · MIT |
| serde_json::to_string(&Line { seq, t: now, event }).map_err(|e| e.to_string())?; | ||
| line.push('\n'); | ||
| let mut f = std::fs::OpenOptions::new() | ||
| .create(true) |
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.
What
Part 1b of #588:
tole_core::discussion_log, the append-only ledger of a discussion and the state machine folded from it. Still no model call and no command; the orchestration that drives the models is the next PR.Why
Design
profiles-collaboration-secrets.mdA8.3: all discussion state lives in the ledger, so a crash resumes mid-discussion, and the gate must not rest on the orchestrator's own word. The log is also where "the steps cannot be skipped or forged" is enforced, so the code that drives the discussion cannot get it wrong. Part 1a (#665) added the contract, sanitizer, digest validator and gate.Changes
$CODECORA_HOME/tole/discussions/<id>.jsonl(contract, roster, contribution, summary, verdicts, usage, flags, gate, closed). The state, andNext(what must happen now: contribute, summarize, check, decide, finish), are folded from it. A torn last line (a crash mid-write) is ignored; damage elsewhere is a loud error; the file is capped at 16 MiB.decide), never supplied;closeonly after a report or escalate. Nothing after the end. The roster may change between rounds within the contract's participants.e<seq>), which every digest line must cite.CHANGELOG.mdanddocs/epics.mdare updated in this PR.Testing
cargo fmt --all; clippy-D warningsontole-core(also--no-default-features): clean.cargo test -p tole-core: all pass.review_prepare0 deterministic findings,review_finalizeshould_block: falsewith one info note (each step re-reads the whole log, bounded by the cap and by at most 10 rounds of 8 participants).