Repository navigation
improvement(workspaces): move workspace updates behind an application operation and let Chat rename workspaces - #9607
Merged
Conversation
… operation and let Chat rename workspaces PATCH/PUT /api/workspaces/[id] now run through defineInternalJsonRoute and the session-only workspaces.update use case, keeping the legacy 403/400/500 bodies, audit changes and response shape. Chat gets a workspace/general settings section backed by workspaces.identity.read and workspaces.identity.update, which admit only name and logo; billing payer and the personal-key policy stay session-only.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
[Medium impact] The PR appears safe to merge; no actionable new issues were found. SummaryMoves workspace updates into an authorized application operation and lets Chat change workspace names and logos.
|
The workspace UPDATE now carries the not-archived predicate, so an archival that commits after the use case's reads leaves nothing to write and answers the same 404 as a missing workspace, on both the session route and Chat's identity update. The integration suite holds the row lock, archives the row while the update waits, and asserts the 404 and the unchanged name; the archived-fixture refusal now checks that fixture's own row.
Collaborator
Author
Collaborator
Author
|
@cubic-dev-ai review this PR |
Contributor
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
This branch was previously deployed
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.
Summary
PATCH/PUT /api/workspaces/[id]queried the DB and decided authorization in the route; it now runs throughworkspaces.update(admin, session-only, workspace keys denied) on the shared internal route builderworkspaces.identity.update(admin, Copilot-delegated,sim:settings) accepts onlynameandlogoUrlvia a strict pick, sobilledAccountUserIdandallowPersonalApiKeysare rejected; exposed as asettings workspace/generalsection with aworkspaces.identity.readreadInsufficient permissionsfor non-admin/non-member/archived, billed-account 400s, payer transfer in the transaction,WORKSPACE_UPDATEDaudit with the same changes metadata. Differences from the shared builder: error bodies carryrequestId, response is contract-validated, and a row vanishing mid-request returns 404 instead of an empty 200Type of Change
Testing
update-workspace.integration.ts(real Postgres, real route and settings tool): 11/11; each guard reverted alone turns its case red (identity role lowered, identity schema widened, delegated principals admitted to full update, 403 mapping removed)settings.test.ts,settings-management-boundary.test.ts(30),copilot-route-inventory.test.tsbun run lint,check:api-validation:strict,check:boundaries,check:route-verbs,check:api-contract-routes,check:principal-kind-parity,check:application-graph,check:permission-group-enforcement,check:test-types, pre-pushtype-checkChecklist
test-auditauthoring gate)