Skip to content

test(coderd): pin member counts and user details in chat and project ACL reads - #31014

Open
ibetitsmike wants to merge 1 commit into
mainfrom
mike/chat-acl-shared-helpers-tests
Open

ibetitsmike wants to merge 1 commit into
mainfrom
mike/chat-acl-shared-helpers-tests

Conversation

@ibetitsmike

@ibetitsmike ibetitsmike commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator

Adds five assertions to TestChatProjectSharing and TestChatACLSharingLifecycle. It is the test-first layer for the refactor above it, so it adds 8 test lines and removes none.

Why it is needed: the next layers move the chat and chat project ACL reads onto the shared resolvers in coderd/mcp_acl.go, which also replaces the per-group member count query of the project read with one batched query. No test checked a group's member count or any user field other than the ID in those reads, so a wrong count or a dropped username would still pass.

The new assertions check that:

  • the project ACL lists the Everyone group with 3 members and a custom group with 1,
  • the project and chat ACL users carry their usernames.

Proof: the tests pass on main and on this branch. I ran 5 mutants of the main read code with go test -overlay: report a zero member count, count the members of the wrong group, count system users, and return only the user ID in the project read and in the chat read. Each mutant fails these tests and passes the tests on main.

Validation: go test ./coderd -run '^(TestChatProjectSharing|TestChatACLSharingLifecycle)$' -count=1 passes, and the pre-commit hook passed (make gen, formatting, golangci-lint over every package, and the slim build).

Stack

This stack moves the chat, chat project, and chat model ACL handlers onto the organization ACL helpers that MCP server configs and organization skills already share, and deletes their copies. ACL responses do not change.

  1. test(coderd): pin member counts and user details in chat and project ACL reads #31014 Pin member counts and user details in chat and project ACL reads
  2. refactor(coderd): move chat model ACL handlers onto the shared ACL helpers #31015 Move chat model ACL handlers onto the shared ACL helpers
  3. refactor(coderd): move chat and chat project ACL reads onto the shared helpers #31016 Move chat and chat project ACL reads onto the shared helpers

Xum, an AI agent, opened this PR for @ibetitsmike and wrote this description.

…ACL reads

The chat project ACL read path counts group members with one query per
group, and no test checked the counts or the hydrated user fields. Pin
both, and the chat ACL username, before these reads move onto the shared
organization ACL resolvers.
@ibetitsmike
ibetitsmike added this pull request to stack #31017 October 19, 2026 13:53
@ibetitsmike ibetitsmike changed the title mike/chat acl shared helpers tests test(coderd): pin member counts and user details in chat and project ACL reads Oct 19, 2026
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

Xum, an AI agent, requested this review for @ibetitsmike.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-19T22:49:46.592621Z f484cd8 Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: f484cd8f85

ℹ️ 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".

@ibetitsmike
ibetitsmike marked this pull request as ready for review October 19, 2026 22:48

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant