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
v0.2.0 release prep: 8 fixes for ship-blocker QA findings (#44)
* feat: release-blocker bundle for v0.2.0 (#17#18#21#16#15#23#39#40)
Bundles eight ship-blocker fixes called out in the QA triage on main:
- **#39 session cache (major):** persist auth/cookies to
$XDG_CACHE_HOME/crono-export/session.json (mode 0600), retry-on-stale,
CRONOMETER_NO_CACHE escape hatch, new `auth logout` subcommand. Fixes
the rate-limit foot-gun where 5–6 back-to-back calls trip Cronometer's
throttle. Also de-duplicates the "login failed: login failed:" wrap.
- **#17 typed nutrition/notes JSON (breaking):** csvToJSON now returns
[]map[string]any with best-effort coercion (numeric → float64,
true/false → bool, empty → null). Drops the contract drift where two
of five subcommands forced jq `tonumber` on every column.
- **#15 + #23 validation before login:** Args=cobra.NoArgs + a PreRunE
that calls chosenFormat — bad --format / positional args now exit
fast without burning a Cronometer login attempt.
- **#16 + #18 + #21 contract-violation trio:** empty markdown is silent
on stdout (friendly note → stderr); --until alone uses 7d window
ending at --until (was 1-day); inverted --since/--until warns to
stderr and returns empty + exit 0 (was non-zero error).
- **#40 VitaminDIU cosmetic:** strippedSuffix table had "UI" instead of
the standard "IU" abbreviation; vitamin D markdown was rendering
without splitting the unit. Added TestStrippedSuffix to cover.
- **#19 closed as part-fixed/part-wontfix:** zone-as-UTC was already
fixed by the clean-room rewrite (#37); the wire CSV carries no
time-of-day to surface. Documented in prime GOTCHAS.
New tests cover: strippedSuffix (cmd), resolveDateRange (cronoclient),
coerceCSVValue + csvToJSON (cronoclient), session cache round-trip
(cronoclient).
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
* fixup: address PR review — README, gofmt, cache schema version
Review feedback on #44:
- **Must fix#1: README.md stale.** Replaced the "no token cache"
paragraph with the cache location ($XDG_CACHE_HOME), the
CRONOMETER_NO_CACHE opt-out, the `auth logout` subcommand, and a
security note ("treat session.json like a password"). Folds in the
reviewer's nice-to-have #5 (security guidance) at the same time.
- **Must fix#2: gofmt.** Ran `gofmt -w` on `cmd/format.go` and
`internal/cronoclient/daterange_test.go` (trailing blank line + struct
field alignment). `internal/cronoapi/gwt.go` is also flagged but is
pre-existing from #37 — landed as a separate chore commit so this
PR's diff stays scoped to release-blocker work.
- **Nice-to-have #4: cache schema version.** Added
`cacheSchemaVersion = 1` and a `Version int` field on cachedSession.
Old/mismatched versions are silently treated as a miss so a future
incompatible bump triggers a transparent re-login instead of a
JSON-shape error. New test: TestSessionCacheVersionMismatch.
Skipped: race on concurrent fresh logins (#6) — reviewer agreed this is
fine for a single-user CLI.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
* chore: gofmt internal/cronoapi/gwt.go (preexisting drift from #37)
Pure formatting: column-aligned const block and var block. No logic change.
Flagged by `gofmt -l .` during review of #44.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
---------
Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
The CLI logs in on every invocation; there's no token cache. Cronometer doesn't (yet) offer SSO or API tokens for individuals, so a real password is the only auth option.
81
+
Cronometer doesn't (yet) offer SSO or API tokens for individuals, so a real password is the only auth option.
82
+
83
+
After the first successful login, the session (auth token + cookies) is cached at `$XDG_CACHE_HOME/crono-export/session.json` (file mode `0600`, directory mode `0700`; on macOS this resolves to `~/Library/Caches/crono-export/session.json`). Subsequent invocations reuse the cached session and skip the login handshake — useful for LLM-agent workflows that fire several commands in quick succession (a fresh login on every call trips Cronometer's "Too Many Attempts" throttle after ~6 requests). When the cached session goes stale, the CLI transparently re-logs in and retries once.
84
+
85
+
Escape hatches:
86
+
87
+
-`CRONOMETER_NO_CACHE=1` forces a fresh login on every invocation (and skips writing the cache).
88
+
-`crono-export auth logout` deletes the cached session.
89
+
-`crono-export auth status` reports whether credentials are set and whether a session is cached.
90
+
91
+
Treat `session.json` like a password: don't sync it to a shared backup, and don't commit it.
0 commit comments