Skip to content

feat(auth): add Python authentication facade - #3

Closed
swkeever wants to merge 37 commits into
mainfrom
skeever/vol-941-auth-parity
Closed

swkeever wants to merge 37 commits into
mainfrom
skeever/vol-941-auth-parity

Conversation

@swkeever

@swkeever swkeever commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • add immutable, redacted auth values and synchronized client session state
  • implement the full generated-transport-backed authentication facade, including lifecycle, account, OAuth provider, listener, anonymous, password-policy, RFC 8628 device, platform-exchange, and device-session operations
  • bind the shared VOL-941 authentication acceptance scenarios and document the public API
  • enforce deterministic quality gates with Ruff ALL, strict Mypy and Pyright, and low complexity and size limits in Pylint

Coordination

  • Jira: VOL-941
  • Depends on Kong/volcano-hosting#920 and the resulting generated contract refresh in chore(api): sync OpenAPI contract #2
  • Uses the shared branch name skeever/vol-941-auth-parity

Verification

  • repo-wide Ruff lint and format: zero findings
  • Mypy strict and Pyright strict: zero findings
  • Pylint complexity, branch, local, return, statement, and try-block limits
  • 126 unit tests
  • OpenAPI reproducibility check
  • strict Behave dry-run: 12 scenarios, 63 bound steps
  • source distribution and wheel build

@swkeever

Copy link
Copy Markdown
Collaborator Author

@codex review

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

Copy link
Copy Markdown

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: 8961e079ca

ℹ️ 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".

Comment thread src/volcano_sdk/auth.py Outdated
Comment thread src/volcano_sdk/auth.py
Comment thread src/volcano_sdk/auth.py Outdated
Comment thread docs/authentication.md Outdated
Comment thread src/volcano_sdk/auth.py Outdated
Comment thread src/volcano_sdk/auth.py
Comment thread src/volcano_sdk/_transport.py
@swkeever

Copy link
Copy Markdown
Collaborator Author

@codex review

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

Copy link
Copy Markdown

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: 5076d1ddf8

ℹ️ 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".

Comment thread src/volcano_sdk/auth.py Outdated
Comment thread docs/authentication.md Outdated
Comment thread pyproject.toml
Comment thread src/volcano_sdk/auth.py
@swkeever

Copy link
Copy Markdown
Collaborator Author

@codex review

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

Copy link
Copy Markdown

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: 2e0416e0c2

ℹ️ 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".

Comment thread src/volcano_sdk/auth.py Outdated
Comment thread src/volcano_sdk/auth.py Outdated
Comment thread src/volcano_sdk/client.py Outdated
Comment thread src/volcano_sdk/auth.py Outdated
Comment thread src/volcano_sdk/client.py
@swkeever

Copy link
Copy Markdown
Collaborator Author

@codex review

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

Copy link
Copy Markdown

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: b1b64d8ae7

ℹ️ 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".

Comment thread src/volcano_sdk/auth.py
Comment thread src/volcano_sdk/auth.py Outdated
Comment thread src/volcano_sdk/auth.py
Comment thread src/volcano_sdk/client.py Outdated
@swkeever

Copy link
Copy Markdown
Collaborator Author

@codex review

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

Copy link
Copy Markdown

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: 8ba1ceb57a

ℹ️ 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".

Comment thread src/volcano_sdk/auth.py Outdated
Comment thread src/volcano_sdk/auth.py Outdated
Comment thread src/volcano_sdk/_transport.py Outdated
Comment thread src/volcano_sdk/models.py Outdated
Comment thread src/volcano_sdk/auth.py Outdated
@swkeever

Copy link
Copy Markdown
Collaborator Author

@codex review

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

Copy link
Copy Markdown

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: ee8c528528

ℹ️ 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".

Comment thread src/volcano_sdk/realtime.py Outdated
Comment thread src/volcano_sdk/auth.py Outdated
Comment thread src/volcano_sdk/auth.py Outdated
Comment thread src/volcano_sdk/client.py Outdated
Comment thread src/volcano_sdk/auth.py Outdated
@swkeever

Copy link
Copy Markdown
Collaborator Author

@codex review

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

Copy link
Copy Markdown

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: 7cdeda3c75

ℹ️ 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".

Comment thread src/volcano_sdk/realtime.py Outdated
Comment thread src/volcano_sdk/auth.py Outdated
Comment thread src/volcano_sdk/auth.py Outdated
Comment thread src/volcano_sdk/models.py Outdated
@swkeever

Copy link
Copy Markdown
Collaborator Author

@codex review

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

Copy link
Copy Markdown

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: c1c0aee683

ℹ️ 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".

Comment thread src/volcano_sdk/models.py
Comment thread src/volcano_sdk/realtime.py Outdated
Comment thread src/volcano_sdk/auth.py Outdated
Comment thread features/steps/sdk_contract_steps.py
Comment thread src/volcano_sdk/realtime.py
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 28, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-08-28T23:55:47.541748Z 3a9cbc0 Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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

Copy link
Copy Markdown

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: 2ce360e8f4

ℹ️ 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".

Comment thread src/volcano_sdk/realtime.py Outdated
@swkeever

Copy link
Copy Markdown
Collaborator Author

@codex review

@swkeever

Copy link
Copy Markdown
Collaborator Author

@codex review

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

Copy link
Copy Markdown

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: cb49343c2e

ℹ️ 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".

Comment thread src/volcano_sdk/auth.py Outdated
Comment thread src/volcano_sdk/auth.py Outdated
Comment thread src/volcano_sdk/realtime.py Outdated
@swkeever

Copy link
Copy Markdown
Collaborator Author

@codex review

@swkeever

Copy link
Copy Markdown
Collaborator Author

@codex review

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

Copy link
Copy Markdown

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: c92c2e6005

ℹ️ 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".

Comment thread src/volcano_sdk/realtime.py
Comment thread src/volcano_sdk/client.py Outdated
@swkeever

Copy link
Copy Markdown
Collaborator Author

@codex review

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

Copy link
Copy Markdown

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: f501c6d231

ℹ️ 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".

Comment thread src/volcano_sdk/auth.py Outdated
Comment thread src/volcano_sdk/realtime.py Outdated
Comment thread src/volcano_sdk/realtime.py
@swkeever

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: dfaa12ac3e

ℹ️ 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".

@swkeever

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: 9c743df700

ℹ️ 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".

@swkeever

Copy link
Copy Markdown
Collaborator Author

@codex review

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

Copy link
Copy Markdown

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: dfb2a2b287

ℹ️ 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".

Comment thread src/volcano_sdk/auth.py Outdated
Comment thread src/volcano_sdk/auth.py Outdated
@swkeever

Copy link
Copy Markdown
Collaborator Author

@codex review

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

Copy link
Copy Markdown

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: 3a9cbc065e

ℹ️ 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".

Comment thread src/volcano_sdk/auth.py
Comment on lines +695 to +698
message = payload.get("message")
response_email = payload.get("new_email")
if not isinstance(message, str) or not isinstance(response_email, str):
raise AuthenticationError(_INVALID_AUTH_RESPONSE)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Accept omitted email-change acknowledgement fields

When auth_request_email_change returns a schema-conforming 200 that omits message or new_email, this check raises AuthenticationError; both properties are optional in openapi/openapi.yaml:5774-5784, and the generated model represents them with UNSET. Use the caller-supplied new_email as the fallback and make the acknowledgement message optional, as with the other acknowledgement endpoints.

Useful? React with 👍 / 👎.

Comment thread src/volcano_sdk/auth.py
Comment on lines +713 to +714
response = _mapping(payload)
self._client._set_user(_user(_mapping(response.get("user"))))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reconcile confirmation responses that omit the user

When a successful email-change confirmation omits the optional user property, as permitted by openapi/openapi.yaml:5837-5847, _mapping(None) raises AuthenticationError even though the mutation succeeded. Route this response through the existing user-reconciliation path so an omitted user triggers hydration rather than turning a valid 200 into a failure.

Useful? React with 👍 / 👎.

Comment thread src/volcano_sdk/auth.py
Comment on lines +998 to +1000
sessions_value = payload.get("sessions", payload.get("data"))
if not isinstance(sessions_value, list):
raise AuthenticationError(_INVALID_AUTH_RESPONSE)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Treat an omitted session collection as empty

When the session-list endpoint returns {}, this raises AuthenticationError even though the 200 response schema declares both sessions and cursor-mode data optional at openapi/openapi.yaml:6002-6033, and the generated response model accepts that payload. Default an absent collection to an empty list so a schema-conforming empty page produces SessionPage(sessions=()).

Useful? React with 👍 / 👎.

Comment thread src/volcano_sdk/auth.py
Comment on lines +139 to +140
def _optional_int(value: object) -> int | None:
return value if isinstance(value, int) else None

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Exclude booleans from optional integer fields

When a malformed or version-skewed response supplies true for expires_in or a pagination count, isinstance(True, int) succeeds and the SDK exposes True through fields declared as int | None; consumers may consequently interpret an expiry as one second or corrupt pagination calculations. Match _required_int() by checking the exact int type so JSON booleans are not accepted as numeric values.

Useful? React with 👍 / 👎.

Comment thread src/volcano_sdk/auth.py
Comment on lines +284 to +285
identity_id=_required_text(payload, "identity_id"),
email=_required_text(payload, "email"),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Allow empty identity fields for anonymous methods

When list_methods() includes an active anonymous method, these _required_text() calls reject its identity_id and email because that helper forbids empty strings. The AuthMethodSummary contract explicitly requires both fields while specifying that they are empty for anonymous methods at openapi/openapi.yaml:10562-10569, so listing methods for an anonymous account fails with AuthenticationError; validate presence and type here while allowing empty values for the anonymous method type.

Useful? React with 👍 / 👎.

Comment thread src/volcano_sdk/client.py
Comment on lines +144 to +145
listeners = self._queue_auth_notifications()
self.realtime.on_auth_change()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Advance realtime generation atomically with auth state

When an auth change runs on a worker thread, another thread can observe the new current_session after _auth_state_lock is released here but before on_auth_change() advances the realtime generation; an event-loop task in that window passes the old generation checks and can complete a publish through the previous user's socket. Fresh evidence beyond the resolved generation-fencing findings is this state-commit ordering gap: advance the realtime fence while the auth-state commit is still serialized, and apply the same ordering to _clear_auth().

Useful? React with 👍 / 👎.

@swkeever

Copy link
Copy Markdown
Collaborator Author

Superseded by smaller, independently reviewable authentication slices. The branch will remain available as implementation reference.

@swkeever swkeever closed this Aug 29, 2026
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