Skip to content

fix(extension): guard notebase beta access#1230

Merged
mengxi-ream merged 2 commits intomainfrom
fix/notebase-beta-access
Mar 25, 2026
Merged

fix(extension): guard notebase beta access#1230
mengxi-ream merged 2 commits intomainfrom
fix/notebase-beta-access

Conversation

@mengxi-ream
Copy link
Copy Markdown
Owner

@mengxi-ream mengxi-ream commented Mar 25, 2026

Type of Changes

  • 🐛 Bug fix (fix)
  • ✅ Test related (test)

Description

  • gate Notebase table listing and schema fetches behind the beta-status check so non-beta accounts stop hitting forbidden Notebase RPCs
  • show a locked-state alert in the options form and disable save-to-Notebase actions until the signed-in account is enrolled in the beta
  • bump @read-frog/api-contract to 0.2.2 and add a shared Notebase beta helper for the extension
  • replace hardcoded release-version assertions in blog notification tests with semver matchers so release bumps do not break pre-push checks

Related Issue

Not linked.

How Has This Been Tested?

  • Added unit tests
  • Verified through manual testing

Validation:

  • pnpm type-check
  • pnpm lint src/entrypoints/options/pages/custom-actions/action-config-form/notebase-connection-field.tsx src/entrypoints/selection.content/selection-toolbar/custom-action-button/save-to-notebase-button.tsx src/utils/notebase-beta.ts
  • SKIP_FREE_API=true pnpm test -- --exclude="**/free-api.test.ts"

Screenshots

N/A

Checklist

  • I have tested these changes locally
  • I have updated the documentation accordingly if necessary
  • My code follows the code style of this project
  • My changes do not break existing functionality
  • If my code was generated by AI, I have proofread and improved it as necessary.

Additional Information

  • Running plain pnpm test in a network-restricted environment still fails in src/utils/host/translate/api/__tests__/free-api.test.ts because those tests call live Google/Microsoft translation endpoints. The existing pre-push hook and CI already support skipping them with SKIP_FREE_API=true.

Summary by cubic

Guard Notebase beta access in the extension so non‑beta accounts stop calling forbidden RPCs and see a locked UI. Also stabilize tests and bump @read-frog/api-contract.

  • Bug Fixes

    • Gate Notebase table list and schema fetch behind beta status to prevent 403s.
    • Disable Notebase selection/save when locked and show an alert with “Open Notebase”.
    • Handle 403s via a forbidden error helper; add clear toast/tooltip copy.
    • Stabilize blog notification tests by matching release via semver; add i18n strings for beta messages.
  • Dependencies

    • Bump @read-frog/api-contract to 0.2.2.

Written for commit 22e13d0. Summary will update on new commits.

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 25, 2026

🦋 Changeset detected

Latest commit: 22e13d0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@read-frog/extension Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Mar 25, 2026
@github-actions github-actions bot added the fix label Mar 25, 2026
@dosubot dosubot bot added the app: browser extension Related to browser extension label Mar 25, 2026
@dosubot
Copy link
Copy Markdown

dosubot bot commented Mar 25, 2026

Documentation Updates

2 document(s) were updated by changes in this PR:

Build and Development Environment Setup
View Changes
@@ -395,7 +395,7 @@
 
 ## Dependency Management
 - **Pinned Versions:** All `@read-frog/*` dependencies are pinned to specific versions instead of using `latest`. Current versions include:
