fix: preserve schema 15 compatibility for v0.1.8

This commit is contained in:
2026-10-17 18:27:53 +09:00
parent a97548c36b
commit 1134f058cc
61 changed files with 2650 additions and 644 deletions
+14 -3
View File
@@ -17,7 +17,8 @@ from mcp.client.stdio import stdio_client
OPS = ('create_settlement_draft', 'list_settlement_drafts', 'get_settlement_draft',
'update_settlement_draft', 'refresh_settlement_draft_targets',
'set_settlement_draft_item', 'review_settlement_draft',
'approve_settlement_draft', 'finalize_settlement_draft', 'cancel_settlement_draft')
'approve_settlement_draft', 'finalize_settlement_draft', 'cancel_settlement_draft',
'list_monthly_settlement_history', 'get_monthly_settlement_history_record')
ROOT = Path(__file__).resolve().parents[1]
@@ -44,7 +45,7 @@ def test_required_public_field_assertion_detects_omission():
def rows(db, table):
assert table in {'asset_snapshot_runs', 'account_snapshot', 'settlement_drafts', 'settlement_draft_items'}
assert table in {'asset_snapshot_runs', 'asset_snapshots', 'settlement_drafts', 'settlement_draft_items'}
with closing(sqlite3.connect(db)) as connection:
return connection.execute(f'SELECT * FROM {table} ORDER BY rowid').fetchall()
@@ -138,7 +139,7 @@ async def _exercise_stdio_lifecycle(tmp_path):
assert field in provenance, f'final provenance missing {field}'
assert provenance['valuation_date'] == item['valuation_date'] and provenance['age_days'] == item['age_days']
before = (await call('get_settlement_draft', {'draft_id':draft_id}))
tables = ('asset_snapshot_runs', 'account_snapshot', 'settlement_drafts', 'settlement_draft_items')
tables = ('asset_snapshot_runs', 'asset_snapshots', 'settlement_drafts', 'settlement_draft_items')
before_replay = {table: rows(db, table) for table in tables}
assert await call('finalize_settlement_draft', {'draft_id':draft_id,'expected_version':draft['version'],'review_fingerprint':fingerprint,'idempotency_key':'mcp-close'}) == closed
archived = await call('get_settlement_draft', {'draft_id':draft_id})
@@ -147,6 +148,16 @@ async def _exercise_stdio_lifecycle(tmp_path):
assert archived == before
assert {table: rows(db, table) for table in tables} == before_replay
history = await call('list_monthly_settlement_history', {'month': '2026-09'})
require_fields(history, {'success', 'history', 'month', 'read_only'}, 'history list stdio result')
assert history['success'] and history['read_only'] is True
assert [item['run_id'] for item in history['history']] == [closed['run_id']]
record = await call('get_monthly_settlement_history_record', {'run_id': closed['run_id']})
require_fields(record, {'success', 'history', 'read_only'}, 'history record stdio result')
assert record['success'] and record['read_only'] is True
assert record['history']['run_id'] == closed['run_id']
assert record['history']['net_worth'] == 100
second = await call('create_settlement_draft', {'month':'2026-10','created_by':'stdio-test','idempotency_key':'mcp-cancel'})
assert second['success']
cancelled = await call('cancel_settlement_draft', {'draft_id':second['draft']['id'],'expected_version':second['draft']['version'],'cancelled_by':'stdio-test','reason':'synthetic cancellation'})