fix(legacy-meter): guard MCP alias metering off in tests
Alias tests monkeypatch _get/_post but _meter_legacy_mcp uses _client() directly, so every pytest run recorded real usage and reset zero-window retirement streaks. STATEHUB_MCP_LEGACY_METER=off skips metering; set in tests/conftest.py. Verified meter counts flat across the alias suite. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
a18fa13682
commit
54577cd847
3 changed files with 16 additions and 0 deletions
|
|
@ -226,6 +226,8 @@ def _meter_legacy_mcp(*, tool: str | None = None, resource: str | None = None) -
|
|||
(`mcp:<tool_name>` / resource URI). Failures never surface to the caller —
|
||||
the meter gates retirement, it must not break the aliased call itself.
|
||||
"""
|
||||
if os.environ.get("STATEHUB_MCP_LEGACY_METER", "on") == "off":
|
||||
return
|
||||
if tool:
|
||||
key = f"mcp:{tool}"
|
||||
replacement = _LEGACY_MCP_TOOL_REPLACEMENTS[tool]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue