Skip to content

feat: add --name filter to store list - #745

Open
ChrisJr404 wants to merge 4 commits into
openfga:mainfrom
ChrisJr404:store-list-name-filter
Open

feat: add --name filter to store list#745
ChrisJr404 wants to merge 4 commits into
openfga:mainfrom
ChrisJr404:store-list-name-filter

Conversation

@ChrisJr404

@ChrisJr404 ChrisJr404 commented Aug 18, 2026

Copy link
Copy Markdown

Adds a --name flag to fga store list so you can filter stores by name, matching the filter the ListStores API already supports.

The flag binds to a string that gets passed through as Name on ClientListStoresOptions. It's only set when non-empty, so the default fga store list behaves exactly as before and the existing pagination path is untouched.

fga store list --name my-store

Fixes #552. The issue was assigned back in Hacktoberfest 2025 but no PR ever came of it, so picking it up here.

Testing

Added TestListStoresWithName which asserts --name reaches the SDK options via the gomock Options(...) expectation, alongside the existing list tests (updated for the new param). go build ./..., go vet ./cmd/store/..., gofmt -l, and go test ./cmd/store/... all pass. Also updated the store-list parameter list in the README.

Summary by CodeRabbit

  • New Features

    • Added a --name filter to the fga store list command.
    • Users can now list stores matching a specified name.
  • Documentation

    • Documented the new --name option and its usage.

The ListStores API already accepts a name filter, so wire it up on the
CLI. Adds a --name flag to fga store list and passes it through as Name
on ClientListStoresOptions. Only set when non-empty so existing behavior
is unchanged.

Closes openfga#552

Signed-off-by: Chris (ChrisJr404) <11917633+ChrisJr404@users.noreply.github.com>
@ChrisJr404
ChrisJr404 requested a review from a team as a code owner August 18, 2026 02:47
@linux-foundation-easycla

linux-foundation-easycla Bot commented Aug 18, 2026

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: ChrisJr404 / name: Chris (ChrisJr404) (d8a0126)

@coderabbitai

coderabbitai Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 29a63914-1b00-4766-98e7-b5a293a1ccfc

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f3819a9d-6a68-409a-9245-07ae6c87a845

📥 Commits

Reviewing files that changed from the base of the PR and between 76060ae and d8a0126.

📒 Files selected for processing (3)
  • README.md
  • cmd/store/list.go
  • cmd/store/list_test.go

Included review availability: Your plan includes up to 2 reviews per rolling hour; 1 remains after this review.


Walkthrough

Changes

Store name filtering

Layer / File(s) Summary
Name filter command flow
cmd/store/list.go
The fga store list command parses --name and passes non-empty values to ClientListStoresOptions.Name.
Name filter validation and documentation
cmd/store/list_test.go, README.md
Tests verify name forwarding and preserve existing list scenarios. The README documents --name.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to d8a01

This adds an optional store-name filter while preserving existing default behavior and pagination. The documented checks and tests pass, so no actionable merge-blocking risk remains beyond normal review.

Suggested reviewers: rhamzeh

Sequence Diagram(s)

sequenceDiagram
  participant CLI
  participant listStores
  participant SDK
  CLI->>listStores: pass name filter
  listStores->>SDK: set ClientListStoresOptions.Name
  SDK-->>listStores: return filtered stores
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding the --name filter to fga store list.
Linked Issues check ✅ Passed The changes implement store-name filtering through the CLI and ClientListStoresOptions.Name as required by issue #552.
Out of Scope Changes check ✅ Passed The flag, SDK option wiring, tests, and README update are directly related to issue #552.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@SoulPancake

Copy link
Copy Markdown
Member

👋 @ChrisJr404 Can you please sign the EasyCLA

Signed-off-by: Chris (ChrisJr404) <11917633+ChrisJr404@users.noreply.github.com>
Comment thread cmd/store/list.go Outdated
Comment thread README.md Outdated

@Siddhant-K-code Siddhant-K-code left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ChrisJr404, overall it looks good, just some suggestion comments (above)

@ChrisJr404

Copy link
Copy Markdown
Author

Thanks, updated the help text to say it filters by exact name, and added --name plus a filtered example to both the summary row and the List Stores section in the README.

@Siddhant-K-code
Siddhant-K-code requested a review from a team August 20, 2026 14:27

@SoulPancake SoulPancake left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tiny nit, totally non-blocking: the cobra Example: in list.go still only shows fga store list, so folks running --help won't see the new flag in action (the README got the filtered example, but help text is where most people look first). Other commands like store create and tuple write already use multi-line examples, so something like:

Example: `fga store list
fga store list --name "FGA Demo Store"`,

would give help-text parity.
Nice work! 🎉

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.

Allow filtering stores by name

3 participants