Repository navigation
Conversation
frame.database snapshots every table and column before and after the save (three statements, whatever the table count) and judges each table as a slice. A row added, removed or changed is collateral unless a declared effect, a side record or an attributed concurrent writer explains it. A new declared or side row that sets a column nothing declares is collateral too. Tables over max_rows are fingerprinted. allow_tables, reviewed per app, replaces the read-list; an unreadable snapshot leaves the frame not checked. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SQLite caps a function at 127 arguments and OpenEMR's chart has more columns, so the snapshot failed and the frame was not checked. Each row is now read as JSON objects of at most 50 columns, merged in Python (a JSON merge patch would drop null values). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
The frame now diffs the whole database by default when a contract declares
frame.database, not only the tables the contract reads.Why: on #1580's blind held-out suite, the read-list frame passed three bot writes as verified. Each wrote somewhere the contract never read: a column on the new chart, a field on its history row, and a calendar row. Adding those reads one case at a time would only cover the cases already seen.
What it does:
docker execstays fast. Tables overmax_rowsare fingerprinted instead (CHECKSUM TABLEon MySQL and MariaDB, a row hash on SQLite).judge_frame. A row added, removed or changed is collateral unless a declared effect, a declared side record, or a concurrent writer the audit log names explains it.new_row_fieldsor holds its default. The primary key and database-computed defaults (CURRENT_TIMESTAMP) count as defaults.allow_tablesis the reviewed list of tables the app writes on its own (logs, sessions, id registries). It replaces the read-list.attribution.record_keyslets a table name its record through another field (OpenEMR'scontact.foreign_id).Stacked on #1570 (side records and record keys).
Tests:
tests/test_frame_database.pycovers a clean save, five kinds of stray write, the allow-list, an unreadable database, the three-statement read and a table wider than SQLite's 127-argument limit. One more case is intest_frame_links.py. Locally, 110 tests pass across the frame, frame-links, verify-run and collateral-change suites.Measured (#1580, stand-in): the whole-database candidate gets 17/17 on both the original suite and the first held-out suite. The first held-out set shaped this design, so its score doesn't count. A second blind held-out set will be the measurement.
🤖 Generated with Claude Code