Skip to content

Fix sync server#3463

Merged
Herklos merged 7 commits into
node_statefrom
fix/sync-server
May 16, 2026
Merged

Fix sync server#3463
Herklos merged 7 commits into
node_statefrom
fix/sync-server

Conversation

@Herklos
Copy link
Copy Markdown
Contributor

@Herklos Herklos commented May 16, 2026

No description provided.

Herklos added 2 commits May 16, 2026 22:18
Signed-off-by: Herklos <herklos@drakkar.software>
Signed-off-by: Herklos <herklos@drakkar.software>
@Herklos Herklos self-assigned this May 16, 2026
@Herklos Herklos requested a review from GuillaumeDSM as a code owner May 16, 2026 20:21
Herklos and others added 4 commits May 16, 2026 22:34
Default sync collections now use encryption=delegated so the protocol
bridge in octobot_sync.server is the sole encryption layer. With
encryption=identity, EncryptedObjectStore wrapped the bridge and tried
to AES-GCM-decrypt the bridge's wallet-PK ciphertext with an unrelated
HKDF key — InvalidTag.

to_protocol_automations_state now skips tasks that fail to parse
instead of bubbling the exception. One malformed task no longer kills
the entire /pull/users/{addr}/data response. Skipped tasks are logged
with content_metadata and a content preview for diagnosis.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
starfish_server.protocol.pull expects raw store output to be a
StoredDocument-shaped JSON ({"v","data","timestamps","hash"}), but
octobot_sync.server returned the wallet-encrypted blob directly,
producing a KeyError: 'v' on every pull.

server.get_data now wraps its output via _wrap_as_stored_document; the
hash is sha256(plaintext) so it stays stable across pulls (AES-GCM uses
a random nonce, so hashing the ciphertext would change every call and
break ETag/304 caching). server.put_data unwraps incoming bodies via
_unwrap_stored_document_data before decrypting.

The hash helper lives in octobot_sync.crypto as sha256_hex.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Default `generate:typescript` now emits a lightweight `schema.d.ts` via
openapi-typescript. The previous openapi-generator-cli flow remains
available as `generate:typescript:java` for callers that still need the
full typed-fetch client, and the npm package identity is moved to
`@drakkar.software/octobot-protocol` so the two variants don't collide
on the same scope.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Module-level `logger` in packages/node/octobot_node/protocol/automations.py
matches the surrounding packages/node convention
(scheduler/workflows_util.py, scheduler/api.py, scheduler/task_context.py
all bind `logger` at module load) instead of the lazy `_get_logger()`
factory pattern that lives in packages/sync.

octobot_sync.server._wrap_as_stored_document now reuses
starfish_server.protocol.types.DOCUMENT_VERSION for the wire `v` field
instead of a magic literal.

Collections without an explicit protocol-bridge case (everything except
user-data, user-accounts, user-actions — so user-settings, user-strategies,
and anything added later) now fall through to opaque filesystem storage in
user/sync/data. Server persists the client ciphertext as-is on push and
returns it verbatim on pull; wallet-key decryption stays entirely on the
client. Replaces the previous "unsupported collection" error log.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Herklos Herklos force-pushed the fix/sync-server branch from 94046c0 to 558ef8a Compare May 16, 2026 20:55
Comment thread packages/protocol/package.json Outdated
Comment on lines +10 to +11
"generate:typescript": "openapi-typescript openapi.json -o octobot_protocol_ts/schema.d.ts",
"generate:typescript:java": "node scripts/clean-protocol-codegen-output.mjs typescript && openapi-generator-cli generate -i openapi.json -g typescript-fetch -o octobot_protocol_ts --global-property models --additional-properties supportsES6=true,typescriptThreePlus=true,npmName=@drakkar.software/octobot-protocol,npmVersion=0.1.0,useOneOfDiscriminatorLookup=true",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need 2 commands for generate:typescript?

Switches `generate:typescript` back to the Java-based openapi-generator-cli,
but uses the plain `typescript` generator instead of `typescript-fetch` so
no fetch client / runtime is emitted — only model interfaces. Drops the
`typescript-fetch`-specific `typescriptThreePlus` flag and removes the
short-lived `openapi-typescript` JS path along with its lockfile entries.
The clean-codegen script now preserves the hand-written npm wrapper files
(`package.json`, `index.js`, `index.d.ts`) under `octobot_protocol_ts/` so
they survive the pre-codegen wipe.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Member

@GuillaumeDSM GuillaumeDSM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks !👍

@Herklos Herklos merged commit 20249fd into node_state May 16, 2026
16 checks passed
@Herklos Herklos deleted the fix/sync-server branch May 16, 2026 21:21
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.

2 participants