feat(photon): add native poll sending - #43665
Conversation
|
Local verification from fork branch: |
teknium1
left a comment
There was a problem hiding this comment.
Thanks for adding the Photon-sidecar primitive. The feature premise is still valid: current main documents polls as supported by spectrum-ts but not exposed (plugins/platforms/photon/README.md:156).
Problems
plugins/platforms/photon/adapter.py:758addssend_poll(), but the gateway's current interaction path callssend_clarify()(gateway/run.py:18493). Repository-wide search finds no Photon caller forsend_poll; the analogous WhatsApp implementation calls its primitive fromsend_clarify()(plugins/platforms/whatsapp/adapter.py:1048). As written, users cannot trigger the new route, so the README/docs support claims overstate the delivered behavior.- The tests mock
_sidecar_calland exercise the private primitive directly; they do not cover a reachable user flow or a returned poll vote. The maintainer cross-reference on #48194 identifies these missing outbound-clarify and inbound-poll_optionlayers.
Suggested changes
- Reconcile with #48194: wire suitable multiple-choice
send_clarify()calls through the route, translate inbound selectedpoll_optionevents into the existing clarify resolution path, and retain the numbered-text fallback. - Add end-to-end adapter/gateway-behavior coverage for send, selection, deselection, and fallback.
Automated hermes-sweeper review.
| @@ -758,6 +758,29 @@ async def send_animation( | |||
| chat_id, animation_url, caption, reply_to, metadata, | |||
There was a problem hiding this comment.
This transport primitive has no Photon caller in the current gateway flow: multiple-choice interaction is delivered through send_clarify() (gateway/run.py:18493), and repository search finds only WhatsApp invoking its analogous send_poll() from a send_clarify() override. Please wire a concrete user-facing path (with fallback and inbound vote handling) before documenting native polls as supported.
… clarify Follow-up to the #48194 pick: it was written before #43665 landed and re-added its own /send-poll sidecar route and poll import. Collapse the duplicates: - keep #43665's /send-poll route (>=2 trimmed string options) as the single sidecar implementation; drop #48194's variant - drop the duplicated poll import in the sidecar destructure - make adapter.send_poll() a thin wrapper over _sidecar_send_poll(), the one /send-poll client (shared with the poll-backed clarify path), and align its validation to the sidecar's >=2-options contract
… clarify Follow-up to the #48194 pick: it was written before #43665 landed and re-added its own /send-poll sidecar route and poll import. Collapse the duplicates: - keep #43665's /send-poll route (>=2 trimmed string options) as the single sidecar implementation; drop #48194's variant - drop the duplicated poll import in the sidecar destructure - make adapter.send_poll() a thin wrapper over _sidecar_send_poll(), the one /send-poll client (shared with the poll-backed clarify path), and align its validation to the sidecar's >=2-options contract
… clarify Follow-up to the #48194 pick: it was written before #43665 landed and re-added its own /send-poll sidecar route and poll import. Collapse the duplicates: - keep #43665's /send-poll route (>=2 trimmed string options) as the single sidecar implementation; drop #48194's variant - drop the duplicated poll import in the sidecar destructure - make adapter.send_poll() a thin wrapper over _sidecar_send_poll(), the one /send-poll client (shared with the poll-backed clarify path), and align its validation to the sidecar's >=2-options contract
… clarify Follow-up to the #48194 pick: it was written before #43665 landed and re-added its own /send-poll sidecar route and poll import. Collapse the duplicates: - keep #43665's /send-poll route (>=2 trimmed string options) as the single sidecar implementation; drop #48194's variant - drop the duplicated poll import in the sidecar destructure - make adapter.send_poll() a thin wrapper over _sidecar_send_poll(), the one /send-poll client (shared with the poll-backed clarify path), and align its validation to the sidecar's >=2-options contract
|
Merged via #73614 — cherry-picked with authorship preserved. First in the train as the /send-poll primitive. |
for poll clarify Follow-up to the NousResearch#48194 pick: it was written before NousResearch#43665 landed and re-added its own /send-poll sidecar route and poll import. Collapse the duplicates: - keep NousResearch#43665's /send-poll route (>=2 trimmed string options) as the single sidecar implementation; drop NousResearch#48194's variant - drop the duplicated poll import in the sidecar destructure - make adapter.send_poll() a thin wrapper over _sidecar_send_poll(), the one /send-poll client (shared with the poll-backed clarify path), and align its validation to the sidecar's >=2-options contract
for poll clarify Follow-up to the NousResearch#48194 pick: it was written before NousResearch#43665 landed and re-added its own /send-poll sidecar route and poll import. Collapse the duplicates: - keep NousResearch#43665's /send-poll route (>=2 trimmed string options) as the single sidecar implementation; drop NousResearch#48194's variant - drop the duplicated poll import in the sidecar destructure - make adapter.send_poll() a thin wrapper over _sidecar_send_poll(), the one /send-poll client (shared with the poll-backed clarify path), and align its validation to the sidecar's >=2-options contract
Summary
/send-pollendpoint backed byspectrum-ts' nativepoll(...)builderPhotonAdapter.send_poll(...)with basic option validationWhy
spectrum-tsalready supports native iMessage polls, and Hermes' Photon docs identified polls as a natural sidecar-level feature. This exposes the smallest useful slice without adding a new model tool or changing the generic tool schema.Verification
node --check plugins/platforms/photon/sidecar/index.mjsvenv/bin/python -m pytest tests/plugins/platforms/photon/test_outbound_media.py -q -o 'addopts='→ 10 passedvenv/bin/python -m pytest tests/plugins/platforms/photon -q -o 'addopts='→ 68 passed