test_stdio_probe.py¶
tests/integration/test_stdio_probe.py
The gh#48 reporter's own probe, over real JSON-RPC, as a test.
test_the_cwd_only_mode_refuses_by_naming_every_source_of_a_target
None test_stdio_probe.test_the_cwd_only_mode_refuses_by_naming_every_source_of_a_target(Path tmp_path, Path rich_db)
With no target source, the refusal names --repo, the environment and target=.
tests/integration/test_stdio_probe.py:252
Checks
assert not payload, f"a server with no target must not answer: {payload}"assert "No default target repository" in error, errorassert "--repo" in error and PROJECT_DIR_ENV in error and "target=" in error, error
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-MCP-001 | measured | test_the_cwd_only_mode_refuses_by_naming_every_source_of_a_target → _probe_repo → target_for |
Source · 18 lines
def test_the_cwd_only_mode_refuses_by_naming_every_source_of_a_target(
tmp_path: Path, rich_db: Path
) -> None:
"""THE FOURTH MODE, WHICH IS CORRECT TO REFUSE. The working directory is deliberately not a
source for the default target — a client that supplies neither `--repo` nor the environment
nor roots has said nothing about which repository it means. What the refusal must do is name
all three routes plus the per-call argument, so a reader can act without knowing the design.
@brief With no target source, the refusal names --repo, the environment and target=.
@version 1
"""
repo, home = _probe_repo(tmp_path, rich_db)
payload, error = _read(_probe(repo, home, [], None, None))
assert not payload, f"a server with no target must not answer: {payload}"
assert "No default target repository" in error, error
assert "--repo" in error and PROJECT_DIR_ENV in error and "target=" in error, error1 more lines, not shown
Activity · 5 steps
test_the_three_target_bearing_modes_answer_from_first_party
None test_stdio_probe.test_the_three_target_bearing_modes_answer_from_first_party(Path tmp_path, Path rich_db)
--repo with and without target, and $CLAUDE_PROJECT_DIR, all answer from first-party.
tests/integration/test_stdio_probe.py:228
Checks
assert not error, f"{label}: refused — {error}"assert payload.get("found") is not False, f"{label}: {payload}"assert payload.get("sub_index") == FIRST_PARTY_INDEX, f"{label}: {payload}"assert payload.get("target") == str(repo), f"{label}: {payload}"
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-MCP-001 | measured | test_the_three_target_bearing_modes_answer_from_first_party → _probe_repo → target_for |
Source · 24 lines
def test_the_three_target_bearing_modes_answer_from_first_party(
tmp_path: Path, rich_db: Path
) -> None:
"""THE THREE MODES THAT HAVE A REPOSITORY. Each answers, and each says which part answered:
a reply that read first-party while looking like a whole-repository answer is the failure
`Answering` calls this project's most expensive.
@brief --repo with and without target, and $CLAUDE_PROJECT_DIR, all answer from first-party.
@version 1
"""
repo, home = _probe_repo(tmp_path, rich_db)
modes = {
"--repo, target supplied": ([f"--repo={repo}"], None, repo),
"--repo, target omitted": ([f"--repo={repo}"], None, None),
f"no --repo, ${PROJECT_DIR_ENV} set": ([], repo, None),
}
for label, (args, env_repo, target) in modes.items():
payload, error = _read(_probe(repo, home, args, env_repo, target))
assert not error, f"{label}: refused — {error}"
assert payload.get("found") is not False, f"{label}: {payload}"
assert payload.get("sub_index") == FIRST_PARTY_INDEX, f"{label}: {payload}"
assert payload.get("target") == str(repo), f"{label}: {payload}"