Repository navigation
Conversation
OpenIVM now always records the programs it runs for CREATE MATERIALIZED VIEW and refresh in openivm_compiled_programs / openivm_compiled_statements, in the view's metadata catalog, independently of openivm_files_path. - A program is the complete statement list in execution order, keyed by the qualified MV identity and operation. A new version is stored only when the list differs verbatim from the latest stored version; state-specific cutoffs and snapshot IDs are not normalized. All versions are retained. - Outcomes: committed, attempted (failed and rolled back) and unknown (cross-catalog refresh failed after data statements ran, or COMMIT failed). Compile-only calls are never archived. - Native CREATE/refresh write the archive in their own transaction; explicit transactions include it in the caller's program. DuckLake refreshes and replacements record it in one metadata transaction after they commit and report an error, not success, if that write fails. - Connection-executed archives use bound parameters; DuckDB parses long SQL literals slowly. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The reference file is written in text mode, so Windows translates newlines to CRLF. Undo that before checking that the file holds the archived statements in order; the archived text itself is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ila
marked this pull request as ready for review
October 15, 2026 07:24
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.
Implements #83 (automatic archive of compiled SQL in metadata tables). Draft: not ready to merge until two independent feature reviews, any repairs, exact-revision validation and all CI workflows are done.
What it does
openivm_compiled_programs(one row per version) andopenivm_compiled_statements(statements in execution order). The tables sit in the view's metadata catalog/schema, are created through the existing metadata init/migration path, and are independent ofopenivm_files_path. File export still works and can be used alongside the archive.view_namekey plus catalog, schema and SQL name) and by operation (create/refresh). A new version is stored only when the complete statement list differs verbatim from the latest stored version. Nothing is normalized; all versions are kept, including across DROP and recreate. Refresh ids matchopenivm_refresh_profile.refresh_id.committed: the transaction committed.attempted: the run failed and rolled back.unknown: a cross-catalog refresh failed after data statements ran, orCOMMITitself failed.openivm_compile_with_facts) are never archived.attempted/unknown. If that write also fails, the error says so.CREATE OR REPLACE: one metadata transaction after the commit. If it fails, the operation returns an error that says it committed, never plain success.Behaviour to be aware of
Tests (all through the real archive paths)
All on the final binary:
metadata.test: 396 assertions.transactional_lifecycle.test: 546 assertions.ducklake_deltas.test: 238 assertions.They cover CREATE, repeated refreshes, an unchanged program run twice (one version, text unchanged), changed programs (new version, with text and order asserted), full refresh, skipped refresh, compile-only, file export on/off, qualified and attached-catalog names, failure/rollback, explicit transactions, archive-write failures (native, DuckLake refresh, DuckLake replace), reopen, migration, and DROP/recreate.
CI on head
8cc4f984: all workflows pass (Linux amd64/arm64, macOS amd64/arm64, Windows MSVC/MinGW, Wasm ×3, Format, Tidy). The first CI run (47d82787) failed only on Windows, at one new assertion: the reference file is written in text mode (CRLF), so the comparison now normalizes the file's newlines. The archived text is unchanged.Local full suite on the final revision: 91/92 test files passed (14,214 assertions); the remaining file,
refresh_timezone.test, was skipped because it requiresicu. Both integration scripts pass. It ran per file in batches because one monolithic run exceeded the session's 2-hour limit on a loaded machine.Benchmark (loaded machine, noisy)
window_running_aggregate_incremental.test: CPU time 22.4 s vs 27.8 s; wall time unchanged.Found, not fixed (out of scope)
Dropping and recreating an aggregate MV after a database reopen fails with
Could not commit creation of dependency ... openivm_index has been deleted. It reproduces identically on the baseline binary.🤖 Generated with Claude Code
Reviewed head: 2c94d92; base: 9f65757
Independent review and configured validation passed.
Performance comparisons: not applicable to this non-performance task.
Required runtime checks incomplete: timeout is non-blocking, not a pass.
Two independent fresh reviewer sessions passed this exact revision.
Validation scope: configured command only; no additional runtime coverage claimed
Validation command: ["/Users/ila/Code/agent-mistress/.venv/bin/python", "/Users/ila/Code/agent-mistress/scripts/general_validation.py", "9f657576d1e47440d7e62de1befd47bf76b4a83e"]
Fixes #83