fix: bot-lint nits — drop unused imports, add reason to except

Resolves three github-code-quality threads blocking PR-2739 merge:
- workspace/tests/test_mcp_cli_multi_workspace.py: remove unused
  `import os` and `from unittest.mock import patch` (left over from
  an earlier test draft that mocked at the os.environ layer).
- workspace/mcp_cli.py:523: replace bare `pass` in the
  register_workspace_token ImportError handler with a debug log line +
  one-line comment explaining the silent-degrade contract (older
  installs that don't yet ship the helper fall back to the legacy
  single-token path; single-workspace operators see no behavior
  change).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Hongming Wang 2026-05-04 08:16:12 -07:00
parent 6fb9bc9bcd
commit 3195657837
2 changed files with 4 additions and 3 deletions

View File

@ -521,7 +521,10 @@ def main() -> None:
for wsid, tok in workspaces: for wsid, tok in workspaces:
register_workspace_token(wsid, tok) register_workspace_token(wsid, tok)
except ImportError: except ImportError:
pass # Older installs that don't yet ship register_workspace_token —
# multi-workspace resolution silently degrades to the legacy
# single-token path; single-workspace operators see no change.
logger.debug("platform_auth.register_workspace_token unavailable; skipping registry populate")
# Standalone-mode register + heartbeat. Skipped via env var so an # Standalone-mode register + heartbeat. Skipped via env var so an
# in-container caller (which has its own heartbeat loop) can reuse # in-container caller (which has its own heartbeat loop) can reuse

View File

@ -8,10 +8,8 @@ breaks multi-workspace doesn't get hidden in a 1000-line test file.
from __future__ import annotations from __future__ import annotations
import json import json
import os
import sys import sys
from pathlib import Path from pathlib import Path
from unittest.mock import patch
import pytest import pytest