Files
DeepTutor/tests/runtime/test_import_layering.py
Bingxi Zhao (Frank) 740ec413a0 release: v1.5.7
Per-account MCP Services and CLI Apps — the two ways a deployment plugs in
tools DeepTutor never shipped — plus the isolation that makes them safe on a
shared install.

- MCP Services: a 45-entry curated store of hosted servers each account
  installs for itself, OAuth 2.1 (PKCE + dynamic client registration) for the
  servers that require it, static keys held by reference and resolved in memory
  at connect time, stdio refused for self-service. Settings no longer
  configures MCP; /settings/mcp redirects to the store.
- CLI Apps: 101 tools snapshotted from the two CLI-Anything registries.
  Installs are admin-only, the registry's install_cmd is parsed into an argv we
  build rather than executed, npm install scripts are forced off, and 66
  first-party entries are pinned to one reviewed commit. Apps land in
  data/cli-apps, one environment each, mounted read-only into the runner.
- Credentials that authorise a person move to data/system, the one branch the
  exec sandbox never mounts: Codex tokens relocate themselves on first use
  (refusing to follow a symlink), per-user MCP configs and keys land beside
  them.
- Grants gain a cli_apps whitelist with the same deny-by-default posture as
  MCP tools; a per-turn registry view keeps one owner's provider tools out of
  the process-global registry and refuses an unauthorised tool at execute, not
  just in the manifest.
- The composer reports what filled this turn's context window, a gutter rail
  jumps back through long conversations, and the workspace collapses to a
  drawer on small screens.
- The composer keeps focus after sending and across tab switches (#720);
  released images carry provenance and SBOM attestations (#722).

README prose, all ten translated READMEs, and the docs-site pages that named
Settings → MCP are updated to match. Release notes:
assets/releases/ver1-5-7.md
2026-07-31 00:25:48 +08:00

36 lines
1.3 KiB
Python

"""The provider/registry layering must not become mutually dependent.
``deferred_tools`` (registry layer) sanitises provider text through
``providers.text``, so the provider *primitives* sit below the registry.
``providers.view`` composes the registry, so it sits above. Re-exporting
``view`` from ``providers/__init__`` puts the registry back into the package's
own import path: the cycle then resolves only when something else happens to
import ``providers`` first, which makes the suite pass or fail on test order
rather than on correctness.
A fresh interpreter is the only way to assert this — within one process the
first import wins and caches, hiding the cycle.
"""
from __future__ import annotations
import subprocess
import sys
# Importing this module first is the worst case: it pulls in providers.text,
# which triggers the provider package's own initialisation.
_CANARY = "deeptutor.runtime.registry.deferred_tools"
def test_registry_imports_without_a_provider_cycle() -> None:
proc = subprocess.run(
[sys.executable, "-c", f"import {_CANARY}"],
capture_output=True,
text=True,
check=False,
)
assert proc.returncode == 0, (
f"{_CANARY} cannot be imported on its own — the provider layering has a "
f"cycle:\n{proc.stderr}"
)