feat: support publishing packages from GitHub organizations (completes #138)#140
feat: support publishing packages from GitHub organizations (completes #138)#140nepinhum wants to merge 9 commits into
Conversation
- Add UserOrganization entity to store user's org memberships - Fetch user's organizations during OAuth login via GitHub API - Modify check_vcs() to accept URLs from user's organizations - Automatically use organization name as package prefix when publishing from org repos This allows users who are members of GitHub organizations to publish packages from organization repositories. The package name will use the organization name as prefix (e.g., 'v-hono.hono' instead of 'meiseayoung.hono' when publishing from v-hono organization). Closes #XXX
- Add tests for extract_owner_from_url function - Add tests for check_vcs backward compatibility - Add tests for check_vcs_with_orgs new functionality - Add tests for is_valid_mod_name validation - Add tests for UserOrganization entity and membership logic All 2 test files pass with 20+ test cases covering: - Own account publishing (existing behavior) - Organization member publishing (new feature) - Non-member organization rejection - Admin bypass - Edge cases and error handling
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 20e8aab2e2
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| orgs_repo.save_user_organizations(user_id, org_names) or { | ||
| println('failed to save orgs: ${err}') |
There was a problem hiding this comment.
Fail closed when saving refreshed org memberships
If this write fails during login (for example a transient DB error, deadlock, or failed insert), the callback still sets the auth cookies and leaves whatever UserOrganization rows were already in the database. Since package create/update authorization reads those cached rows, a user who was removed from an organization can retain org publishing access until a later successful refresh; return/redirect on this error instead of continuing the login with stale memberships.
Useful? React with 👍 / 👎.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9750f30362
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if owner == org.to_lower() { | ||
| return vcs.name |
There was a problem hiding this comment.
Require repo-level access for org submissions
For GitHub organizations with members who cannot write/administer every repo, accepting any owner that appears in the user's org list lets a read-only org member publish a package for any public repo under that org; the later http.get only proves the repo exists. This broadens the previous ownership check from personal repos to all org repos, so please verify the user's permission on the specific repository before returning success here.
Useful? React with 👍 / 👎.
|
|
|
could someone review the latest changes? |
This picks up #138 (@meiseayoung), which implemented organization based package publishing but went unanswered after Codex requested changes and the pr sat without follow up. All findings from that review are addressed here. The original feature and its intent are unchanged.
Summary (original, by @meiseayoung)
VPM only allowed publishing packages from a user's personal GitHub account. This adds support for publishing from GitHub organizations a user is a member of.
Solution
What changed since #138
Test plan