Skip to content

Commit 648346b

Browse files
Merge pull request #29 from PromptExecution/codex-issue-21-workbook-contract
feat: honor the CPA workbook export contract
2 parents 7268248 + 290dcb1 commit 648346b

7 files changed

Lines changed: 428 additions & 145 deletions

File tree

AGENTS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,10 @@ Treat this as a standing operational gate, not a one-time migration task.
245245
- The published MCP surface now lives in `crates/ledgerr-mcp/src/contract.rs`; treat it as the only source of truth for parser shapes, generated JSON Schema, and checked-in operator docs/examples.
246246
- Regenerate `docs/mcp-capability-contract.md`, `docs/agent-mcp-runbook.md`, and `scripts/mcp_cli_demo.sh` via `cargo run -p xtask-mcpb -- generate-mcp-artifacts` after changing the published MCP surface.
247247
- Drift between `contract.rs` and those generated artifacts is a test failure, not a documentation chore.
248+
- 2026-04-17: CPA workbook export is now explicitly projection-only.
249+
- Treat `ledger_core::workbook::REQUIRED_SHEETS` as the canonical base workbook contract for export paths.
250+
- `export_cpa_workbook` should rebuild the full workbook from canonical service state on each export, including `META.config`, `ACCT.registry`, schedule sheets, flag sheets, transaction sheets, and `AUDIT.log`.
251+
- Tests should assert representative workbook contents, not just that a file was written.
248252

249253

250254

crates/ledgerr-mcp/src/contract.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,8 @@ impl JsonSchema for PluginInfoSubcommand {
157157
fn json_schema(_gen: &mut schemars::gen::SchemaGenerator) -> Schema {
158158
Schema::Object(SchemaObject {
159159
instance_type: Some(SingleOrVec::Single(Box::new(InstanceType::String))),
160-
enum_values: Some(vec![json!("check"), json!("upgrade"), json!("cleanup")]),
161160
metadata: Some(Box::new(Metadata {
162-
description: Some("Recognized values are check, upgrade, and cleanup. Unknown strings intentionally fall through to the default check behavior.".to_string()),
161+
description: Some("Subcommand string. Known values: check, upgrade, cleanup. Unknown strings fall through to the default check behavior.".to_string()),
163162
..Metadata::default()
164163
})),
165164
..SchemaObject::default()
@@ -599,8 +598,7 @@ Expected blocked outcomes:\n\n\
599598
}
600599

601600
pub fn generated_mcp_cli_demo_script() -> String {
602-
format!(
603-
"#!/usr/bin/env bash\nset -euo pipefail\n\n\
601+
"#!/usr/bin/env bash\nset -euo pipefail\n\n\
604602
JOURNAL_PATH=\"${{JOURNAL_PATH:-/tmp/demo.beancount}}\"\n\
605603
WORKBOOK_PATH=\"${{WORKBOOK_PATH:-/tmp/demo.xlsx}}\"\n\
606604
SOURCE_REF=\"${{SOURCE_REF:-wf-2023-01.rkyv}}\"\n\n\
@@ -619,7 +617,7 @@ cat <<'EOF'\n\
619617
{{\"jsonrpc\":\"2.0\",\"id\":3,\"method\":\"tools/call\",\"params\":{{\"name\":\"ledgerr_reconciliation\",\"arguments\":{{\"action\":\"commit\",\"source_total\":\"100.00\",\"extracted_total\":\"95.00\",\"posting_amounts\":[\"-95.00\",\"95.00\"]}}}}}}\n\
620618
{{\"jsonrpc\":\"2.0\",\"id\":4,\"method\":\"tools/call\",\"params\":{{\"name\":\"ledgerr_audit\",\"arguments\":{{\"action\":\"event_history\",\"time_start\":\"2026-12-31\",\"time_end\":\"2026-01-01\"}}}}}}\n\
621619
EOF\n"
622-
)
620+
.to_string()
623621
}
624622

625623
fn documents_ingest_pdf_example() -> Value {

0 commit comments

Comments
 (0)