Evidence
On a cached, unexpired session, authenticate always calls verify() (src/auth.mjs:60) = GET /chip/sync (src/auth.mjs:150-157). Measured share on this machine: libby archive (no flags — all bootstrap, no work) median 2596 ms vs libby help 26.1 ms; buildConfig + session load + JWT decode are single-digit ms, so the network verify is essentially the entire delta.
If verify() were skipped (trust the JWT exp locally, let the command's first real API call surface an invalid session), every authed invocation — list, archive --all, auth, borrow, … — would start ~2.5 s sooner on this network.
The tradeoff (why evaluate, not implement)
verify() gives the clean "Cached session no longer valid; re-bootstrapping" path (src/auth.mjs:62). Skipping it turns invalid-session detection into a mid-command failure (e.g. after partially archiving), with a messier recovery story.
- An invalid session would also pay a failed call before re-bootstrap (one extra round trip in the bad case, to save one in the good case).
libby auth exists to verify authentication only — it presumably keeps an explicit verify regardless.
Question for evaluation
Measure the real invalid-session frequency and the failure UX both ways; decide whether verify should be dropped, deferred (verify only when the command's first API call fails), or kept. Implementation is explicitly NOT the todo until that call is made.
Related: #10, #11.
Evidence
On a cached, unexpired session,
authenticatealways callsverify()(src/auth.mjs:60) =GET /chip/sync(src/auth.mjs:150-157). Measured share on this machine:libby archive(no flags — all bootstrap, no work) median 2596 ms vslibby help26.1 ms;buildConfig+ session load + JWT decode are single-digit ms, so the network verify is essentially the entire delta.If
verify()were skipped (trust the JWTexplocally, let the command's first real API call surface an invalid session), every authed invocation —list,archive --all,auth,borrow, … — would start ~2.5 s sooner on this network.The tradeoff (why evaluate, not implement)
verify()gives the clean "Cached session no longer valid; re-bootstrapping" path (src/auth.mjs:62). Skipping it turns invalid-session detection into a mid-command failure (e.g. after partially archiving), with a messier recovery story.libby authexists to verify authentication only — it presumably keeps an explicit verify regardless.Question for evaluation
Measure the real invalid-session frequency and the failure UX both ways; decide whether verify should be dropped, deferred (verify only when the command's first API call fails), or kept. Implementation is explicitly NOT the todo until that call is made.
Related: #10, #11.