Skip to content

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

Open
sangeethailango wants to merge 1 commit into
previewfrom
fix-configure_instance-management-command
Open

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

Conversation

@sangeethailango

@sangeethailango sangeethailango commented Jun 24, 2026

Copy link
Copy Markdown
Member

This pull request improves the handling of instance configuration setup by ensuring that only missing configuration keys are created, rather than always attempting to create all keys if any are missing.

Configuration management improvement:

  • Updated the logic in configure_instance.py to identify which of the required keys (IS_GOOGLE_ENABLED, IS_GITHUB_ENABLED, IS_GITLAB_ENABLED, IS_GITEA_ENABLED) are missing, and only create those, avoiding redundant creation attempts for keys that already exist.

Summary by CodeRabbit

  • Bug Fixes
    • Improved instance setup so missing authentication provider settings are added more reliably during configuration.
    • Prevented setup issues where some sign-in options could be skipped if only part of the required configuration was already present.
    • Made configuration initialization more resilient for partially configured environments.

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

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 70528ec0-f60f-4023-8b0a-6f33be928f4b

📥 Commits

Reviewing files that changed from the base of the PR and between 6c9dbb5 and cd49445.

📒 Files selected for processing (1)
  • apps/api/plane/license/management/commands/configure_instance.py

📝 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 | ❌ 1

❌ Failed checks (1 warning)

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.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately reflects the main change: fixing missing InstanceConfiguration key 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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 on lines +48 to 50
if missing_keys:
for key in missing_keys:
if key == "IS_GOOGLE_ENABLED":
Comment on lines +45 to +49
existed_keys = InstanceConfiguration.objects.filter(key__in=keys).values_list("key", flat=True)
missing_keys = set(keys) - set(existed_keys)

if missing_keys:
for key in missing_keys:
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.

2 participants