Skip to content

feat(types): add CxOne stubs so conv.cxone resolves in projects - #296

Open
JaySonani wants to merge 1 commit into
mainfrom
jay/cxone-handoff/type-stubs
Open

feat(types): add CxOne stubs so conv.cxone resolves in projects#296
JaySonani wants to merge 1 commit into
mainfrom
jay/cxone-handoff/type-stubs

Conversation

@JaySonani

Copy link
Copy Markdown

Summary

Companion to genai_lambda_runtime#116, which adds conv.cxone for NICE CXone Signal API handoffs. Without these stubs conv.cxone doesn't exist in _gen, so builders get no autocomplete and a project function that catches CxOneSignalError fails its local tests.

Adds cxone.py to STUB_FILES, the generated src/poly/types/cxone.py, and the cxone property on the Conversation stub.

Deliberately not a full resync

Scoped to the CXone delta rather than running sync_runtime_stubs.py wholesale, because a full resync is currently broken:

STUB_FILES is missing clock.py, knowledge_base.py and verified_context.py, but the current runtime conversation.py imports all three. A full run therefore emits a conversation.py stub importing three modules that never get generated — the resulting _gen package raises ModuleNotFoundError on import, which would break every project. That's pre-existing and worth fixing, but not in a CXone change. Happy to raise it separately.

(A full run also picks up genuine additive drift that's accumulated since the last sync — AgenticDial.unsubscribe_from_destination, XaiVoice/GradiumVoice, BackgroundTrack, Attachment.chart_spec, EntityValidationResult.details, new prompt_llm models. All safe, all missing from the committed stubs, all better handled in a dedicated resync PR once the three missing modules are added.)

Circular-import note

runtime/cxone.py deliberately does not import Conversation, not even under TYPE_CHECKING. The generator promotes TYPE_CHECKING imports to unconditional ones, and conversation.py imports CxOne, so the pair would be circular and _gen unimportable. flow.py uses the same annotate-against-Conversation pattern safely only because nothing imports flow back. There's a comment on the runtime side so nobody re-adds it.

Testing

  • Verified the generated package actually imports and resolves, rather than just eyeballing the stub:
    _gen imported OK
    CxOne exports: ['CxOne', 'CxOneError', 'CxOneMissingContactId', 'CxOneSecretError', 'CxOneSignalError', 'CxOneTokenError']
    Conversation.cxone is a property: True
    CxOne attrs: ['handoff', 'signal', 'contact_id', 'default_secret_name']
    cxone -> return annotation: <class '_gen.cxone.CxOne'>
    
  • 1352 passed, 112 subtests passed
  • ruff check / ruff format --check clean

Ticket

https://poly-ai.atlassian.net/browse/HSP-16548

🤖 Generated with Claude Code

Companion to genai_lambda_runtime#116, which adds conv.cxone for NICE
CXone Signal API handoffs. Without these stubs conv.cxone doesn't exist
in _gen and builders get no autocomplete for it.

Scoped deliberately to the CXone delta rather than a full resync. A full
`sync_runtime_stubs.py` run currently also regenerates conversation.py
with imports of clock, knowledge_base and verified_context -- none of
which are in STUB_FILES, so none of which get generated. The resulting
_gen package fails to import, which would break every project. That is a
pre-existing gap, not one to fix in a CXone change.

Note cxone.py deliberately does not import Conversation, not even under
TYPE_CHECKING: the generator promotes TYPE_CHECKING imports to
unconditional ones, and conversation.py imports CxOne, so the pair would
be circular and _gen unimportable. flow.py gets away with the same
pattern only because nothing imports flow back.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@JaySonani
JaySonani requested a review from a team August 28, 2026 14:18
@github-actions

Copy link
Copy Markdown
Contributor

Coverage Report

Base (main) PR Change
76.5% 76.5% ±0.0% ➡️

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