Skip to content

FEAT-001 — write runtime and signed ledger: propose, apply, undo (#170) - #195

Merged
jmmana merged 5 commits into
mainfrom
feat/170-write-tools
Nov 30, 2026
Merged

jmmana merged 5 commits into
mainfrom
feat/170-write-tools

Conversation

@jmmana

@jmmana jmmana commented Nov 30, 2026

Copy link
Copy Markdown
Owner

Refs #170. Stage A of the rest of the issue: the engine-side runtime, without MCP tools yet (stage B).

  • write_runtime.py: propose (counts and previews with SELECT, never runs DML), apply (explicit approval, atomic claim in the ledger, policy re-check, count equals the proposal and within max_rows, primary-key set equal to the proposal's, row locks on PostgreSQL, MySQL and SQL Server, before and after images), undo (UPDATE and DELETE, drift check, force only skips drift, policy and columns re-validated).
  • ledger.py: SQLite file with mode 0600, HMAC-signed records (key file or SQLGUARD_LEDGER_KEY), retention and purge.
  • Two Claude API (Sonnet 5.5) security reviews drove the fixes: undo can no longer write columns or tables the policy does not allow, a tampered ledger is refused, propose does not execute the write, owner binding, symlink-safe ledger file.
  • Known limits, documented in docs/WRITES.md: SQLite has no row lock; DELETE images hold every column; INSERT undo is not supported yet; engine tests on SQL Server, PostgreSQL and MySQL are not in this PR.

Leaves out #155, #156, versions and release.yml.

🤖 Generated with Claude Code

jmmana and others added 4 commits November 30, 2026 12:41
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Undo re-validates policy and columns, UPDATE restores only writable columns plus the key,
propose never runs DML, atomic claim of a change, owner binding, row locks, key-set check,
ledger file hardening.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 30, 2026 18:53

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@jmmana
jmmana merged commit 3af1bb6 into main Nov 30, 2026
24 checks passed
@jmmana
jmmana deleted the feat/170-write-tools branch November 30, 2026 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants