Skip to content

chore: encryption example for gen docs#40

Merged
infiniteregrets merged 3 commits intomainfrom
m/encryption-examples
Apr 24, 2026
Merged

chore: encryption example for gen docs#40
infiniteregrets merged 3 commits intomainfrom
m/encryption-examples

Conversation

@infiniteregrets
Copy link
Copy Markdown
Member

No description provided.

@infiniteregrets infiniteregrets requested a review from a team as a code owner April 24, 2026 15:50
@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Apr 24, 2026

Greptile Summary

This PR adds a new documentation example (examples/docs/encryption.py) demonstrating basin cipher configuration and encrypted append/read operations. However, the example imports and uses two symbols — EncryptionKey and EncryptionAlgorithm — that do not exist in the s2_sdk package, causing the script to fail with ImportError immediately on startup.

  • EncryptionAlgorithm should be Encryption (the enum already in _types.py with .AEGIS_256 / .AES_256_GCM values).
  • EncryptionKey(...) is not a type; the encryption key should be passed as a plain str or bytes directly to the encryption_key keyword argument of basin.stream().

Confidence Score: 4/5

Not safe to merge as-is — the example fails with ImportError on startup due to non-existent SDK symbols.

Three P1 findings: EncryptionKey and EncryptionAlgorithm are both imported and used but do not exist anywhere in the s2_sdk package. The script raises ImportError before executing any logic. The correct types (Encryption enum, plain str/bytes key) already exist in the SDK. These must be fixed before the example is usable or can be embedded in generated docs.

examples/docs/encryption.py — all three P1 issues are concentrated here.

Important Files Changed

Filename Overview
examples/docs/encryption.py New documentation example for encryption — imports EncryptionKey and EncryptionAlgorithm which do not exist in s2_sdk; the correct types are plain str/bytes for the key and the Encryption enum for the algorithm. The script will raise ImportError on startup.
Prompt To Fix All With AI
This is a comment left during a code review.
Path: examples/docs/encryption.py
Line: 14-22

Comment:
**`EncryptionKey` and `EncryptionAlgorithm` don't exist in `s2_sdk`**

Both symbols are imported here but are absent from `s2_sdk/__init__.py` and `_types.py`. Running the script will raise `ImportError: cannot import name 'EncryptionKey' from 's2_sdk'` before any code executes. The correct equivalent types already in the SDK are: `Encryption` (the enum — with `.AEGIS_256` / `.AES_256_GCM` values) and plain `bytes | str` for the key value passed directly to `basin.stream()`.

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: examples/docs/encryption.py
Line: 36-44

Comment:
**`EncryptionAlgorithm` referenced but should be `Encryption`**

`EncryptionAlgorithm.AEGIS_256` and `EncryptionAlgorithm.AES_256_GCM` will fail at runtime (the `ImportError` above is the first failure; this is what you'd fix next). The existing `Encryption` enum in `_types.py` already has `Encryption.AEGIS_256` and `Encryption.AES_256_GCM`; `BasinConfig.stream_cipher` is typed as `Encryption | None`.

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: examples/docs/encryption.py
Line: 57-59

Comment:
**`EncryptionKey(...)` wrapper doesn't exist — pass the key directly**

`S2Basin.stream()` accepts `encryption_key: bytes | str | None` as a plain parameter; there is no `EncryptionKey` wrapper class in the SDK. The value from the environment variable should be passed directly to the `encryption_key` keyword argument.

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "chore: encryption example for gen docs" | Re-trigger Greptile

Comment thread examples/docs/encryption.py
Comment thread examples/docs/encryption.py
Comment thread examples/docs/encryption.py Outdated
@infiniteregrets infiniteregrets merged commit b810b99 into main Apr 24, 2026
5 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