Skip to content

groups list 400 INVALID_ARGUMENT: searchTransitiveGroups rejects (A || B) OR label filter #1059

Description

@hengshan

Environment

  • gog version: v0.38.1 (324f656 2026-08-26T04:37:04Z)
  • Auth: delegated service account (domain-wide delegation), invoked as --account <workspace-email>

Repro

gog --account admin@example.com groups list

Result:

Google API error (400 badRequest): Request contains an invalid argument.

Root cause

internal/cmd/groups.go → searchTransitiveGroupsQuery builds this query:

return fmt.Sprintf(
    "member_key_id == '%s' && ('%s' in labels || '%s' in labels)",
    memberKeyID,
    groupLabelDiscussionForum, // cloudidentity.googleapis.com/groups.discussion_forum
    groupLabelDynamic,         // cloudidentity.googleapis.com/groups.dynamic
)

Cloud Identity's groups.memberships.searchTransitiveGroups query accepts && (AND) filters, but the parenthesized || (OR) between two label conditions is rejected with 400 INVALID_ARGUMENT.

Evidence (raw API, varying the query)

query HTTP
member_key_id == 'x@example.com' (no label) 400
member_key_id == 'x@example.com' && 'cloudidentity.googleapis.com/groups.discussion_forum' in labels 200
member_key_id == 'x@example.com' && ('...discussion_forum' in labels || '...dynamic' in labels) 400

Suggested fix

Use a single label filter instead of the OR (e.g. only discussion_forum), or issue two separate queries and merge results. The two-label OR appears to have been introduced by the label-filter change (#315), but the OR form is not accepted by the Cloud Identity API.

Activity

  1. added
    P2Normal priority bug or improvement with limited blast radius.
    clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.
    clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.
    clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.
    impact:otherThis issue has meaningful maintainer-visible impact outside the owned taxonomy.
    issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.
    no-staleExempts this issue from stale automation.
    on Sep 2, 2026
  2. clawsweeper commented on Sep 2, 2026

    @clawsweeper
    Contributor

    Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed September 7, 2026, 4:26 AM ET / 08:26 UTC.

    Summary
    The reported query remains on current main and in v0.39.1. The maintainer explicitly reopened this issue after an unrelated pagination merge; the approved repair still awaits independent provider validation.

    Reproducibility: yes. for constructing and sending the reported query: both current callers visibly use it. Independent reproduction of Google's rejection remains pending on an eligible identity; no live request or tests were executed in this review.

    Root-cause cluster
    Relationship: canonical
    Canonical: #1059
    Summary: This issue remains the query-repair tracker; the merged pagination and dependency work explicitly excluded it.

    Members:

    Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

    Next step
    Retain the explicit no-new-fix-pr hold and route the existing eligible-provider validation gate to steipete without reopening settled product direction.

    Review details

    Best possible solution:

    Use the documented single discussion-forum predicate in the shared helper, preserving escaping, native pagination, and output contracts, with exact-query regressions and eligible-provider proof.

    Do we have a high-confidence way to reproduce the issue?

    Yes for constructing and sending the reported query: both current callers visibly use it. Independent reproduction of Google's rejection remains pending on an eligible identity; no live request or tests were executed in this review.

    Is this the best way to solve the issue?

    Yes. The maintainer-selected single predicate follows Google's documented membership search and dynamic-group examples without introducing a second query or composite cursor.

    AGENTS.md: found and applied where relevant.

    Remaining risk / open question:

    • Independent provider evidence has not established successful single-filter retrieval of a known dynamic membership and agreement between --max 1, --page, and --all under an already-authorized eligible identity.

    Codex review notes: model internal, reasoning medium; reviewed against 443c84da8b57.

    Label changes

    Label changes:

    • remove clawsweeper:no-new-fix-pr: Current issue advisory state no longer selects this label.
    • remove clawsweeper:needs-maintainer-review: Current issue advisory state no longer selects this label.

    Label justifications:

    • P2: An existing Workspace Groups operation reports a provider rejection, with a bounded repair and limited service-specific impact.
    • impact:other: The affected behavior is group-membership retrieval for listing and backup, outside the more specific owned impact classes.
    Evidence reviewed

    What I checked:

    Likely related people:

    • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
    How this review workflow works
    • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
    • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
    • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
    • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
    • Maintainers can also comment @clawsweeper review to request a fresh review only.
    • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
    • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
    • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
  3. added
    clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.
    clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.
    clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.
    and removed
    clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.
    clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.
    no-staleExempts this issue from stale automation.
    on Sep 3, 2026
  4. steipete commented on Sep 3, 2026

    @steipete
    Collaborator

    Maintainer triage: this is an existing-query repair; a new product decision or two-query merge is not needed. Google's transitive-membership guide uses one discussion-forum predicate to retrieve direct and indirect group memberships, excluding identity-mapped groups. Its dynamic-group creation example also uses that label with dynamic-group metadata.

    The bounded repair is to replace the OR in searchTransitiveGroupsQuery with that documented single predicate, retaining member escaping and native page tokens. The shared helper covers both groups list and the Groups backup collector. Exact-query and request-level pagination tests should cover both; no deduplication or composite cursor is warranted.

    The remaining gate is independent live proof with an already-authorized eligible Workspace/Cloud Identity Premium identity and membership-view access. Compare the reported OR failure with a successful single-filter request, include a known dynamic membership, and verify --max 1, --page, and --all agree. The existing focused Groups tests pass, but they are mocks, not provider proof. The consumer test account cannot exercise this endpoint. No new scopes, IAM, API enablement, billing, or fixture groups are authorized by this triage. Keep the issue open pending that validation; no fix has landed yet.

  5. added
    clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.
    clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.
    issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.
    and removed
    issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.
    clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.
    clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.
    on Sep 3, 2026
  6. steipete commented on Sep 7, 2026

    @steipete
    Collaborator

    Reopening: this was closed automatically by the #1087 merge reference, but the Groups OR-label query is still on main. Peter selected the narrow single-discussion-forum predicate repair; it still needs live validation against an eligible Cloud Identity grant before landing.

  7. removed
    clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.
    clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.
    on Sep 7, 2026
  8. steipete commented on Sep 24, 2026

    @steipete
    Collaborator

    Maintainer update: proceed with the narrow single-discussion-forum query repair using Google's documented query/label contracts, generated-client request regressions, review, and normal CI. I am relaxing the earlier requirement for an independent live Cloud Identity comparison for this bounded fix.

    The configured Workspace accounts were checked again: user OAuth is healthy, but neither has a delegated Groups credential. Ordinary OAuth reauthentication does not supply that configuration. Do not add IAM grants, enable APIs, change billing, or create fixture groups to satisfy this check.

    The refreshed regression suite fails against the old query and passes with the documented predicate. It covers listing and backups, page sizes, opaque native cursors, --all from the beginning or an existing cursor, and literal member escaping. Google's ordinary/security/dynamic label documentation supports the single predicate; fixture group names are not presented as live dynamic-membership proof. The original reporter's OR-versus-single-filter API comparison remains reporter evidence, not an independently repeated result.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal priority bug or improvement with limited blast radius.clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.impact:otherThis issue has meaningful maintainer-visible impact outside the owned taxonomy.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions