add: background upgrade hint at startup (rate-limited, non-blocking)#42
Conversation
Calls background_update_hint() when solvent runs with no subcommand. A daemon thread checks PyPI at most once per 24h and prints a one-liner to stderr if a newer version is available. Skipped via SOLVENT_NO_UPDATE_CHECK=1. Timestamp gate lives in data_dir/.upgrade_check. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SGjM79GJpSksy9wSSBa7e6
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f8fe29b620
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if time.time() - last < _CHECK_INTERVAL: | ||
| return | ||
| latest = latest_pypi_version() | ||
| stamp_path.write_text(str(time.time())) |
There was a problem hiding this comment.
Keep the update stamp out of the git worktree
In source checkouts, solvent.paths.data_dir() resolves to <repo>/data, and .gitignore does not ignore data/.upgrade_check, so this write makes the repository dirty just by running the no-subcommand CLI path (I also hit it when the routing test exercised entry.main()). Store the rate-limit stamp in an already-ignored/cache location or add this file to the ignore rules so normal CLI/test usage does not leave untracked files behind.
Useful? React with 👍 / 👎.
In source checkouts data_dir() resolves to <repo>/data; writing the rate-limit stamp there without a gitignore entry dirtied the tree on every no-subcommand CLI run. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SGjM79GJpSksy9wSSBa7e6
Summary
background_update_hint()insolvent/upgrade.pyfires a daemon thread on startupdata_dir/.upgrade_check)SOLVENT_NO_UPDATE_CHECK=1is setsolventruns with no subcommand (the interactive demo path)Test plan
python3 -m pytest tests/test_upgrade_hint.py -v→ 8 passedpython3 -m pytest -q→ 324 passed, 6 skippedSOLVENT_NO_UPDATE_CHECK=1 solvent— no PyPI call, no hintsolventwhen outdated → stderr hint within a few secondssolventtwice within 24 h → hint only on first run🤖 Generated with Claude Code
https://claude.ai/code/session_01SGjM79GJpSksy9wSSBa7e6
Generated by Claude Code