Commit 26b657d
committed
Fix positional-args bug in discover_api_client → handle_api_client_discovery
When discover_api_client is called with positional next_args (e.g.
``self.discover_api_client(self._apply_active_connection, current_connection)``
from activate_connection_configuration's cold-cache path), the cached
NetworkResponse was being silently mis-slotted into the response-less
next_() callable, manifesting as
AttributeError: 'NetworkResponse' object has no attribute 'base_url'
inside _apply_active_connection.
The cause: ``finished`` emits one positional NetworkResponse, and
``partial(handler, next_, *next_args)`` *appends* that NetworkResponse
to the end of the bound args. The handler's signature was
handle_api_client_discovery(next_, response, *next_args, **next_kwargs)
so when next_args was non-empty the call became
``handle_api_client_discovery(next_, current_connection, NetworkResponse)``
— current_connection in the response slot, the actual response in
*next_args. Then ``next_(*next_args, **next_kwargs)`` invoked
self._apply_active_connection(NetworkResponse) instead of
self._apply_active_connection(current_connection).
The contract was already wrong in the legacy code (same partial/append
shape with ``task_result: bool`` in place of ``response``), but every
caller used kwargs only, so it never tripped. Phase 3 introduced the
positional-arg call site and exposed it; Phase 6 made it the default
path on cold-cache connection switches.
Fix:
* Replace the partial with a lambda that explicitly discards the
NetworkResponse and forwards next_ / next_args / next_kwargs as-is.
* Drop the unused ``response`` parameter from
handle_api_client_discovery — the handler doesn't read the response
body; the api-support cache populated by probe_api_client's own
finished slot is the source of truth by the time the handler runs.
Also drops the now-unused ``NetworkResponse`` import.1 parent a10894a commit 26b657d
1 file changed
Lines changed: 13 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| |||
473 | 473 | | |
474 | 474 | | |
475 | 475 | | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
476 | 485 | | |
477 | | - | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
478 | 489 | | |
479 | 490 | | |
480 | 491 | | |
481 | 492 | | |
482 | 493 | | |
483 | | - | |
484 | 494 | | |
485 | 495 | | |
486 | 496 | | |
| |||
0 commit comments