feat(web): pick reviewers when editing policies.cedar - #2165
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cec3a906fb
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| name === 'policies.cedar' || | ||
| path.endsWith('/.cedar/policies.cedar') || | ||
| path === '.cedar/policies.cedar' || | ||
| path.endsWith('/policies.cedar') |
There was a problem hiding this comment.
Restrict reviewer picker to .cedar policy files
When editing a policies.cedar that is not under a .cedar/ directory, such as project/policies.cedar, this condition still mounts the reviewer picker even though inferPathPatternFromFilePath falls back to the empty pattern and the backend only discovers .cedar/policies.cedar files. Selecting a reviewer in that case appends a global startsWith("") reviewer rule to an unrelated Cedar file, which can corrupt files the reviewer system will not read; limit the picker to .cedar/policies.cedar paths.
Useful? React with 👍 / 👎.
Add a BlobEditor member multi-select that rewrites the matching path's `to [...]` list, mirroring MegaCedarAdminPicker without a new API.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 887c492464
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| ) : ( | ||
| <div className='divide-y divide-gray-100'> | ||
| {members.map((member) => { | ||
| const cedarId = member.user.github_login || member.user.username |
There was a problem hiding this comment.
Store reviewer policies with approvable usernames
When the selected member has a GitHub login that differs from their Campsite username, this writes the GitHub login into policies.cedar; those strings are later stored verbatim as mega_cl_reviewer.username, but the approval route calls reviewer_change_state(&link, &user.username, ...) using the Campsite username (mono/src/api/router/reviewer_router.rs:182-185). The resulting system-required reviewer can be assigned and shown in the CL, but that user cannot mark the review approved because the backend looks for a different username, so use the same API identity as the manual reviewer picker or update the approval lookup to handle GitHub logins.
Useful? React with 👍 / 👎.
b9537d3 to
c42958c
Compare
Replace username-keyed collaboration storage with Campsite public ids, keep github_login for Cedar/display, and resolve CL UI members by id so handles no longer render as opaque ids.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9fc974f241
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| "reactions", | ||
| "item_assignees", | ||
| "mega_code_review_comment", | ||
| "access_token", |
There was a problem hiding this comment.
Populate github_login for migrated tokens
With the migration, existing access_token.username values are renamed into campsite_user_id, so legacy token rows enter this loop with campsite_user_id equal to the old handle. The earlier UPDATE access_token SET github_login ... WHERE campsite_user_id = '{id}' does not match those rows, and this generic update only changes campsite_user_id; after startup backfill they still have github_login = NULL. git_receive_pack_auth now rejects any access token whose LoginUser lacks github_login, so previously generated personal tokens stop being usable for pushes. Set github_login in the handle-matched access_token update, or do it after the id rewrite, before marking the backfill completed.
Useful? React with 👍 / 👎.
| id: Set(generate_id()), | ||
| group_id: Set(group_id), | ||
| username: Set(username.clone()), | ||
| campsite_user_id: Set(username.clone()), |
There was a problem hiding this comment.
Store group member ids from the admin picker
After this change, values passed in usernames are stored as campsite_user_id, but the admin add-members UI still passes member.user.username from moon/apps/web/components/AdminGroups/AddMembersDialog.tsx. For users whose Campsite public id differs from username, adding them through the UI writes the username into the id column; later permission lookups use collaboration_actor/find_group_ids_by_username with the real id, so the new group membership never grants access. Update the UI to send member.user.id or resolve legacy usernames here.
Useful? React with 👍 / 👎.
Add a BlobEditor member multi-select that rewrites the matching path's
to [...]list, mirroring MegaCedarAdminPicker without a new API.