Skip to content

[GIT-243]fix: InstanceConfiguration not created for some keys#9303

Open
sangeethailango wants to merge 2 commits into
previewfrom
fix-configure_instance-management-command
Open

[GIT-243]fix: InstanceConfiguration not created for some keys#9303
sangeethailango wants to merge 2 commits into
previewfrom
fix-configure_instance-management-command

Conversation

@sangeethailango

@sangeethailango sangeethailango commented Jun 24, 2026

Copy link
Copy Markdown
Member

This pull request refactors how authentication provider enablement flags are handled in the instance configuration. Instead of dynamically creating IS_GOOGLE_ENABLED, IS_GITHUB_ENABLED, IS_GITLAB_ENABLED, and IS_GITEA_ENABLED keys in the configure_instance management command, these flags are now statically defined in the configuration variable lists for each provider. This simplifies the setup process and makes the configuration more consistent.

Authentication provider configuration changes:

  • The IS_GOOGLE_ENABLED, IS_GITHUB_ENABLED, and IS_GITLAB_ENABLED flags are now added directly to their respective configuration variable lists (google_config_variables, github_config_variables, gitlab_config_variables) in core.py, pulling their values from environment variables or defaulting to "0". [1] [2] [3]

Management command simplification:

  • The logic for dynamically creating authentication enablement flags (IS_GOOGLE_ENABLED, IS_GITHUB_ENABLED, IS_GITLAB_ENABLED, IS_GITEA_ENABLED) in the configure_instance management command has been removed, as these are now handled in the static configuration.
  • The unused import of get_configuration_value was removed from configure_instance.py.

Copilot AI review requested due to automatic review settings June 24, 2026 06:43
@coderabbitai

coderabbitai Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The handle method in configure_instance.py is updated so that OAuth provider configuration rows (IS_GOOGLE_ENABLED, IS_GITHUB_ENABLED, IS_GITLAB_ENABLED, IS_GITEA_ENABLED) are initialized on a per-key basis. Instead of skipping all creation when any key exists, missing keys are computed via a set difference and only those entries are created.

Changes

Instance Configuration Initialization Fix

Layer / File(s) Summary
Missing-key guard in handle()
apps/api/plane/license/management/commands/configure_instance.py
Replaces the single exists() gate (which blocked all creation if any key existed) with a values_list query, a set difference to compute missing_keys, and a conditional creation loop that runs only when missing_keys is non-empty.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~5 minutes

Poem

A bunny once checked if one key was there,
And skipped all the rest — oh, that wasn't fair!
Now missing keys leap from the set-difference hole,
Each config row created, now finally whole.
🐇✨ No key left behind, from warren to cloud!

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning The PR explains the change well, but it does not follow the required template sections like Type of Change and Test Scenarios. Add the missing template headings, fill in Type of Change, describe test scenarios, and include References or note none if applicable.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change to instance configuration creation.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-configure_instance-management-command

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@makeplane

makeplane Bot commented Jun 24, 2026

Copy link
Copy Markdown

Linked to Plane Work Item(s)

This comment was auto-generated by Plane

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adjusts the configure_instance management command so it creates only missing auth-provider instance configuration keys (Google/GitHub/GitLab/Gitea) instead of treating “any key exists” as “all keys exist”.

Changes:

  • Fetches the subset of existing keys from InstanceConfiguration and computes missing_keys.
  • Creates configuration rows only for keys that are actually missing.

Comment thread apps/api/plane/license/management/commands/configure_instance.py Outdated
Comment thread apps/api/plane/license/management/commands/configure_instance.py Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants