Repository navigation
refactor(mcp): fold schema tools into bm_schema - #1959
Conversation
Rename tests/mcp/test_tool_schema.py to test_tool_bm_schema.py and call bm_schema(command="validate"/"infer"/"diff") instead of the unpublished schema_validate/schema_infer/schema_diff functions. Drop the three error-propagation tests that patched SchemaClient methods with AsyncMock: they only asserted that an exception propagates, which no branch in the tool handles. Add real-path tests for the report paths the dropped and legacy tests did not reach through bm_schema: warning and error lines, infer exclusions and JSON, infer with no notes, every drift section, no drift, diff JSON, and diff with a schema but no notes. schema.py and note_schemas.py stay at 100% coverage. schema.py stays: `bm schema validate/infer/diff` still call it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CMYVL1x91B8kJxy7nn2GU8 Signed-off-by: phernandez <paul@basicmachines.co>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Move the report renderers, guidance text and the validate/infer/diff logic from mcp/tools/schema.py into note_schemas.py and delete schema.py. Point `bm schema validate/infer/diff` at bm_schema and drop the schema_* re-exports from mcp/tools/__init__.py. CLI changes: - With no --project and no default project, `bm schema` now exits 1 with "pass --project" instead of passing None to the tool. - Remove the infer zero-notes branch: bm_schema refuses an infer with no notes, and the CLI already prints that refusal. Tests: - Replace the mocked CLI schema tests (tests/cli/test_cli_schema.py, tests/cli/test_json_output.py) with real-project runs in test-int/cli/test_schema_commands_integration.py. - Drop the schema_* entries from tests/implementation_mcp.py and tests/mcp/test_tool_contracts.py. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CMYVL1x91B8kJxy7nn2GU8 Signed-off-by: phernandez <paul@basicmachines.co>
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 20fb86f12e
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Move bm tool's default-project resolution into command_utils.project_or_default and use it in run_tool and in the three `bm schema` commands. `bm schema` no longer checks --project against the local project map, so a 'workspace/project' name or a project id reaches bm_schema and routes the same way it does under `bm tool`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CMYVL1x91B8kJxy7nn2GU8 Signed-off-by: phernandez <paul@basicmachines.co>
|
@codex review |
1 similar comment
|
@codex review |
|
Codex Review: Didn't find any major issues. 👍 Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
## Why `just release v1.0.0` pre-flight-checks for a `## v1.0.0` heading on `main`, so the changelog has to land first. ## What changed `CHANGELOG.md`: the Unreleased section becomes `## v1.0.0 (2026-10-29)`. Its existing items are kept, and the 60 or so commits since #1871 are added: - **Breaking:** - the MCP surface is only `bm_*`, with the old tools deleted (#1944, #1947, #1959, #1962–#1964) - `project` is required (#1934) - the ChatGPT adapters moved to Cloud - `bm tool` mirrors the tools (#1943) - the POSIX verbs are rebuilt and `bm tail` is removed (#1960) - cloud sync/bisync are removed (#1953) - `bm schema` project resolution (#1959) - LiteLLM is an optional extra - **Features:** text-file line ranges in `bm_read`; chat imports return their file paths. - **Bug fixes:** including the three found in the 1.0 live test (#1971, #1972, #1974), with contributor credits for @Flynn-Kawolsky (#1957), @SWSAmor (#1951) and @MbappeWU (#1948). - **Security:** the CodeRabbit deep-scan hardening batch. I checked the entries against PR bodies rather than titles, and corrected #1954, #1948 and #1967 to describe what they actually fixed. The date is today; change it if the tag lands tomorrow. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01CMYVL1x91B8kJxy7nn2GU8 Signed-off-by: phernandez <paul@basicmachines.co> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Summary
Remove the legacy
schema_validate/schema_infer/schema_difffunctions.bm_schemaand thebm schemaCLI now use the same code.src/basic_memory/mcp/tools/schema.pyintosrc/basic_memory/mcp/tools/note_schemas.py, and deletedschema.py. Innote_schemas.py,bm_schemachecks its arguments, opens oneSchemaClient, and dispatches to_validate,_inferor_diff.bm schema validate/infer/diff(src/basic_memory/cli/commands/schema.py) now callbm_schema(command=...).schema_*re-exports fromsrc/basic_memory/mcp/tools/__init__.py.schema_validate()mention in aschema_router.pycomment.bm_schema's name, signature, annotations, description and output are unchanged.User-visible CLI changes
bm schemanow resolves its project with the helperbm tooluses. I movedrun_tool's default-project logic intocommand_utils.project_or_default, and both commands call it. This has two effects:--projectis no longer checked against the local project map. A 'workspace/project' name or a project id reachesbm_schemaand routes as it does underbm tool. An unknown project now fails with the tool's error, prefixed "Error during schema validate: ...". It used to say "No project found named: X".--projectand no default project configured,bm schemaexits 1 with "Error: no default project is set; pass --project.", the same asbm tool. It used to passNoneto the tool.bm schema inferzero-notes branch. It printed "No notes found with type: X". It could no longer run, because the tool refuses an infer with no notes (NOT_FOUND) and the CLI already prints that refusal. Users now see "No notes found of type 'X'" and exit 0, as they did before through the error path.All other flags and output are unchanged.
Tests
MCP:
tests/mcp/test_tool_schema.pybecametests/mcp/test_tool_bm_schema.py.bm_schema(command=...).CLI: the mocked tests that patched
basic_memory.mcp.tools.schema_*(11 intests/cli/test_cli_schema.py, 5 intests/cli/test_json_output.py) are replaced bytest-int/cli/test_schema_commands_integration.py.bm schemaagainst a real test project, with notes written throughbm tool write.--strict, identifier-vs-type targets,--threshold,--save, nothing-to-report messages, an invalid schema (exit 1), drift and no drift, a project id passed as--project, and an unknown--project.tests/cli/test_cli_schema.pykeeps only the two tests that use no mocks: the routing-flag conflict andrun_schema_tool.Removed entries: the
schema_*entries intests/implementation_mcp.pyandtests/mcp/test_tool_contracts.py.Dropped
test_schema_{validate,infer,diff}_error_propagates. They mockedSchemaClientto raiseRuntimeError, the tool has no handler for that case, so they covered no branch.Not tested
project_or_default, whichbm toolalso left untested. Saving a config withdefault_project=Nonein the test-int fixtures still left a default in place, andcli/**is excluded from coverage.Verification
just fast-checkpasses. ty needsuv sync --extra milvuslocally.just test-unit-sqlite -kon the touched and dependent tests (bm_schema, cli schema, json output, tool contracts, bm_project, v1 registration, required project, manual regressions, cli consumers, tool_search, tool_read_note, cli_exit): all pass.just test-unit-postgres -k "test_tool_bm_schema or test_cli_schema or test_json_output or test_tool_contracts or test_tool_bm_project": 65 passed.just test-int-sqlite -k "test_schema_commands_integration or test_tool_commands_integration": 19 passed.just test-int-postgres -k test_schema_commands_integration: 13 passed.note_schemas.pyhas 100% coverage fromtest_tool_bm_schema.pyplustest_tool_bm_project.py.🤖 Generated with Claude Code
https://claude.ai/code/session_01CMYVL1x91B8kJxy7nn2GU8