Skip to content

fix(hermes-tlon-adapter): accept the optional kwarg in two SSE test doubles so the suite passes with Context Lens on - #6240

Open
wundrellama wants to merge 1 commit into
tloncorp:developfrom
wundrellama:fix/hermes-adapter-sse-double-optional-kwarg
Open

fix(hermes-tlon-adapter): accept the optional kwarg in two SSE test doubles so the suite passes with Context Lens on#6240
wundrellama wants to merge 1 commit into
tloncorp:developfrom
wundrellama:fix/hermes-adapter-sse-double-optional-kwarg

Conversation

@wundrellama

Copy link
Copy Markdown
Contributor

Problem

TlonSSEClient.subscribe gained a keyword-only optional parameter in ead5a94. _connect_sse uses it for the one subscription that is allowed to fail:

if self._lens.enabled:
    await sse.subscribe("steward", "/v1/lens", optional=True)

Nine test doubles were updated to match the new signature. Two were not:

  • test_adapter_nudge.pyasync def subscribe(self, _app, _path)
  • test_adapter_attention.pyasync def subscribe(self, app, path)

A double that does not match the real signature raises TypeError: subscribe() got an unexpected keyword argument 'optional'.

Why CI does not catch this

The steward subscription sits behind a guard on self._lens.enabled, which reads context_lens_enabled from the config. CI runs with Context Lens off. The branch never runs, so both doubles look correct.

A developer who enables Context Lens gets an error in test_retained_queue_head_waits_for_fully_authenticated_sse. The failure looks like a broken adapter. The adapter is correct.

Change

Add *, optional=False to both doubles. No production code changes.

Verification

Full adapter suite, 956 tests:

Config Before After
TLON_CONTEXT_LENS=true 1 error OK
variable unset (CI state) OK OK

Command:

python -m unittest discover . -p 'test_*.py'

…oubles so the suite passes with Context Lens on

The real TlonSSEClient.subscribe gained a keyword-only optional
parameter in ead5a94, and _connect_sse calls it with optional=True
for the %steward /v1/lens subscription. Nine test doubles were updated
to match. Two were not.

test_adapter_nudge.py and test_adapter_attention.py still declare
subscribe without the parameter. A double that does not match the real
signature raises TypeError when the adapter passes optional=True.

The defect is latent because the steward subscription sits behind a
guard on self._lens.enabled. That flag needs context_lens_enabled in
the config. CI runs with Context Lens off, so the branch never runs and
both doubles look correct. A developer who enables Context Lens hits
the error in test_retained_queue_head_waits_for_fully_authenticated_sse.

Add the parameter to both doubles. The production code is correct and
does not change.

Verification, 956 tests:

- With TLON_CONTEXT_LENS=true, before the change: 1 error.
- With TLON_CONTEXT_LENS=true, after the change: OK.
- With the variable unset, after the change: OK.
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