Skip to content

Comments

Rebuild Python SDK to production-quality parity with TypeScript SDK#8

Merged
GsCommand merged 1 commit intomainfrom
codex/update-ens-txt-parsing-and-verification-logic-qe5n9p
Feb 15, 2026
Merged

Rebuild Python SDK to production-quality parity with TypeScript SDK#8
GsCommand merged 1 commit intomainfrom
codex/update-ens-txt-parsing-and-verification-logic-qe5n9p

Conversation

@GsCommand
Copy link
Contributor

Motivation

  • Replace the unreliable previous Python SDK with a production-quality implementation that mirrors the TypeScript SDK's structure, typing, and verification semantics.
  • Provide a clear, typed client API with consistent errors and optional automatic receipt verification for safer production use.
  • Implement a deterministic, secure ENS signer-key resolution flow (two-hop TXT lookup) and robust canonicalization / signature verification to make receipt verification reliable and debuggable.

Description

  • Introduced a typed public surface and models in commandlayer/types.py and a consistent CommandLayerError in commandlayer/errors.py.
  • Implemented a synchronous CommandLayerClient in commandlayer/client.py with constructor options (runtime, actor, timeout_ms, headers, retries, verify_receipts, verify), convenient verb helpers, generic call, retry-aware transport, and receipt verification hooks using the verification module.
  • Rewrote verification logic in commandlayer/verify.py to include deterministic canonicalize_stable_json_v1, recompute_receipt_hash_sha256, parse_ed25519_pubkey, verify_ed25519_signature_over_utf8_hash_string, and deterministic ENS two-hop signer-key resolution via cl.receipt.signer -> cl.sig.pub + cl.sig.kid with clear, actionable errors and a SignerKeyResolution return type.
  • Exported the refined API and utilities from commandlayer/__init__.py, added pyproject.toml for packaging and dev tooling, and added docs (README.md, docs/*) that mirror the TS SDK guidance and examples.
  • Added and expanded tests (tests/test_client.py, tests/test_verify.py, tests/test_public_api.py) to cover client request flow, error propagation, explicit and ENS-based verification, two-hop ENS resolution, and canonicalization/signature validation.

Testing

  • Ran linter and formatter: ruff check . which reported no issues after formatting, and ruff format . was applied when needed (passed).
  • Static typing: mypy commandlayer completed with no errors.
  • Unit tests: pytest -q ran the test suite and all tests passed (no failures, test run showed 100% success).
  • Packaging: attempted python -m build failed in this environment because the build helper module is not installed and pip install build was blocked by network/proxy restrictions, so the sdist/wheel build could not be executed here.

Codex Task

@GsCommand GsCommand merged commit f4b38b6 into main Feb 15, 2026
8 checks passed
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ba1d7d4bae

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

if v == 0.0 and str(v).startswith("-"):
return "0"
return format(v, "g") if isinstance(v, float) else str(v)
return str(v)

Choose a reason for hiding this comment

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

P1 Badge Format floats using JS-compatible canonical encoding

Using str(v) for numeric canonicalization diverges from the TypeScript/runtime behavior (String(v)), e.g. a float like 1.0 canonicalizes to "1.0" here but "1" in TS. That changes the canonical payload and hash, so Python can reject otherwise valid signed receipts whenever unsigned receipt fields include integral float values (or other JS/Python stringification mismatches), causing false verification failures.

Useful? React with 👍 / 👎.

@GsCommand GsCommand deleted the codex/update-ens-txt-parsing-and-verification-logic-qe5n9p branch February 15, 2026 23:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant