You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(api): accept network on project create and update - #10238
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.
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.
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: 4
Check name
Status
Explanation
Title check
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
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
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
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.
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The public REST API silently ignored
network(project visibility) onPOSTandPATCHof/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.networkwas missing fromProjectCreateSerializer.Meta.fields, whichProjectUpdateSerializerinherits. This adds it, so DRF accepts and persists0(secret) or2(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
Test Scenarios
preview(validation only, nothing written), with the change applied in memory: create withnetwork0,"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 changenetworkis not in the field list.TestProjectNetworkAPIinapps/api/plane/tests/contract/api/test_projects.py(create private, default public, invalid on create, update, invalid on update).pytest plane/tests/contract/api/test_projects.pyagainst 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 checkandruff format --checkare clean on both files.References
Closes #9576. Supersedes #9656.
🤖 Generated with Claude Code
Summary by CodeRabbit