strix/tests
0xallam 4e0d0f35d9 feat(migration): phase 5b — STRIX_USE_SDK_HARNESS dispatch flag
Adds the env-var gate that lets users opt into the SDK harness without
disturbing the legacy default. Per PLAYBOOK §7.1, this is the cutover
mechanism: STRIX_USE_SDK_HARNESS=1 routes scans through run_strix_scan
(the Phase 5 entry point); anything else continues to use
StrixAgent.execute_scan.

- strix/interface/sdk_dispatch.py:
  - should_use_sdk_harness(): truthy-string parse of the env var.
  - _resolve_sandbox_image(): reads strix_image from Config; falls
    back to "strix-sandbox:latest" with a warning if unset.
  - _resolve_sources_path(): when --local-sources is given, mounts
    its parent so the agent walks down to the source tree; otherwise
    creates a per-run scratch dir under XDG_CACHE_HOME/strix/sources/.
    Phase 6 will replace this with the legacy clone-into-container
    flow once we port that.
  - run_scan_via_sdk(): the adapter — translates the legacy CLI
    (scan_config dict + argparse Namespace + Tracer) into the keyword
    arguments run_strix_scan expects. Returns the SDK RunResult; lets
    failures bubble up.

- strix/interface/cli.py: adds the dispatch branch inside the existing
  Live/status loop. Legacy default unchanged; SDK path is reached only
  when STRIX_USE_SDK_HARNESS is truthy. Two pre-existing lazy imports
  hoisted to module level (cleanup_runtime + sdk_dispatch helpers) so
  ruff is happy.

Pre-existing legacy lint/type issues surfaced when pre-commit checked
the edited cli.py and chased imports — fixed or ignored in passing:
- utils.py:1052 duplicate ``metadata`` annotation removed.
- utils.py:1251 unused ``# type: ignore[import-not-found]`` for yarl.
- main.py:456 ``panel_parts`` inferred type rejected later string
  entries — explicit ``list[Text | str]`` annotation.
- utils.py:resolve_diff_scope_context PLR0912 (16 branches) per-file
  ignore — branches map 1:1 to scope-mode × target-type combinations.

Tests: 18 new tests in tests/interface/test_sdk_dispatch.py — env
flag parsing parametrized over truthy/falsy variants, image lookup
with config hit + miss-with-warning, sources path resolution for
local_sources / alternative key names / scratch-dir creation, and
the adapter's kwarg handoff verified against a patched
run_strix_scan (run_name from args + run_name from scan_config
fallback + failure propagation).

Refs: PLAYBOOK.md §7.1 (cutover), §7.2 (rollback).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-25 08:03:00 -07:00
..
agents feat(migration): phase 5 — root agent factory + entry point 2026-04-25 00:58:32 -07:00
config fix: --config flag now fully overrides ~/.strix/cli-config.json (#457) 2026-04-22 16:37:22 -04:00
interface feat(migration): phase 5b — STRIX_USE_SDK_HARNESS dispatch flag 2026-04-25 08:03:00 -07:00
llm feat(migration): phase 1 — Session + Tracer + RunConfig factory 2026-04-25 00:01:05 -07:00
orchestration feat(migration): phase 0 — foundation files + smoke tests for SDK migration 2026-04-24 23:43:56 -07:00
runtime feat(migration): phase 0 — foundation files + smoke tests for SDK migration 2026-04-24 23:43:56 -07:00
sandbox feat(migration): phase 4 — sandbox capability + healthcheck + session manager 2026-04-25 00:49:26 -07:00
skills feat: add skills for specific tools (#366) 2026-03-19 16:47:29 -07:00
static feat(migration): phase 0 — foundation files + smoke tests for SDK migration 2026-04-24 23:43:56 -07:00
telemetry feat(migration): phase 1 — Session + Tracer + RunConfig factory 2026-04-25 00:01:05 -07:00
tools feat(migration): phase 3 — multi-agent graph tools + Runner bridge 2026-04-25 00:36:00 -07:00
__init__.py test: add initial unit tests for argument_parser module 2025-12-04 00:02:14 +04:00
conftest.py refactor(tests): reorganize unit tests module structure 2025-12-04 00:02:14 +04:00
test_run_config_factory.py feat(migration): phase 1 — Session + Tracer + RunConfig factory 2026-04-25 00:01:05 -07:00
test_sdk_entry.py feat(migration): phase 5 — root agent factory + entry point 2026-04-25 00:58:32 -07:00