You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 4ae6759
Browse filesBrowse the repository at this point in the historyBrowse files
fix(cloud): #96 review — a request stays with its session and gateway; waiting on a renewal is free
1. A token from another session, or for another host, could be put on a request.
authRetry took "a different gateway token is stored" to mean "the token was
renewed", and copied it onto the original request. Two ways that is not true.
Someone else signs in while the request is out — or half-way through a Sketch
run, which sends one request for minutes — and the old account's prompt was
sent again on the new account's token. And when the cloud host changes, the
token stored for the new host went to the old URL.
A request now stays with what it was sent on. The host hands authRetry its
sessionGeneration: the count the refresh already keeps, which moves on a
sign-in, a sign-out and an expiry and stays put through a renewal. It is noted
per REQUEST, the first time one is sent, so the later nodes of a run are held
to the session the run started in. A stored token is a renewal only for the
same generation, provider and gateway URL. Otherwise recovery stops — before
refreshing, so the new session's refresh token is not spent on the old
request, and again before re-sending — and the request's own error stands. An
ENDED session still outranks that and gets its sentence. What a renewal
achieved is now read from what is stored afterwards, not from its answer.
2. The ration on ghost-text renewals also turned away requests that only had to
wait. A keystroke cancels the completion that started a renewal; the next
pause is refused on the old token while that renewal is still out, and was
answered "one renewal a minute": no suggestion, though the token arrived a
moment later. The limit is on STARTING a renewal. Waiting on one already out
starts nothing, and is never held back.
Also: authRetryCallers.test.js slices storedToken and catchUpWithStoredSession
when extension.js has them. #92's round four (f4f38c1) has the refresh call
both, and this file is stacked on it. A slice that is out of date still says so
by name.
Verified: 46 suites, 884 cases, 0 failing. authRetry.test.js goes from 31 to 39
cases and authRetryCallers.test.js from 68 to 72: a real storeSession() sign-in
while an inline edit is out, and half-way through a Sketch run; the cloud host
changed under a request; the next completion arriving while the cancelled one's
renewal is still pending. On the module as pushed, the cases added or tightened
here fail and the rest pass. 48 breakages — each rule removed, each caller
reverted, each option dropped — fail a case each. node --check is clean, and
tsc --checkJs reports nothing new. Trial-merged with no conflicts and 0 failing:
develop (4e49295), 48 suites; #92's head (f4f38c1), 46; #95's new head (4ef3ee0),
46. Not run in the editor.
0 commit comments