Add integration verification and validation phases, role templates, and static graph tests

- Implement Phase 4: Integration Verification to ensure skill package consistency.
- Implement Phase 5: Validation to verify quality and deliver the final skill package.
- Create role-template.md for generating per-role execution detail files.
- Create skill-router-template.md for generating SKILL.md with role-based routing.
- Add tests for static graph relationship writing during index build in test_static_graph_integration.py.
This commit is contained in:
catlog22
2026-02-13 12:35:31 +08:00
parent 6054a01b8f
commit a512564b5a
14 changed files with 2897 additions and 51 deletions

View File

@@ -145,7 +145,7 @@ class Config:
# Staged cascade search configuration (4-stage pipeline)
staged_coarse_k: int = 200 # Number of coarse candidates from Stage 1 binary search
staged_lsp_depth: int = 2 # LSP relationship expansion depth in Stage 2
staged_stage2_mode: str = "precomputed" # "precomputed" (graph_neighbors) | "realtime" (LSP)
staged_stage2_mode: str = "precomputed" # "precomputed" (graph_neighbors) | "realtime" (LSP) | "static_global_graph" (global_relationships)
# Static graph configuration (write relationships to global index during build)
static_graph_enabled: bool = False
@@ -627,7 +627,7 @@ class Config:
staged_stage2_mode = get_env("STAGED_STAGE2_MODE")
if staged_stage2_mode:
mode = staged_stage2_mode.strip().lower()
if mode in {"precomputed", "realtime"}:
if mode in {"precomputed", "realtime", "static_global_graph"}:
self.staged_stage2_mode = mode
log.debug("Overriding staged_stage2_mode from .env: %s", self.staged_stage2_mode)
elif mode in {"live"}:

View File

@@ -1293,6 +1293,9 @@ class ChainSearchEngine:
query=query,
)
if mode == "static_global_graph":
return self._stage2_static_global_graph_expand(coarse_results, index_root=index_root)
return self._stage2_precomputed_graph_expand(coarse_results, index_root=index_root)
except ImportError as exc:
@@ -1343,6 +1346,50 @@ class ChainSearchEngine:
return self._combine_stage2_results(coarse_results, related_results)
def _stage2_static_global_graph_expand(
self,
coarse_results: List[SearchResult],
*,
index_root: Path,
) -> List[SearchResult]:
"""Stage 2 (static_global_graph): expand using GlobalGraphExpander over global_relationships."""
from codexlens.search.global_graph_expander import GlobalGraphExpander
global_db_path = index_root / GlobalSymbolIndex.DEFAULT_DB_NAME
if not global_db_path.exists():
self.logger.debug("Global symbol DB not found at %s, skipping static graph expansion", global_db_path)
return coarse_results
project_id = 1
try:
for p in self.registry.list_projects():
if p.index_root.resolve() == index_root.resolve():
project_id = p.id
break
except Exception:
pass
global_index = GlobalSymbolIndex(global_db_path, project_id=project_id)
global_index.initialize()
try:
expander = GlobalGraphExpander(global_index, config=self._config)
related_results = expander.expand(
coarse_results,
top_n=min(10, len(coarse_results)),
max_related=50,
)
if related_results:
self.logger.debug(
"Stage 2 (static_global_graph) expanded %d base results to %d related symbols",
len(coarse_results), len(related_results),
)
return self._combine_stage2_results(coarse_results, related_results)
finally:
global_index.close()
def _stage2_realtime_lsp_expand(
self,
coarse_results: List[SearchResult],