refactor: remove redundant comments and docstrings (#6527)
* refactor: remove redundant comments and docstrings * fix(signal): annotate async context manager as a generator
This commit is contained in:
1 parent
cb3ba45317
commit
a4d2430140
922 files changed
+406
-7738
No files matched your search
@@ -1 +0,0 @@
|
||||
"""WhatsApp Agent Platform channel package."""
|
||||
@@ -1,5 +1,3 @@
|
||||
"""WhatsApp Agent Platform management contract."""
|
||||
|
||||
from nanobot.channels._manifest import field, required
|
||||
from nanobot.channels.contracts import ChannelSetupSpec
|
||||
from nanobot.channels.plugin import ChannelPlugin
|
||||
|
||||
@@ -47,20 +47,16 @@ MEDIA_LIMITS = {
|
||||
}
|
||||
|
||||
ACCEPTED_UPLOAD_MIME = {
|
||||
# image
|
||||
"image/jpeg",
|
||||
"image/png",
|
||||
# video
|
||||
"video/mp4",
|
||||
"video/3gpp",
|
||||
# audio
|
||||
"audio/aac",
|
||||
"audio/mp4",
|
||||
"audio/mpeg",
|
||||
"audio/amr",
|
||||
"audio/ogg",
|
||||
"audio/opus",
|
||||
# document
|
||||
"application/pdf",
|
||||
"text/plain",
|
||||
"application/msword",
|
||||
@@ -69,9 +65,7 @@ ACCEPTED_UPLOAD_MIME = {
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
||||
"application/vnd.ms-powerpoint",
|
||||
"application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
||||
# sticker
|
||||
"image/webp",
|
||||
# generic
|
||||
"application/octet-stream",
|
||||
}
|
||||
|
||||
@@ -447,7 +441,6 @@ def _normalize_kind(value: Any) -> MessageKind:
|
||||
|
||||
|
||||
def _as_dict(value: Any) -> dict[str, Any] | None:
|
||||
"""Narrow an untrusted JSON value to an object at the boundary."""
|
||||
if not isinstance(value, dict):
|
||||
return None
|
||||
return cast(dict[str, Any], value)
|
||||
|
||||
@@ -92,7 +92,6 @@ AUTH_FAILURE_MESSAGE = (
|
||||
"channels.whatsapp_agent.token."
|
||||
)
|
||||
|
||||
# Placeholders for media-only messages, matching other nanobot channels.
|
||||
_MEDIA_PLACEHOLDERS = {
|
||||
"image": "[image]",
|
||||
"video": "[video]",
|
||||
@@ -177,9 +176,6 @@ class WhatsAppAgentChannel(BaseChannel):
|
||||
self._typing_task: asyncio.Task[None] | None = None
|
||||
self._pending_sends: dict[int, _PendingSend] = {}
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# Transport helpers
|
||||
# ------------------------------------------------------------------
|
||||
|
||||
def progress_transport_defaults(self) -> tuple[bool, bool]:
|
||||
"""Keep progress traffic opt-in; each hint spends the send budget."""
|
||||
@@ -244,7 +240,6 @@ class WhatsAppAgentChannel(BaseChannel):
|
||||
files: dict[str, Any] | None = None,
|
||||
data: dict[str, Any] | None = None,
|
||||
) -> tuple[int, Any]:
|
||||
"""Perform one paced API request and decode a JSON body when present."""
|
||||
client = self._client
|
||||
if client is None:
|
||||
raise ChannelNotReadyError("WhatsApp Agent Platform channel is not connected")
|
||||
@@ -278,7 +273,6 @@ class WhatsAppAgentChannel(BaseChannel):
|
||||
files: dict[str, Any] | None = None,
|
||||
data: dict[str, Any] | None = None,
|
||||
) -> Any:
|
||||
"""Perform a request that must succeed, raising a classified error."""
|
||||
status_code, payload = await self._request(
|
||||
method,
|
||||
path,
|
||||
@@ -297,9 +291,6 @@ class WhatsAppAgentChannel(BaseChannel):
|
||||
raise WhatsAppAgentAuthError(str(error))
|
||||
raise WhatsAppAgentAPIError(error)
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# Durable state
|
||||
# ------------------------------------------------------------------
|
||||
|
||||
def _state_path(self) -> Path:
|
||||
configured = self.config.state_dir.strip()
|
||||
@@ -307,7 +298,6 @@ class WhatsAppAgentChannel(BaseChannel):
|
||||
return base / "state.json"
|
||||
|
||||
def _load_state(self) -> None:
|
||||
"""Load the cursor, resetting it when the token identifies a new agent."""
|
||||
path = self._state_path()
|
||||
self._state = WhatsAppAgentState.load(path)
|
||||
if self._state.reset_for_token(self.config.token):
|
||||
@@ -324,9 +314,6 @@ class WhatsAppAgentChannel(BaseChannel):
|
||||
# that cannot survive a restart (including the first-start boundary).
|
||||
self._state.save(self._state_path())
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# Lifecycle
|
||||
# ------------------------------------------------------------------
|
||||
|
||||
async def start(self) -> None:
|
||||
if not self.config.token.strip():
|
||||
@@ -384,7 +371,6 @@ class WhatsAppAgentChannel(BaseChannel):
|
||||
backoff: float,
|
||||
last_poll: float,
|
||||
) -> tuple[float, float]:
|
||||
"""Apply the documented recovery for a failed poll."""
|
||||
if error.poll_replaced:
|
||||
self.logger.error(
|
||||
"Another poller replaced this WhatsApp Agent poll (409). "
|
||||
@@ -413,12 +399,8 @@ class WhatsAppAgentChannel(BaseChannel):
|
||||
if client is not None:
|
||||
await client.aclose()
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# Polling
|
||||
# ------------------------------------------------------------------
|
||||
|
||||
async def _poll_once(self) -> PollBatch | None:
|
||||
"""Run one long poll. Returns None when the timeout elapsed empty."""
|
||||
if self._state.offset is None:
|
||||
# An offset-less 204 has no cursor. Repeating that request skips
|
||||
# traffic between polls. Start at the documented retained cursor
|
||||
@@ -447,7 +429,6 @@ class WhatsAppAgentChannel(BaseChannel):
|
||||
return parse_poll_batch(payload)
|
||||
|
||||
async def _process_batch(self, batch: PollBatch) -> None:
|
||||
"""Handle one batch in order, persisting progress as it goes."""
|
||||
for receipt in batch.statuses:
|
||||
self._state.note_status(receipt.wamid, receipt.status)
|
||||
|
||||
@@ -476,12 +457,8 @@ class WhatsAppAgentChannel(BaseChannel):
|
||||
self._state.accept_offset(batch.next_offset)
|
||||
self._persist()
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# Inbound handling
|
||||
# ------------------------------------------------------------------
|
||||
|
||||
async def _dispatch(self, message: PlatformMessage) -> None:
|
||||
"""Route one inbound message into the agent pipeline."""
|
||||
if message.kind == "reaction":
|
||||
# Reactions are receive-only on this platform and carry no reply.
|
||||
self.logger.debug(
|
||||
@@ -518,7 +495,6 @@ class WhatsAppAgentChannel(BaseChannel):
|
||||
)
|
||||
|
||||
async def _acknowledge(self, wamid: str) -> None:
|
||||
"""Mark read and start the typing indicator, best effort."""
|
||||
body: dict[str, Any] = {
|
||||
"messaging_product": "whatsapp",
|
||||
"status": "read",
|
||||
@@ -541,7 +517,6 @@ class WhatsAppAgentChannel(BaseChannel):
|
||||
self._start_typing(wamid)
|
||||
|
||||
def _start_typing(self, wamid: str) -> None:
|
||||
"""Refresh the typing indicator while the turn is running."""
|
||||
self._cancel_typing_task()
|
||||
|
||||
async def _refresh() -> None:
|
||||
@@ -582,7 +557,6 @@ class WhatsAppAgentChannel(BaseChannel):
|
||||
await task
|
||||
|
||||
async def _materialize(self, message: PlatformMessage) -> tuple[list[str], str]:
|
||||
"""Download attached media and build the agent-visible content."""
|
||||
caption = message.text or (message.media.caption if message.media else "")
|
||||
if message.media is None or not self.config.download_media:
|
||||
return [], caption
|
||||
@@ -609,12 +583,8 @@ class WhatsAppAgentChannel(BaseChannel):
|
||||
content = label
|
||||
return [str(path)], content
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# Media download
|
||||
# ------------------------------------------------------------------
|
||||
|
||||
async def _download_media(self, message: PlatformMessage) -> Path | None:
|
||||
"""Fetch inbound media bytes and store them under the media directory."""
|
||||
media = message.media
|
||||
if media is None:
|
||||
return None
|
||||
@@ -669,7 +639,6 @@ class WhatsAppAgentChannel(BaseChannel):
|
||||
return path
|
||||
|
||||
async def _fetch_media_bytes(self, url: str, limit: int) -> bytes:
|
||||
"""Download media bytes with the bearer token and a hard size cap."""
|
||||
client = self._client
|
||||
if client is None:
|
||||
raise RuntimeError("WhatsApp Agent Platform channel is not connected")
|
||||
@@ -720,12 +689,8 @@ class WhatsAppAgentChannel(BaseChannel):
|
||||
digest = hashlib.sha256(message.wamid.encode("utf-8")).hexdigest()[:12]
|
||||
return get_media_dir(self.name) / f"{name}-{digest}{suffix}"
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# Outbound
|
||||
# ------------------------------------------------------------------
|
||||
|
||||
def _recipient(self) -> str:
|
||||
"""Return the creator identifier the API accepts in ``to``."""
|
||||
if self._state.creator_id:
|
||||
return self._state.creator_id
|
||||
return ""
|
||||
@@ -736,7 +701,6 @@ class WhatsAppAgentChannel(BaseChannel):
|
||||
msg.event.notify or self.show_compaction_notices
|
||||
):
|
||||
return
|
||||
# ChannelManager already applies the progress/tool-hint opt-in policy.
|
||||
|
||||
to = self._recipient()
|
||||
if not to:
|
||||
@@ -800,7 +764,6 @@ class WhatsAppAgentChannel(BaseChannel):
|
||||
self._remember_sent(response)
|
||||
|
||||
def _remember_sent(self, response: Any) -> None:
|
||||
"""Record the outbound wamid that later receipts refer to."""
|
||||
if not isinstance(response, dict):
|
||||
return
|
||||
body = cast(dict[str, Any], response)
|
||||
@@ -815,7 +778,6 @@ class WhatsAppAgentChannel(BaseChannel):
|
||||
self._state.note_status(wamid, "sent")
|
||||
|
||||
async def _send_media(self, to: str, media_path: str) -> None:
|
||||
"""Upload a local file and send it as the matching message type."""
|
||||
path = Path(media_path).expanduser()
|
||||
if not path.is_file():
|
||||
self.logger.warning("Skipping missing WhatsApp Agent media: {}", media_path)
|
||||
|
||||
@@ -176,14 +176,12 @@ class WhatsAppAgentState:
|
||||
|
||||
|
||||
def _json_object(value: object) -> dict[str, Any] | None:
|
||||
"""Narrow decoded JSON to a string-keyed object."""
|
||||
if not isinstance(value, dict):
|
||||
return None
|
||||
return cast(dict[str, Any], value)
|
||||
|
||||
|
||||
def _string_map(value: object) -> dict[str, str]:
|
||||
"""Narrow a persisted JSON value to a flat string map."""
|
||||
if not isinstance(value, dict):
|
||||
return {}
|
||||
mapping = cast(dict[object, object], value)
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
"""Package marker for WhatsApp Agent Platform tests."""
|
||||
@@ -159,7 +159,6 @@ def test_missing_profile_name_is_not_treated_as_empty_string():
|
||||
body = _poll_body()
|
||||
body["entry"][0]["changes"][0]["value"]["contacts"] = [{"wa_id": "user:55"}]
|
||||
|
||||
# The absent ``profile`` key must not raise; names are optional per poll.
|
||||
assert parse_poll_batch(body).messages == []
|
||||
|
||||
|
||||
@@ -206,12 +205,10 @@ def test_media_limits_match_the_documented_caps():
|
||||
assert media_limit_for("image/jpeg", "image") == 5 * 1024 * 1024
|
||||
assert media_limit_for("image/webp", "sticker") == 500 * 1024
|
||||
assert media_limit_for("video/mp4", "video") == 16 * 1024 * 1024
|
||||
# An undeclared type still receives the generic 16 MB cap.
|
||||
assert media_limit_for("audio/ogg", "unknown") == 16 * 1024 * 1024
|
||||
|
||||
|
||||
def test_media_url_must_pass_the_ssrf_guard():
|
||||
# A malformed or internal target must be refused before any request is made.
|
||||
assert quote_safe_url("http://127.0.0.1/media")[0] is False
|
||||
assert quote_safe_url("file:///etc/passwd")[0] is False
|
||||
assert quote_safe_url("")[0] is False
|
||||
|
||||
@@ -1,9 +1,3 @@
|
||||
"""Runtime contracts for the WhatsApp Agent Platform channel.
|
||||
|
||||
These exercise the paths that protect real invariants: ordered chunked sends,
|
||||
cursor durability, dedup across a replayed batch, pacing, and retry safety.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
@@ -96,11 +90,6 @@ def _text_message(wamid: str, body: str = "hi", sender: str = "user:55") -> dict
|
||||
}
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Retry policy
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
|
||||
def test_confirmed_non_delivery_is_retried(tmp_path: Path):
|
||||
channel = _channel(tmp_path)
|
||||
|
||||
@@ -147,11 +136,6 @@ def test_progress_traffic_is_off_by_default(tmp_path: Path):
|
||||
assert channel.config.send_progress is False
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Polling and durable cursor
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
|
||||
def test_empty_204_reuses_the_same_offset(tmp_path: Path, monkeypatch: pytest.MonkeyPatch):
|
||||
channel = _channel(tmp_path)
|
||||
channel._load_state()
|
||||
@@ -222,8 +206,6 @@ def test_bootstrap_filters_history_across_pages_and_restarts(
|
||||
assert batch is not None
|
||||
await channel._process_batch(batch)
|
||||
assert not channel.bus.inbound_messages
|
||||
# Restart while still scanning the backlog must retain the original
|
||||
# boundary, not skip a message sent since the first process started.
|
||||
monkeypatch.setattr(runtime_module.time, "time", lambda: 200)
|
||||
restarted = _channel(tmp_path, markRead=False, typingIndicator=False)
|
||||
restarted._load_state()
|
||||
@@ -352,7 +334,6 @@ def test_failed_message_is_not_retried_as_a_duplicate_on_replay(tmp_path: Path,
|
||||
asyncio.run(channel._process_batch(batch))
|
||||
asyncio.run(channel._process_batch(batch))
|
||||
|
||||
# The wamid is recorded before handling, so a crash cannot double-answer.
|
||||
assert calls == ["wamid.1"]
|
||||
|
||||
|
||||
@@ -362,11 +343,6 @@ def _parse(body: dict[str, Any]):
|
||||
return parse_poll_batch(body)
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Inbound routing
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
|
||||
def test_inbound_text_reaches_the_bus_with_quote_metadata(tmp_path: Path, monkeypatch: pytest.MonkeyPatch):
|
||||
bus = _Bus()
|
||||
channel = WhatsAppAgentChannel(
|
||||
@@ -415,11 +391,6 @@ def _message(raw: dict[str, Any]):
|
||||
return parsed
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Outbound
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
|
||||
def test_text_is_chunked_to_the_api_limit_and_sent_in_order(tmp_path: Path, monkeypatch: pytest.MonkeyPatch):
|
||||
channel = _channel(tmp_path)
|
||||
channel._state.note_creator("user:55")
|
||||
@@ -437,7 +408,6 @@ def test_text_is_chunked_to_the_api_limit_and_sent_in_order(tmp_path: Path, monk
|
||||
)
|
||||
|
||||
assert [len(chunk["text"]["body"]) for chunk in sent] == [4096, 904]
|
||||
# No inbound message id was supplied, so no quote is attached.
|
||||
assert all("context" not in chunk for chunk in sent)
|
||||
assert all(chunk["to"] == "user:55" for chunk in sent)
|
||||
|
||||
@@ -588,7 +558,6 @@ def test_media_uses_the_matching_payload_object_only(tmp_path: Path, monkeypatch
|
||||
|
||||
assert sent[0]["type"] == "image"
|
||||
assert sent[0]["image"] == {"id": "MEDIA1"}
|
||||
# Extra payload objects are validated by the API, so none are included.
|
||||
assert set(sent[0]) == {"messaging_product", "to", "type", "image"}
|
||||
|
||||
|
||||
@@ -787,8 +756,6 @@ def test_abandoned_or_cancelled_sends_release_retry_progress(
|
||||
monkeypatch.setattr(channel, "_request_ok", request)
|
||||
|
||||
async def abandon():
|
||||
# No successful retry follows; collecting the envelope must remove its
|
||||
# progress even when the failure was retryable.
|
||||
with pytest.raises(WhatsAppAgentAPIError):
|
||||
await channel.send(OutboundMessage(channel.name, "creator", "hello"))
|
||||
|
||||
@@ -850,11 +817,6 @@ async def test_manager_dispatch_respects_progress_opt_ins(
|
||||
await asyncio.gather(dispatcher, return_exceptions=True)
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Inbound media
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
|
||||
def test_inbound_media_is_downloaded_and_verified(tmp_path: Path, monkeypatch: pytest.MonkeyPatch):
|
||||
channel = _channel(tmp_path)
|
||||
content = b"pdf-bytes"
|
||||
@@ -907,7 +869,6 @@ def test_media_with_a_mismatched_digest_is_discarded(tmp_path: Path, monkeypatch
|
||||
monkeypatch.setattr(channel, "_fetch_media_bytes", fake_fetch)
|
||||
paths, text = asyncio.run(channel._materialize(_message(raw)))
|
||||
|
||||
# The bytes never reach the agent and no file is written.
|
||||
assert paths == []
|
||||
assert text == "[image]"
|
||||
|
||||
@@ -959,11 +920,6 @@ def test_voice_note_is_transcribed_when_a_provider_is_available(tmp_path: Path,
|
||||
assert len(paths) == 1
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Lifecycle and pacing
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
|
||||
def test_start_requires_a_token(tmp_path: Path):
|
||||
channel = _channel(tmp_path, token="")
|
||||
|
||||
@@ -997,7 +953,6 @@ def test_invalid_token_during_poll_stops_the_loop(tmp_path: Path, monkeypatch: p
|
||||
|
||||
asyncio.run(run())
|
||||
assert entered.is_set()
|
||||
# An invalid token cannot recover by retrying, so the channel is not running.
|
||||
assert channel._running is False
|
||||
|
||||
|
||||
@@ -1012,7 +967,6 @@ def test_rolling_window_limiter_paces_a_method(monkeypatch: pytest.MonkeyPatch):
|
||||
await limiter.acquire("messages")
|
||||
return loop.time() - start
|
||||
|
||||
# The third call must wait for the window rather than exceed the cap.
|
||||
assert asyncio.run(run()) >= 0.24
|
||||
|
||||
|
||||
@@ -1021,7 +975,6 @@ def test_rolling_window_limiter_counts_each_method_separately(monkeypatch: pytes
|
||||
limiter = runtime_module._RollingWindowLimiter({"messages": 1, "updates": 1}, margin=0)
|
||||
|
||||
async def run() -> None:
|
||||
# A send must not consume the poll budget; both complete immediately.
|
||||
await asyncio.wait_for(limiter.acquire("messages"), timeout=0.2)
|
||||
await asyncio.wait_for(limiter.acquire("updates"), timeout=0.2)
|
||||
|
||||
@@ -1029,7 +982,6 @@ def test_rolling_window_limiter_counts_each_method_separately(monkeypatch: pytes
|
||||
|
||||
|
||||
def test_restart_resumes_from_the_persisted_offset(tmp_path: Path, monkeypatch: pytest.MonkeyPatch):
|
||||
# First process handles one message and advances the cursor.
|
||||
first = _channel(tmp_path)
|
||||
first._load_state()
|
||||
|
||||
@@ -1040,7 +992,6 @@ def test_restart_resumes_from_the_persisted_offset(tmp_path: Path, monkeypatch:
|
||||
first._client = object() # type: ignore[assignment]
|
||||
asyncio.run(first._process_batch(_parse(_poll_body([_text_message("wamid.1")], 500))))
|
||||
|
||||
# A new process with the same token must resume, not restart the stream.
|
||||
second = _channel(tmp_path)
|
||||
second._load_state()
|
||||
seen: list[dict[str, Any]] = []
|
||||
@@ -1054,7 +1005,6 @@ def test_restart_resumes_from_the_persisted_offset(tmp_path: Path, monkeypatch:
|
||||
asyncio.run(second._poll_once())
|
||||
|
||||
assert seen[0]["offset"] == 500
|
||||
# The dedup window also survives the restart.
|
||||
assert second._state.has_message("wamid.1") is True
|
||||
|
||||
|
||||
@@ -1078,7 +1028,6 @@ def test_restart_with_a_new_token_does_not_reuse_the_old_cursor(
|
||||
replacement._client = object() # type: ignore[assignment]
|
||||
asyncio.run(replacement._poll_once())
|
||||
|
||||
# next_offset belongs to the agent that issued it, so it is not replayed.
|
||||
assert seen[0]["offset"] == 0
|
||||
|
||||
|
||||
@@ -1094,7 +1043,6 @@ def test_the_token_never_appears_in_logs_or_persisted_state(
|
||||
|
||||
logger_id = logger.add(lambda message: records.append(message), level="DEBUG")
|
||||
try:
|
||||
# A failing poll exercises the error-logging path with a live token.
|
||||
async def failing_request(method, path, *, method_key, params=None, **kwargs):
|
||||
return 400, {"error": {"code": 100, "message": "(100) invalid"}}
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
"""Setup contract and validation ownership for the Agent Platform channel."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import httpx
|
||||
@@ -20,7 +18,6 @@ def test_manifest_and_setup_contract_match_the_runtime_fields():
|
||||
assert plugin.name == "whatsapp_agent"
|
||||
assert plugin.display_name == "WhatsApp Agent Platform"
|
||||
assert plugin.runtime == "nanobot.channels.whatsapp_agent.runtime:WhatsAppAgentChannel"
|
||||
# No optional platform SDK: the API is plain HTTPS.
|
||||
assert plugin.dependencies == ()
|
||||
assert plugin.default_enabled is False
|
||||
assert plugin.setup is not None
|
||||
@@ -33,7 +30,6 @@ def test_token_is_a_secret_and_setup_does_not_require_a_second_step():
|
||||
assert spec is not None
|
||||
assert spec.secrets == {"token"}
|
||||
assert spec.route_field_types["token"] == "secret"
|
||||
# There is no QR or terminal login step; the token alone completes setup.
|
||||
assert spec.is_configured({"token": "abc"}) is True
|
||||
assert spec.is_configured({"token": ""}) is False
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
"""Durable cursor, dedup, and token-rotation contracts for the channel store."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
@@ -120,7 +118,6 @@ def test_unreadable_state_file_reports_no_local_state(tmp_path: Path):
|
||||
|
||||
|
||||
def test_legacy_state_without_creator_id_loads():
|
||||
# A state file written before creator ids were persisted must still load.
|
||||
payload = json.dumps({"offset": 5, "initialized": True, "token_fingerprint": "abc"})
|
||||
import tempfile
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
"""WhatsApp Agent Platform setup validation owned by the channel package."""
|
||||
|
||||
from typing import Any, cast
|
||||
|
||||
import httpx
|
||||
|
||||
Reference in new issue
Block a user