Skip to content

Rate-limit CLI update notices#5184

Queued
clockwork-labs-bot wants to merge 2 commits into
masterfrom
bot/rate-limit-update-notice
Queued

Rate-limit CLI update notices#5184
clockwork-labs-bot wants to merge 2 commits into
masterfrom
bot/rate-limit-update-notice

Conversation

@clockwork-labs-bot
Copy link
Copy Markdown
Contributor

@clockwork-labs-bot clockwork-labs-bot commented Jun 2, 2026

Description of Changes

Fixes #5183.

This rate-limits the CLI update notice so the same advertised latest version is printed at most once every 24 hours. It keeps the existing 24 hour release lookup cache and adds backward-compatible notice metadata to the same cache file.

API and ABI breaking changes

None.

Expected complexity level and risk

  1. The change is local to the lightweight update notice cache path and only affects how often the notice is printed.

Testing

  • cargo fmt --all
  • cargo test -p spacetimedb-update update_notice
  • Manual binary check with cargo run:
tmpdir=$(mktemp -d)
mkdir -p "$tmpdir/config"
printf '{"last_check_secs":4102444800,"latest_version":"999.0.0"}' > "$tmpdir/config/.update_check_cache"

cargo build -p spacetimedb-cli -p spacetimedb-update
SPACETIMEDB_UPDATE_MULTICALL_APPLET=spacetime cargo run -p spacetimedb-update -- --root-dir="$tmpdir" help 2> /tmp/update-notice-1.err >/tmp/update-notice-1.out
SPACETIMEDB_UPDATE_MULTICALL_APPLET=spacetime cargo run -p spacetimedb-update -- --root-dir="$tmpdir" help 2> /tmp/update-notice-2.err >/tmp/update-notice-2.out

rg "A new version of SpacetimeDB is available" /tmp/update-notice-1.err
! rg "A new version of SpacetimeDB is available" /tmp/update-notice-2.err

Comment thread crates/update/src/update_notice.rs Outdated
@bfops
Copy link
Copy Markdown
Collaborator

bfops commented Jun 2, 2026

Manual testing instruction incorrect:

   Compiling spacetimedb-update v2.3.0 (/home/work/SpacetimeDBPrivate/public/crates/update)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 7.48s
     Running `target/debug/spacetimedb-update --root-dir /tmp/tmp.SS56CGJ467 help`
Error: a value is required for '--root-dir <root_dir>' but none was supplied
```

Copy link
Copy Markdown
Collaborator

@bfops bfops left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I ran the manual testing instructions

@bfops bfops added this pull request to the merge queue Jun 2, 2026
Any commits made after this event will not be merged.
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.

Add timeout to CLI version update notice

2 participants