Skip to content

Commit 7ceec1c

Browse files
committed
Rename Google Voice target to recipients
1 parent 34a2c74 commit 7ceec1c

3 files changed

Lines changed: 17 additions & 15 deletions

File tree

docs/strategy_plugin_runtime_contract.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,12 @@ structured sent/skipped/failed diagnostics, and can use
133133
sent.
134134

135135
Platforms should expose this as Google Voice notification config, not as a
136-
generic email alert surface. The public configuration names should be channel
137-
specific:
136+
generic email alert surface. The recipient value is still an email-form address:
137+
a normal mailbox receives an email, while a Google Voice mailbox/address can
138+
also surface the Google Voice prompt. The public configuration names should be
139+
channel specific:
138140

139-
- `CRISIS_ALERT_GOOGLE_VOICE_GATEWAY`
141+
- `CRISIS_ALERT_GOOGLE_VOICE_RECIPIENTS`
140142
- `CRISIS_ALERT_GOOGLE_VOICE_GMAIL_USER`
141143
- `CRISIS_ALERT_GOOGLE_VOICE_GMAIL_APP_PASSWORD`
142144

src/quant_platform_kit/notifications/strategy_plugin_google_voice.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
@dataclass(frozen=True)
2828
class StrategyPluginGoogleVoiceSettings:
29-
gateway_recipients: tuple[str, ...] = ()
29+
recipients: tuple[str, ...] = ()
3030
gmail_user: str | None = None
3131
gmail_app_password: str | None = field(default=None, repr=False)
3232
timeout: float = 10.0
@@ -36,17 +36,17 @@ def from_object(cls, value: object) -> "StrategyPluginGoogleVoiceSettings":
3636
if isinstance(value, cls):
3737
return value
3838
return cls(
39-
gateway_recipients=tuple(
40-
parse_email_recipients(_get_value(value, "crisis_alert_google_voice_gateway", ()))
39+
recipients=tuple(
40+
parse_email_recipients(_get_value(value, "crisis_alert_google_voice_recipients", ()))
4141
),
4242
gmail_user=_first_non_empty(_get_value(value, "crisis_alert_google_voice_gmail_user")),
4343
gmail_app_password=_get_value(value, "crisis_alert_google_voice_gmail_app_password"),
4444
)
4545

4646
def missing_fields(self) -> tuple[str, ...]:
4747
missing: list[str] = []
48-
if not parse_email_recipients(self.gateway_recipients):
49-
missing.append("CRISIS_ALERT_GOOGLE_VOICE_GATEWAY")
48+
if not parse_email_recipients(self.recipients):
49+
missing.append("CRISIS_ALERT_GOOGLE_VOICE_RECIPIENTS")
5050
if not str(self.gmail_user or "").strip():
5151
missing.append("CRISIS_ALERT_GOOGLE_VOICE_GMAIL_USER")
5252
if not str(self.gmail_app_password or "").strip():
@@ -281,7 +281,7 @@ def _send_message(
281281
smtp_host=_GOOGLE_VOICE_SMTP_HOST,
282282
smtp_port=_GOOGLE_VOICE_SMTP_PORT,
283283
sender=settings.gmail_user,
284-
recipients=settings.gateway_recipients,
284+
recipients=settings.recipients,
285285
username=settings.gmail_user,
286286
password=settings.gmail_app_password,
287287
use_starttls=_GOOGLE_VOICE_SMTP_STARTTLS,

tests/test_google_voice_notifications.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def test_publish_strategy_plugin_google_voice_alerts_skips_missing_config():
8686
assert result.sent_count == 0
8787
assert result.skipped_count == 1
8888
assert result.deliveries[0].reason == "missing_google_voice_config"
89-
assert "CRISIS_ALERT_GOOGLE_VOICE_GATEWAY" in result.deliveries[0].error
89+
assert "CRISIS_ALERT_GOOGLE_VOICE_RECIPIENTS" in result.deliveries[0].error
9090
assert "CRISIS_ALERT_GOOGLE_VOICE_GMAIL_USER" in result.deliveries[0].error
9191
assert "CRISIS_ALERT_GOOGLE_VOICE_GMAIL_APP_PASSWORD" in result.deliveries[0].error
9292
assert observed == []
@@ -99,7 +99,7 @@ def test_publish_strategy_plugin_google_voice_alerts_sends_and_records_marker(tm
9999
result = publish_strategy_plugin_google_voice_alerts(
100100
[_alert_signal()],
101101
google_voice_settings=StrategyPluginGoogleVoiceSettings(
102-
gateway_recipients=("risk@example.com",),
102+
recipients=("risk@example.com",),
103103
gmail_user="bot@example.com",
104104
gmail_app_password="app-password",
105105
),
@@ -128,7 +128,7 @@ def test_publish_strategy_plugin_google_voice_alerts_sends_and_records_marker(tm
128128
def test_publish_strategy_plugin_google_voice_alerts_skips_duplicate_marker(tmp_path):
129129
store = StrategyPluginGoogleVoiceAlertMarkerStore(local_dir=tmp_path)
130130
settings = StrategyPluginGoogleVoiceSettings(
131-
gateway_recipients=("risk@example.com",),
131+
recipients=("risk@example.com",),
132132
gmail_user="bot@example.com",
133133
gmail_app_password="app-password",
134134
)
@@ -158,16 +158,16 @@ def test_publish_strategy_plugin_google_voice_alerts_skips_duplicate_marker(tmp_
158158
assert second.deliveries[0].reason == "duplicate_alert"
159159

160160

161-
def test_google_voice_settings_reads_google_voice_gmail_names_only():
161+
def test_google_voice_settings_reads_google_voice_recipient_names_only():
162162
settings = StrategyPluginGoogleVoiceSettings.from_object(
163163
SimpleNamespace(
164-
crisis_alert_google_voice_gateway="gateway@txt.voice.google.com",
164+
crisis_alert_google_voice_recipients="alerts@example.com; voice@example.com",
165165
crisis_alert_google_voice_gmail_user="sender@gmail.com",
166166
crisis_alert_google_voice_gmail_app_password="app-password",
167167
)
168168
)
169169

170170
assert settings.gmail_user == "sender@gmail.com"
171-
assert settings.gateway_recipients == ("gateway@txt.voice.google.com",)
171+
assert settings.recipients == ("alerts@example.com", "voice@example.com")
172172
assert settings.gmail_app_password == "app-password"
173173
assert settings.missing_fields() == ()

0 commit comments

Comments
 (0)