Skip to content

feat(plugin): notice when a new version is available - #534

Merged
Leo310 merged 4 commits into
mainfrom
feat/update-check
Sep 27, 2026
Merged

Leo310 merged 4 commits into
mainfrom
feat/update-check

Conversation

@Leo310

@Leo310 Leo310 commented Sep 27, 2026

Copy link
Copy Markdown
Member

What

A notice tells users a new version of the plugin is available. Obsidian only offers plugin updates when someone opens Community plugins, unless they've turned on its own automatic check (off by default), so most users otherwise pick up fixes late.

  • The check: runs once a day, starting 30 s after startup and re-evaluated hourly for sessions left open. It fetches manifest.json from the default branch on GitHub, the same file Obsidian's own update check reads, so the notice fires exactly when Obsidian would offer the update.
  • The notice: "Smart Second Brain X is available · Update", shown once per version. Update opens Settings → Community plugins, where Obsidian's "Check for updates" and Update buttons are. If the internal app.setting API ever moves, it falls back to obsidian://show-plugin?id=smart-second-brain.
  • Stays quiet:
    • on pre-release builds, since BRAT delivers those
    • for a version whose minAppVersion the running Obsidian doesn't meet, since Obsidian wouldn't install it
    • when offline or on any fetch error; the next day retries
    • while Obsidian's own Automatically check for plugin updates (new in 1.14) is on, making no request at all, so nobody gets told twice
  • Opt out: a "Check for updates" toggle under Settings → General → Privacy, on by default.
  • Disclosure: nothing about the user or the vault is sent. The README's privacy line now says "none of your data leaves your machine" (it used to say "nothing") and discloses the request, as Obsidian's plugin guidelines require. The site's privacy page needs the same change; I'll open that PR separately in s2b-dev/site.
  • Shared code: adds utils/version.ts (version comparison), byte-identical to the copy in feat(plugin): show bundled release notes after an update #533, so the two PRs merge cleanly in either order.

How I tested it

  • Unit tests in test/utils/updateCheck.test.ts cover:
    • version ordering
    • the daily interval, including a clock that jumps backwards
    • manifest parsing
    • the announce rules: newer stable, once per version, up to date, too-new minAppVersion, pre-release build
  • Ran bun run check, format, lint and the full test suite; all pass.
  • Checked live in the slot vault on desktop Obsidian 1.14.2, pretending the running version was 2.1.0 in memory:
    • The real request to GitHub returned 2.2.0, and the notice appeared.
    • Clicking Update opened Settings → Community plugins.
    • With Obsidian's automatic check turned on, no request was made and nothing was recorded.
    • dev:errors was clean.
  • obsidian://show-plugin, opened through window.open or the OS, did not visibly open anything in the slot vaults, which is why the internal settings API is the primary route.
  • Not tried on mobile.

AI assistance: Claude Code wrote this from Leo's brief (a notice when a new version is available, as a separate PR from #533). The step-aside for Obsidian's own check and the settings route for Update were changes Claude made after testing live. The notice, its defaults and the privacy wording still need Leo's review and live test.

Checklist

  • bun run check, bun run format, bun run lint, and bun run test pass locally
  • I tried the change in a real Obsidian vault (or explained above why that isn't applicable)
  • I read CONTRIBUTING.md, including the section on AI assistance
  • If this adds a provider, a bundled skill, a built-in tool, or changes manifest.json: I noted that the docs site needs updating (see "Documentation" in CONTRIBUTING.md). The privacy page needs the new request disclosed; PR to follow.

Once a day, a while after startup, fetch the plugin's manifest.json from
the default branch on GitHub (the same file Obsidian's own update check
reads) and show "Smart Second Brain X is available · Update" once per
newer stable version. Update opens Settings -> Community plugins.

It stays quiet on pre-release builds (BRAT delivers those), for versions
whose minAppVersion the running Obsidian doesn't meet, and while
Obsidian's own "Automatically check for plugin updates" is on. A
"Check for updates" toggle under Settings -> General -> Privacy turns it
off; nothing about the user or the vault is sent. The README's privacy
line now discloses the request.

Adds utils/version.ts (shared with the release-notes PR).

Co-Authored-By: Claude <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium risk] Adds daily update-check notification to the plugin.

The PR appears safe to merge; the remaining issue is a non-blocking false update announcement after some fresh-install restarts.

Summary

The PR adds a daily plugin-update notice and opt-out, and adds bundled release notes shown after installation of a new version.

  • Release notes are sourced from CHANGELOG.md for both the in-plugin view and GitHub release drafts.
  • A fresh install can show a false update announcement after a restart because its initial last-seen version is not persisted.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Load saved plugin data] --> B[Plan release-notes announcement]
  B --> C[Show update notice when due]
  C --> D[Open release-notes view]
  A --> E[Schedule plugin update check]
  E --> F[Fetch remote manifest when enabled and due]
  F --> G[Show available-version notice]
Loading

Reviews (4) · Last reviewed commit: "Merge remote-tracking branch 'origin/mai..."

Comment thread src/main.ts Outdated
Comment thread src/main.ts Outdated
Comment thread test/utils/updateCheck.test.ts Outdated
The request-to-notice flow moves to runUpdateCheck() in
utils/updateCheck.ts behind injected dependencies, with tests for the
daily gate, once-per-version, the opt-out and Obsidian step-aside (no
request at all), and failures. A response that arrives after the plugin
unloads, or after the user turned the check off, no longer announces.
The Update link falls back to the obsidian://show-plugin URI when the
internal settings API throws, not only when it is missing.

Co-Authored-By: Claude <noreply@anthropic.com>
Comment thread src/utils/updateCheck.ts Outdated
Leo310 and others added 2 commits September 27, 2026 20:17
Co-Authored-By: Claude <noreply@anthropic.com>
# Conflicts:
#	src/main.ts
#	src/stores/dataStore.svelte.ts
#	src/types/plugin.ts
@greptile-apps

greptile-apps Bot commented Sep 27, 2026

Copy link
Copy Markdown
Contributor

Comments Outside Diff

These findings sit on lines the diff does not cover, so they could not be posted inline. Each one leaves this list once its file changes.

  • P2 Fresh-install version is not saved src/stores/dataStore.svelte.ts:2286 ▶

    This sets lastSeenVersion only in memory. If the user closes Obsidian before another settings write-for example, before the first update check-the next launch has saved data but no last-seen version. The plugin then shows “Smart Second Brain updated” even though its version has not changed. Persisting the initial version would prevent that false notice.

@Leo310
Leo310 merged commit 4763aa0 into main Sep 27, 2026
3 checks passed
@Leo310
Leo310 deleted the feat/update-check branch September 27, 2026 18:35
Leo310 added a commit that referenced this pull request Sep 27, 2026
A reworked chat composer (growing input, attachment preview tiles, Take
photo on mobile, a single jump-to-bottom button, and a composer that keeps
up with the iOS keyboard), agents that keep their memory index and skills
up to date (#513-#519), release notes shown in the plugin after an update
(#533), and a notice when a new version is available (#534).

Co-Authored-By: Claude <noreply@anthropic.com>
Leo310 added a commit to s2b-dev/site that referenced this pull request Sep 28, 2026
s2b-dev/smart-second-brain#534 adds a once-a-day request to GitHub for the
plugin's version number. List it under "What leaves your machine" and
explain what it sends, when it skips itself, and where to turn it off.

Co-authored-by: Claude <noreply@anthropic.com>
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.

1 participant