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
auth status reports 'session cached' for any file at the cache path — doesn't validate the cached session is usable #46
But exporter.loadCachedSession(user) — the function the export commands actually call to load the cache — performs four additional checks the status command skips:
JSON parses
Version == cacheSchemaVersion (so a stale-schema cache from an old binary doesn't get used)
Username == user (so switching CRONOMETER_USERNAME invalidates the cache)
AuthToken != "" (so a zero/truncated file is rejected)
Any cache that passes os.Stat but fails one of those four is reported by auth status as session cached — and then the very next crono-export nutrition call silently re-logs in because the load actually fails. The status message lies.
The contract §5 expects auth status to be a useful readiness signal ("logged in as you@example.com (token expires 2026-05-01)" / "missing CRONOMETER_PASSWORD"). "I see a file at the path" doesn't clear that bar.
Easy fix
Swap the os.Stat for a call to loadCachedSession. The function already exists and does exactly the right validation; only thing it needs is to become exported (or a thin wrapper). Then the three branches become:
(valid cached session) — file present, parses, version + user + token all good
(no usable cached session) — file absent, or present-but-rejected
Activity
Terastar-Paperclip commentedon May 19, 2026
Triage:
kind:bug·area:auth·priority:mediumos.StatforloadCachedSession) is in the body.No CONTRACT.md change required — §5 already describes the expected behavior; this is an implementation gap. Engineering ownership.