Skip to content

feat(dashboard): update notice for operators with an optional Update now through Wise Wren - #366

Open
Ferdinand99 wants to merge 5 commits into
v5.3from
feat/53-update-notice
Open

Ferdinand99 wants to merge 5 commits into
v5.3from
feat/53-update-notice

Conversation

@Ferdinand99

Copy link
Copy Markdown
Owner

What

An update notice for the people who run a Sylo instance (operators only), with an optional Update now through Wise Wren.

  • Notice: an "Update available" pill in the top bar and an Updates section on the Health page: the new version, its release notes (data rendered as text, https links only) and the command to copy (docker compose pull && docker compose up -d).
  • Check: the latest GitHub release, anonymous, cached 6 hours, 8 second timeout, one log line on failure, never blocks startup. UPDATE_CHECK=off turns it off (no request at all).
  • Wise Wren (optional): WISE_WREN_URL, WISE_WREN_TOKEN, WISE_WREN_TARGET_ID. Sylo reads the target, shows whether Wren sees an update, Update now approves exactly that version (POST /api/v1/targets/{id}/approve) and the page follows the run (GET /api/v1/runs/{id}) through a rate limited operator route. It survives Sylo restarting, and works with any token that may approve the target (a token that cannot read falls back to the GitHub check).
  • Security: operator routes only (admins and signed-out visitors refused), CSRF on the write, approve limited to 5 a minute, the token stays on the server (never in an answer, a log line or the browser; redirects are not followed), only three Wren routes on the one target id are ever called, step logs stay in Wren, and Wren errors are never answered as 401/403.
  • App: feature string update-notice and the JSON routes, documented in docs/mobile-app.md.
  • Docs: "Update notice and Update now" in docs/self-hosting.md (plus env table, .env.example, README).

Tests

New: version compare, cache and disabled check, failures, notes sanitising, Wren client against a fake Wren (approve, run progress, every error kind, redirect, token never leaked), service logic, the routes through the real app (operator-only guard, CSRF, rate limit, audit entry, no token in answers or logs), config switches, and the dashboard components (progress through a restart, badge only for operators). npm test passes on SQLite and Postgres 16, npm run test:v2, lint and build:v2 are green.

…now through Wise Wren

Operators see a note in the top bar and an Updates section on the Health page when a newer Sylo release is out, with its release notes (rendered as data, https links only) and the command to copy. The check reads the latest GitHub release anonymously, caches it for six hours, never blocks startup, fails quietly and is turned off with UPDATE_CHECK=off.

With WISE_WREN_URL, WISE_WREN_TOKEN and WISE_WREN_TARGET_ID set, the server reads the target from Wise Wren, offers Update now (approves exactly the version Wren shows) and follows the run through a rate limited operator route; the page reconnects when Sylo restarts. The token stays on the server and is never logged or sent to the browser or the app. The app gets the update-notice feature string and the same operator JSON routes.

@graphify-labs graphify-labs Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Graphify reviewed this change.

No issues found by static checks — no coupling regressions or blocking issues in the code graph. That is not the same as safe to merge: see what was not checked.

Not checked: tests were not run; no formal proof of the changed code.


Graphify review — findings

Adds an operator-only update notice: Sylo asks GitHub anonymously (at most every 6 hours) for its latest release and shows "Update available" in the dashboard with release notes and the docker compose pull && docker compose up -d command. Setting UPDATE_CHECK=off stops the lookup entirely, and the notice and its API return nothing else. Adds optional Wise Wren integration, configured by WISE_WREN_URL, WISE_WREN_TOKEN and WISE_WREN_TARGET_ID (all three required), which gives operators an "Update now" button so Sylo never needs Docker socket access. Without that config the dashboard falls back to the copyable command only, and the token stays server-side, never shown in the dashboard or logged. Exposes this to the app through GET /api/v2/update, POST /api/v2/update/wren/approve and GET /api/v2/update/wren/runs/:id, all operator-only and rate limited, advertised via a new update-notice feature string. Also documents the feature in the README, the self-hosting guide, the mobile app doc and .env.example.

Review partial — this diff was larger than one review pass covers, so later files were not reviewed; some findings may be missing.

Analysis details — impact, health, verification

Impact & health

Graphify review

Impact — 672 functions depend on the 474 functions this change touches.

Health — this change adds coupling hotspots:

  • worse: apiFetch() — 64 callers, 3 callees
  • worse: Health() — 2 callers, 12 callees
  • worse: SignedInShell() — 1 callers, 23 callees
  • new: UpdateNotice() — 3 callers, 6 callees
  • new: loadUpdateStatus() — 5 callers, 3 callees
  • new: UpdateBadge() — 3 callers, 4 callees

