Skip to content

chat spaces find: substring match by default, --exact for legacy behavior#506

Closed
mvanhorn wants to merge 1 commit intoopenclaw:mainfrom
mvanhorn:osc/503-chat-spaces-find-substring
Closed

chat spaces find: substring match by default, --exact for legacy behavior#506
mvanhorn wants to merge 1 commit intoopenclaw:mainfrom
mvanhorn:osc/503-chat-spaces-find-substring

Conversation

@mvanhorn
Copy link
Copy Markdown
Contributor

Closes #503

`gog chat spaces find` previously required an exact, case-insensitive match on the full `displayName`. Searching `Project` against a space named `My Project Team` returned no results, and the documented workaround was `gog chat spaces list --all -p | grep`, which is slower and less ergonomic.

This change makes `find` do substring matching (case-insensitive) by default and adds an `--exact` flag to opt into the previous behavior. The underlying Google Chat `Spaces.List` API has no server-side display name filter, so both modes iterate the same paginated result set; substring matching is strictly more permissive. Scripts that relied on the exact-match behavior can add `--exact` to keep the old semantics.

Examples:

```console

default (substring, case-insensitive)

gog chat spaces find Project

returns: My Project Team, Project Alpha, Old Project Archive

legacy exact match

gog chat spaces find --exact "Project Alpha"

returns: Project Alpha

```

Tests

  • `TestExecute_ChatSpacesFind_Substring` - default search `project` matches `My Project Team`, `Project Alpha`, and `Old Project Archive`, and excludes `Random Channel`.
  • `TestExecute_ChatSpacesFind_Exact` - `--exact "project alpha"` returns only the space whose `displayName` equals `Project Alpha` (case-insensitive).
  • Existing `TestExecute_ChatSpacesFind_JSON` still passes (exact-named `Engineering` remains matched by the default substring behavior because it is a substring of itself).

`go test ./internal/cmd/ -run TestExecute_ChatSpacesFind` and `go build ./...` both clean locally.

…vior

Closes openclaw#503

`gog chat spaces find` previously required an exact, case-insensitive
match on the full displayName. Searching "Project" against a space
named "My Project Team" returned no results, forcing users to fall
back to `gog chat spaces list --all -p | grep`.

This changes `find` to substring match (case-insensitive) by default
and adds an `--exact` flag to opt into the previous behavior. The
underlying Google Chat `Spaces.List` API has no server-side display
name filter, so both modes iterate the same paginated result set;
substring matching is strictly more permissive. Scripts that relied
on the exact-match behavior can add `--exact` to keep the old
semantics.

Tests:
- TestExecute_ChatSpacesFind_Substring: default search "project"
  matches "My Project Team", "Project Alpha", and "Old Project
  Archive" but not "Random Channel".
- TestExecute_ChatSpacesFind_Exact: --exact "project alpha" matches
  only the space whose displayName equals "Project Alpha" (case-
  insensitive).
- Existing TestExecute_ChatSpacesFind_JSON still passes unchanged.
steipete added a commit that referenced this pull request Apr 20, 2026
Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
@steipete
Copy link
Copy Markdown
Collaborator

Landed manually on main with regression coverage for substring and --exact matching.

Thanks @mvanhorn!

@steipete steipete closed this Apr 20, 2026
@mvanhorn
Copy link
Copy Markdown
Contributor Author

Thanks for landing this @steipete and for adding the regression coverage. Appreciate the ping on the Workspace account blocker too.

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.

chat spaces find: support partial/substring matching on displayName

2 participants