You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Overall, the unified run is a failure (4 passed, 4 failed), with two high-severity replay defects repeatedly reproduced showing that dolt_patch emits JSONB INSERT SQL that breaks on valid complex payloads (nested quotes, backslashes, newlines, arrays, nulls) with invalid input syntax for type jsonb. The evidence points to a real production regression introduced with the PR’s Dolt dependency bump and not covered by existing simple-payload smoke coverage, while separate oracle checks passed and confirmed that ORDER BY enforces strict statement sequence whereas unordered assertions are set-based and can mask ordering regressions.
❌ Failed (4)
Category
Summary
Screenshot
Serialization
⚠️ dolt_patch emitted JSONB INSERT SQL that fails replay for nested-quote/newline payloads with invalid jsonb syntax.
Serialization
⚠️ dolt_patch emitted boundary JSONB INSERT SQL that is over-escaped and rejected as invalid jsonb during replay.
Upstream
⚠️ Generated dolt_patch data SQL fails replay with invalid input syntax for type jsonb.
Upstream
⚠️ Multi-row downstream replay fails on first emitted JSONB patch INSERT statement.
⚠️ Complex JSONB payload with nested quotes stays executable
What failed: The emitted patch INSERT for complex JSONB content fails with invalid JSONB syntax instead of replaying the original value.
Impact: Downstream workflows that execute dolt_patch output can fail for legitimate JSONB data containing nested escaping. This blocks reliable patch replay for affected repositories and automation pipelines.
Steps to reproduce:
Create repro(pk int primary key, data jsonb).
Insert a JSONB row with nested quotes and escaped newline content.
Query dolt_patch('HEAD','WORKING','repro') and capture the data INSERT statement.
Truncate target rows and execute the emitted INSERT statement.
Observe invalid input syntax for type jsonb instead of successful replay.
Stub / mock context: The run used deterministic local-auth bypassing and startup patches so SQL verification could execute offline; authentication and SCRAM behavior were not under test. Temporary edits in server startup and constraint paths (including server/auth/* and server/analyzer/domain_constraints.go) were applied to reduce unrelated environment failures while validating dolt_patch and replay behavior.
Code analysis: I reviewed dependency wiring and test coverage in Doltgres. The server uses Dolt's dfunctions path from the pinned github.com/dolthub/dolt/go revision, and this PR updates that revision; the newly added smoke assertion validates only a simple JSON payload and does not cover escaping-heavy JSON, which matches the observed replay breakage.
Why this is likely a bug: The failure reproduces on real SQL replay while the production code path is bound to a newly bumped upstream Dolt implementation that is responsible for emitting these statements.
{
Name: "dolt_patch works with JSONB columns",
SetUpScript: []string{
"CREATE TABLE repro (pk int primary key, data jsonb);",
"INSERT INTO repro VALUES (1, '{\"text\": \"hello\"}');",
},
Assertions: []ScriptTestAssertion{
{
Query: "SELECT statement_order, table_name, diff_type, statement FROM dolt_patch('HEAD', 'WORKING', 'repro')",
Expected: []sql.Row{
{Numeric("1"), "public.repro", "schema", "CREATE TABLE \"repro\" (\n\"pk\" integer NOT NULL,\n\"data\" jsonb,\n PRIMARY KEY (\"pk\")\n);"},
{Numeric("2"), "public.repro", "data", "INSERT INTO \"repro\" (\"pk\",\"data\") VALUES (1,'{\\\"text\\\": \\\"hello\\\"}');"},
⚠️ Stress JSONB escaping boundaries in generated patch SQL
What failed: Replay fails on emitted INSERT statements because JSONB payload text is over-escaped and rejected by JSONB parsing.
Impact: Teams relying on patch export/replay lose data portability for complex JSONB records. Automated migration or synchronization workflows can fail at runtime without a practical workaround.
Steps to reproduce:
Create repro with a jsonb column in an isolated database.
Generate dolt_patch('HEAD','WORKING','repro') data statements.
Replay emitted INSERT statements against a clean table state.
Observe invalid jsonb syntax errors and mismatched replayed data.
Stub / mock context: The run used deterministic local-auth bypassing and startup patches so SQL verification could execute offline; authentication and SCRAM behavior were not under test. Temporary edits in server startup and constraint paths (including server/auth/* and server/analyzer/domain_constraints.go) were applied to reduce unrelated environment failures while validating dolt_patch and replay behavior.
Code analysis: The same dependency and execution path is used for this stress case, and the PR-level JSONB smoke test remains scoped to one simple fixture. The observed multi-row boundary failure is consistent with an escaping bug in generated patch SQL rather than test scaffolding, because the SQL generation and replay path is the exact production path exercised by dolt_patch.
Why this is likely a bug: Boundary JSON payload replay fails in the live SQL path while simple fixtures pass, which indicates escaping logic in generated patch SQL is defective for valid JSONB inputs.
SetUpScript: []string{
"CREATE TABLE repro (pk int primary key, data jsonb);",
"INSERT INTO repro VALUES (1, '{\"text\": \"hello\"}');",
},
Assertions: []ScriptTestAssertion{
{
Query: "SELECT statement_order, table_name, diff_type, statement FROM dolt_patch('HEAD', 'WORKING', 'repro')",
Expected: []sql.Row{
{Numeric("1"), "public.repro", "schema", "CREATE TABLE \"repro\" (\n\"pk\" integer NOT NULL,\n\"data\" jsonb,\n PRIMARY KEY (\"pk\")\n);"},
{Numeric("2"), "public.repro", "data", "INSERT INTO \"repro\" (\"pk\",\"data\") VALUES (1,'{\\\"text\\\": \\\"hello\\\"}');"},
⚠️ JSONB patch SQL cannot be replayed safely
What failed: The emitted data INSERT contains escaped quote sequences inside the JSON literal and fails at execution with invalid input syntax for type jsonb, instead of replaying the original row.
Impact: Consumers that execute exported patch SQL cannot reliably reconstruct JSONB changes. This breaks a core replay/export workflow with no practical workaround besides manual SQL rewriting.
Steps to reproduce:
Create repro(pk int primary key, data jsonb) and insert quote-sensitive JSON payloads.
Run dolt_patch('HEAD','WORKING','repro') and capture emitted schema/data SQL statements.
Execute emitted CREATE/INSERT statements in a clean destination database with strict error handling.
Observe replay failure on the JSONB INSERT with invalid input syntax for type jsonb.
Stub / mock context: The run used local auth/bootstrap bypasses to keep the database service available, then executed real patch generation and replay SQL in isolated source and consumer databases; no route-level network mocking was used for this case.
Code analysis: I reviewed the PR-scoped dependency update in go.mod, the new JSONB smoke expectation in testing/go/dolt_functions_test.go, and runtime JSONB input validation in server/functions/jsonb.go. The code path expects strict JSON text on input, while emitted patch SQL shows double-escaped content that does not satisfy that parser.
Why this is likely a bug: Production parsing enforces valid JSONB input, and emitted patch SQL for JSONB data violates that expectation during replay, so the failure is consistent with a real product defect rather than a harness-only artifact.
⚠️ Downstream replay breaks for JSONB heavy patches
What failed: Replay fails on the first emitted JSONB data statement with invalid JSONB syntax, preventing downstream state reconstruction.
Impact: Multi-row replay/export pipelines break before applying JSONB changes, so downstream systems cannot reconstruct source state. This disrupts a primary integration path for patch consumers.
Generate patch SQL via dolt_patch('HEAD','WORKING','repro').
Execute emitted statements in a clean downstream database and compare replayed state.
Observe failure on the first JSONB data statement during replay execution.
Stub / mock context: Authentication and startup bypasses remained enabled to stabilize local execution, but replay verification used real SQL generation and execution against isolated databases with no synthetic API responses.
Code analysis: I examined the same production boundary as UPSTREAM-2 and confirmed the failure generalizes beyond a single payload: dependency-updated patch output format conflicts with strict JSONB parser requirements in server code. The failure repeats across varied JSONB shapes, indicating systemic escaping drift rather than one malformed fixture.
Why this is likely a bug: The same code-level mismatch between emitted patch SQL escaping and JSONB parser requirements consistently breaks replay for diverse JSON payloads, which is a reproducible production behavior defect.
These are tests that we're marking as Successful, however they do not match the expected output in some way. This is due to small differences, such as different wording on the error messages, or the column names being incorrect while the data itself is correct. ↩
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
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.
Depends on: dolthub/dolt#11153