Skip to content

docs: update encryption examples for central docs site #79

Merged
quettabit merged 1 commit into
mainfrom
qb/encryp-docs
Jun 23, 2026
Merged

docs: update encryption examples for central docs site #79
quettabit merged 1 commit into
mainfrom
qb/encryp-docs

Conversation

@quettabit

Copy link
Copy Markdown
Member

No description provided.

@quettabit quettabit requested a review from a team as a code owner June 23, 2026 22:35
@greptile-apps

greptile-apps Bot commented Jun 23, 2026

Copy link
Copy Markdown

Greptile Summary

This PR cleans up examples/docs/encryption.py for extraction by the central docs build script, replacing the broad try/except Exception: pass guards with cleaner patterns and restructuring the anchor blocks to match the TypeScript SDK example.

  • The silent exception swallow around create_stream is replaced with the idempotent basin.ensure_stream(stream_name), which is the correct SDK primitive for this use-case.
  • basin and stream_name are moved after the # ANCHOR: basin-cipher block, so the extracted doc snippet stays clean and matches the structure of the equivalent TypeScript example.

Confidence Score: 5/5

Safe to merge — the change is a docs example cleanup with no logic shared across the SDK itself.

The only outstanding concern (bare create_basin lacking idempotency) was already raised in a prior review thread, acknowledged by the team as a cross-example audit to be done separately, and is therefore out of scope for this PR. The stream-creation path is now correctly idempotent via ensure_stream, and the anchor block structure aligns with the TypeScript SDK example.

No files require special attention.

Important Files Changed

Filename Overview
examples/docs/encryption.py Replaces swallowed-exception pattern for stream creation with the idempotent ensure_stream; removes equivalent guard from create_basin (pre-existing concern tracked separately); reorganises basin/stream_name declarations to sit outside the doc anchor block.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
    participant Script
    participant S2Client
    participant Basin

    Script->>S2Client: create_basin(basin_name, AEGIS_256)
    Note over Script,S2Client: ANCHOR: basin-cipher
    S2Client-->>Script: basin created

    Script->>S2Client: reconfigure_basin(basin_name, AES_256_GCM)
    S2Client-->>Script: reconfigured
    Note over Script,S2Client: ANCHOR_END: basin-cipher

    Script->>Basin: ensure_stream(stream_name)
    Basin-->>Script: stream ready (idempotent)

    Note over Script,Basin: ANCHOR: append-read
    Script->>Basin: stream.append([Record])
    Basin-->>Script: AppendAck

    Script->>Basin: "stream.read(SeqNum(0), count=10)"
    Basin-->>Script: batch
    Note over Script,Basin: ANCHOR_END: append-read

    Script->>Basin: delete_stream(stream_name)
    Basin-->>Script: deleted
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
    participant Script
    participant S2Client
    participant Basin

    Script->>S2Client: create_basin(basin_name, AEGIS_256)
    Note over Script,S2Client: ANCHOR: basin-cipher
    S2Client-->>Script: basin created

    Script->>S2Client: reconfigure_basin(basin_name, AES_256_GCM)
    S2Client-->>Script: reconfigured
    Note over Script,S2Client: ANCHOR_END: basin-cipher

    Script->>Basin: ensure_stream(stream_name)
    Basin-->>Script: stream ready (idempotent)

    Note over Script,Basin: ANCHOR: append-read
    Script->>Basin: stream.append([Record])
    Basin-->>Script: AppendAck

    Script->>Basin: "stream.read(SeqNum(0), count=10)"
    Basin-->>Script: batch
    Note over Script,Basin: ANCHOR_END: append-read

    Script->>Basin: delete_stream(stream_name)
    Basin-->>Script: deleted
Loading

Reviews (2): Last reviewed commit: "initial commit" | Re-trigger Greptile

Comment thread examples/docs/encryption.py
@quettabit

Copy link
Copy Markdown
Member Author

@greptileai address your comments. pls review again.

@quettabit quettabit merged commit 973f6b7 into main Jun 23, 2026
6 checks passed
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