refactor(datasets): add comprehensive unit tests for dataset API hooks and fix api guards#36175
Conversation
- Add ESLint disable comments for describe blocks (following ChartList pattern) - Fix TypeScript mock typing using jest.mocked() helper - Update supersetGetCache.delete mock to be properly typed - Fix mockDb.owners type to be tuple [number] - Add 'as any' casts for test fixtures to avoid strict type checking - All 30 unit tests passing 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Improvements to existing unit tests for dataset hooks and API resources. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add break statement in pagination loop error handler to prevent infinite retries on persistent API errors - Add db?.id guard to prevent API calls with undefined database ID - Add 5 new tests covering extension fallback, db undefined, and pagination error scenarios - Update existing error tests to expect single API call (not retry) Test Results: 35/35 passing 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
3fcbe5a to
1699185
Compare
There was a problem hiding this comment.
Pull Request Overview
This pull request adds comprehensive unit test coverage for dataset API hooks and fixes two critical bugs that could cause browser hangs and unnecessary API calls.
Key Changes:
- Added 35 comprehensive unit tests across two test files (datasets.test.ts and useDatasetLists.test.ts)
- Fixed pagination infinite loop bug by adding
breakstatement in error handler - Fixed missing database guard to prevent API calls with undefined database ID
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| superset-frontend/src/hooks/apiResources/datasets.test.ts | New test file with 21 tests covering getDatasetId, createVerboseMap, useDatasetDrillInfo hook, extension integration, and edge cases |
| superset-frontend/src/features/datasets/hooks/useDatasetLists.test.ts | New test file with 14 tests covering pagination, error handling, guard conditions, and schema encoding |
| superset-frontend/src/features/datasets/hooks/useDatasetLists.ts | Critical bug fixes: added break statement in pagination error handler (line 68) and database ID guard check (line 82) |
There was a problem hiding this comment.
Code Review Agent Run #7e8d58
Actionable Suggestions - 1
-
superset-frontend/src/features/datasets/hooks/useDatasetLists.test.ts - 1
- Incorrect URL encoding expectation in test · Line 378-380
Review Details
-
Files reviewed - 3 · Commit Range:
7c68474..1699185- superset-frontend/src/features/datasets/hooks/useDatasetLists.test.ts
- superset-frontend/src/features/datasets/hooks/useDatasetLists.ts
- superset-frontend/src/hooks/apiResources/datasets.test.ts
-
Files skipped - 0
-
Tools
- Eslint (Linter) - ✔︎ Successful
- Whispers (Secret Scanner) - ✔︎ Successful
- Detect-secrets (Secret Scanner) - ✔︎ Successful
Bito Usage Guide
Commands
Type the following command in the pull request comment and save the comment.
-
/review- Manually triggers a full AI review. -
/pause- Pauses automatic reviews on this pull request. -
/resume- Resumes automatic reviews. -
/resolve- Marks all Bito-posted review comments as resolved. -
/abort- Cancels all in-progress reviews.
Refer to the documentation for additional commands.
Configuration
This repository uses Default Agent You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.
Documentation & Help
| // Verify the encoded schema is present in the URL (double-encoded by rison) | ||
| // Schema 'sales analytics' -> encodeURIComponent -> 'sales%20analytics' -> rison.encode_uri -> 'sales%2520analytics' | ||
| expect(callArg).toContain('sales%2520analytics'); |
There was a problem hiding this comment.
The test expects double-encoded schema in the URL, but rison does not encode percent signs, leading to incorrect validation. Update to expect 'sales%20analytics' instead of 'sales%2520analytics' to match actual rison behavior. This affects the useDatasetsList hook's API endpoint construction, where schema encoding is critical for proper URL formation and API calls.
Code suggestion
Check the AI-generated fix before applying
| // Verify the encoded schema is present in the URL (double-encoded by rison) | |
| // Schema 'sales analytics' -> encodeURIComponent -> 'sales%20analytics' -> rison.encode_uri -> 'sales%2520analytics' | |
| expect(callArg).toContain('sales%2520analytics'); | |
| // Verify the encoded schema is present in the URL (encoded by rison) | |
| // Schema 'sales analytics' -> encodeURIComponent -> 'sales%20analytics' -> rison.encode_uri -> 'sales%20analytics' | |
| expect(callArg).toContain('sales%20analytics'); |
Code Review Run #7e8d58
Should Bito avoid suggestions like this for future reviews? (Manage Rules)
- Yes, avoid them
Replace toBeNaN() with Number.isNaN() check since toBeNaN is not a standard Jest matcher. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Remove all describe() nesting following Kent C. Dodds' "Avoid Nesting When You're Testing" principles: - Remove 3 describe blocks (useDatasetDrillInfo, getDatasetId malformed, extension path) - Move beforeEach/afterEach to module level - Create setupExtensionMock() helper for extension tests - All 21 tests now flat with descriptive names Test structure is cleaner and more maintainable. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
071e9fd to
011624c
Compare
…s and fix api guards (apache#36175) Co-authored-by: Claude <noreply@anthropic.com>
…s and fix api guards (apache#36175) Co-authored-by: Claude <noreply@anthropic.com>
…s and fix api guards (apache#36175) Co-authored-by: Claude <noreply@anthropic.com>
Add API key authentication support to Superset by delegating to Flask-AppBuilder's SecurityManager. This ensures @Protect() works automatically with API keys and benefits the broader FAB ecosystem. Changes: - Update MCP auth to use FAB's SecurityManager.validate_api_key() - Add FAB_API_KEY_ENABLED and FAB_API_KEY_PREFIXES config options - Add frontend UI for API key management (list, create, revoke) - Add migration for ab_api_key table (FAB-managed) - Pin FAB to feature branch with API key support Key design decisions: - API keys validated via prefix-based lookup + hash verification - Key prefix configurable (default: ["sst_"]) for identification - Keys inherit user's RBAC permissions via FAB's has_access() - UUID-based external references for key management Depends on: dpgaspar/Flask-AppBuilder#2431 Related: apache#36175
Add API key authentication support to Superset by delegating to Flask-AppBuilder's SecurityManager. This ensures @Protect() works automatically with API keys and benefits the broader FAB ecosystem. Changes: - Update MCP auth to use FAB's SecurityManager.validate_api_key() - Add FAB_API_KEY_ENABLED and FAB_API_KEY_PREFIXES config options - Add frontend UI for API key management (list, create, revoke) - Add migration for ab_api_key table (FAB-managed) - Pin FAB to feature branch with API key support Key design decisions: - API keys validated via prefix-based lookup + hash verification - Key prefix configurable (default: ["sst_"]) for identification - Keys inherit user's RBAC permissions via FAB's has_access() - UUID-based external references for key management Depends on: dpgaspar/Flask-AppBuilder#2431 Related: apache#36175
Add API key authentication support to Superset by delegating to Flask-AppBuilder's SecurityManager. This ensures @Protect() works automatically with API keys and benefits the broader FAB ecosystem. Changes: - Update MCP auth to use FAB's SecurityManager.validate_api_key() - Add FAB_API_KEY_ENABLED and FAB_API_KEY_PREFIXES config options - Add frontend UI for API key management (list, create, revoke) - Add migration for ab_api_key table (FAB-managed) - Pin FAB to feature branch with API key support Key design decisions: - API keys validated via prefix-based lookup + hash verification - Key prefix configurable (default: ["sst_"]) for identification - Keys inherit user's RBAC permissions via FAB's has_access() - UUID-based external references for key management Depends on: dpgaspar/Flask-AppBuilder#2431 Related: apache#36175
Add API key authentication support to Superset by delegating to Flask-AppBuilder's SecurityManager. This ensures @Protect() works automatically with API keys and benefits the broader FAB ecosystem. Changes: - Update MCP auth to use FAB's SecurityManager.validate_api_key() - Add FAB_API_KEY_ENABLED and FAB_API_KEY_PREFIXES config options - Add frontend UI for API key management (list, create, revoke) - Add migration for ab_api_key table (FAB-managed) - Pin FAB to feature branch with API key support Key design decisions: - API keys validated via prefix-based lookup + hash verification - Key prefix configurable (default: ["sst_"]) for identification - Keys inherit user's RBAC permissions via FAB's has_access() - UUID-based external references for key management Depends on: dpgaspar/Flask-AppBuilder#2431 Related: apache#36175
Add API key authentication support to Superset by delegating to Flask-AppBuilder's SecurityManager. This ensures @Protect() works automatically with API keys and benefits the broader FAB ecosystem. Changes: - Update MCP auth to use FAB's SecurityManager.validate_api_key() - Add FAB_API_KEY_ENABLED and FAB_API_KEY_PREFIXES config options - Add frontend UI for API key management (list, create, revoke) - Add migration for ab_api_key table (FAB-managed) - Pin FAB to feature branch with API key support Key design decisions: - API keys validated via prefix-based lookup + hash verification - Key prefix configurable (default: ["sst_"]) for identification - Keys inherit user's RBAC permissions via FAB's has_access() - UUID-based external references for key management Depends on: dpgaspar/Flask-AppBuilder#2431 Related: apache#36175
Add API key authentication support to Superset by delegating to Flask-AppBuilder's SecurityManager. This ensures @Protect() works automatically with API keys and benefits the broader FAB ecosystem. Changes: - Update MCP auth to use FAB's SecurityManager.validate_api_key() - Add FAB_API_KEY_ENABLED and FAB_API_KEY_PREFIXES config options - Add frontend UI for API key management (list, create, revoke) - Add migration for ab_api_key table (FAB-managed) - Pin FAB to feature branch with API key support Key design decisions: - API keys validated via prefix-based lookup + hash verification - Key prefix configurable (default: ["sst_"]) for identification - Keys inherit user's RBAC permissions via FAB's has_access() - UUID-based external references for key management Depends on: dpgaspar/Flask-AppBuilder#2431 Related: apache#36175
Add API key authentication support to Superset by delegating to Flask-AppBuilder's SecurityManager. This ensures @Protect() works automatically with API keys and benefits the broader FAB ecosystem. Changes: - Update MCP auth to use FAB's SecurityManager.validate_api_key() - Add FAB_API_KEY_ENABLED and FAB_API_KEY_PREFIXES config options - Add frontend UI for API key management (list, create, revoke) - Add migration for ab_api_key table (FAB-managed) - Pin FAB to feature branch with API key support Key design decisions: - API keys validated via prefix-based lookup + hash verification - Key prefix configurable (default: ["sst_"]) for identification - Keys inherit user's RBAC permissions via FAB's has_access() - UUID-based external references for key management Depends on: dpgaspar/Flask-AppBuilder#2431 Related: apache#36175
Add API key authentication support to Superset by delegating to Flask-AppBuilder's SecurityManager. This ensures @Protect() works automatically with API keys and benefits the broader FAB ecosystem. Changes: - Update MCP auth to use FAB's SecurityManager.validate_api_key() - Add FAB_API_KEY_ENABLED and FAB_API_KEY_PREFIXES config options - Add frontend UI for API key management (list, create, revoke) - Add migration for ab_api_key table (FAB-managed) - Pin FAB to feature branch with API key support Key design decisions: - API keys validated via prefix-based lookup + hash verification - Key prefix configurable (default: ["sst_"]) for identification - Keys inherit user's RBAC permissions via FAB's has_access() - UUID-based external references for key management Depends on: dpgaspar/Flask-AppBuilder#2431 Related: apache#36175
Add API key authentication support to Superset by delegating to Flask-AppBuilder's SecurityManager. This ensures @Protect() works automatically with API keys and benefits the broader FAB ecosystem. Changes: - Update MCP auth to use FAB's SecurityManager.validate_api_key() - Add FAB_API_KEY_ENABLED and FAB_API_KEY_PREFIXES config options - Add frontend UI for API key management (list, create, revoke) - Add migration for ab_api_key table (FAB-managed) - Pin FAB to feature branch with API key support Key design decisions: - API keys validated via prefix-based lookup + hash verification - Key prefix configurable (default: ["sst_"]) for identification - Keys inherit user's RBAC permissions via FAB's has_access() - UUID-based external references for key management Depends on: dpgaspar/Flask-AppBuilder#2431 Related: apache#36175
Add API key authentication support to Superset by delegating to Flask-AppBuilder's SecurityManager. This ensures @Protect() works automatically with API keys and benefits the broader FAB ecosystem. Changes: - Update MCP auth to use FAB's SecurityManager.validate_api_key() - Add FAB_API_KEY_ENABLED and FAB_API_KEY_PREFIXES config options - Add frontend UI for API key management (list, create, revoke) - Add migration for ab_api_key table (FAB-managed) - Pin FAB to feature branch with API key support Key design decisions: - API keys validated via prefix-based lookup + hash verification - Key prefix configurable (default: ["sst_"]) for identification - Keys inherit user's RBAC permissions via FAB's has_access() - UUID-based external references for key management Depends on: dpgaspar/Flask-AppBuilder#2431 Related: apache#36175
Add API key authentication support to Superset by delegating to Flask-AppBuilder's SecurityManager. This ensures @Protect() works automatically with API keys and benefits the broader FAB ecosystem. Changes: - Update MCP auth to use FAB's SecurityManager.validate_api_key() - Add FAB_API_KEY_ENABLED and FAB_API_KEY_PREFIXES config options - Add frontend UI for API key management (list, create, revoke) - Add migration for ab_api_key table (FAB-managed) - Pin FAB to feature branch with API key support Key design decisions: - API keys validated via prefix-based lookup + hash verification - Key prefix configurable (default: ["sst_"]) for identification - Keys inherit user's RBAC permissions via FAB's has_access() - UUID-based external references for key management Depends on: dpgaspar/Flask-AppBuilder#2431 Related: apache#36175
Add API key authentication support to Superset by delegating to Flask-AppBuilder's SecurityManager. This ensures @Protect() works automatically with API keys and benefits the broader FAB ecosystem. Changes: - Update MCP auth to use FAB's SecurityManager.validate_api_key() - Add FAB_API_KEY_ENABLED and FAB_API_KEY_PREFIXES config options - Add frontend UI for API key management (list, create, revoke) - Add migration for ab_api_key table (FAB-managed) - Pin FAB to feature branch with API key support Key design decisions: - API keys validated via prefix-based lookup + hash verification - Key prefix configurable (default: ["sst_"]) for identification - Keys inherit user's RBAC permissions via FAB's has_access() - UUID-based external references for key management Depends on: dpgaspar/Flask-AppBuilder#2431 Related: apache#36175
Add API key authentication support to Superset by delegating to Flask-AppBuilder's SecurityManager. This ensures @Protect() works automatically with API keys and benefits the broader FAB ecosystem. Changes: - Update MCP auth to use FAB's SecurityManager.validate_api_key() - Add FAB_API_KEY_ENABLED and FAB_API_KEY_PREFIXES config options - Add frontend UI for API key management (list, create, revoke) - Add migration for ab_api_key table (FAB-managed) - Pin FAB to feature branch with API key support Key design decisions: - API keys validated via prefix-based lookup + hash verification - Key prefix configurable (default: ["sst_"]) for identification - Keys inherit user's RBAC permissions via FAB's has_access() - UUID-based external references for key management Depends on: dpgaspar/Flask-AppBuilder#2431 Related: apache#36175
Add API key authentication support to Superset by delegating to Flask-AppBuilder's SecurityManager. This ensures @Protect() works automatically with API keys and benefits the broader FAB ecosystem. Changes: - Update MCP auth to use FAB's SecurityManager.validate_api_key() - Add FAB_API_KEY_ENABLED and FAB_API_KEY_PREFIXES config options - Add frontend UI for API key management (list, create, revoke) - Add migration for ab_api_key table (FAB-managed) - Pin FAB to feature branch with API key support Key design decisions: - API keys validated via prefix-based lookup + hash verification - Key prefix configurable (default: ["sst_"]) for identification - Keys inherit user's RBAC permissions via FAB's has_access() - UUID-based external references for key management Depends on: dpgaspar/Flask-AppBuilder#2431 Related: apache#36175
Add API key authentication support to Superset by delegating to Flask-AppBuilder's SecurityManager. This ensures @Protect() works automatically with API keys and benefits the broader FAB ecosystem. Changes: - Update MCP auth to use FAB's SecurityManager.validate_api_key() - Add FAB_API_KEY_ENABLED and FAB_API_KEY_PREFIXES config options - Add frontend UI for API key management (list, create, revoke) - Add migration for ab_api_key table (FAB-managed) - Pin FAB to feature branch with API key support Key design decisions: - API keys validated via prefix-based lookup + hash verification - Key prefix configurable (default: ["sst_"]) for identification - Keys inherit user's RBAC permissions via FAB's has_access() - UUID-based external references for key management Depends on: dpgaspar/Flask-AppBuilder#2431 Related: apache#36175
Add API key authentication support to Superset by delegating to Flask-AppBuilder's SecurityManager. This ensures @Protect() works automatically with API keys and benefits the broader FAB ecosystem. Changes: - Update MCP auth to use FAB's SecurityManager.validate_api_key() - Add FAB_API_KEY_ENABLED and FAB_API_KEY_PREFIXES config options - Add frontend UI for API key management (list, create, revoke) - Add migration for ab_api_key table (FAB-managed) - Pin FAB to feature branch with API key support Key design decisions: - API keys validated via prefix-based lookup + hash verification - Key prefix configurable (default: ["sst_"]) for identification - Keys inherit user's RBAC permissions via FAB's has_access() - UUID-based external references for key management Depends on: dpgaspar/Flask-AppBuilder#2431 Related: apache#36175
Add API key authentication support to Superset by delegating to Flask-AppBuilder's SecurityManager. This ensures @Protect() works automatically with API keys and benefits the broader FAB ecosystem. Changes: - Update MCP auth to use FAB's SecurityManager.validate_api_key() - Add FAB_API_KEY_ENABLED and FAB_API_KEY_PREFIXES config options - Add frontend UI for API key management (list, create, revoke) - Add migration for ab_api_key table (FAB-managed) - Pin FAB to feature branch with API key support Key design decisions: - API keys validated via prefix-based lookup + hash verification - Key prefix configurable (default: ["sst_"]) for identification - Keys inherit user's RBAC permissions via FAB's has_access() - UUID-based external references for key management Depends on: dpgaspar/Flask-AppBuilder#2431 Related: apache#36175
Add API key authentication support to Superset by delegating to Flask-AppBuilder's SecurityManager. This ensures @Protect() works automatically with API keys and benefits the broader FAB ecosystem. Changes: - Update MCP auth to use FAB's SecurityManager.validate_api_key() - Add FAB_API_KEY_ENABLED and FAB_API_KEY_PREFIXES config options - Add frontend UI for API key management (list, create, revoke) - Add migration for ab_api_key table (FAB-managed) - Pin FAB to feature branch with API key support Key design decisions: - API keys validated via prefix-based lookup + hash verification - Key prefix configurable (default: ["sst_"]) for identification - Keys inherit user's RBAC permissions via FAB's has_access() - UUID-based external references for key management Depends on: dpgaspar/Flask-AppBuilder#2431 Related: apache#36175
Add API key authentication support to Superset by delegating to Flask-AppBuilder's SecurityManager. This ensures @Protect() works automatically with API keys and benefits the broader FAB ecosystem. Changes: - Update MCP auth to use FAB's SecurityManager.validate_api_key() - Add FAB_API_KEY_ENABLED and FAB_API_KEY_PREFIXES config options - Add frontend UI for API key management (list, create, revoke) - Add migration for ab_api_key table (FAB-managed) - Pin FAB to feature branch with API key support Key design decisions: - API keys validated via prefix-based lookup + hash verification - Key prefix configurable (default: ["sst_"]) for identification - Keys inherit user's RBAC permissions via FAB's has_access() - UUID-based external references for key management Depends on: dpgaspar/Flask-AppBuilder#2431 Related: apache#36175
Add API key authentication support to Superset by delegating to Flask-AppBuilder's SecurityManager. This ensures @Protect() works automatically with API keys and benefits the broader FAB ecosystem. Changes: - Update MCP auth to use FAB's SecurityManager.validate_api_key() - Add FAB_API_KEY_ENABLED and FAB_API_KEY_PREFIXES config options - Add frontend UI for API key management (list, create, revoke) - Add migration for ab_api_key table (FAB-managed) - Pin FAB to feature branch with API key support Key design decisions: - API keys validated via prefix-based lookup + hash verification - Key prefix configurable (default: ["sst_"]) for identification - Keys inherit user's RBAC permissions via FAB's has_access() - UUID-based external references for key management Depends on: dpgaspar/Flask-AppBuilder#2431 Related: apache#36175
Add API key authentication support to Superset by delegating to Flask-AppBuilder's SecurityManager. This ensures @Protect() works automatically with API keys and benefits the broader FAB ecosystem. Changes: - Update MCP auth to use FAB's SecurityManager.validate_api_key() - Add FAB_API_KEY_ENABLED and FAB_API_KEY_PREFIXES config options - Add frontend UI for API key management (list, create, revoke) - Add migration for ab_api_key table (FAB-managed) - Pin FAB to feature branch with API key support Key design decisions: - API keys validated via prefix-based lookup + hash verification - Key prefix configurable (default: ["sst_"]) for identification - Keys inherit user's RBAC permissions via FAB's has_access() - UUID-based external references for key management Depends on: dpgaspar/Flask-AppBuilder#2431 Related: apache#36175
Add API key authentication support to Superset by delegating to Flask-AppBuilder's SecurityManager. This ensures @Protect() works automatically with API keys and benefits the broader FAB ecosystem. Changes: - Update MCP auth to use FAB's SecurityManager.validate_api_key() - Add FAB_API_KEY_ENABLED and FAB_API_KEY_PREFIXES config options - Add frontend UI for API key management (list, create, revoke) - Add migration for ab_api_key table (FAB-managed) - Pin FAB to feature branch with API key support Key design decisions: - API keys validated via prefix-based lookup + hash verification - Key prefix configurable (default: ["sst_"]) for identification - Keys inherit user's RBAC permissions via FAB's has_access() - UUID-based external references for key management Depends on: dpgaspar/Flask-AppBuilder#2431 Related: apache#36175
Add API key authentication support to Superset by delegating to Flask-AppBuilder's SecurityManager. This ensures @Protect() works automatically with API keys and benefits the broader FAB ecosystem. Changes: - Update MCP auth to use FAB's SecurityManager.validate_api_key() - Add FAB_API_KEY_ENABLED and FAB_API_KEY_PREFIXES config options - Add frontend UI for API key management (list, create, revoke) - Add migration for ab_api_key table (FAB-managed) - Pin FAB to feature branch with API key support Key design decisions: - API keys validated via prefix-based lookup + hash verification - Key prefix configurable (default: ["sst_"]) for identification - Keys inherit user's RBAC permissions via FAB's has_access() - UUID-based external references for key management Depends on: dpgaspar/Flask-AppBuilder#2431 Related: apache#36175
Add API key authentication support to Superset by delegating to Flask-AppBuilder's SecurityManager. This ensures @Protect() works automatically with API keys and benefits the broader FAB ecosystem. Changes: - Update MCP auth to use FAB's SecurityManager.validate_api_key() - Add FAB_API_KEY_ENABLED and FAB_API_KEY_PREFIXES config options - Add frontend UI for API key management (list, create, revoke) - Add migration for ab_api_key table (FAB-managed) - Pin FAB to feature branch with API key support Key design decisions: - API keys validated via prefix-based lookup + hash verification - Key prefix configurable (default: ["sst_"]) for identification - Keys inherit user's RBAC permissions via FAB's has_access() - UUID-based external references for key management Depends on: dpgaspar/Flask-AppBuilder#2431 Related: apache#36175
Add API key authentication support to Superset by delegating to Flask-AppBuilder's SecurityManager. This ensures @Protect() works automatically with API keys and benefits the broader FAB ecosystem. Changes: - Update MCP auth to use FAB's SecurityManager.validate_api_key() - Add FAB_API_KEY_ENABLED and FAB_API_KEY_PREFIXES config options - Add frontend UI for API key management (list, create, revoke) - Add migration for ab_api_key table (FAB-managed) - Pin FAB to feature branch with API key support Key design decisions: - API keys validated via prefix-based lookup + hash verification - Key prefix configurable (default: ["sst_"]) for identification - Keys inherit user's RBAC permissions via FAB's has_access() - UUID-based external references for key management Depends on: dpgaspar/Flask-AppBuilder#2431 Related: apache#36175
Add API key authentication support to Superset by delegating to Flask-AppBuilder's SecurityManager. This ensures @Protect() works automatically with API keys and benefits the broader FAB ecosystem. Changes: - Update MCP auth to use FAB's SecurityManager.validate_api_key() - Add FAB_API_KEY_ENABLED and FAB_API_KEY_PREFIXES config options - Add frontend UI for API key management (list, create, revoke) - Add migration for ab_api_key table (FAB-managed) - Pin FAB to feature branch with API key support Key design decisions: - API keys validated via prefix-based lookup + hash verification - Key prefix configurable (default: ["sst_"]) for identification - Keys inherit user's RBAC permissions via FAB's has_access() - UUID-based external references for key management Depends on: dpgaspar/Flask-AppBuilder#2431 Related: apache#36175
Add API key authentication support to Superset by delegating to Flask-AppBuilder's SecurityManager. This ensures @Protect() works automatically with API keys and benefits the broader FAB ecosystem. Changes: - Update MCP auth to use FAB's SecurityManager.validate_api_key() - Add FAB_API_KEY_ENABLED and FAB_API_KEY_PREFIXES config options - Add frontend UI for API key management (list, create, revoke) - Add migration for ab_api_key table (FAB-managed) - Pin FAB to feature branch with API key support Key design decisions: - API keys validated via prefix-based lookup + hash verification - Key prefix configurable (default: ["sst_"]) for identification - Keys inherit user's RBAC permissions via FAB's has_access() - UUID-based external references for key management Depends on: dpgaspar/Flask-AppBuilder#2431 Related: apache#36175
…s and fix api guards (apache#36175) Co-authored-by: Claude <noreply@anthropic.com>
SUMMARY
This PR adds comprehensive unit test coverage for the dataset API hooks used in the filter configuration flow, plus fixes two critical bugs discovered during testing.
New Test Coverage (35 tests)
src/hooks/apiResources/datasets.test.ts (21 tests)
src/features/datasets/hooks/useDatasetLists.test.ts (14 tests)
Bug Fixes
- Problem: Error handler in pagination loop didn't break, causing infinite retries on persistent API errors
- Fix: Added break statement in catch block
- Risk: CRITICAL - could cause browser hangs/crashes
- Problem: API calls fired with database: undefined when db not selected
- Fix: Added db?.id !== undefined check to guard condition
- Risk: MEDIUM - API spam with malformed filters
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION