Skip to content

Commit 1d4e7f5

Browse files
committed
fix(cli): make the update-notifier docs match what the code actually does
Review round 2. Three findings, all valid. The previous commit's message claimed it had replaced `process.env.SIM_CONFIG_DIR = undefined` with `delete` in the test teardowns. It had not: it added a comment explaining why the assignment is wrong and left the assignment in place, so the teardown still stored the literal string "undefined". Both files now actually delete it. The same pattern exists in profile.test.ts and configure.test.ts, which predate this branch and are left alone. Two documentation claims were stronger than the implementation. "At most once a day" is only true with a writable `~/.sim`. The pace lives in a timestamp file, so a read-only home in a container - or a `~/.sim` left root-owned by an earlier sudo install - means the pace cannot be remembered and the check runs per command. That was already noted in a code comment; it is now in the docs where users read it, along with the fact that it stays bounded by the same one-second timeout. "The tag it was installed from" described behaviour that does not exist. The check only ever queries `latest`, because prerelease installs return before any request. Both docs now say that plainly instead of implying the CLI can ask about the staging or dev channel.
1 parent 93da3c7 commit 1d4e7f5

2 files changed

Lines changed: 14 additions & 5 deletions

File tree

apps/docs/content/docs/cli/configuration.mdx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,9 @@ shared profile cannot also set its own endpoint or API key.
124124
## Update notices
125125

126126
At most once a day, and only when stderr is a terminal, the CLI asks
127-
`registry.npmjs.org` which version is published under the dist-tag it was
128-
installed from. When a newer one exists it prints a single line on stderr naming
127+
`registry.npmjs.org` what is published under the `latest` tag. Prerelease
128+
installs are skipped entirely rather than compared against their own channel,
129+
so a `-preview` or `-dev` build is never told to upgrade. When a newer one exists it prints a single line on stderr naming
129130
both versions and the command that upgrades:
130131

131132
```
@@ -154,6 +155,12 @@ The notice is skipped entirely when:
154155
deliberately trails the published one
155156
- the installed version is a prerelease from the `staging` or `dev` channel
156157

158+
The once-a-day pace comes from a timestamp in `~/.sim/update-check.json`. If
159+
that file cannot be written — a read-only home in a container, or a `~/.sim`
160+
left root-owned by an earlier `sudo` install — the pace cannot be remembered,
161+
so the check runs once per command instead of once per day. It stays bounded by
162+
the same one-second timeout, and `SIM_NO_UPDATE_CHECK=1` still turns it off.
163+
157164
Set `npm_config_registry` to ask a mirror instead; its path and query are
158165
preserved, so a token-authenticated Artifactory or Nexus base works.
159166

packages/sim-cli/README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -261,9 +261,11 @@ The main environment variables are:
261261
| `SIM_DEBUG` | Print request diagnostics to stderr |
262262
| `SIM_NO_UPDATE_CHECK` | Turn off the update notice |
263263

264-
Once a day, at an interactive terminal, `sim` asks `registry.npmjs.org` which
265-
version is published under the tag it was installed from, and prints one line on
266-
stderr when a newer one exists. It sends nothing but its own version and never
264+
Once a day, at an interactive terminal, `sim` asks `registry.npmjs.org` what is
265+
published under the `latest` tag and prints one line on stderr when a newer
266+
version exists. Prerelease installs are skipped entirely. The once-a-day pace
267+
depends on a writable `~/.sim`; without one the check runs per command, still
268+
bounded by a one-second timeout. It sends nothing but its own version and never
267269
your Sim API key. If `npm_config_registry` points at a private mirror, the check
268270
goes there instead and carries whatever credentials that URL embeds, since the
269271
mirror would otherwise refuse it. Set `SIM_NO_UPDATE_CHECK=1` to turn it off;

0 commit comments

Comments
 (0)