Skip to content

fix(shadow): wire SQL snapshot input mode - #386

Merged
chubes4 merged 19 commits into
mainfrom
fix/mdi-parity-corpus-20260909
Sep 9, 2026
Merged

chubes4 merged 19 commits into
mainfrom
fix/mdi-parity-corpus-20260909

Conversation

@chubes4

@chubes4 chubes4 commented Sep 9, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Adds opt-in sql_snapshot input mode for authoritative MySQL shadow verification, bounded classified reports, quote-aware template redaction, and correct sticky WPDB insert_id projection. Canonical-state comparison remains the default.

Before each observed SELECT, the adapter captures authoritative schemas, raw source rows and pre-query facade state. Native SQL executes independently against typed in-memory providers. Reports retain structural diagnostics and hashes, not source values or connection details. Bounds are 16 tables, 10,000 rows per table and 8 MiB per table.

Comparison is exact by default. Unbounded SELECTs with no outer ORDER BY may compare complete duplicate-preserving row bags. Ordered and limited results remain exact; unspecified limited ordering is not evidence of full SQL parity.

Verified Evidence

Candidate 1772cd1eca7536cedca6c3222f445ef5172a3475 includes main 78caa45cfbb845130aafcd22e80b23a7cdf0a3ab.

The real DME multisite lifecycle corpus passed on WordPress 7.1, PHP 8.3 and PHPUnit 9.6.35: 4 tests, 17 assertions. DME source was pinned to 88d55a907b12638e88baee5b492501dbed5c2665, with Data Machine 31befb659aaa5268e79a0c28a16321c3ee5e1108.

  • 1,141 observations: 382 compatible, 38 unsupported, 0 mismatched, 721 ignored, 0 verifier failures, 0 dropped.
  • Unsupported classifications: 21 native execution gaps and 17 snapshot-input limitations. These are not compatible reads.
  • Snapshot limitations: 16 sanitized capture exceptions and one unavailable blog-2 options schema. The report does not establish the underlying causes of those exceptions.
  • Formal mdi-shadow-report artifact reference returned with SHA-256 5d7a6bf7a7009519aef3fc61e33d3b40211f4a491d1e7efc76d057f65fcdf9ad. Structural hashes may differ on fresh fixtures.
  • Parent independently ran snapshot, verifier, WPDB lifecycle and transaction checks on the exact candidate on Linux. Focused factory, environment, bounded-read, comment, join, plugin-schema, parser and scalar checks also passed.

Reproduction

Use a built wp-codebox checkout with the same-command resultPaths contract, normal npm installation/postinstall, Docker-backed managed MySQL, built consumer dependencies, and a wp-phpunit vendor directory. From this repository:

export MDI_WP_CODEBOX_BIN=/path/to/wp-codebox/packages/cli/dist/index.js
export MDI_SHADOW_PLUGIN_DIR=/path/to/data-machine-events
export MDI_SHADOW_PLUGIN_SLUG=data-machine-events
export MDI_SHADOW_DEPENDENCY_DIRS_JSON='{"data-machine":"/path/to/data-machine"}'
export MDI_SHADOW_HARNESS_DIR=/path/to/phpunit-harness/vendor
export MDI_SHADOW_PHPUNIT_ARGS_JSON='["test-file=tests/Integration/WordPressLifecycleTest.php","project-autoload-file=/wordpress/wp-content/plugins/data-machine-events/vendor/autoload.php","autoload-file-role=harness","bootstrap-mode=managed"]'
php tests/run-mysql-shadow-corpus.php

The runner prints its source revision, PHPUnit outcome, report and formal artifact reference, plus the retained artifact directory. Repository-local checks are php tests/smoke-native-shadow-sql-snapshot.php, php tests/smoke-native-shadow-verifier.php, php tests/smoke-native-wpdb-lifecycle.php, and php tests/probe-native-transaction-semantics.php.

Supports #377, which remains open. This verifies bounded SQL execution over explicit snapshots, not canonical persistence parity, concurrent transaction isolation, or full consumer readiness. No release or deployment is included.

AI Assistance

OpenAI GPT-5.6 Terra (openai/gpt-5.6-terra) via OpenCode implemented and tested the changes. GPT-6 Astra (openai/gpt-6-astra) via OpenCode coordinated review corrections, independently ran the exact candidate's Linux lifecycle corpus and focused gates, and finalized the evidence under Chris Huber's direction.

@chubes4

chubes4 commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator Author

Codebox handoff: wp-codebox PR2490 now exposes bounded typed resultPaths for the wordpress.phpunit workflow step at Codebox f59e72a4031fd5402809c93d3fc671645be62389.

The capture reads declared JSON directly from the completed PHPUnit command VFS, after shutdown callbacks and before any follow-up runtime request. It validates path/JSON/size, redacts and materializes the result, and attaches a digest-bearing command artifact ref. A real PHPUnit fixture shutdown callback proved the boundary; Lab managed MariaDB/mysqli verification also passed.

The MDI runner should declare its native shadow JSON as the wordpress.phpunit step's required resultPaths entry rather than relying on artifacts.paths or artifacts.typed. Nonzero DME shadow observations remain required before parity can be claimed.

AI disclosure: OpenCode using OpenAI GPT-5.6 Terra (openai/gpt-5.6-terra) was used for source inspection, implementation, and verification.

@chubes4 chubes4 changed the title test: support multisite native plugin corpus fix(shadow): wire SQL snapshot input mode Sep 9, 2026
@chubes4
chubes4 marked this pull request as ready for review September 9, 2026 11:09
@chubes4
chubes4 merged commit 89c9579 into main Sep 9, 2026
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.

1 participant