Repository navigation
test(mcp): isolate the invalid-action trace test from on-disk state - #87
Closed
basil-k-aji-dev wants to merge 1 commit into
Closed
basil-k-aji-dev wants to merge 1 commit into
basil-k-aji-dev wants to merge 1 commit into
Conversation
`test_mobile_inspect_trace_invalid_action` did not request `temp_trace_env`, so it ran against whatever `trace_store.TRACES_DIR` resolves to, defaulting to `<project_root>/traces`. `mobile_inspect_trace` checks for `data_engine.db` there -- and falls back to `<project_root>/traces/data_engine.db` -- and returns "Database not found" before it validates `action` at all. The result therefore tracked leftover disk state rather than the branch the test names: it passed on a machine with a database from an earlier run and failed on a clean checkout, and in neither case reached the unsupported-action branch it asserts on. Give it the same isolated trace directory the other tests in the module use and seed an empty database there. An unknown action never reads the database, so an empty file is enough to get past the gate and into the branch under test. Also assert that the offending action name is echoed back, which is the part of the message a caller acts on. The test now passes both with and without a database under the project root, and fails on main without one. Closes google#62.
|
close this pr, a solution is already on way (#66 .) |
Author
|
Closing as a duplicate. #66 by @RohanOnKeys already covers issue #62 and was opened first — that one should get the review, not this. My mistake: I didn't check the open PR queue for an existing claim before sending this. Sorry for the noise. |
giveUphope
added a commit
to giveUphope/autoGamer
that referenced
this pull request
Oct 14, 2026
…p opened as G92 The ledger records the reversal (google#87 deferred OCR, the user ruled it built-in), the numbers measured while landing it, and the two places where the plan was wrong rather than merely incomplete: the confidence floor is judged on the words a match actually covers, not on the line or the whole frame the plan quoted, and the packaging spec does load the real model, because "no install, no network, no leftover files" cannot be proved through an injected fake. G92 is opened instead of papered over: on a live desktop capture the packaged model reads only 2 of 24 text-bearing nodes, and the failures are unread glyphs, not the threshold refusing them. Candidate fixes are listed, none chosen.
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.
Closes #62.
Problem
test_mobile_inspect_trace_invalid_actiondoes not request thetemp_trace_envfixture the rest of the module uses, so it runs against whatevertrace_store.TRACES_DIRresolves to.mobile_inspect_tracelooks fordata_engine.dbthere, falls back to<project_root>/traces/data_engine.db, and returns "Database not found" before it validatesactionat all — so the unsupported-action branch the test names is never reached either way.The result therefore reports leftover disk state, not the logic under test.
Reproduction on this host
The project-root database exists only because running the suite creates it, which is exactly what makes this self-concealing — it passes on the second run and fails on a clean checkout:
I hit this accidentally mid-session: a full-suite run overlapped with the window in which I had moved
traces/aside, and this single test flipped to failing in that run and back to passing afterwards, with no code change in between.Change
Give the test the same isolated trace directory the other tests in the module use, and seed an empty
data_engine.dbin it. An unknown action never reads the database — the only gate before the finalelseisos.path.exists(db_path)— so an empty file is enough to get past it and into the branch under test. Seeding the temp database also stops the<project_root>/tracesfallback from being consulted at all, which is what madetemp_trace_envalone insufficient here.Also assert that the offending action name is echoed back, since that is the part of the message a caller acts on.
Scope note
I deliberately did not move
actionvalidation ahead of the database check inmcp_server/tools/inspect_trace.py. It would arguably be a better error for an unknown action with no database present, but it changes the tool's response for a real caller and is a separate decision from making this test honest. Happy to follow up if you'd prefer that.Verification
The decisive property is that the outcome no longer depends on the project-root database:
traces/data_engine.dbpresentmainuv run pytest -q tests/unit/mcp/test_mcp_tools.pyuv run pytest -q(full deterministic suite)main— 0 newuv run ruff check/ruff format --checkon the touched filemake typecheckcould not be run in my environment — thepyrightwheel downloads a Node runtime on first use and my sandbox blocks it. The touched file is not inpyright-core.json.