Repository navigation
fix(organizations): enforce shared parent and child creation limit - #7940
Conversation
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Executive SummaryThe incremental commit restores NULL creator attribution for self-service child organizations and adds a regression covering the inherited-access boundary; both changed files are internally consistent and I found no new defects, and the previously flagged lock-scope concern is a documented, non-bypassable scope limit rather than a defect. Overview
Files Reviewed (3 files)
Notes
Previous Review Summaries (2 snapshots, latest commit b848f6a)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit b848f6a)Status: 2 Issues Found | Recommendation: Address before merge Executive SummaryThe incremental commit is test-only and resolves both prior test-fixture suggestions; the remaining risk is the parent-creation path enforcing the shared quota without the hierarchy advisory lock used by child creation, leaving a narrow cross-user bypass. Overview
Issue Details (click to expand)WARNING
SUGGESTION
Verified
NotesFull-repository typecheck/lint/tests were not run in this session, so the suite-level claims in the PR description (five organization suites, 77 tests) were not independently reproduced; only static inspection of the changed lines was performed. Files Reviewed (4 files)
Fix these issues in Kilo Cloud Previous review (commit f5d1d13)Status: 4 Issues Found | Recommendation: Address before merge Executive SummaryThe core limit query and staff-domain tightening are correct, but the parent-creation path enforces the shared quota without the hierarchy advisory lock used by child creation, leaving a narrow cross-user bypass. Overview
Issue Details (click to expand)WARNING
SUGGESTION
Verified
NotesFull-repository typecheck/lint/tests were not run in this session; the five organization suites cited by the PR were not executed. Other suites that call Files Reviewed (7 files)
Reviewed by deepseek-v4.1-flash · Input: 51.8K · Output: 11.2K · Cached: 419.7K Review guidance: REVIEW.md from base branch |
Summary
kilocode.aidomain.Cause
The child-creation endpoint had no quota check. Top-level creation checked only direct memberships outside the creation transaction, allowing unassigned creations and concurrent requests to bypass the existing limit. The staff-domain suffix check also accepted unrelated domains such as
notkilocode.ai.Verification
pnpm --filter web typecheckpassed; final review corrections also passed the webtsgocheck.pnpm --filter @kilocode/web-shared typecheckpassed.oxlint,pnpm format, andgit diff --checkpassed.Targeted test command:
JEST_SILENT=true pnpm --filter web test --runInBand src/routers/organizations/organization-creation.test.ts src/routers/organizations/organization-router.test.ts src/routers/organizations/organization-admin-router.test.ts src/lib/organizations/organization-hierarchy.test.ts src/routers/user-exports-router.test.ts src/routers/organizations/organization-modes-router.test.ts src/routers/organizations/organization-settings-router.test.ts ../../packages/web-shared/src/lib/organizations/organizations.test.tsScope
No schema migration or new dependency. This controls future creation; it does not delete existing organizations or block their use. It is not an absolute membership/access cap: invitations, trusted admin changes, and another manager creating an inherited child can increase another user’s accessible total. A regression documents that sequential boundary and confirms subsequent creation is blocked. Full repository validation and production-scale query-plan measurements were not run locally. No production data was changed.