fix(user): list active org members by default#21
Merged
Conversation
`dailybot user list` (and any internal caller of `DailyBotClient.list_users`)
was returning every user the server exposed, including deactivated
accounts. That's both confusing for the human-facing table and a
correctness hazard for downstream resolvers (e.g. `kudos give --to "X"`
matching against a deactivated user record).
This change filters out `is_active: false` rows by default. A missing
`is_active` field is treated as active for forward-compatibility with
older server payloads.
## Change Log
- `api_client.py::DailyBotClient.list_users` now accepts `include_inactive`
(keyword-only, default False). When False, drops rows with
`is_active` falsy.
- `commands/user.py`: new `--include-inactive` flag on `dailybot user list`
(default off). Updated help text + examples.
- `commands/user_scoped_actions.py::execute_user_list` plumbed through.
- Tests: two new `list_users` tests (filter-by-default + opt-out) and one
new command-level test asserting `--include-inactive` is forwarded.
- Existing `list_users` tests updated to include `is_active: True` on
the fixture rows so the default-filter path behaves correctly.
## Risks
- Behavior change in the default response of `dailybot user list` — but
the change reflects user intent ("members of the organization" means
current/active members), and the opt-out flag preserves the legacy
output for admin / audit flows.
- No payload change to outgoing requests; no schema migrations.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
dailybot user listwas returning every user the server exposed, including deactivated accounts — confusing for the human-facing table and a correctness hazard for downstream resolvers (e.g.kudos give --to "Old Employee"matching against a deactivated user record).This change filters out
is_active: falserows by default at theDailyBotClient.list_userslayer. A missingis_activefield is treated as active for forward-compatibility with older server payloads. The legacy unfiltered output is still available viadailybot user list --include-inactive.Change Log
api_client.py::DailyBotClient.list_usersnow acceptsinclude_inactive(keyword-only, defaultFalse). WhenFalse, drops rows withis_activefalsy.commands/user.py: new--include-inactiveflag (default off). Updated help text + examples.commands/user_scoped_actions.py::execute_user_listplumbed through.list_userstests — filter-by-default + opt-out behavior.--include-inactiveis forwarded.list_userspaginated fixtures updated withis_active: True.Risks
dailybot user list— but the change reflects user intent ("members of the organization" → current/active members), and--include-inactivepreserves the legacy output for admin / audit flows.kudos give --to "<name>"resolves againstlist_users(), so deactivated accounts are now correctly excluded from name-matching. This is the desired behavior.Local validation
ruff check,ruff format --check,mypy dailybot_cli— all clean.pytest tests/api_client_test.py tests/public_api_commands_test.py— 78/78 pass.dailybot user listreturns 4 active members.Test plan
dailybot user listshows only active members by default.dailybot user list --include-inactiveshows the full server response.dailybot kudos give --to "<deactivated-user-name>"returns "No user found matching X".dailybot user list --jsonmatches the table contents (both filtered identically by default).🤖 Generated with Claude Code