Conversation
Signed-off-by: phernandez <paul@basicmachines.co>
|
Claude finished @phernandez's task in 1m 50s —— View job PR Review: Speed up bm --version startupReviewing this performance optimization PR against our team checklist. SummaryThis PR successfully optimizes Key Changes:
Code Quality & Standards✅ Follows Basic Memory's coding conventions
✅ Python 3.12+ conventions followed
✅ FastAPI and Typer conventions followed
✅ No commented-out code blocks
Testing & Documentation✅ Regression tests added
Recommendation: While the subprocess tests verify the behavior works correctly, consider adding a unit test for # tests/cli/test_cli_version_fastpath.py
from basic_memory.cli.main import _version_flag_present
def test_version_flag_detection():
assert _version_flag_present(["--version"])
assert _version_flag_present(["-v"])
assert _version_flag_present(["--help", "--version"])
assert not _version_flag_present(["--help"])
assert not _version_flag_present([])However, since the function is trivial and covered by integration tests, the current ✅ Documentation updated appropriately
Basic Memory Architecture✅ MCP architecture preserved
✅ Local-first architecture maintained
✅ Performance optimization aligns with project goals
Security & Performance✅ No security issues
✅ Performance improvement verified
✅ No sensitive data concerns
Compatibility✅ Cross-platform compatible
✅ No emoji/unicode issues
Detailed Code Reviewsrc/basic_memory/cli/main.pyLines 8-9: Helper function def _version_flag_present(argv: list[str]) -> bool:
return any(flag in argv for flag in ("--version", "-v"))✅ Clean implementation, handles both long and short forms Lines 12-25: Conditional imports if not _version_flag_present(sys.argv[1:]):
# Register commands only when not short-circuiting for --version
from basic_memory.cli.commands import ...✅ Comment clearly explains the optimization src/basic_memory/cli/commands/mcp.pyLines 1-10: Import reordering Lines 42-47: Deferred imports # Deferred imports to avoid heavy startup cost for unrelated CLI commands
from basic_memory.mcp.server import mcp as mcp_server # pragma: no cover
# Import mcp tools/prompts to register them with the server
import basic_memory.mcp.tools # noqa: F401 # pragma: no cover
import basic_memory.mcp.prompts # noqa: F401 # pragma: no cover✅ Comment explains the "why" (literate programming style) SuggestionsMinor: Consider early return in app_callbackIn Documentation: Link to performance benchmarksConsider adding a comment in # Trigger: --version or -v flag present in CLI args
# Why: avoid loading ~16 MCP tools and their dependencies (~500ms saved)
# Outcome: defers command registration, faster version check
if not _version_flag_present(sys.argv[1:]):This follows the "Decision Point Comments" pattern from CLAUDE.md. Final ChecklistCode Quality & Standards
Testing & Documentation
Basic Memory Architecture
Security & Performance
Compatibility
Recommendation: APPROVE ✅This PR is well-implemented, properly tested, and achieves its performance optimization goal without introducing technical debt or breaking changes. The deferred import pattern is appropriate for CLI commands and follows Python best practices. No blocking issues found. The code is ready to merge after approval. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9844fcb360
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| def _version_flag_present(argv: list[str]) -> bool: | ||
| return any(flag in argv for flag in ("--version", "-v")) | ||
|
|
||
|
|
||
| if not _version_flag_present(sys.argv[1:]): |
There was a problem hiding this comment.
Don’t treat every -v as a global version flag
The new _version_flag_present gate treats any -v anywhere in argv as --version, which skips importing all subcommands. That breaks normal invocations like bm status -v or bm project -v where -v is a per-command verbose flag (see status.py/project.py options), because the command modules never register and Typer will report “No such command.” This regression only happens when a subcommand uses -v, so the fix should scope the version check to top-level flags (e.g., only when -v/--version appears before any subcommand).
Useful? React with 👍 / 👎.
|
Claude finished @phernandez's task in 2m 9s —— View job PR Review: Speed up bm --version startupReviewing this performance optimization PR against our team checklist. 🚨 Critical Issue:
|
|
Claude finished @phernandez's task in 4m 8s —— View job PR Review: Speed up bm --version startupReviewing this performance optimization PR against the Basic Memory team checklist. 🚨 CRITICAL ISSUE:
|
Signed-off-by: Paul Hernandez <60959+phernandez@users.noreply.github.com>
|
Claude finished @phernandez's task in 1m 52s —— View job PR Review: Speed up bm --version startupReviewing this PR against the Basic Memory team checklist. 🚨 CRITICAL BUG:
|
Older versions of basic-memory CLI (v0.17.4 and earlier) call GET /projects/projects to list projects. This endpoint was removed when we migrated to v2 routers. Re-add the legacy route by mounting v2_project router at /projects prefix, which provides /projects/projects/ for backwards compatibility. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: phernandez <paul@basicmachines.co>
|
Claude finished @phernandez's task in 2m 32s —— View job PR Review: Speed up bm --version startupReviewing this PR against the Basic Memory team checklist. 🚨 CRITICAL BUG:
|
Summary
Testing