Working-set publication loses schema-qualified conflict identities
perfloop-oss/dolt · Identity Collision
https://perfloop.ai/t/oss/case_375hr0ahq6
Verdict
VERIFIED · settled 2026-11-10 · pull request opened as dolthub/dolt#12428
What happened: The check fails before this change and passes with it.
Hypothesis
Publishing a working set loses the schema component of its conflicting table identities. Reloading can therefore point conflict inspection at an absent or different default-schema table, and distinct same-named tables can collapse to one identity. The demonstrated scope is the shared root and working-set library APIs with named database schemas; ordinary default-schema-only batches are controls, and deployed named-schema usage is unknown.
TableName is documented as uniquely identifying a table and includes Schema. RootValue supports CreateDatabaseSchema and schema-qualified table insertion. CommitHeadUpdates builds a WorkingSetUpdate through WorkingSet.writeValues. At workingset.go:755–756, that writer passes FlattenTableNames(ws.mergeState.unmergableTables) to the storage layer. FlattenTableNames deliberately retains only Name. On reload, newWorkingSet uses ToTableNames(unmergableTables, DefaultSchemaName) at line 601, so no schema distinction can be recovered. MergeState.IterSchemaConflicts subsequently uses those reconstructed identities in both root lookups. The SQL merge producer also supplies TableName values through WithUnmergableTables; no claim is made that every SQL configuration exposes named schemas.
The native check on prop_m7m3n1zqfn ran `go -C go test ./libraries/doltcore/doltdb -run '^TestPerfloopConflictIdentityRoundTrip$' -count=1 -timeout=90s -v`. checkProperty call_ZX6wKkH6HhmwX7YlalT57Lxw completed all 37 distinct-identity lists of length zero through two over names t/u in schemas default/s1/s2. Each case created real tables on both sides with different primary-key schemas, successfully published a source commit and a merge working set through CommitHeadUpdates, then reloaded and called IterSchemaConflicts. All five empty/default-only controls passed; the 32 lists containing a named-schema identity failed. The smallest returned replay was a single {Name: t, Schema: s1}: it became {Name: t, Schema: empty}, and both consumer table lookups were absent after publication although they existed before it. Two-schema same-name cases also showed the key collision.
Confidence is medium. The Case's independent proof target is a lossless working-set conflict-identity round trip through supported named-schema roots, including same-name tables, correct subsequent table-pair lookup, and unchanged default-schema and legacy-record interpretation. The checker exercises persistence rather than full merge conflict detection; end-to-end merge/status exposure and the compatibility implementation remain investigation questions. The test placement and enumeration layout are provisional. The change likely needs storage-metadata evolution and compatibility tests, not a global redefinition of the intentionally lossy migration helper.
Current work was checked through the complete open-PR listing at https://github.com/dolthub/dolt/pulls; it contained no change to this working-set identity persistence path. Searches for FlattenTableNames and the specific conflict-table repair found no prior repair overlap. Older merged-file history remains an evidence gap because the checkout is shallow and the bounded GitHub history read was refused. No separate review archive was named in the inspected repository guidance.
Change to test: Preserve each conflicting table's schema and name through working-set publication and reload instead of stripping its schema at the persistence boundary. Keep legacy unqualified conflict records readable as default-schema identities and leave unrelated uses of the migration helper unchanged.
Where it lives
perfloop-oss/dolt · go/libraries/doltcore/doltdb/doltdb.go
Evidence
The check fails before this change and passes with it: `For roots built through the shared library APIs, working-set publication through CommitHeadUpdates and reload preserves every conflict table's name and schema, including same-named tables in different schemas, and IterSchemaConflicts returns the original destination and source tables or absence on either side.`
Checks: 5 of 5 passed. Verification: no defect found.
Timeline
2026-11-10· Case opened2026-11-10· PR opened