feat(settings): add debug mode for superusers#2893
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
Greptile SummaryThis PR adds a toggleable debug mode for superusers that allows importing workflows by ID for debugging purposes. The implementation introduces a two-factor authentication pattern where superuser features require both the database Key Changes:
Note: Previous thread identified missing user feedback in the Debug component (silent success/failure). This wasn't addressed in the current changes. Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant DebugUI as Debug Component
participant API as /api/superuser/import-workflow
participant PermCheck as verifyEffectiveSuperUser
participant DB as Database
participant WorkflowOps as Workflow Operations
User->>DebugUI: Enter workflow ID & click Import
DebugUI->>API: POST {workflowId, targetWorkspaceId}
API->>PermCheck: Check superuser access
PermCheck->>DB: Query user.isSuperUser
PermCheck->>DB: Query settings.superUserModeEnabled
PermCheck-->>API: {effectiveSuperUser: true/false}
alt Not Effective Superuser
API-->>DebugUI: 403 Forbidden
DebugUI->>DebugUI: Log error (no user feedback)
else Effective Superuser
API->>DB: Verify target workspace exists
API->>DB: Fetch source workflow
API->>WorkflowOps: loadWorkflowFromNormalizedTables
API->>WorkflowOps: sanitizeForExport
API->>WorkflowOps: parseWorkflowJson (regenerate IDs)
API->>DB: Create new workflow record
API->>WorkflowOps: saveWorkflowToNormalizedTables
alt Save Failed
API->>DB: Delete workflow record (cleanup)
API-->>DebugUI: 500 Error
else Save Success
API->>DB: Copy copilot chats
API-->>DebugUI: 200 {newWorkflowId, copilotChatsImported}
DebugUI->>DebugUI: Invalidate workflow list query
DebugUI->>DebugUI: Clear input & log (no user feedback)
end
end
|
...pace/[workspaceId]/w/components/sidebar/components/settings-modal/components/debug/debug.tsx
Show resolved
Hide resolved
...pace/[workspaceId]/w/components/sidebar/components/settings-modal/components/debug/debug.tsx
Show resolved
Hide resolved
Collaborator
|
@greptile |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds superuser capability to debug workflows
Type of Change
Testing
Manual
Checklist