Remove diff sync support - #1098
Conversation
| @@ -104,7 +102,6 @@ const ( | |||
| ActionGetSchemaType | |||
There was a problem hiding this comment.
🟡 Suggestion: this PR removes a large set of exported symbols (connectorstore.SyncTypePartialUpserts/Deletions, connectorrunner.WithDiffSyncs, c1zstore.FileOps.GenerateSyncDiff, c1zstore.SyncRun.LinkedSyncID, C1File.SetSyncLink, C1FileAttached.GenerateSyncDiffFromFile, pebble.Put*RecordsIfNewer/ErrDiffUnsupported, and tasks.CreateSyncDiff here) plus a proto oneof field. pkg/sdk/version.go is bumped automatically by CI as a patch, which won't signal the break to downstream connectors — worth calling out a 0.x minor bump and a migration note in the PR/release description. (Removing CreateSyncDiff from this iota block also renumbers ListStaticEntitlementsType/IssueCredentialType; harmless today since TaskType is process-local metrics-only, but it's worth not relying on that silently.)
There was a problem hiding this comment.
Nothing uses these things in practice.
General PR Review: Remove diff sync supportBlocking Issues: 0 | Suggestions: 3 | Threads Resolved: 0 Review SummaryFull PR diff (64 files, ~4k lines deleted, including Risk triage (per Security IssuesNone found. Correctness IssuesNone found. Suggestions
Prompt for AI agents |
Diff syncs were never enabled in production and had no consumer: nothing started a connector sync from, or applied, a partial_upserts / partial_deletions run. Only the generation half ever shipped, reachable through hidden CLI flags. Removes both generators (in-file GenerateSyncDiff and cross-file GenerateSyncDiffFromFile), the --diff-syncs CLI surface and local task manager, the diff sync types and their retention/compaction/convert guards, the linked_sync_id pair link, and the pebble Put*RecordsIfNewer apply layer that existed only to serve the unbuilt apply path. Deleted proto fields and enum values are reserved by number and name. The supports_diff marker stays: it now gates `baton rollback-expansion`, which is unrelated to diff syncs and keeps working unchanged. Co-authored-by: Cursor <cursoragent@cursor.com>
The sanitizer helper only carries the supports_diff marker now that linked_sync_id is gone, so name it preserveSupportsDiffMarkers. Update the v4 tracker to reflect that FileOps.GenerateSyncDiff was removed rather than DONE. Co-authored-by: Cursor <cursoragent@cursor.com>
Dropping the column from the DDL broke CloneSync/SnapshotTo for every pre-existing c1z: cloneCopy builds its INSERT column list from the source's PRAGMA table_info and inserts into a fresh-DDL destination, so a source column absent from the current schema fails with "table clone.v1_sync_runs has no column named linked_sync_id". Restore the column and its add-if-missing migration so every opened file converges on one shape; nothing reads or writes it anymore. Add a regression test pinning the migration and the clone/snapshot paths. Co-authored-by: Cursor <cursoragent@cursor.com>
Add a blank placeholder in the TaskType iota block where CreateSyncDiff was removed so ListStaticEntitlementsType/IssueCredentialType keep their released ordinals. Retarget the deleted TestToPebbleDiffOnlyEmptySyncID as TestToPebbleNoConvertibleSyncEmptySyncID using an unknown sync type, restoring the only coverage for "sync runs exist but none convertible => error, no partial output". Co-authored-by: Cursor <cursoragent@cursor.com>
8da0f91 to
5a67394
Compare
Summary
Diff syncs never ran in production. The generation half had exactly one downstream consumer — the c1 monorepo's partial-uplift feature — and that feature is gated behind
DEV_MANUALfeature flags, which cannot be enabled for production customers. The apply half was never built: nothing in any sync pipeline ever started a connector sync from, or applied, apartial_upserts/partial_deletionsrun. In this repo the feature was reachable only through hidden CLI flags. This removes the whole feature.Net: 64 files changed, ~4,000 lines deleted (58 files / ~3,560 lines excluding generated
pb/).What's removed
Generation
(*C1File).GenerateSyncDiff(in-file delta) —pkg/dotc1z/diff.godeleted(*C1FileAttached).GenerateSyncDiffFromFile(cross-file upserts/deletions pair) and its table helpersFileOps.GenerateSyncDiffremoved from thec1zstore.FileOpsinterface and from both engine implementationsEntry points
--diff-syncs/--base-sync-id/--applied-sync-idflags and their field definitionsconnectorrunner.WithDiffSyncs,syncDifferConfig, and the runner branchpkg/tasks/local/differ.goand theCreateSyncDifftask type (a blank placeholder pins the ordinals of theTaskTypevalues that followed it)Types and storage
SyncTypePartialUpserts/SyncTypePartialDeletionsand their retention, compaction, and convert guardslinked_sync_idAPI surfaces:SyncRun.LinkedSyncID,SetSyncLinkon both engines, and the v3 proto fieldPut*RecordsIfNewerlayer (if_newer.go), which existed only to serve the apply path that was never built and has no other callerProto — deleted fields and enum values are reserved by number and name:
Task.create_sync_diff(field 119)SyncTypevalues 4 and 5SyncRunRecord.linked_sync_id(field 8)buf.yamlgains anENUM_VALUE_NO_DELETEexception, mirroring theFIELD_NO_DELETEexception already there for the same reason: theFILEcategory's blanket rule would otherwise reject the reserved-and-removed enum values.What deliberately stays
linked_sync_idcolumn — vestigial but load-bearing for schema uniformity.CloneSync/SnapshotTobuild their INSERT column list from the source'sPRAGMA table_infoand insert into a fresh-DDL destination, so removing the column from the DDL broke cloning of every pre-existing c1z (all of which physically carry it). The column and its add-if-missing migration stay; nothing reads or writes it, andTestLinkedSyncIDColumnMigratedAndCloneablepins both the migration and the clone/snapshot paths.supports_diff— despite the name, this marker no longer has anything to do with diff syncs. It records that a sync's data collection finished with SQL-layer grant metadata populated, and it gatesbaton rollback-expansion. The parallel syncer still writes it and the command still works unchanged; the sanitizer's carry-over is now namedpreserveSupportsDiffMarkersto match.SyncTypePartial("partial") — targeted connector syncs, unrelated to diff syncs.baton diff— the read-only CLI comparison of two full syncs.mergeBucketRawIfNewer), which is its own implementation.Compatibility
linked_sync_id, so no legacy-read tolerance is needed for the removed sync types. Cross-version schema skew is covered: older SDKs re-addlinked_sync_idvia their shipped migration, and this SDK keeps the column (see above) so clones of older files keep working in both directions.GenerateSyncDiffFromFilefrom the temporal incremental-sync compactor — and upgrading the SDK will produce compile breaks in those files. The feature's flags areDEV_MANUAL(internal/dev accounts only, never production customers), so the breakage is confined to retiring that dev-only code as part of the SDK bump.Test plan
go build ./...make lint— 0 issues (also fixed 4 pre-existing reviveunhandled-errorfindings inpkg/sync/external_principal_index.goandpkg/uhttp/xml_test.go)go test ./pkg/dotc1z/... ./pkg/c1zsanitize/... ./pkg/synccompactor/... ./pkg/field/... ./pkg/tasks/... ./pkg/connectorrunner/... ./cmd/baton/...go test ./pkg/sync/...(full suite)TestLinkedSyncIDColumnMigratedAndCloneable(schema uniformity + clone/snapshot),TestToPebbleNoConvertibleSyncEmptySyncID(sync runs exist but none convertible ⇒ error, no partial output)DEV_MANUAL; SDK bump there requires retiring that dev-only code