Skip to content

Commit 2924ac9

Browse files
authored
Naman Chhabra GSoC 2026 Phase 1 report (#267)
* Add Naman Chhabra GSoC 2026 Phase 1 report * Clean up Naman Phase 1 Report Removed placeholder PR links and comments in the report. * Update Phase 1 report: apply review feedback (we/I wording, compress media) * Apply CodeRabbit suggestions: hyphenate security-related, soften risk wording
1 parent db1546d commit 2924ac9

7 files changed

Lines changed: 163 additions & 0 deletions

File tree

Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
---
2+
title: "Enterprise Organizations for CircuitVerse | GSoC 2026 | Phase 1 Report"
3+
date: 2026-07-05T00:00:00Z
4+
draft: false
5+
author: Naman Chhabra
6+
tags: ["GSoC 2026", "CircuitVerse", "Rails", "Organizations", "Backend", "Multi-Tenancy"]
7+
type: post
8+
---
9+
10+
> **TL;DR:** Over the first six weeks of Google Summer of Code 2026 we built the foundation of **Enterprise Organizations** for CircuitVerse: the database and models, a full **role-based access control** layer with Pundit, the controllers, and a complete **Organization Dashboard** with member management and settings. The backend foundation is merged or in review, and the UI is being shipped as a set of small, focused pull requests behind a feature flag.
11+
>
12+
> None of this would have been possible without the patient guidance of my mentors **[Vedant Jain](https://github.com/vedant-jain03)**, **[Yashika Jotwani](https://github.com/yashikajotwani12)**, and **[Pratham More](https://github.com/PRATHAM2002-DS)**.
13+
14+
---
15+
16+
## 1. Where this project fits
17+
18+
CircuitVerse is used by hundreds of thousands of learners and educators, and increasingly by whole institutions. But there was no first-class way for a university, a department, or a team to manage itself on the platform. There was no shared space to organize their members and groups under one roof.
19+
20+
That is what **Enterprise Organizations** sets out to solve. The goal is a scoped, multi-tenant layer where an institution can create an organization, invite members with different roles, and manage its groups, with the groundwork laid for single sign-on and custom branding later. Phase 1 is about building that foundation the right way: a solid data model, airtight authorization, and a clean, low-friction interface.
21+
22+
---
23+
24+
## 2. Community bonding recap (May)
25+
26+
The community bonding period set the rhythm for everything that followed. After results, our first mentor meet kicked off, and we've had one **every Wednesday** since. We used those early calls to talk through the full implementation plan and sequence the work, and jumped into **Figma** to design the organization pages so we had a visual target before writing code. The first **database PRs** went up early too, so the foundation was already in motion by the time the coding period began.
27+
28+
One nice part of the bonding period was CircuitVerse's **Mergathon**, a fun community drive to get everyone active and clear out the backlog of stale, long-forgotten pull requests. I got properly stuck in, mostly closing out old PRs that had been sitting around for ages, and it turned into a great excuse to explore the codebase from top to bottom before starting my own feature. Getting that familiar with the project early paid off for the rest of the phase.
29+
30+
---
31+
32+
## 3. Phase 1 sprint log
33+
34+
### Sprint 1 (25–31 May): Foundation first
35+
36+
Week one was all about the database. We decided early that the smart move was to get the foundation rock solid before building anything on top of it. The PRs for the **`organizations`** and **`organization_members`** tables went up, along with the necessary alterations to the existing `users` and `groups` tables so everything fit together.
37+
38+
These weren't one-and-done PRs. The organization schema went through several rounds of review, back and forth, refinements, and more refinements across the whole week before it finally merged. It was my first merged PR of the coding period. It's "just" a database table on paper, but knowing what it's going to hold up eventually, it hit different.
39+
40+
![Organization database schema](/images/naman_gsoc_2026/DB.png)
41+
42+
- **PR:** [Add organizations table](https://github.com/CircuitVerse/CircuitVerse/pull/7370)
43+
- **PR:** [Add organization_members table](https://github.com/CircuitVerse/CircuitVerse/pull/7391)
44+
45+
### Sprint 2 (1–7 Jun): Wrapping the data layer
46+
47+
The `organization_members` PR came together and wrapped up the database layer cleanly. With the schema in place, the **models** PR went up, and the **policy** and **controller** work was lined up next. I had a dedicated call scheduled with Pratham Bhaiya to go over the authorization direction before writing it, with the plan being to get the policy PR out before the next Wednesday meet, no delays.
48+
49+
A key design decision landed here: a user should never be able to join the same organization twice or hold two roles in it. We enforced this on both layers, with a model validation *and* a matching unique database index, so duplicates are impossible even under a race.
50+
51+
![Organization and OrganizationMember models](/images/naman_gsoc_2026/models.png)
52+
53+
- **PR:** [Organization & OrganizationMember models + associations](https://github.com/CircuitVerse/CircuitVerse/pull/7451)
54+
55+
### Sprint 3 (8–14 Jun): Authorization & RBAC
56+
57+
I had a focused **RBAC call with Pratham Bhaiya** to plan the policy layer, covering how roles and permissions should be structured, before writing a single line. That conversation saved a lot of guesswork. The **policy PR** went up with its accompanying specs, along with the **controllers**, and in the Wednesday meet we talked through which edge cases mattered now versus later. The call was clear: establish the foundation first, handle edge cases after, with no over-engineering before the base is solid.
58+
59+
By the end of this sprint, the entire backend foundation was in place: **both DB PRs merged**, and **models, controllers, and policies** all done and up for review. Each layer shipped with its own **RSpec tests**, so the models, controllers, and policies all came with the coverage to back them up rather than being added as an afterthought. Looking back at week one, where I was just getting a single table merged, to a full tested stack of DB, models, controllers, and policies in three weeks felt like a real chunk of work.
60+
61+
![RBAC policy structure](/images/naman_gsoc_2026/RBAC.png)
62+
63+
![Controller ER diagram](/images/naman_gsoc_2026/Controller_ER_Diagram.png)
64+
65+
- **PR:** [Pundit policies for Organization & Group RBAC + tests](https://github.com/CircuitVerse/CircuitVerse/pull/7493)
66+
- **PR:** [Organization & Member controllers](https://github.com/CircuitVerse/CircuitVerse/pull/7457)
67+
68+
### Sprint 4 (15–21 Jun): Into the frontend
69+
70+
With the backend written and in review, we moved ahead and started on the **views**. Most of the UI came together quickly, but the number of edge cases I had to reason through on my own genuinely surprised me. Building an interface where actions are gated by role, states change based on data, and nothing breaks for a standalone versus an organization-owned resource is a lot more subtle than it looks from the outside. But it came together.
71+
72+
We also added the **`location`** field to organizations end to end: the migration, model validation (max 100 chars), and the UI.
73+
74+
- **PR:** [Add location column + validation](https://github.com/CircuitVerse/CircuitVerse/pull/7563)
75+
76+
### Sprint 5 (22–28 Jun): The dashboard, polished
77+
78+
This sprint the frontend really took shape. We finished the planned views, but the first pass was functional rather than polished. Taking it to the mentor meet, we got solid direction on the design and reworked it, and the **Organization Dashboard PR** went up. It went from "works" to genuinely looking the part, closely matching what the mentors had described.
79+
80+
The dashboard is a single page with tabs for **Groups**, **Members**, and **Settings**, and two features I'm particularly happy with: a **live, debounced member search** with role filtering (no "Apply" button), and a **real-time slug availability check** that previews and validates the organization's URL as you type.
81+
82+
![Organization dashboard](/images/naman_gsoc_2026/dashboard.png)
83+
84+
- **PR:** [Organization Dashboard UI](https://github.com/CircuitVerse/CircuitVerse/pull/7568)
85+
86+
### Sprint 6 (29 Jun–5 Jul): Splitting PRs & member management
87+
88+
Based on mentor feedback this sprint, the large dashboard PR was **split into small, focused, stacked PRs** (one for the dashboard, one for the settings page, one for member management), which made reviews far faster and sharper. We worked through a detailed round of review comments across them, several of them security-related: gating the organization param behind the feature flag on create only (to prevent org-hijacking through the edit form), making the "leave organization" action fail gracefully instead of erroring, and guarding the group authorization against invalid input.
89+
90+
We also built the **Member Management page** with the goal of making it as low-friction as possible: an admin changes a member's role with a **single click** on an inline dropdown, adds members through a clean slide-over, and removes them inline, with no modals for the common actions.
91+
92+
- **PR:** [Organization Settings (Edit) page](https://github.com/CircuitVerse/CircuitVerse/pull/7612)
93+
94+
---
95+
96+
## 4. What the feature looks like
97+
98+
### Database & Models
99+
100+
The feature rests on two tables, `organizations` and `organization_members`, with members joining through a role-carrying join table. Organizations use `FriendlyId` for clean, human-readable URL slugs, and data integrity is guaranteed on two layers (a uniqueness validation plus a unique DB index) so a user can only ever hold one membership, and one role, per organization.
101+
102+
### Authorization & Roles (RBAC)
103+
104+
Every organization has three roles (**Admin**, **Mentor**, and **Member**) modelled cleanly with **Pundit**. A dedicated policy handles organization-scoped groups, so an org admin can manage the groups inside their organization while standalone groups keep their existing rules. Getting the create-versus-update permissions right was the crux here: it's what stops a user from injecting an organization ID to move a group somewhere they don't control.
105+
106+
### Organization Dashboard
107+
108+
The dashboard is the home of an organization. The tabs switch instantly on the client and sync to the URL (`?tab=members`), so a refresh or the back button keeps you on the right tab. Member search and role filtering apply live, and the slug checker gives you instant feedback on your organization's URL before you ever hit save.
109+
110+
{{< video src="/videos/naman_gsoc_2026/Dashboard.mp4" type="video/mp4" preload="auto" >}}
111+
112+
### Member Management & Settings
113+
114+
Managing members is built to be fast: one-click inline role changes, a slide-over for adding members, and inline removal, all protected by policy checks. The Settings page lets admins update everything about their organization (name, description, location, visibility, logo, links) and includes a **Danger Zone** for deletion, guarded by a type-to-confirm modal so nothing is deleted by accident.
115+
116+
### Shipping safely with a feature flag
117+
118+
Because this feature is being built and merged incrementally, every organization-facing action is gated behind the **`:organizations` Flipper flag**. The code can be merged and deployed without any of it being reachable by real users until it's complete and approved, so there's little risk of accidentally rolling out a half-baked feature before it's ready.
119+
120+
---
121+
122+
## 5. Where things stand
123+
124+
| Deliverable | Status |
125+
| --- | --- |
126+
| Organization & Member models, schema | **Merged** |
127+
| Pundit RBAC policies + tests | **Merged** |
128+
| RSpec tests (models, controllers, policies) | **Merged** |
129+
| `location` field | **Merged** |
130+
| Controllers (orgs, members, groups) | **In review** |
131+
| Organization Dashboard UI | **In review** |
132+
| Settings / Edit page | **In review** |
133+
| Member Management page | **In progress** |
134+
135+
---
136+
137+
## 6. Lessons & learnings
138+
139+
- **Foundation before features.** Getting the DB, models, and policies solid before touching UI meant everything built on top of it actually worked. Rushing upward on a shaky base would have cost more later.
140+
- **Talk to your mentor before you write the code.** The RBAC call with Pratham Bhaiya replaced a lot of guesswork with a clear plan. The best design decisions this phase came *before* the first line was written.
141+
- **Small PRs win.** My early PRs were large and hard to review. Splitting them into a clean, stacked sequence made reviews faster and feedback sharper, a lesson I'll carry through Phase 2.
142+
- **Security is the first question, not the last.** On a multi-tenant feature, "who's allowed to do this, and can it be bypassed?" has to come first. Several of my review fixes were exactly this, closing subtle authorization gaps in the edit flows.
143+
- **Multiple review rounds are a good sign.** They mean people care about getting it right.
144+
145+
---
146+
147+
## 7. Looking ahead (Phase 2 targets)
148+
149+
- Get the remaining stacked PRs (dashboard, members, settings) through review and merged.
150+
- Build **serializers and an API** so the feature works on the **mobile app**, not just the web.
151+
- Add **Single Sign-On (SSO)** so institutions can log in through their own identity providers (OIDC / SAML).
152+
- Add **custom branding and subdomain** support for organizations.
153+
- Wire existing groups and classrooms more deeply under organizations, and add an invite/notification **mailer**.
154+
155+
The foundation from Phase 1 sets us up for a much more powerful second half.
156+
157+
---
158+
159+
## Acknowledgements
160+
161+
Huge thanks to the entire **CircuitVerse community** for making this such a rewarding experience. A special thank you to my mentors, **[Vedant Jain](https://github.com/vedant-jain03)**, **[Yashika Jotwani](https://github.com/yashikajotwani12)**, and **[Pratham More](https://github.com/PRATHAM2002-DS)**, for their detailed reviews, the weekly meets, and their patience in walking me through the tricky calls.
162+
163+
This has been one of the most formative stretches of my journey so far, and I'm genuinely excited for what's next. πŸš€
55.2 KB
Loading
34.4 KB
Loading
199 KB
Loading
136 KB
Loading
39.2 KB
Loading
2.98 MB
Binary file not shown.

0 commit comments

Comments
Β (0)