Skip to content

fix: handle null values in instance configuration patch endpoint#9238

Open
okxint wants to merge 1 commit into
makeplane:previewfrom
okxint:fix/null-handling-configuration
Open

fix: handle null values in instance configuration patch endpoint#9238
okxint wants to merge 1 commit into
makeplane:previewfrom
okxint:fix/null-handling-configuration

Conversation

@okxint

@okxint okxint commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

What

When patching instance configuration values via the PATCH endpoint, request.data can contain None for fields that should be cleared. Calling str(None) produces the literal string "None" instead of an empty string, which gets persisted as the field value.

Fix

Added an explicit null check before coercing to string:

raw_value = request.data.get(configuration.key, configuration.value)
value = "" if raw_value is None else str(raw_value).strip()

None values now become "" (empty string) as expected.

Files changed

  • apps/api/plane/license/api/views/configuration.py

Summary by CodeRabbit

  • Bug Fixes
    • Enhanced configuration endpoint to normalize input values by trimming whitespace and consistently handling empty parameters, applicable to both encrypted and standard configurations.

When request.data contains None values, str(None) would produce the
string "None" instead of clearing the field. This adds explicit null
checking so None values become empty strings.
@coderabbitai

coderabbitai Bot commented Jun 15, 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: 03dfe027-9773-48f3-85d5-fb97fb16c76f

📥 Commits

Reviewing files that changed from the base of the PR and between f2feca6 and 067a0ee.

📒 Files selected for processing (1)
  • apps/api/plane/license/api/views/configuration.py

📝 Walkthrough

Walkthrough

In InstanceConfigurationEndpoint.patch, incoming configuration values are now preprocessed before encryption or storage: None values are coerced to an empty string, and non-None values are converted to strings and strip()-trimmed.

Changes

Configuration Value Normalization

Layer / File(s) Summary
None/whitespace normalization in PATCH handler
apps/api/plane/license/api/views/configuration.py
Before encrypting or storing each configuration value, the handler now converts None to "" and calls str(...).strip() on any other value. Previously, request.data.get(...) was used directly without sanitization.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

A bunny once fetched a config so bare,
With spaces and None floating loose in the air.
A quick little strip, an empty string too,
Now values arrive tidy, clean, and brand new!
🐇✨

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

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 ❓ Inconclusive The description provides context and the fix, but does not follow the required template structure with Type of Change, Test Scenarios, and other sections. Follow the repository template by adding Type of Change (bug fix), Test Scenarios describing how the fix was verified, and any related issue references.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: handling null values in the instance configuration patch endpoint.
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 unit tests (beta)
  • Create PR with unit tests

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 and usage tips.

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