Skip to content

Commit 2be4fdb

Browse files
committed
fix(linear): use is-not-None for installation_key_prefix (gemini review)
https://claude.ai/code/session_01FyMxQn2BEAzmwKS1GZczKj
1 parent 337a32f commit 2be4fdb

2 files changed

Lines changed: 21 additions & 2 deletions

File tree

src/chat_sdk/adapters/linear/adapter.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,12 @@ def __init__(self, config: LinearAdapterConfig | None = None) -> None:
174174
"or LINEAR_CLIENT_ID/LINEAR_CLIENT_SECRET, or provide auth in config.",
175175
)
176176

177-
# State-key prefix for per-organization installations.
178-
self._installation_key_prefix = getattr(config, "installation_key_prefix", None) or "linear:installation"
177+
# State-key prefix for per-organization installations. Use ``is not
178+
# None`` (not truthiness) so an explicit ``installation_key_prefix=""``
179+
# is honored verbatim and NOT silently overridden by the default
180+
# (CLAUDE.md truthiness-trap hazard).
181+
prefix = getattr(config, "installation_key_prefix", None)
182+
self._installation_key_prefix = prefix if prefix is not None else "linear:installation"
179183

180184
# Optional AES-256-GCM key for encrypting OAuth tokens at rest. Use
181185
# ``is not None`` (not truthiness) so an explicit ``encryption_key=""``

tests/test_linear_encryption.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,21 @@ def test_explicit_empty_string_opts_out_of_env(self, monkeypatch):
8989
)
9090
assert adapter._encryption_key is None
9191

92+
def test_explicit_empty_installation_key_prefix_is_honored(self):
93+
# An explicit empty prefix ("") is a valid caller choice and must NOT
94+
# be silently overridden by the default. A truthiness fallback
95+
# (``... or "linear:installation"``) would discard "" and yield the
96+
# default; an explicit ``is not None`` check preserves it.
97+
adapter = LinearAdapter(
98+
LinearAdapterAppConfig(
99+
client_id="c",
100+
client_secret="s",
101+
webhook_secret=WEBHOOK_SECRET,
102+
installation_key_prefix="",
103+
)
104+
)
105+
assert adapter._installation_key_prefix == ""
106+
92107

93108
# ---------------------------------------------------------------------------
94109
# Round-trip and storage shape

0 commit comments

Comments
 (0)