Skip to content

feat(connectors): add --wait to connectors sync - #291

Merged
leet-c1 merged 4 commits into
mainfrom
feat/connectors-sync-wait
Nov 19, 2026
Merged

leet-c1 merged 4 commits into
mainfrom
feat/connectors-sync-wait

Conversation

@cvkramer

@cvkramer cvkramer commented Nov 19, 2026 •

Copy link
Copy Markdown

What

c1i connectors sync <connector-id> --app-id <app> --wait [--wait-timeout 15m].

  • Before requesting the sync it reads .status.completedAt as a baseline; the wait ends only on a later completedAt, so an already-DONE connector cannot end it early.
  • On success it prints the connector's whole .status object, as the server sent it, as the command's single document, in place of the API's empty {}. The accept response is still validated, so a non-JSON 2xx stays a mutation error. This is opt-in through withWaitResultOutput(); no other --wait output changes.
  • A 200 without connectorView.connector exits 6 at once rather than polling to the timeout. A never-synced connector reports .status with SYNC_STATUS_UNSPECIFIED and null timestamps (or omits it) and is waited on normally.
  • A terminal SYNC_STATUS_ERROR, or a .status.lastError, exits 1 with applied: true, naming it. .status.errorKind is deliberately not checked: a clean DONE carries ERROR_KIND_UNSPECIFIED, its enum's zero value, not "".
  • A connector whose .status.completedAt never advances (an unconfigured connector stays SYNC_STATUS_DONE with null timestamps; a sync the server refuses before it starts stays RUNNING with a lastError) is reported at the timeout, not as a sync error: the wait cannot tell it from a sync that has not started yet. connectors get shows its .status.
  • A failure writing that final status document reports applied: true.
  • Without --wait, behavior is unchanged.

Verified

  • Unit tests: baseline, advance, lastError, terminal SYNC_STATUS_ERROR with no lastError, missing connectorView.connector, both never-synced shapes, a non-JSON accept response, a failed status write, and the timeout.
  • Live on a dev tenant: a real sync ran ~5 s and the command printed one JSON document carrying the connector's full .status (including updatedAt and the new completedAt). A connector created with an empty config (.status SYNC_STATUS_UNSPECIFIED with null timestamps, later DONE with null timestamps) and a connector whose syncs are refused (RUNNING + lastError, no completedAt) both behave as described above.
  • golangci-lint is clean.

c1-charleskramer and others added 4 commits November 18, 2026 17:33
…ken read

- `--wait` printed a re-marshalled five-field struct after the empty `{}`
  accept document: the rest of the server's `.status` was lost and
  `lastError`/`errorKind` were forced into the output. Keep the status as
  sent and make it the command's single document; the accept response is
  still validated, so a non-JSON 2xx stays a mutation error.
- A 200 without `connectorView.connector` was read as "no status yet" and
  polled to the full `--wait-timeout`. It now exits 6 at once. A connector
  that has never synced (no `.status`) is still waited on, which is what the
  empty `completedAt` baseline exists for.
- A terminal `SYNC_STATUS_ERROR` with an empty `lastError` is a failure too;
  `errorKind` cannot stand in for it (a clean DONE carries
  `ERROR_KIND_UNSPECIFIED`).
- A failure writing the final status now reports `applied: true`, like every
  other post-write failure.
- Docs state the single-document output, the exit-6 case and the ERROR
  status; a stray blank line in the CHANGELOG list is gone.

Co-authored-by: c1-squire-dev[bot] <c1-squire-dev[bot]@users.noreply.github.com>
Live on the dev tenant: a connector created with an empty config stays
SYNC_STATUS_DONE with null timestamps (its syncs record NOT_CONNECTED), and a
connector whose syncs the server refuses stays RUNNING with a lastError and no
completion time. Neither advances .status.completedAt, so --wait cannot tell
them from a sync that has not started yet: it reports them at the timeout,
with "connectors get" showing why. Say that in the help and both docs, and pin
that a DONE-without-timestamp status keeps waiting instead of ending the wait
(ending it would abort a wait whose connector was configured a moment ago).

A never-synced connector does report .status (SYNC_STATUS_UNSPECIFIED with
null timestamps), so the help no longer claims it omits the object.

Co-authored-by: c1-squire-dev[bot] <c1-squire-dev[bot]@users.noreply.github.com>
- README: re-wrap the paragraph the last edit left long.
- Wait comment: say what actually makes the wait end at the timeout -- a
  status whose completedAt never advances looks the same at every poll -- and
  cover the refused/RUNNING case the docs describe.
- Test: pin the live creation shape (SYNC_STATUS_UNSPECIFIED with null
  timestamps) ending on the sync whose completedAt advances. The docs claim
  both that shape and an omitted .status; only omission was pinned.

Co-authored-by: c1-squire-dev[bot] <c1-squire-dev[bot]@users.noreply.github.com>
@leet-c1
leet-c1 marked this pull request as ready for review November 19, 2026 21:16
@leet-c1
leet-c1 merged commit 35b7107 into main Nov 19, 2026
2 checks passed
@leet-c1
leet-c1 deleted the feat/connectors-sync-wait branch November 19, 2026 21:38
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.

3 participants