feat(health): expose fsck as kb.fsck on mcp/jsonl/capabilities - #739
Open
philluiz2323 wants to merge 2 commits into
Open
feat(health): expose fsck as kb.fsck on mcp/jsonl/capabilities#739philluiz2323 wants to merge 2 commits into
philluiz2323 wants to merge 2 commits into
Conversation
health.fsck() (orphaned embeddings, dangling supersede/contradict chains, decided-proposal <-> artifact mismatches, index-vs-file drift) was called from exactly one place, cli.py's fsck command. kb.lint and kb.doctor already have full mcp/jsonl/capabilities registration - fsck was the one gap in that otherwise-complete trio, leaving an agent no way to run the deepest check without shelling out to the CLI. register kb_fsck on mcp and _h_fsck on jsonl, mirroring kb_doctor's registration exactly, plus the capabilities.METHODS entry and hot_memory.py's coverage registry (excluded with the same reason kb.lint/kb.doctor already carry: diagnostics, no claim payload). the CLI mirror needed no change - vouch fsck already exists and matches the default kb.foo -> vouch foo naming rule test_cli_commands_match_ methods checks against. Closes vouchdev#738
diff-coverage flagged server.py:1204-1205 (kb_fsck's report = health.
fsck(_store()) / return {...}) as untested - the existing jsonl-level
test exercises _h_fsck, never the mcp wrapper function itself.
add a direct call matching the pattern newer kb.* methods already use
(test_explain_ranking.py's test_mcp_surface_serves_explain_ranking):
monkeypatch server._store to the test fixture, call server.kb_fsck()
directly, and diff its result against a direct health.fsck() call.
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.
What changed
health.fsck()is now registered on MCP (kb_fsck), JSONL (kb.fsck),and
capabilities.METHODS, mirroringkb_doctor's registration exactly.The CLI mirror (
vouch fsck) already existed and needed no change — italready matches the default
kb.foo→vouch foonaming ruletest_cli_commands_match_methodschecks against.Why
health.fsck()(orphaned embeddings, dangling supersede/contradictchains, decided-proposal ↔ artifact mismatches, index-vs-file drift) was
called from exactly one place:
cli.py'sfsckcommand.kb.lintandkb.doctorboth have full four-surface registration;fsck— thedeepest of the three checks — was the one gap, leaving an agent no way
to run it without shelling out to the CLI.
Closes #738
What might break
Nothing — purely additive.
health.fsck()itself is completely untouched;this only wires its existing, unmodified output to three more surfaces
the same way
kb.doctoralready does.Heads up for review: while testing this I confirmed
health.fsck()oncurrent
testHEAD still crashes with an uncaughtKeyErroron anyapproved
DELETE(and separately,GOAL) proposal — the bug my own#735(still open) fixes. That crash is pre-existing and orthogonal tothis PR (it lives entirely inside
_check_decided_proposals, which thisPR never touches) — but worth flagging that exposing
kb.fsckhere makesthat crash reachable from MCP/JSONL agents too, not just CLI users of
vouch fsck. I'd suggest merging#735around the same time as this oneif convenient, though neither PR strictly depends on the other.
VEP
Not applicable — no object model, on-disk layout, bundle format, or
audit-log shape change. A registration-only change wiring an existing,
unmodified function to three more surfaces.
Tests
make check-equivalent: ruff clean (src+tests); mypyclean;
tests/test_health.py,tests/test_capabilities.py,tests/test_hot_memory.py,tests/test_cli.pyall passtests/test_health.py:JSONL
kb.fsckresult matches a directhealth.fsck()call,findings round-trip through the JSONL envelope (not just the
okflag), and a pin confirming
kb.fsck's default CLI-mirror namecorrectly resolves to the pre-existing
fsckcommand with no_CLI_MIRRORSentry neededCHANGELOG.mdupdated under## [Unreleased]