Skip to content

fix(web): include connect metadata in callbacks#1957

Merged
elibosley merged 4 commits intomainfrom
codex/connect-callback-payload
Mar 24, 2026
Merged

fix(web): include connect metadata in callbacks#1957
elibosley merged 4 commits intomainfrom
codex/connect-callback-payload

Conversation

@elibosley
Copy link
Member

@elibosley elibosley commented Mar 24, 2026

Summary

  • install @unraid/shared-callbacks@3.1.0 in the web workspace
  • remove the temporary local callback payload typing shim from the server store
  • keep the callback payload builder sending both connectPluginVersion and connectState through the published shared package contract

Problem

The earlier branch work had to model the new Connect callback fields locally because the web app was still pinned to @unraid/shared-callbacks@3.0.0. Now that 3.1.0 is available, the branch should depend on the published package directly so the callback payload contract lives in one place and the web store stops carrying stopgap local types.

Testing

  • pnpm test __test__/store/server.test.ts
  • pnpm type-check still fails on pre-existing issues in src/components/ApiKey/ApiKeyCreate.vue, src/components/Common/ResizableSlideover.vue, src/components/Onboarding/OnboardingModal.vue, and src/components/UpdateOs/CheckUpdateResponseModal.vue

Summary by CodeRabbit

  • New Features

    • Server callback payloads now include Connect state and connect plugin version for improved monitoring and diagnostics.
  • Tests

    • Expanded tests to validate inclusion, correct population, propagation, and fallback behavior of Connect state and plugin version in server payloads and callbacks.

- Purpose: send Connect capability data in account callback payloads so downstream apps can preserve sign-in/sign-out actions during callback resolution.
- Before: server callback payloads omitted connectPluginVersion, so sign-in/sign-out callbacks could arrive without any Connect version field and be re-resolved as generic license flows.
- Problem: the account app could not reliably keep Connect actions visible after redirect, especially when license mismatch logic also applied.
- Now: callback payloads include connectPluginVersion and store coverage asserts the field is preserved in both purchase and account callback payload builders.
- How: add connectPluginVersion to buildServerCallbackPayload() and extend the web store tests to cover the callback contract.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 24, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 34011467-2f3b-46d4-b4f0-c090ac6e925e

📥 Commits

Reviewing files that changed from the base of the PR and between 7fbf50c and 19abdba.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (3)
  • web/__test__/store/server.test.ts
  • web/package.json
  • web/src/store/server.ts

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.


Walkthrough

Added connectState and connectPluginVersion to server callback payloads: store state now exposes cloud and connectPluginVersion, buildServerCallbackPayload() includes both fields (deriving connectState from cloud.minigraphql.status), and tests updated to assert presence and fallback behavior. (50 words)

Changes

