feat: close BACKEND_GAPS #28/#29/#30 + verify #18 - #4
Merged
Conversation
Extracts MessageView into internal/wire so both handler (REST) and service (WS) layers produce identical wire shapes, then applies wire.ToMessageView in MessageSvc.AppendUser bus publish. Adds regression tests guarding both AppendUser and AppendAgentMessage paths. Closes BACKEND_GAPS #30.
… svc Pre-merge review feedback: Artifact.Get/SetExcluded and Workspace.LeaveWorkspace previously collapsed any GetMemberRole/RoleFor error into ErrForbidden, hiding 500s from infra failures. Now only pgx.ErrNoRows (resp. ErrNotMember) maps to ErrForbidden; other errors propagate. Adds 2-owner self-leave success test that was missing from coverage.
2 tasks
Jarad-z
added a commit
to Jarad-z/brainrot-frontend
that referenced
this pull request
May 19, 2026
Sync status from backend PR Jarad-z/brainrot#4: - #18 verified already fixed in run.go; regression tests in run_promote_test.go - #28 PATCH /artifacts/{id} { excluded } shipped - #29 DELETE /workspaces/{ws_id}/members/me shipped (last-owner 409 guard) - #30 message.appended WS payload now decoded via wire.MessageView #28-#30 sections added (didn't exist on main yet); #18 status line updated.
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
Closes 4 entries from
frontend/docs/BACKEND_GAPS.md:promoteQueuedcorrectness — verified already fixed ininternal/service/run.go; existingrun_promote_test.gocovers cases A-E. No code change.PATCH /api/v1/artifacts/{artifact_id} { excluded }(editor+ RBAC; viewer 403; unknown 404).DELETE /api/v1/workspaces/{ws_id}/members/me(any member; last-owner 409 guard). AddsCountWorkspaceOwnersSQL.message.appendedjsonb decode — extractsMessageViewintointernal/wireso service can use it without backwards import;MessageSvc.AppendUserbus publish now passeswire.ToMessageView(msg). Frontend can drop base64 fallback inlib/parse-message.ts.Pre-merge code review surfaced two Important findings (fixed in
804e554):ErrForbidden— onlypgx.ErrNoRows/ErrNotMembermap to 403; other errors propagate as 500.API.md updated: two new endpoint sections + two auth-matrix rows.
Test plan
go test -short ./...— greengo test -tags=integration ./internal/service/...— 232.5s green (includes 4 newLeaveWorkspacetests, 3 newArtifact.SetExcludedtests, 2 newws_payloadtests)go test -tags=integration ./internal/handler/...— 96.1s green (includes 2 newMember.Leavetests, 3 newArtifact.PatchExcludedtests)go test -tags=integrationon remaining packages (auth,blob,daemon,daemon/backend/*,events) — all greenBACKEND_GAPS.mdstatus lines for #18/#28/#29/#30 — needs separate PR in frontend repoMigration / breaking changes
artifact.excludedcolumn and existingSetArtifactExcludedquery).MessageViewre-exported as a type alias ininternal/handler/jsonb.go, so existing handler code compiles unchanged.Notes for review
internal/wire/message_view.gois a new tiny package — accept it as the documented seam between handler and service for wire DTOs. If you prefer the type stayed ininternal/handler, the alternative is to inline the decode at the service publish site; the package felt cleaner because the guard tests want the same type.SELECT … FOR UPDATEonworkspace_memberrows inside a tx. Not blocking IMO since the failure mode is "workspace temporarily has zero owners" which the owner can recover from.Artifact404 detection still usesstrings.Contains(err.Error(), "not found")— matches the loose convention in sibling handlers. IntroduceErrArtifactNotFoundsentinel if codebase consolidates on that pattern.