Verification — 672 functions in the blast radius were not formally verified this run (proofs are advisory here).

Gate & verification

graphify gate

PASS — objectively clean (no health regressions, tests not run — proofs not run this pass (advisory)). Grounded, not self-assessed.

Advisory (not blocking):

  • verification_scope: 670 function(s) in the blast radius were not formally verified this run

Test selection

Test selection

678 of 678 test file(s) selected (100%) via static blast radius.

Escalated to a full run for safety (noncode-change, uncovered-code) — the selection is not trustworthy on its own (see below). CI should run the whole suite.

  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Access/DashboardAccessTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Access/Round3Tests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Account/AccountConnectTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Account/AccountModelTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Account/ConnectCallbackSourceTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Account/NoDashboardLinkSourceTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Appeals/AppealsReviewTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Applications/ApplicationFormsTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Applications/ApplicationPassthroughTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Applications/ApplicationSubmissionsTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Applications/ApplicationWireTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Audit/AuditHistoryTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Audit/AuditLogTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Auth/CallbackIssuerAddressTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Auth/CallbackIssuerTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Auth/KeychainTokenStoreTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Auth/PKCETests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Auth/SignInRequestTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Auth/TokenStoreTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Changelog/ChangelogTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Commands/CommandOverridesTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Economy/CollectiblePictureTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Economy/EconomyAdminTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Economy/EconomyMembersTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Economy/InventoryTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Economy/ShopExtrasTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Economy/ShopItemsTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Economy/ShopModelTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Embeds/EmbedDraftTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Embeds/ModuleLimitsTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Events/CommunityReviewFixesTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Events/EventEndpointsTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Giveaways/GiveawayActionsTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/GuildSettings/CommandPrefixTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/GuildSettings/GuildSettingsTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Health/HealthTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Import/P6Tests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Insights/InsightsTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Leaderboard/LeaderboardTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Members/MemberDataTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Members/MemberSearchTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Messages/ComposedMessagesModelTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Messages/ComposedMessagesTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Models/ModelDecodingTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Models/ServerListTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Models/Sylo52PolishTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Models/UnknownKeysTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Models/Utf16TextLimitTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/Moderation/ModerationTests.swift — full-run-safety
  • apps/sylo-ios/SyloKit/Tests/SyloKitTests/ModuleSettings/AfkSettingsTests.swift — full-run-safety
  • … and 628 more

non-code file(s) changed (.env.example, README.md, docs/mobile-app.md, docs/self-hosting.md, web-v2/src/styles/p2.css) → running the full suite for safety (a code graph can't see config/fixture/data deps)

changed code file(s) with no mapped test (README.md, docs/mobile-app.md, docs/self-hosting.md, src/web/lib/routeAccess.js, src/web/routes/mobile.js …) — a coverage gap or a missing link — running the full suite rather than only the selected tests

Selection is safe under the controlled-regression assumption; always-run tests + a periodic full run are the backstops. Advisory — it never changes the check verdict.

… refuse Update now in open mode

Wise Wren's errors are {"error": {"code", "message"}} and an approval it refuses is a 400 (version changed, a run already queued or running, notify-only, no update) or a 409 (the agent would refuse). Sylo now reads that envelope and answers those refusals with a 409 carrying Wren's own words; 502 stays for real upstream failures.

The single-target token cannot list runs, so Sylo no longer asks for the run list: it remembers the run it approved (app settings, so it survives the restart the update causes) and reads it by id. Update now stays off while that run is not finished. A 403 on the target is an error, and an approval always carries the version key.

Without a dashboard login, Update now answers 409 open_mode and is not offered unless WISE_WREN_ALLOW_OPEN_MODE=true; a startup warning says so.

Also: a minimum interval for Check again across the instance that respects the failure backoff, a streamed size cap on the GitHub answer, a shared in-flight Wren read with shorter read timeouts, GitHub and Wren asked at the same time, a fake Wren that answers like the real one (error envelope, 400 refusals, second approval refused, single-target token mode), and access tests for app tokens, Inbox/View users, a Fluxer operator and open mode.
The Wise Wren tip and the open-mode reason were cut to one line with an
ellipsis, hiding the environment variable names. They now wrap. The headline
is the section's lead line, Check again stays at the top of the row, the Wise
Wren line names the version and server, an unreachable Wise Wren says what to
check and offers Try again, and the top-bar pill reads as a link.
The client buffered the whole response before checking its size, so a
hostile or spoofed Wise Wren could make Sylo hold hundreds of MB in
memory. It now reads through the same streaming cap as the release check
(1 MB, enforced while reading) and refuses a larger declared
content-length before reading.
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