Skip to content

Fix authentication toggles persistence bug in God Mode - #3

Merged
codecsrayo merged 2 commits into
feature/integrations-panel-fix-17593507967815292912from
fix/auth-toggles-persistence-bug-god-mode-17770788961305901682
Apr 6, 2026
Merged

codecsrayo merged 2 commits into
feature/integrations-panel-fix-17593507967815292912from
fix/auth-toggles-persistence-bug-god-mode-17770788961305901682

Conversation

@codecsrayo

Copy link
Copy Markdown
Owner

The bug where authentication toggles (Google, GitHub, GitLab, etc.) in the God Mode panel changed in the UI but did not persist in the database was caused by two main issues:

  1. Several configuration keys (IS_GOOGLE_ENABLED, IS_GITHUB_ENABLED, IS_GITLAB_ENABLED) were not part of the backend's whitelist of known configuration variables, making them unmanageable through the API.
  2. The backend's configuration PATCH endpoint was only designed to update existing records and did not support the creation of missing ones.
  3. The configure_instance management command had a logic error that skipped initializing several authentication keys if others were already present.

This PR fixes these issues by:

  • Adding the missing keys to apps/api/plane/utils/instance_config_variables/core.py.
  • Modernizing the patch method in apps/api/plane/license/api/views/configuration.py to use update_or_create.
  • Refactoring apps/api/plane/license/management/commands/configure_instance.py for reliable initialization.

PR created automatically by Jules for task 17770788961305901682 started by @codecsrayo

- Added missing configuration keys (IS_GOOGLE_ENABLED, IS_GITHUB_ENABLED, IS_GITLAB_ENABLED) to the backend's known configuration variables.
- Updated InstanceConfigurationEndpoint's patch method to use update_or_create for known keys, ensuring that even missing configuration records are created when toggled in the UI.
- Refactored the configure_instance management command to consistently initialize all configuration variables, including the authentication toggles, and to preserve backward-compatible auto-enabling if client credentials are provided via environment variables.

This fix addresses the bug where toggling authentication methods in the God Mode panel did not persist their state to the database, causing them to reset upon page refresh.

Co-authored-by: codecsrayo <[email protected]>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

- Added missing configuration keys (IS_GOOGLE_ENABLED, IS_GITHUB_ENABLED, IS_GITLAB_ENABLED) to the backend's known configuration variables.
- Updated InstanceConfigurationEndpoint's patch method to use update_or_create for known keys, ensuring that even missing configuration records are created when toggled in the UI.
- Refactored the configure_instance management command to consistently initialize all configuration variables, including the authentication toggles, and to preserve backward-compatible auto-enabling if client credentials are provided via environment variables.

This fix addresses the bug where toggling authentication methods in the God Mode panel did not persist their state to the database, causing them to reset upon page refresh.

Co-authored-by: codecsrayo <[email protected]>
@codecsrayo
codecsrayo merged commit af80b15 into feature/integrations-panel-fix-17593507967815292912 Apr 6, 2026
@codecsrayo
codecsrayo deleted the fix/auth-toggles-persistence-bug-god-mode-17770788961305901682 branch April 12, 2026 02:06
codecsrayo pushed a commit that referenced this pull request Apr 18, 2026
…Error, URL encoding, useMemo→useCallback

#3 — setInterval sin cleanup:
- Extraído interval ID a intervalRef (useRef) en lugar de variable local
- Añadido useEffect de unmount que llama clearInterval(intervalRef.current)
- Patrón idéntico al ya usado en personal-connect-card.tsx:58,76-81

#4 — popup.current.closed sin try/catch:
- Envuelto el acceso a popup.current.closed en try/catch
- SecurityError en popup cross-origin ahora se trata como 'closed'
- El guard === undefined previo no cubría el throw

#5 — URLs construidas sin encodeURIComponent:
- workspaceSlug, projectId y stateParams ahora se encodean antes
  de inyectarse en el parámetro state=
- Slug con &, #, = o espacios ya no corrompe el parseo del callback
- Nonce (UUID, url-safe) también encodificado defensivamente
- slackChannelState construido con variables intermedias encodificadas

#6 — useMemo retornando función:
- Cambiado useMemo(() => (nonce) => ...) → useCallback((nonce) => ...)
- Eliminado el eslint-disable-next-line innecesario (deps estaban completas)
- Import: reemplazado useMemo por useCallback
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