plane icon indicating copy to clipboard operation
plane copied to clipboard

[WEB-4338] fix: incorrect error code in project retrieve API

Open sangeethailango opened this issue 6 months ago โ€ข 2 comments

Description

This PR will fix the incorrect error code in the project retrieve API.

Type of Change

  • [x] Bug fix (non-breaking change which fixes an issue)

sangeethailango avatar Jun 18 '25 11:06 sangeethailango

[!NOTE]

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

API now enforces membership checks with network-type-specific errors; web routing moved to projectId-based layouts; ProjectAuthWrapper made projectId required and replaced JoinProject with ProjectAccessRestriction; multiple UI loading spinners removed; new i18n keys added for project access/invalid states.

Changes

Cohort / File(s) Summary
API Project View
apps/api/plane/app/views/project/base.py
Adjusted imports; retrieve() now fetches project then verifies membership via project.members_list; returns 403 for SECRET-network projects or 409 for non-members; calls recent_visited_task.delay with additional args.
Model Exports
apps/api/plane/db/models/__init__.py
Re-exported ProjectNetwork.
Project Auth Wrapper (web)
apps/web/core/layouts/auth-layout/project-wrapper.tsx, apps/web/ce/layouts/project-wrapper.tsx
Made projectId required; centralized access control to ProjectAccessRestriction; added join-project workflow and isProjectLoading handling; removed prior JoinProject/EmptyState flows.
Routing Restructure
apps/web/app/routes/core.ts
Reworked routes to use /:projectId-based layouts, centralized archives, added intake and automations nested layouts, and reorganized project settings paths.
Project Settings UI
apps/web/app/(all)/[workspaceSlug]/(settings)/settings/projects/layout.tsx, apps/web/app/(all)/[workspaceSlug]/(settings)/settings/projects/[projectId]/layout.tsx, apps/web/app/(all)/[workspaceSlug]/(settings)/settings/projects/[projectId]/page.tsx, apps/web/app/(all)/[workspaceSlug]/(settings)/settings/projects/page.tsx
Added new project-specific settings layout; removed SWR fetch from page; simplified rendering guards; added observer wrappers and theme-based assets.
Project Wrapper for Nested Routes
apps/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/layout.tsx
Wrapped nested Outlet with ProjectAuthWrapper to require project authorization.
Removed Join UI / Added Access Restriction
apps/web/core/components/auth-screens/project/join-project.tsx (removed), apps/web/core/components/auth-screens/project/project-access-restriction.tsx (added)
Deleted JoinProject component; added ProjectAccessRestriction component that renders different EmptyStateDetailed views and a join CTA based on errorStatusCode and admin status.
Removed LogoSpinner Loading Paths
apps/web/core/components/issues/issue-layouts/roots/*.tsx, apps/web/core/components/issues/issue-layouts/spreadsheet/spreadsheet-view.tsx, apps/web/core/components/workspace/settings/workspace-details.tsx, apps/web/app/(all)/[workspaceSlug]/(settings)/settings/account/*.tsx
Removed LogoSpinner imports and spinner UIs; consolidated guards to return empty fragment until required identifiers/filters/data exist; updated SWR fetchers to call fetchFilters where applicable.
Project Service Error Shape
apps/web/core/services/project/project.service.ts
getProject now rethrows error.response (the full response) instead of error.response.data.
Browse Page Guard Tightening
apps/web/app/(all)/[workspaceSlug]/(projects)/browse/[workItem]/page.tsx
EmptyState now shown only when error && !issueLoader to avoid displaying during loading.
i18n โ€” project_empty_state additions
packages/i18n/src/locales/*/empty-state.ts (en, cs, de, es, fr, id, it, ja, ko, pl, pt-BR, ro, ru, sk, tr-TR, ua, vi-VN, zh-CN, zh-TW)
Added project_empty_state.no_access (title, restricted_description, join_description, cta_primary, cta_loading) and project_empty_state.invalid_project (title, description) across locales.

Estimated code review effort

๐ŸŽฏ 4 (Complex) | โฑ๏ธ ~45โ€“75 minutes

Key attention areas:

  • apps/api/plane/app/views/project/base.py โ€” membership validation and HTTP status selection for SECRET vs non-secret networks.
  • apps/web/core/layouts/auth-layout/project-wrapper.tsx โ€” new ProjectAccessRestriction integration, join flow, and loading/error handling.
  • apps/web/app/routes/core.ts โ€” verify route relocations and no missing paths.
  • i18n additions โ€” ensure keys match usages in new access-restriction UI.

Possibly related PRs

  • makeplane/plane#8021 โ€” overlaps on empty-state i18n keys and empty-state UI usage; likely complementary changes to project_empty_state translations.

Suggested reviewers

  • vamsikrishnamathala
  • prateekshourya29

Poem

๐Ÿฐ I hopped through routes and guards today,

projects checked, secrets kept at bay.
No spinning logos on the way,
New messages guide the lost astray.
A join-button winked โ€” hop in, hooray!

Pre-merge checks and finishing touches

โŒ 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%. You can run @coderabbitai generate docstrings to improve docstring coverage.
โœ… Passed checks (2 passed)
Check name Status Explanation
Title check โœ… Passed The PR title '[WEB-4338] fix: incorrect error code in project retrieve API' clearly summarizes the main change: fixing error codes in the project retrieve API endpoint.
Description check โœ… Passed The PR description includes the required 'Description' section explaining the fix, 'Type of Change' with 'Bug fix' selected, and references the broader impact with detailed notes on backend and frontend changes.
โœจ Finishing touches
  • [ ] ๐Ÿ“ Generate docstrings
๐Ÿงช Generate unit tests (beta)
  • [ ] Create PR with unit tests
  • [ ] Post copyable unit tests in a comment
  • [ ] Commit unit tests in branch fix-project-status-code

[!TIP]

๐Ÿ“ Customizable high-level summaries are now available in beta!

You can now customize how CodeRabbit generates the high-level summary in your pull requests โ€” including its content, structure, tone, and formatting.

  • Provide your own instructions using the high_level_summary_instructions setting.
  • Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
  • Use high_level_summary_in_walkthrough to move the summary from the description to the walkthrough section.

Example instruction:

"Divide the high-level summary into five sections:

  1. ๐Ÿ“ Description โ€” Summarize the main change in 50โ€“60 words, explaining what was done.
  2. ๐Ÿ““ References โ€” List relevant issues, discussions, documentation, or related PRs.
  3. ๐Ÿ“ฆ Dependencies & Requirements โ€” Mention any new/updated dependencies, environment variable changes, or configuration updates.
  4. ๐Ÿ“Š Contributor Summary โ€” Include a Markdown table showing contributions: | Contributor | Lines Added | Lines Removed | Files Changed |
  5. โœ”๏ธ Additional Notes โ€” Add any extra reviewer context. Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."

Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later.


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.

coderabbitai[bot] avatar Jun 18 '25 11:06 coderabbitai[bot]

Linked to Plane Work Item(s)

This comment was auto-generated by Plane

makeplane[bot] avatar Jun 18 '25 11:06 makeplane[bot]