Skip to content

Fix instance admin sign-up with form-encoded telemetry value#9405

Open
nicksan222 wants to merge 2 commits into
makeplane:previewfrom
nicksan222:fix/9370-telemetry-form-value
Open

Fix instance admin sign-up with form-encoded telemetry value#9405
nicksan222 wants to merge 2 commits into
makeplane:previewfrom
nicksan222:fix/9370-telemetry-form-value

Conversation

@nicksan222

@nicksan222 nicksan222 commented Jul 12, 2026

Copy link
Copy Markdown

Description

Fixes instance administrator sign-up failing when is_telemetry_enabled is submitted as a form-encoded string.

The endpoint now converts supported truthy form values ("true" and "1") into a Python boolean before assigning the value to the instance model. This prevents PostgreSQL from rejecting string values for the boolean column and allows the existing atomic setup flow to complete successfully.

A contract test covers both "true" and "false" form values and verifies that:

  • sign-up completes successfully;
  • the instance is marked as configured;
  • the selected telemetry setting is persisted as a boolean;
  • the user and instance administrator records are created.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • Feature (non-breaking change which adds functionality)
  • Improvement (change that would cause existing functionality to not work as expected)
  • Code refactoring
  • Performance improvements
  • Documentation update

Screenshots and Media (if applicable)

Not applicable.

Test Scenarios

  • Submit first-run administrator sign-up with is_telemetry_enabled=false and verify setup completes with telemetry disabled.
  • Submit first-run administrator sign-up with is_telemetry_enabled=true and verify setup completes with telemetry enabled.
  • Verify the instance, user, and instance administrator records are created together.

References

Fixes #9370

Summary by CodeRabbit

  • Bug Fixes
    • Correctly interpret the first-run administrator “telemetry” preference when submitted as common form values (e.g., true, false, and 1), and persist the normalized setting during instance setup.
  • Tests
    • Added contract coverage for the admin sign-up endpoint to verify telemetry coercion, successful redirect, setup completion, and creation of the administrator account.

Copilot AI review requested due to automatic review settings July 12, 2026 18:08
@coderabbitai

coderabbitai Bot commented Jul 12, 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: 9d9b92d5-4ab1-47ea-b806-94e83ff260fd

📥 Commits

Reviewing files that changed from the base of the PR and between d9723f9 and 8d52812.

📒 Files selected for processing (1)
  • apps/api/plane/tests/contract/app/test_instance_admin.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/api/plane/tests/contract/app/test_instance_admin.py

📝 Walkthrough

Walkthrough

The instance admin sign-up endpoint now converts form-encoded telemetry values into booleans. A contract test covers false and true inputs, successful setup, redirect behavior, and administrator record creation.

Changes

Instance admin sign-up

Layer / File(s) Summary
Telemetry normalization and setup validation
apps/api/plane/license/api/views/admin.py, apps/api/plane/tests/contract/app/test_instance_admin.py
Telemetry values are normalized from form strings to booleans, with contract coverage for instance setup completion, redirects, persisted telemetry state, and administrator records.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: dheeru0198, pablohashescobar

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main fix: handling form-encoded telemetry values during instance admin sign-up.
Description check ✅ Passed The description includes the bug summary, change details, type of change, test scenarios, and a linked reference.
Linked Issues check ✅ Passed The changes address #9370 by coercing form telemetry values to booleans and verifying successful first-run setup and record creation.
Out of Scope Changes check ✅ Passed The PR stays focused on the sign-up telemetry fix and its contract test, with no obvious unrelated changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ 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.

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 fixes first-run instance administrator sign-up failing when is_telemetry_enabled is submitted as a form-encoded string by coercing the form value to a Python boolean before persisting it, and adds a contract test to ensure setup completes and the telemetry flag is stored correctly.

Changes:

  • Coerce is_telemetry_enabled from request.POST into a boolean ("1"/"true"True, otherwise False) prior to saving the Instance.
  • Add a contract test that exercises the sign-up redirect flow and asserts the instance becomes configured and telemetry is persisted as expected.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
apps/api/plane/license/api/views/admin.py Coerces is_telemetry_enabled POST form value to a boolean before saving the instance.
apps/api/plane/tests/contract/app/test_instance_admin.py Adds a contract test validating sign-up completes and telemetry preference persists correctly.

Comment thread apps/api/plane/tests/contract/app/test_instance_admin.py

@coderabbitai coderabbitai Bot 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.

🧹 Nitpick comments (1)
apps/api/plane/tests/contract/app/test_instance_admin.py (1)

19-22: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Cover the documented "1" truthy form value.

The endpoint explicitly supports both "true" and "1", but this contract only exercises "true" and "false". Add ("1", True) so the second supported truthy representation is protected by regression coverage.

Proposed test update
         ("form_value", "expected_value"),
-        [("false", False), ("true", True)],
+        [("false", False), ("true", True), ("1", True)],
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/api/plane/tests/contract/app/test_instance_admin.py` around lines 19 -
22, Add the documented ("1", True) case to the parameter list in the
instance-admin contract test, preserving the existing "true" and "false" cases.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@apps/api/plane/tests/contract/app/test_instance_admin.py`:
- Around line 19-22: Add the documented ("1", True) case to the parameter list
in the instance-admin contract test, preserving the existing "true" and "false"
cases.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c2d04425-904a-43ff-a183-1d19bd73d224

📥 Commits

Reviewing files that changed from the base of the PR and between dc9d80b and d9723f9.

📒 Files selected for processing (2)
  • apps/api/plane/license/api/views/admin.py
  • apps/api/plane/tests/contract/app/test_instance_admin.py

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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.

[bug] Instance admin sign-up 500s when is_telemetry_enabled is posted as a form string, leaving the instance half-configured (is_setup_done never set)

2 participants