fix(cli): replace make users target with bin/users wrapper - #271
Merged
Conversation
`make users ARGS="..."` swallowed any argument starting with `-` before it reached the Makefile, forcing awkward ARGS= quoting. bin/users execs docker-compose (falling back to `docker compose`) directly, passing all arguments through unchanged.
There was a problem hiding this comment.
Pull request overview
This PR replaces the make users convenience target with a repository-level ./bin/users wrapper so user-management CLI arguments (especially flags like --role/-h) pass through to the backend container unchanged.
Changes:
- Remove the
userstarget from the Makefile and introduce abin/userswrapper that execs Docker Compose with passthrough args. - Add unit tests covering docker-compose preference, docker compose v2 fallback, and exit-code passthrough.
- Update documentation (README, commands docs, and
manage_users.pydocstring) to reference./bin/users.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
bin/users |
New shell wrapper that runs scripts/manage_users.py inside the backend container via Compose. |
Makefile |
Removes the users target and related argument-forwarding logic. |
src/backend/tests/unit/test_users_wrapper.py |
Adds unit tests for wrapper argument passthrough, compose fallback, and exit code propagation. |
src/backend/scripts/manage_users.py |
Updates Docker usage examples to use ./bin/users. |
README.md |
Updates user-management examples to use ./bin/users. |
docs/commands.md |
Updates user-management documentation to use ./bin/users and removes the make-flag caveat. |
Comment on lines
+38
to
+54
| bin_dir = tmp_path / "bin" | ||
| bin_dir.mkdir(exist_ok=True) | ||
| capture_path = tmp_path / "arguments.txt" | ||
| environment = { | ||
| **os.environ, | ||
| "PATH": f"{bin_dir}{os.pathsep}/usr/bin{os.pathsep}/bin", | ||
| "CAPTURE_PATH": str(capture_path), | ||
| "FAKE_EXIT_CODE": str(exit_code), | ||
| } | ||
| return subprocess.run( | ||
| [str(USERS_WRAPPER), *arguments], | ||
| cwd=tmp_path, | ||
| env=environment, | ||
| capture_output=True, | ||
| text=True, | ||
| check=False, | ||
| ) |
Comment on lines
15
to
18
| Usage (Docker): | ||
| docker-compose ... exec backend /app/.venv/bin/python scripts/manage_users.py <cmd> | ||
| # or via make: | ||
| make users ARGS="list --json" | ||
| ./bin/users create --email alice@example.com --password '<password>' --full-name "Alice" | ||
| ./bin/users list --role admin --active | ||
|
|
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
make users ARGS="..."convenience target with abin/usersshell wrappermakewas consuming any argument starting with-before it reached the Makefile, forcing awkwardARGS="..."quoting for flags like--role,--active,-hbin/usersexecsdocker-compose(falling back todocker compose) directly against the backend container, passing all arguments through unchangedmanage_users.pydocstring to reference./bin/usersinstead ofmake users ARGS="..."Test plan
uv run pytest tests/unit/test_users_wrapper.py— covers both thedocker-composeanddocker composefallback paths, and exit code passthrough