Cohort / File(s) Summary
Tests
web/__test__/store/server.test.ts
Extended mocked store with cloud and connectPluginVersion; updated/added tests for serverPurchasePayload, serverAccountPayload, and serverReplacePayload to assert connectState and connectPluginVersion propagation and fallback when metadata is missing.
Payload construction / store
web/src/store/server.ts
Added getConnectState() helper; included connectState (from cloud.value?.minigraphql?.status) and connectPluginVersion (from `connectPluginVersion.value
Dependency
web/package.json
Bumped @unraid/shared-callbacks from 3.0.0 to 3.1.0 to align with shared types/enum changes used by the new ConnectState handling.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 I hopped through code to fetch a state,
A version tucked in tails of fate,
Payloads now carry what I sow,
Tests nod, the signals flow,
A tiny rabbit’s joyful update.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The PR title 'fix(web): include connect metadata in callbacks' accurately summarizes the main change: adding connect-related metadata (connectPluginVersion and connectState) to callback payloads in the web store.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/connect-callback-payload

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0154ab79dc

ℹ️ 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".


const buildServerCallbackPayload = (overrides: Partial<ServerData> = {}): ServerData => {
const payload: ServerData = {
connectPluginVersion: connectPluginVersion.value,

Choose a reason for hiding this comment

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

P1 Badge Update callback type contract before adding connectPluginVersion

buildServerCallbackPayload is explicitly typed as ServerData from @unraid/shared-callbacks, but that contract (current dependency version) does not include connectPluginVersion; adding it here introduces TS2353 and also breaks type checking where this payload is consumed in tests. This means the new callback field is not actually represented in the shared typed interface and will fail any strict type-check workflow until the shared callbacks package/schema is updated (or an explicit extended type is used).

Useful? React with 👍 / 👎.

@codecov
Copy link

codecov bot commented Mar 24, 2026

Codecov Report

❌ Patch coverage is 6.66667% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 51.95%. Comparing base (0e004a7) to head (19abdba).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
web/src/store/server.ts 6.66% 14 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1957      +/-   ##
==========================================
+ Coverage   51.74%   51.95%   +0.20%     
==========================================
  Files        1028     1030       +2     
  Lines       70792    71137     +345     
  Branches     7881     7937      +56     
==========================================
+ Hits        36630    36956     +326     
- Misses      34039    34058      +19     
  Partials      123      123              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
web/__test__/store/server.test.ts (1)

183-186: Align mocked payload behavior with the real store contract.

At Line 185 and Line 214, store.connectPluginVersion || undefined can hide empty-string behavior that production currently emits. Consider mirroring store behavior exactly to avoid test drift.

Proposed diff
-          connectPluginVersion: store.connectPluginVersion || undefined,
+          connectPluginVersion: store.connectPluginVersion,
...
-          connectPluginVersion: store.connectPluginVersion || undefined,
+          connectPluginVersion: store.connectPluginVersion,

Also applies to: 213-215

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@web/__test__/store/server.test.ts` around lines 183 - 186, The mocked get()
builds a payload that currently uses "connectPluginVersion:
store.connectPluginVersion || undefined", which masks empty-string values unlike
the real store; update the mock in the get() implementation to assign
connectPluginVersion directly from store (connectPluginVersion:
store.connectPluginVersion) so empty strings are preserved and the test mirrors
the real store contract—apply the same change where this pattern appears around
the other mock (lines referenced near connectPluginVersion and the payload
fields such as description).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@web/__test__/store/server.test.ts`:
- Around line 183-186: The mocked get() builds a payload that currently uses
"connectPluginVersion: store.connectPluginVersion || undefined", which masks
empty-string values unlike the real store; update the mock in the get()
implementation to assign connectPluginVersion directly from store
(connectPluginVersion: store.connectPluginVersion) so empty strings are
preserved and the test mirrors the real store contract—apply the same change
where this pattern appears around the other mock (lines referenced near
connectPluginVersion and the payload fields such as description).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 680f2db0-8e4d-4031-980a-8881d2c75e15

📥 Commits

Reviewing files that changed from the base of the PR and between 0e004a7 and 0154ab7.

📒 Files selected for processing (2)
  • web/__test__/store/server.test.ts
  • web/src/store/server.ts

- Purpose: align the callback payload branch with the latest local shared-callbacks ServerData shape for Connect-aware flows.
- Before: the PR only threaded connectPluginVersion through callback payloads, so newer shared-callbacks consumers would still miss connectState context.
- Problem: Connect callbacks could not carry the full Connect runtime metadata expected by the updated local library, especially on replace/account/purchase flows.
- Now: the server store includes both connectPluginVersion and connectState in callback payloads, and keeps the extra typing local so the branch still type-checks before the package release lands.
- How: add a local callback payload type alias in the server store, source connectState from the cloud minigraph status, and extend the server-store tests to cover purchase, account, and replace payloads.
@elibosley elibosley changed the title fix(web): include connect plugin version in callbacks fix(web): include connect metadata in callbacks Mar 24, 2026
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
web/__test__/store/server.test.ts (1)

647-650: Optional: add one fallback-path test for missing Connect metadata.

Consider adding a case where cloud or connectPluginVersion is absent to assert the payload behavior when values are unavailable (e.g., undefined), so regressions in the fallback path are also covered.

Also applies to: 723-726, 777-780

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@web/__test__/store/server.test.ts` around lines 647 - 650, Add a test that
exercises the fallback path when Connect metadata is missing: create a case
where the test harness uses createTestData(...) without providing
cloud.minigraphql (or with cloud set to undefined) and/or omits
connectPluginVersion (undefined) and assert the produced payload/behavior
matches the expected fallback (e.g., fields absent or defaulted). Locate the
existing tests that use createTestData and connectPluginVersion (the blocks
around cloud: createTestData(...) as PartialCloudFragment and
connectPluginVersion: '2024.05.06.1049') and add one additional spec that passes
undefined for cloud or connectPluginVersion and verifies the handler/output
returns the correct fallback values.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@web/__test__/store/server.test.ts`:
- Around line 647-650: Add a test that exercises the fallback path when Connect
metadata is missing: create a case where the test harness uses
createTestData(...) without providing cloud.minigraphql (or with cloud set to
undefined) and/or omits connectPluginVersion (undefined) and assert the produced
payload/behavior matches the expected fallback (e.g., fields absent or
defaulted). Locate the existing tests that use createTestData and
connectPluginVersion (the blocks around cloud: createTestData(...) as
PartialCloudFragment and connectPluginVersion: '2024.05.06.1049') and add one
additional spec that passes undefined for cloud or connectPluginVersion and
verifies the handler/output returns the correct fallback values.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 306b7d44-918c-4d97-8a3c-c4d8b150d931

📥 Commits

Reviewing files that changed from the base of the PR and between 0154ab7 and 7fbf50c.

📒 Files selected for processing (2)
  • web/__test__/store/server.test.ts
  • web/src/store/server.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • web/src/store/server.ts

- Purpose: install the published  release on the PR branch and stop carrying a local callback payload typing shim.
- Before: the branch depended on , so the web store had to define local callback types to model the new Connect metadata while waiting for the package release.
- Problem: that kept the branch temporarily divergent from the real package API and added local maintenance overhead in the callback payload builder.
- Now: the web workspace depends on , the lockfile points at the published package, and the server store uses the shared package types directly.
- How: bump the dependency and lockfile, import  from , remove the local callback type aliases, and normalize the GraphQL Connect status through a typed helper before putting it into .
- Purpose: verify the callback payload fallback path when Connect metadata is absent.
- Before: the server store tests covered only the positive case where connectPluginVersion and cloud minigraph status were both present.
- Problem: that left the current branch without an assertion for the expected fallback behavior when those fields are missing.
- Now: the test suite includes a focused spec that omits both cloud metadata and connectPluginVersion and confirms the payload leaves those fields undefined while preserving the rest of the callback data.
- How: add a single serverPurchasePayload test in server.test.ts and re-run the focused Vitest file.
@elibosley elibosley merged commit c392146 into main Mar 24, 2026
7 checks passed
@elibosley elibosley deleted the codex/connect-callback-payload branch March 24, 2026 21:01
@github-actions
Copy link
Contributor

This plugin has been deployed to Cloudflare R2 and is available for testing.
Download it at this URL:

https://preview.dl.unraid.net/unraid-api/tag/PR1957/dynamix.unraid.net.plg

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