Repository navigation
feat(team-provisioner): give team members access to their group mailbox - #153
Merged
Merged
Conversation
Terraform Plan🚧 Changes detected — Plan: 0 to add, 1 to change, 0 to destroy. Plan outputLLM ReviewRisk: 🟢 LOW Plan updates one existing Lambda function (javabin-team-provisioner) in place with a new deployment package; no creates or destroys.
|
Alexanderamiri
added a commit
that referenced
this pull request
Oct 24, 2026
…t missing scope Address review on #153: never remove admin-set OWNERs, report non-java.no members instead of failing the team sync, cache a not-delegated scope for the invocation and log it as a warning, give the exception a readable message, assert the Groups Settings PATCH request shape, and document the Groups for Business prerequisite and the additive scope wording. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Terraform Plan🚧 Changes detected — Plan: 0 to add, 1 to change, 0 to destroy. Plan outputLLM ReviewRisk: 🟢 LOW Plan updates one existing Lambda function (javabin-team-provisioner) in place with a new deployment package (source_code_hash change); no resources created or destroyed.
|
Map registry maintainers to Google MANAGER (OWNER untouched) and enforce group settings so members can read the team group's mail and archive. Settings use a separate token for the apps.groups.settings scope and are skipped when the scope is not delegated, so member sync keeps working. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…t missing scope Address review on #153: never remove admin-set OWNERs, report non-java.no members instead of failing the team sync, cache a not-delegated scope for the invocation and log it as a warning, give the exception a readable message, assert the Groups Settings PATCH request shape, and document the Groups for Business prerequisite and the additive scope wording. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Alexanderamiri
force-pushed
the
feat/team-group-mailbox
branch
from
October 26, 2026 14:06
aed9022 to
f39e49a
Compare
Terraform Plan🚧 Changes detected — Plan: 0 to add, 2 to change, 0 to destroy. Plan outputLLM ReviewRisk: 🟢 LOW Plan updates 2 resources in place (0 add, 0 destroy): a Cognito Google identity provider authorize URL gains an hd=java.no domain restriction and prompt=select_account, and the team-provisioner Lambda receives new code.
|
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.
Why
Team members should be able to read the mail sent to their team group (
team-{name}@java.no). Today the team-provisioner adds every member as MEMBER and never sets the group's settings, so whether members can see the conversations depends on Google's defaults. The registry'srole: maintaineris also used only for GitHub.What
sync_google_groupmaps registryrole: maintainerto Google MANAGER and everyone else to MEMBER. A role that differs is changed withPATCH /groups/{g}/members/{m}. OWNERs (set only by an admin by hand) are never demoted or removed, even when not in the registry; they are returned askept_owners. Other members not in the registry are still removed, as today.Members whose address is not
@java.no(legacyemail:field) are not added, because the group hasallowExternalMembers=falseand the insert would abort the team's sync. They are returned asskipped_externaland flagged in Slack. No registry team usesemail:today.New
enforce_team_group_settingsreads the Groups Settings API and writes only the keys that differ:whoCanViewGroup=ALL_MEMBERS_CAN_VIEWisArchived=true,archiveOnly=falsewhoCanViewMembership=ALL_IN_DOMAIN_CAN_VIEWwhoCanJoin=INVITED_CAN_JOINallowWebPosting=trueallowExternalMembers=falseA group whose settings already match gets no write. Right after a group is created the read can 404 for a few seconds, so it retries with 2, 4 and 8 s waits.
Not enforced:
whoCanPostMessage, moderation, collaborative inbox and posting as the group, so outside senders reach the group exactly as before. The currentwhoCanPostMessageandmessageModerationLevelare returned in the result so the first run shows them.Separate token: the settings scope
apps.groups.settingsis requested on its own token. Google rejects the whole token if any requested scope is missing, so adding it to the shared scope list would break all Google sync until the scope is granted. If it is not delegated (unauthorized_client), the settings step is skipped with a Slack:warning:and member sync still succeeds. That answer is cached for 5 minutes and logged as a warning, so one run does not retry and log an ERROR per team. A disabled API (accessNotConfigured) is reported clearly and does not fail the run.Slack: the result line now shows how many members were added, role changes, settings changes and settings warnings.
Only team groups are affected. Org groups from
groups.yaml(helter@, styret@, drift@ …) are not touched.Docs:
docs/lambda-functions.md(role mapping and settings) andCLAUDE.md(full list of delegated scopes and the separate-token behaviour).No Terraform change.
How verified
python3 -m unittest discover -s terraform/lambda-src/testspasses (86 tests, 22 new intest_team_provisioner_google_group.py). The new tests mock the Google APIs and cover:unauthorized_clientmaps toGoogleScopeNotDelegated_groups_settings_apiPATCH request: method, URL.../groups/v1/groups/team-x%40java.no?alt=json, JSON body, auth headerpython3 -m unittest discover -s scripts/testspasses (43 tests).unauthorized_client, so after merge the settings step will report "skipped" until steps 1 and 2 below are done.Manual steps for an admin
103162295681564397615and addhttps://www.googleapis.com/auth/apps.groups.settings. Keep every existing scope: the field replaces the whole list, and dropping one breaks all Google sync. Read the list currently configured in the console first and addapps.groups.settingsto it. These are the scopes the platform code needs; the console may grant others that are not listed here, so do not paste this list over it:https://www.googleapis.com/auth/admin.directory.group, https://www.googleapis.com/auth/admin.directory.group.member, https://www.googleapis.com/auth/admin.directory.user, https://www.googleapis.com/auth/admin.directory.user.alias, https://www.googleapis.com/auth/gmail.send, https://www.googleapis.com/auth/gmail.settings.sharing, https://www.googleapis.com/auth/apps.groups.settingsgroupssettings.googleapis.com) in GCP projectjavabin-platform.whoCanPostMessage).Follow-ups
team-{name}@java.no, not{name}@java.no. A short-address alias can be added later if wanted.whoCanPostMessage, a follow-up can set it toANYONE_CAN_POST.isArchivedwas turned on may not be in the archive.🤖 Generated with Claude Code