Commit Graph
2 Commits
Author SHA1 Message Date
Dario Gabriel LipicarandClaude Opus 5 5bff8f8f80 test(token): pin that the caller's budget bounds the handshake, not just the call
Written first and on its own commit so the red is on the record: against this
parent it fails at ~20s, because the capability handshake ignores the caller's
budget entirely.

LogosAPIClient::invokeRemoteMethod takes a Timeout, but on an un-tokened target
the handshake runs FIRST and LogosAPIConsumer::requestModule hardcodes 20000
twice -- once for the capability_module acquire, once for the requestModule call
on it. A caller asking for 1500ms could therefore block on the order of 40s
before the part it had actually bounded began. logos-view-module-runtime's
callModule advertises a 1500ms bound on precisely this path.

capability_module is deliberately NOT published, so the acquire runs its budget
out rather than succeeding. Every other test in this file publishes it, which is
how a hardcoded 20s survived alongside them: none of them ever entered the wait.

The assertion is two-sided on purpose. An upper bound alone would pass if
something made the acquire return instantly -- leaving the hardcoded 20s in
place and the test green for the wrong reason, which is the exact shape of two
earlier tests in this change set that passed in both directions. So:

  >= budget-200ms  proves the timeout path actually ran;
  <  4x budget     proves it was the CALLER's budget and not the 20s default.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-10 11:45:24 -03:00
Khushboo Mehta 84be236552 fix(logos_api_client): cache minted capability token on the client side
Without a client-side cache, every sync invokeRemoteMethod re-mints a
fresh capability token. On Linux, QtRO's waitForFinished() spins a nested
QEventLoop that dispatches queued slots mid-wait, so back-to-back calls
reenter the function and each fires its own requestModule. The target
stores ONE token per caller (TokenManager::saveToken replaces) — last
inform wins and earlier in-flight calls arrive with a superseded token,
rejected by ModuleProxy::isAuthorized as "auth token not recognized".

Fix: save the minted token into the client's TokenManager after a
successful requestModule on both the sync path and the async drain
callback. Subsequent calls short-circuit the handshake — one mint per
(client, target), no rotation.
2026-06-26 17:21:47 +02:00