fix(extension): guard notebase beta access#1230
Conversation
🦋 Changeset detectedLatest commit: 22e13d0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
|
Documentation Updates 2 document(s) were updated by changes in this PR: Build and Development Environment SetupView 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 LocalizationView 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: |
There was a problem hiding this comment.
💡 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".
| return useQuery(orpc.notebaseBeta.status.queryOptions({ | ||
| input: {}, | ||
| enabled, | ||
| staleTime: 60_000, |
There was a problem hiding this comment.
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 👍 / 👎.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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>
Type of Changes
Description
@read-frog/api-contractto0.2.2and add a shared Notebase beta helper for the extensionRelated Issue
Not linked.
How Has This Been Tested?
Validation:
pnpm type-checkpnpm 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.tsSKIP_FREE_API=true pnpm test -- --exclude="**/free-api.test.ts"Screenshots
N/A
Checklist
Additional Information
pnpm testin a network-restricted environment still fails insrc/utils/host/translate/api/__tests__/free-api.test.tsbecause those tests call live Google/Microsoft translation endpoints. The existing pre-push hook and CI already support skipping them withSKIP_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
Dependencies
@read-frog/api-contractto0.2.2.Written for commit 22e13d0. Summary will update on new commits.