Skip to content

fix(api): accept network on project create and update - #10238

Open
AppSunder wants to merge 1 commit into
makeplane:previewfrom
AppSunder:fix/api-project-network
Open

AppSunder wants to merge 1 commit into
makeplane:previewfrom
AppSunder:fix/api-project-network

Conversation

@AppSunder

@AppSunder AppSunder commented Nov 9, 2026 •

Copy link
Copy Markdown

Description

The public REST API silently ignored network (project visibility) on POST and PATCH of /api/v1/workspaces/{slug}/projects/: it returned success and the project stayed public (network=2). Automation could not create private projects, and in a workspace with external members a new project was visible to everyone until someone fixed it by hand.

network was missing from ProjectCreateSerializer.Meta.fields, which ProjectUpdateSerializer inherits. This adds it, so DRF accepts and persists 0 (secret) or 2 (public) and rejects anything else with a 400. Omitting it keeps the model default (public), so existing clients are unaffected.

This is the same one-line change as #9656 (opened in August, closed as stale on 8 Nov with no review, and already confirmed working by @FervenT-90 on v1.4.2). I added contract tests for create, update, default and invalid values.

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

Test Scenarios

  • Checked the serializers on a running instance built from preview (validation only, nothing written), with the change applied in memory: create with network 0, "0" and 2 is valid; omitted leaves it out (model default applies); 5 is rejected with "5" is not a valid choice; update with {"network": 0} is valid and {"network": 5} is rejected. Before the change network is not in the field list.
  • Added TestProjectNetworkAPI in apps/api/plane/tests/contract/api/test_projects.py (create private, default public, invalid on create, update, invalid on update).
  • Ran pytest plane/tests/contract/api/test_projects.py against Postgres and Redis: 16 passed with the change. With only the serializer change reverted and the new tests kept, 4 of the 5 new tests fail (the default-public one still passes, as expected).
  • ruff check and ruff format --check are clean on both files.

References

Closes #9576. Supersedes #9656.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Project visibility can now be specified when creating a project. If no visibility is provided, the existing default is used.
  • Bug Fixes
    • Invalid visibility values are rejected, preventing a project from being created or an existing project from being changed with an invalid setting.

@coderabbitai

coderabbitai Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The project create serializer now includes the network field. Contract tests cover network values supplied during project creation and update, including invalid values.

Changes: Project network API

Layer / File(s) Summary
Expose and validate network
apps/api/plane/api/serializers/project.py, apps/api/plane/tests/contract/api/test_projects.py
The create serializer includes network. Tests check explicit and omitted values, and verify that an invalid value returns HTTP 400 without creating a project. Update tests check that valid values persist and that invalid values return HTTP 400 without changing the existing value.

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

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: Minimal · up to 70542

The public project API will now accept and persist the project visibility (network) value on create and update, and reject invalid values. No actionable merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title states the main change: the public REST API now accepts the network field on project create and update. The fix matches the serializer change (network added to ProjectCreateSerializer.Meta.f…
Description check Passed The description follows the repository template. It includes the Description section with the problem, the one-line serializer fix, and the default and invalid-value behavior. The Type of Change secti…
Linked Issues check Passed Issue #9576 requires that the public REST API either accept network on project create (POST) and update (PATCH), or reject it with a clear validation error. The whole-PR diff (merge base 0b9ca51 to…
Out of Scope Changes check Passed The whole-PR change set has two parts. The first is a one-line addition of network to the create serializer field list, which the update serializer inherits. The second is a contract test class, `Te…
Full details: Title check

Explanation

The title states the main change: the public REST API now accepts the network field on project create and update. The fix matches the serializer change (network added to ProjectCreateSerializer.Meta.fields, inherited by ProjectUpdateSerializer) and the added contract tests. The title follows conventional commit style and is concise.

Full details: Description check

Explanation

The description follows the repository template. It includes the Description section with the problem, the one-line serializer fix, and the default and invalid-value behavior. The Type of Change section marks Bug fix. The Test Scenarios section lists the new TestProjectNetworkAPI tests, the pytest run (16 passed), the revert check, and ruff results. The References section links issue #9576 and supersedes #9656. The Screenshots and Media section is absent, but it applies only when relevant, so this is a non-critical gap.

Full details: Linked Issues check

Explanation

Issue #9576 requires that the public REST API either accept network on project create (POST) and update (PATCH), or reject it with a clear validation error. The whole-PR diff (merge base 0b9ca51 to head 70542ee) adds "network" to ProjectCreateSerializer.Meta.fields in apps/api/plane/api/serializers/project.py. ProjectUpdateSerializer inherits this field list, so both operations now accept the field. Per the PR summary, DRF accepts 0 and 2, rejects other values with a 400, and keeps the model default when the field is omitted. The added TestProjectNetworkAPI tests cover create with private, default public, invalid create, update, and invalid update. The summary reports these tests pass (16 passed) and that four of the five new tests fail when the serializer change is reverted. The requirement is met by the code change. I did not re-run the tests. The update-serializer inheritance rests on the PR description and summary, not on a separate file read.

Full details: Out of Scope Changes check

Explanation

The whole-PR change set has two parts. The first is a one-line addition of network to the create serializer field list, which the update serializer inherits. The second is a contract test class, TestProjectNetworkAPI, in apps/api/plane/tests/contract/api/test_projects.py. Both parts directly implement or verify the network behavior requested in #9576. No unrelated changes appear in the supplied summary or the inspected serializer diff. The test file was not read directly, so its content rests on the summary.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 56546a7a-9525-4249-bab2-04d8407745c6
Commits

Reviewing files that changed from the base of the PR and between e47e9f2 and 70542ee.

Files selected for processing: 1

  • apps/api/plane/tests/contract/api/test_projects.py

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

`network` was missing from ProjectCreateSerializer.Meta.fields (inherited by
ProjectUpdateSerializer), so the public API silently dropped it and every
project created through it was public. Add it so POST/PATCH persist it, with
DRF validating against Project.NETWORK_CHOICES, and add contract tests.

Same one-line change as makeplane#9656, which was closed as stale without review.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@AppSunder
AppSunder force-pushed the fix/api-project-network branch from e47e9f2 to 70542ee Compare November 12, 2026 00:21

This branch has not been deployed

No deployments
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]: network (project visibility) is silently ignored on create/update via public REST API

1 participant