Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion agent/burr_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -1206,7 +1206,7 @@ def respond(state: State) -> State:


@action(
reads=["service_name"],
reads=["service_name", "component_filter"],
writes=[
"components",
"depth_order",
Expand All @@ -1228,10 +1228,13 @@ def read_discovery(state: State, __tracer: "TracerFactory") -> State:
- /tmp/{service_name}/dependency_graphs/analysis_order.json

Populates state with components and depth ordering for analysis.
If component_filter is set, only includes those components (plus
transitive deps) in the depth order.
"""
from pathlib import Path

service_name = state.get("service_name", "unknown")
component_filter = state.get("component_filter")
work_dir = Path(f"/tmp/{service_name}")
components_file = work_dir / "service_discovery" / "components.json"
analysis_order_file = work_dir / "dependency_graphs" / "analysis_order.json"
Expand Down Expand Up @@ -1266,6 +1269,20 @@ def read_discovery(state: State, __tracer: "TracerFactory") -> State:
total_components=sum(len(level) for level in depth_order),
)

# Apply component filter: prune depth_order to only include filtered components
if component_filter:
filtered_depth_order = []
for level in depth_order:
filtered_level = [name for name in level if name in component_filter]
if filtered_level:
filtered_depth_order.append(filtered_level)
depth_order = filtered_depth_order
logger.info(
"Component filter active: %d components across %d depth levels",
sum(len(l) for l in depth_order),
len(depth_order),
)

# Build component lookup by name
component_map = {c["name"]: c for c in components}

Expand Down Expand Up @@ -1717,6 +1734,7 @@ def analysis_respond(state: State) -> State:
def build_analysis_pipeline(
service_name: str,
project_name: str = "flashlight-analysis",
component_filter: set[str] | None = None,
) -> Application:
"""Build the analysis pipeline for headless codebase analysis.

Expand All @@ -1732,6 +1750,8 @@ def build_analysis_pipeline(
Args:
service_name: Name of the service being analyzed (for /tmp/{service_name}/)
project_name: Project name for Burr tracking UI
component_filter: If set, only these components will be analyzed.
The filter is passed to read_discovery which prunes the depth order.

Returns:
Compiled Burr Application
Expand Down Expand Up @@ -1769,6 +1789,7 @@ def receive_analysis_input(state: State, task: str) -> State:
service_name=service_name,
synthesis_result="",
final_response="",
component_filter=component_filter,
)
.with_tracker(project=project_name)
.build()
Expand Down
Loading
Loading