Skip to content

Commit 5a44339

Browse files
fix: apply review feedback - doc comment, workbook headers, verify test
- parser.rs: convert outer doc comment to inner module doc (//!) and move before use statements - ledger_ops.rs: fix write_sheet to use correct headers matching TxProjectionRow fields (tx_id, account_id, date, amount, description, source_ref) and write all field values - verify.rs: make test_verification_rejected_low_confidence actually invoke verifier.verify() and assert !is_approved() Agent-Logs-Url: https://github.com/PromptExecution/l3dg3rr/sessions/b1a08908-ae43-4870-9678-d6b9ef09c136 Co-authored-by: elasticdotventures <35611074+elasticdotventures@users.noreply.github.com>
1 parent f82a938 commit 5a44339

3 files changed

Lines changed: 31 additions & 18 deletions

File tree

crates/ledger-core/src/ledger_ops.rs

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -456,15 +456,29 @@ impl LedgerOperation for ExportWorkbookOp {
456456
.map_err(|e| LedgerOpError::Workbook(e.to_string()))?;
457457
ws.write_string(0, 0, "tx_id")
458458
.map_err(|e| LedgerOpError::Workbook(e.to_string()))?;
459-
ws.write_string(0, 1, "category")
459+
ws.write_string(0, 1, "account_id")
460460
.map_err(|e| LedgerOpError::Workbook(e.to_string()))?;
461-
ws.write_string(0, 2, "reason")
461+
ws.write_string(0, 2, "date")
462+
.map_err(|e| LedgerOpError::Workbook(e.to_string()))?;
463+
ws.write_string(0, 3, "amount")
464+
.map_err(|e| LedgerOpError::Workbook(e.to_string()))?;
465+
ws.write_string(0, 4, "description")
466+
.map_err(|e| LedgerOpError::Workbook(e.to_string()))?;
467+
ws.write_string(0, 5, "source_ref")
462468
.map_err(|e| LedgerOpError::Workbook(e.to_string()))?;
463469
for (idx, row) in rows.iter().enumerate() {
464470
let r = (idx + 1) as u32;
465471
ws.write_string(r, 0, &row.tx_id)
466472
.map_err(|e| LedgerOpError::Workbook(e.to_string()))?;
467-
ws.write_string(r, 2, &row.source_ref)
473+
ws.write_string(r, 1, &row.account_id)
474+
.map_err(|e| LedgerOpError::Workbook(e.to_string()))?;
475+
ws.write_string(r, 2, &row.date)
476+
.map_err(|e| LedgerOpError::Workbook(e.to_string()))?;
477+
ws.write_string(r, 3, &row.amount)
478+
.map_err(|e| LedgerOpError::Workbook(e.to_string()))?;
479+
ws.write_string(r, 4, &row.description)
480+
.map_err(|e| LedgerOpError::Workbook(e.to_string()))?;
481+
ws.write_string(r, 5, &row.source_ref)
468482
.map_err(|e| LedgerOpError::Workbook(e.to_string()))?;
469483
}
470484
Ok(())

crates/ledger-core/src/verify.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -247,20 +247,18 @@ mod tests {
247247
fn test_verification_rejected_low_confidence() {
248248
let proposer_json =
249249
r#"{"rule_id":"test","proposed_fix":"x","reasoning":"y","confidence":0.5}"#;
250+
// Reviewer confidence 0.6 is below the 0.80 threshold → must force rejection
250251
let reviewer_json =
251252
r#"{"approved":false,"concerns":["too risky"],"suggestions":[],"confidence":0.6}"#;
252253

253254
let proposer = MockModelClient::default().with_response(proposer_json);
254255
let reviewer = MockModelClient::default().with_response(reviewer_json);
255256

256-
// Use higher threshold to force rejection
257257
let config = MultiModelConfig::default().with_threshold(0.80);
258-
let _verifier = MultiModelVerifier::new(proposer, reviewer, config);
258+
let verifier = MultiModelVerifier::new(proposer, reviewer, config);
259259

260-
// Override with mocked threshold test - manually check
261-
// In real code, reviewer_json confidence 0.6 < 0.80 threshold
262-
// This test shows the logic path
263-
assert!(true); // Placeholder - confidence check happens in review()
260+
let outcome = verifier.verify("test", "[]", "context").unwrap();
261+
assert!(!outcome.is_approved());
264262
}
265263

266264
#[test]

crates/mdbook-rhai-mermaid/src/parser.rs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1+
//! Graph-based AST for the rhai pseudo-DSL.
2+
//!
3+
//! Two statement forms are supported:
4+
//! - Pipeline step: `fn name() -> target`
5+
//! - Conditional: `if expr -> target` where expr is e.g. `confidence > 0.8`
6+
//! - Match arm: `match expr => Arm -> target`
7+
//!
8+
//! The syntax is stable — richer identity and placement semantics are encoded
9+
//! in the parser output, not in a second incompatible syntax.
10+
111
use indexmap::IndexMap;
2-
/// Graph-based AST for the rhai pseudo-DSL.
3-
///
4-
/// Two statement forms are supported:
5-
/// - Pipeline step: `fn name() -> target`
6-
/// - Conditional: `if expr -> target` where expr is e.g. `confidence > 0.8`
7-
/// - Match arm: `match expr => Arm -> target`
8-
///
9-
/// The syntax is stable — richer identity and placement semantics are encoded
10-
/// in the parser output, not in a second incompatible syntax.
1112
use std::collections::HashMap;
1213

1314
// ---------------------------------------------------------------------------

0 commit comments

Comments
 (0)