-  - `@read-frog/[email protected]`
+  - `@read-frog/[email protected]`
   - `@read-frog/[email protected]`
 - **Icon Strategy:** The extension uses bundled React icon components from `@remixicon/react` and `@tabler/icons-react` to avoid Content Security Policy (CSP) restrictions on dynamically loaded SVGs. For cases requiring dynamic icon loading via Iconify, the extension provides a background fetch proxy (see [Background Fetch Infrastructure](#background-fetch-infrastructure)).
 - **Charting Library:** The project uses `recharts` (^3.8.0), a composable charting library built on React components, for rendering statistics charts such as the batch request chart.
Internationalization and Localization
View Changes
@@ -304,6 +304,8 @@
 - **`emptyTitle`**: Title shown when no notebases exist
 - **`emptyDescription`**: Description prompting user to create a notebase
 - **`openNotebaseAction`**: Label for the button to open notebase website
+- **`betaLockedTitle`**: Title shown when user is not enrolled in Notebase beta ("This account is not in the Notebase beta")
+- **`betaLockedDescription`**: Description explaining beta limitation and directing users to enroll
 - **`tableUnavailableTitle`**: Title shown when selected notebase is no longer available
 - **`tableUnavailableDescription`**: Description for unavailable notebase
 - **`tableUnavailableOption`**: Label suffix for unavailable notebase in dropdown ("unavailable")
@@ -326,7 +328,7 @@
 - **`mappingMissingSchema`**: Error message prompting user to refresh schema
 - **`mappingIncompatible`**: Error message when field types no longer match
 
-Users can select a notebase, map custom action output fields to notebase columns, and save results using the "Save to Notebase" button in the selection toolbar. Invalid mappings are preserved but disable saving until fixed. The UI validates mapping compatibility based on field types and provides clear feedback for authentication, missing notebases, schema errors, and invalid mappings.
+Users can select a notebase, map custom action output fields to notebase columns, and save results using the "Save to Notebase" button in the selection toolbar. Invalid mappings are preserved but disable saving until fixed. The UI validates mapping compatibility based on field types and provides clear feedback for authentication, beta access limitations, missing notebases, schema errors, and invalid mappings.
 
 **Example:**
 
@@ -681,11 +683,12 @@
 - **`action.saveToNotebaseSuccess`**: Success message after saving ("Saved to Notebase")
 - **`action.saveToNotebaseFailed`**: Error message when save fails ("Failed to save to Notebase")
 - **`action.saveToNotebaseLoginRequired`**: Error message when user is not authenticated
+- **`action.saveToNotebaseBetaRequired`**: Error message when user is not enrolled in Notebase beta
 - **`action.saveToNotebaseTableUnavailable`**: Error message when selected notebase is unavailable
 - **`action.saveToNotebaseConnectionInvalid`**: Error message when notebase connection is invalid
 - **`action.saveToNotebaseNoMappings`**: Error message when no valid mappings exist
 
-These action buttons appear in popover footers with tooltip support. The copy button displays a success state after copying text to the clipboard, while the speak button integrates with the TTS system and shows different states (speak, playing, loading). The `translation` key is used for the toolbar button tooltip to provide an accessible label. The "Save to Notebase" button (added in PR #1215) validates mappings and saves structured output to the configured notebase, with clear error feedback for authentication, unavailable notebases, invalid connections, and missing mappings.
+These action buttons appear in popover footers with tooltip support. The copy button displays a success state after copying text to the clipboard, while the speak button integrates with the TTS system and shows different states (speak, playing, loading). The `translation` key is used for the toolbar button tooltip to provide an accessible label. The "Save to Notebase" button (added in PR #1215) validates mappings and saves structured output to the configured notebase, with clear error feedback for authentication, beta access limitations, unavailable notebases, invalid connections, and missing mappings.
 
 **Example:**
 
@@ -1080,6 +1083,7 @@
 - **PR #1152**: Added provider options recommendation keys with 5 new keys under `options.apiProviders.form.providerOptionsRecommendation*` to support manual preview and application of recommended provider options
 - **PR #1171**: Added context menu selection translation and custom action support with 1 new key (`contextMenu.translateSelection`) and updated context menu configuration description
 - **PR #1215**: Added notebase integration for custom AI actions with 34+ new keys under `options.floatingButtonAndToolbar.selectionToolbar.customActions.form.notebase` for connection configuration and field mapping, plus 8 new keys under `action.saveToNotebase*` for the save button and error handling
+- **PR #1230**: Added Notebase beta access gating with 3 new keys (`form.notebase.betaLockedTitle`, `form.notebase.betaLockedDescription`, `action.saveToNotebaseBetaRequired`) to handle non-beta accounts attempting to use Notebase features
 
 ### Context Menu Localization
 The browser context menu (right-click menu) supports page translation, selection translation, and custom AI actions. Context menu entries are localized under the `contextMenu` namespace:

How did I do? Any feedback?  Join Discord

Copy link
Copy Markdown

@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: 22e13d0ace

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

Comment on lines +6 to +9
return useQuery(orpc.notebaseBeta.status.queryOptions({
input: {},
enabled,
staleTime: 60_000,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Scope beta-status query cache to the authenticated user

This hook caches notebaseBeta.status for 60 seconds under a key derived only from input: {}; when a user switches accounts in the same extension session, React Query can reuse the previous account’s fresh allowed value instead of refetching, so non-beta users may temporarily see beta-only controls enabled and still hit the forbidden Notebase RPCs this change is trying to avoid. Include user/session identity in the query key (or explicitly invalidate on session changes) so entitlement is re-evaluated per account.

Useful? React with 👍 / 👎.

@mengxi-ream mengxi-ream merged commit b2173e8 into main Mar 25, 2026
5 checks passed
@mengxi-ream mengxi-ream deleted the fix/notebase-beta-access branch March 25, 2026 04:20
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 16 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="src/entrypoints/selection.content/selection-toolbar/custom-action-button/save-to-notebase-button.tsx">

<violation number="1" location="src/entrypoints/selection.content/selection-toolbar/custom-action-button/save-to-notebase-button.tsx:151">
P2: The disabled tooltip condition treats any non-`true` beta state as "beta required", so signed-out or beta-status-error states show an incorrect message. Restrict the title to confirmed beta-locked states.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

|| saveMutation.isPending
|| hasInvalidMappings
|| !hasValidMappings
const disabledTitle = !betaStatusQuery.isPending && !isBetaAllowed
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot Mar 25, 2026

Choose a reason for hiding this comment

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

P2: The disabled tooltip condition treats any non-true beta state as "beta required", so signed-out or beta-status-error states show an incorrect message. Restrict the title to confirmed beta-locked states.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/entrypoints/selection.content/selection-toolbar/custom-action-button/save-to-notebase-button.tsx, line 151:

<comment>The disabled tooltip condition treats any non-`true` beta state as "beta required", so signed-out or beta-status-error states show an incorrect message. Restrict the title to confirmed beta-locked states.</comment>

<file context>
@@ -131,19 +139,26 @@ function SaveToNotebaseButtonEnabled({
     || saveMutation.isPending
     || hasInvalidMappings
     || !hasValidMappings
+  const disabledTitle = !betaStatusQuery.isPending && !isBetaAllowed
+    ? i18n.t("action.saveToNotebaseBetaRequired")
+    : undefined
</file context>
Fix with Cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: browser extension Related to browser extension fix size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant