Skip to content

Treat missing timesince cache as cache miss, not error#94

Merged
icco merged 1 commit intomainfrom
copilot/fix-etu-directory-creation
Apr 5, 2026
Merged

Treat missing timesince cache as cache miss, not error#94
icco merged 1 commit intomainfrom
copilot/fix-etu-directory-creation

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 5, 2026

First-time etu CLI usage logs a confusing error because cacheFromFile() treats a nonexistent cache file as an error rather than a cache miss.

etu: reading timesince cache: open /Users/nat/Library/Application Support/etu/timesince.cache: no such file or directory
  • cacheFromFile() now returns (nil, nil) on os.IsNotExist, letting TimeSinceLastPost fall through to UpdateCache which creates the directory and file via MkdirAll
  • Updated TestCacheFromFileMissing to assert no error on missing file

On first use, the cache file doesn't exist yet. Instead of logging a
confusing error, cacheFromFile() now returns (nil, nil) for a missing
file, allowing TimeSinceLastPost() to proceed and create the cache.

Agent-Logs-Url: https://github.com/icco/etu/sessions/acb3f2f1-e81c-46e6-96e9-49f0c4364e63

Co-authored-by: icco <20201+icco@users.noreply.github.com>
Copilot AI assigned Copilot and icco Apr 5, 2026
@icco icco marked this pull request as ready for review April 5, 2026 20:09
@icco icco merged commit 0d07730 into main Apr 5, 2026
7 checks passed
@icco icco deleted the copilot/fix-etu-directory-creation branch April 5, 2026 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants