Skip to content

feat(cloud): cleo cloud sync - seal, push, pull and apply each attached stream (T12996) - #1962

Open
kryptobaseddev wants to merge 5 commits into
feat/T12343-pullfrom
feat/T12996-cloud-sync
Open

kryptobaseddev wants to merge 5 commits into
feat/T12343-pullfrom
feat/T12996-cloud-sync

Conversation

@kryptobaseddev

Copy link
Copy Markdown
Owner

Task: T12996 (C-1 core; the two-device AC lands with the T12999 JOIN, as proposed to team-lead)

Stacked on #1959. sync.push and sync.pull stay unreleased: the CLI never opts in.

What

cloudSync(opts) (cloud/nexus-vault.ts) runs, for each attached stream (the project's and the account's global store, or the one --scope names), pushSyncStream then pullSyncStream, and returns one CloudSyncResult.

  • Per stream:
    • a status: synced; disabled (both flags off); paused (clock ahead); not-attached (E_NEXUS_VAULT_NOT_LINKED / E_NEXUS_NOT_A_PROJECT); or refused, with the reason;
    • the counts: sealed, built, sent, duplicates, received, staged, redelivered, applied, held (pending + held-skew + refused-schema) and conflicts;
    • the staged position against the server's head.
  • E_SYNC_DISABLED (a new code), with the fix cleo sync enable push, is returned when no attached stream did work and at least one is disabled.
  • pullSyncStream now looks for a pull position only when sync.pull is on, so a store with pull off reports disabled instead of "no position".

CLI: cleo cloud sync [--scope project|global] [--api-url] gives one envelope and a one-line summary per stream.

Contracts: CloudSyncResult, CloudSyncStreamResult, and E_SYNC_DISABLED in NEXUS_ACCOUNT_ERROR_CODES.

T12996 ACs

Tests

nexus-vault.test.ts, "C-1", against the fake server:

  1. One cloudSync seals, pushes, pulls and applies: synced, sent 1, received 1, applied 1, after equal to head. A rerun does nothing.
  2. Interrupted: a segment upload is refused, so the call rejects; the rerun sends the same segment (built 0, sent 1), receives and applies it once. One inbox row, one task.
  3. Flags off: E_SYNC_DISABLED, with cleo sync enable push in the fix.

CLI (nexus-vault-cli.test.ts): the API URL passes through, and a scope is passed only when one is given.

Mutations (3, all killed): the E_SYNC_DISABLED refusal dropped, the pull flag check before the position dropped, sent misreported.

Checks

  • typecheck: contracts, core, and cleo (against a rebuilt core dist);
  • tests: nexus-vault "C-1|S5-1" and nexus-vault-cli (37/37);
  • biome on the changed set;
  • gates 28, 36, 40, 4, contracts purity, generated drift, 1 and 6 (baseline), and 38 --base origin/feat/T12343-pull;
  • skill coverage and lint-changesets.

🤖 Generated with Claude Code

kryptobaseddev and others added 3 commits October 6, 2026 19:11
…ed stream (T12996)

cloudSync (cloud/nexus-vault.ts) runs pushSyncStream then pullSyncStream
for each attached stream (the project's and the account's global store,
or the one --scope names) and returns one CloudSyncResult: per stream a
status (synced, disabled, paused, not-attached, refused) and sealed,
sent, received, staged, applied, held and conflict counts with the staged
position against the server's head. E_SYNC_DISABLED names `cleo sync
enable push` when no attached stream has a journal flag on; pull now
refuses on sync.pull before it looks for a position. An interrupted run
resumes without sending or applying anything twice.

`cleo cloud sync [--scope]` is the CLI verb.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts:
#	packages/core/src/cloud/__tests__/nexus-vault.test.ts
#	packages/core/src/cloud/nexus-vault.ts
…le legs (T12996 review)

review-hotfix LOWs on #1962:
- LOW-1: any error on a stream is reported on that stream (status
  'failed', with its code), never thrown, so the next stream still syncs.
- LOW-2: one connection and one account-key unlock serve every stream of
  a run (push and pull take a shared session) instead of five connects
  and four keychain reads.
- LOW-3: a flag off, or push before this store has its own genesis, is
  reported in `skipped`, not as `refused`, so a store that only pulls
  shows synced.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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