Repository navigation
Conversation
Claude Code's own commit habits cover what the command said. The one rule it held that nothing else did, no Claude attribution on commits or PRs, now lives in a checked-in .claude/settings.json so the harness enforces it.
…on-or-service-account pipeline
…store AccessTokenAuth's single with
…tify as an option
…ioning's :create_project
… for a policy refusal
…ing scheduled_deletion
…T /api/projects/:id
…roles from RolesEnum
… members_by_email cases to projects_test
…-owner index Children of a has_many cast are written in list order, and membership_params/2 lists existing members in whatever order the unordered preload returns them. When the new owner's row came first, its promotion hit the non-deferrable one-owner index before the old owner's demotion. project_with_users_changeset/2 now moves the row that ends up as owner to the end of the list, so every membership write path gets the same order.
Member
Author
|
Folded into #5239, which now goes straight to main with the projects work as its own commit. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds
PUT /api/projects/:id, which creates a project under a client-supplied id or replaces its name and description, and opensGET /api/projects/:idto the service account. It's the first resource beyond users that jig's apply can write, and it builds the groundwork every later resource opts into: one pipeline that accepts either a person's bearer token or the service account's access token, and a service-account case inProjects.ScopeandPolicies.ProjectUsers. The API contract is jig's ADR 0024 (Projects section).How the pieces fit:
LightningWeb.Plugs.PersonOrServiceAccountAuthsits in a per-resource pipeline that names its scope (:projects_apinamesprojects:write). A service-account token goes toAccessTokenAuthand is held to that scope; any other token goes throughUserAuthexactly as before, and the policy decides. OnlyGET/PUT /api/projects/:iduse it;index, the nested project routes and provisioning are unchanged.%Scope{}holds no role and no membership.ProjectUsersdecides for it in one clause from a written-out, deny-by-default list of actions (every project action exceptpublish_templateand the per-member alert settings).Provisioning's:create_project: a superuser for a person, the service account behindprojects:write.create_projectandupdate_projectnow take an actor (Lightning.Actor.t(), a user or the service account) and auditcreated, each initialcollaborator_added, and name and description changes.notifyreplaces the oldschedule_email?flag.Projects.members_by_email/1, which CON-330's members route can reuse.Two answers change for existing callers:
scopeis now refused with 400invalid_scopeinstead of being granted every scope.GET /api/projects/:idanswers 403 when the policy refuses (it used to be 401, which reads as a bad token), and 409scheduled_for_deletionto the service account.Closes #
Validation steps
mix test test/lightning_web/controllers/api/project_controller_test.exs test/lightning_web/plugs/person_or_service_account_auth_test.exs test/lightning/policies/project_user_permissions_test.exs test/lightning/projects/scope_test.exsSERVICE_ACCOUNT_PUBLIC_KEYset, exchange an assertion for a token withscope=projects:write, thenPUT /api/projects/<uuid>with{"name": "acme", "description": "…", "members": [{"email": "…", "role": "owner"}], "notify": false}. Expect 201 with the members; send it again and expect 200 with the members unchanged.createdand onecollaborator_addedper member, with the service account as actor.scripts/e2e.shagainst this branch runs the whole thing end to end.Additional notes for the reviewer
scope:.ProjectUsers.authorize/3now accepts anyScope.actor(), so a repo connection onGET /api/projects/:idis refused instead of raising.update_project/3requires an actor now, andupdate_project_with_users/4audits name and description changes too, so sandbox renames and admin form edits leave a trail./api/provision(project import) still write nocreatedevent. That path is untouched here.9e70e80539(drops.claude/commands/commit.mdand turns Claude attribution off in.claude/settings.json), which isn't onmainyet.AI Usage
Please disclose whether you've used AI anywhere in this PR (it's cool, we just
want to know!):
You can read more details in our
Responsible AI Policy
Pre-submission checklist
/reviewwith Claude Code)
(e.g.,
:owner,:admin,:editor,:viewer)