Skip to content

Structure missing-token authentication errors - #5

Draft
jshaw wants to merge 1 commit into
mainfrom
agent/structure-missing-token-error
Draft

Structure missing-token authentication errors#5
jshaw wants to merge 1 commit into
mainfrom
agent/structure-missing-token-error

Conversation

@jshaw

@jshaw jshaw commented Jul 26, 2026

Copy link
Copy Markdown
Member

What changed

  • raise a structured DataNetError when an HTTP-200 authentication response does not contain a non-empty JWT
  • preserve the authentication_failed code and HTTP status for callers
  • include the server-provided authentication detail when available
  • add regression coverage for the invalid-key response observed during serial-bridge testing
  • bump datanet-sdk and datanet.__version__ from 0.1.1 to 0.1.2
  • document the patch in the changelog

Why

The Python SDK already rejected missing-token responses, but it used a generic RuntimeError. The equivalent JavaScript fix now returns a structured authentication error, so Python should expose the same predictable error contract for applications, examples, and diagnostics.

Developer impact

Code catching DataNetError can now handle this malformed authentication response using error.code == "authentication_failed" and inspect error.status. Valid authentication behavior is unchanged.

Validation

  • .venv/bin/python -m pytest — 27 tests passed
  • .venv/bin/python -m ruff check .
  • .venv/bin/python -m build
  • built datanet_sdk-0.1.2.tar.gz
  • built datanet_sdk-0.1.2-py3-none-any.whl
  • staged credential scan
  • git diff --check

Publication

This PR prepares version 0.1.2 but does not upload anything to PyPI or create a Git tag/release.

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