mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-14 02:42:04 +08:00
feat: unified task.json schema migration and multi-module updates
- Create task-schema.json (JSON Schema draft-07) with 10 field blocks fusing Unified JSONL, 6-field Task JSON, and Solution Schema advantages - Migrate unified-execute-with-file from JSONL to .task/*.json directory scanning - Migrate 3 producers (lite-plan, plan-converter, collaborative-plan) to .task/*.json multi-file output - Add review-cycle Phase 7.5 export-to-tasks (FIX-*.json) and issue-resolve --export-tasks option - Add schema compatibility annotations to action-planning-agent, workflow-plan, and tdd-plan - Add spec-generator skill phases and templates - Add memory v2 pipeline (consolidation, extraction, job scheduler, embedder) - Add secret-redactor utility and core-memory enhancements - Add codex-lens accuracy benchmarks and staged env config overrides
This commit is contained in:
117
codex-lens/tests/test_config_staged_env_overrides.py
Normal file
117
codex-lens/tests/test_config_staged_env_overrides.py
Normal file
@@ -0,0 +1,117 @@
|
||||
"""Unit tests for Config .env overrides for staged/cascade settings."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from codexlens.config import Config
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def temp_config_dir() -> Path:
|
||||
"""Create temporary directory for config data_dir."""
|
||||
tmpdir = tempfile.TemporaryDirectory(ignore_cleanup_errors=True)
|
||||
yield Path(tmpdir.name)
|
||||
try:
|
||||
tmpdir.cleanup()
|
||||
except (PermissionError, OSError):
|
||||
pass
|
||||
|
||||
|
||||
def test_staged_env_overrides_apply(temp_config_dir: Path) -> None:
|
||||
config = Config(data_dir=temp_config_dir)
|
||||
|
||||
env_path = temp_config_dir / ".env"
|
||||
env_path.write_text(
|
||||
"\n".join(
|
||||
[
|
||||
"ENABLE_CASCADE_SEARCH=true",
|
||||
"CASCADE_STRATEGY=staged",
|
||||
"CASCADE_COARSE_K=111",
|
||||
"CASCADE_FINE_K=7",
|
||||
"STAGED_STAGE2_MODE=realtime",
|
||||
"STAGED_CLUSTERING_STRATEGY=path",
|
||||
"STAGED_CLUSTERING_MIN_SIZE=5",
|
||||
"ENABLE_STAGED_RERANK=false",
|
||||
"STAGED_REALTIME_LSP_TIMEOUT_S=12.5",
|
||||
"STAGED_REALTIME_LSP_DEPTH=2",
|
||||
"STAGED_REALTIME_LSP_MAX_NODES=123",
|
||||
"STAGED_REALTIME_LSP_MAX_SEEDS=3",
|
||||
"STAGED_REALTIME_LSP_MAX_CONCURRENT=4",
|
||||
"STAGED_REALTIME_LSP_WARMUP_S=0.25",
|
||||
"STAGED_REALTIME_LSP_RESOLVE_SYMBOLS=yes",
|
||||
"",
|
||||
]
|
||||
),
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
config.load_settings()
|
||||
|
||||
assert config.enable_cascade_search is True
|
||||
assert config.cascade_strategy == "staged"
|
||||
assert config.cascade_coarse_k == 111
|
||||
assert config.cascade_fine_k == 7
|
||||
|
||||
assert config.staged_stage2_mode == "realtime"
|
||||
assert config.staged_clustering_strategy == "path"
|
||||
assert config.staged_clustering_min_size == 5
|
||||
assert config.enable_staged_rerank is False
|
||||
assert config.staged_realtime_lsp_timeout_s == 12.5
|
||||
assert config.staged_realtime_lsp_depth == 2
|
||||
assert config.staged_realtime_lsp_max_nodes == 123
|
||||
assert config.staged_realtime_lsp_max_seeds == 3
|
||||
assert config.staged_realtime_lsp_max_concurrent == 4
|
||||
assert config.staged_realtime_lsp_warmup_s == 0.25
|
||||
assert config.staged_realtime_lsp_resolve_symbols is True
|
||||
|
||||
|
||||
def test_staged_env_overrides_prefixed_wins(temp_config_dir: Path) -> None:
|
||||
config = Config(data_dir=temp_config_dir)
|
||||
|
||||
env_path = temp_config_dir / ".env"
|
||||
env_path.write_text(
|
||||
"\n".join(
|
||||
[
|
||||
"STAGED_CLUSTERING_STRATEGY=score",
|
||||
"CODEXLENS_STAGED_CLUSTERING_STRATEGY=path",
|
||||
"STAGED_STAGE2_MODE=precomputed",
|
||||
"CODEXLENS_STAGED_STAGE2_MODE=realtime",
|
||||
"",
|
||||
]
|
||||
),
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
config.load_settings()
|
||||
|
||||
assert config.staged_clustering_strategy == "path"
|
||||
assert config.staged_stage2_mode == "realtime"
|
||||
|
||||
|
||||
def test_staged_env_overrides_invalid_ignored(temp_config_dir: Path) -> None:
|
||||
config = Config(data_dir=temp_config_dir)
|
||||
|
||||
env_path = temp_config_dir / ".env"
|
||||
env_path.write_text(
|
||||
"\n".join(
|
||||
[
|
||||
"STAGED_STAGE2_MODE=bogus",
|
||||
"STAGED_CLUSTERING_STRATEGY=embedding_remote",
|
||||
"STAGED_REALTIME_LSP_TIMEOUT_S=nope",
|
||||
"CASCADE_STRATEGY=???",
|
||||
"",
|
||||
]
|
||||
),
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
config.load_settings()
|
||||
|
||||
assert config.cascade_strategy == "binary"
|
||||
assert config.staged_stage2_mode == "precomputed"
|
||||
assert config.staged_clustering_strategy == "auto"
|
||||
assert config.staged_realtime_lsp_timeout_s == 30.0
|
||||
Reference in New Issue
Block a user