Repository navigation
feat(mcp): align summary section routing and record per-query log counts - #1194
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors the task summary section resolution to support multi-feature fan-out and properly handle boundaries like fan-in tasks. Specifically, the destination struct now tracks a slice of featureIDs instead of a single ID, allowing queries, properties, and markdown to propagate to all reachable features. Additionally, the task graph resolver has been updated to propagate and preserve dependency scopes on task edges, and structured log fetching now records log counts individually for split queries. Extensive test coverage has been added or updated to reflect these changes. There are no review comments, so no feedback is provided.
| wantLogsString []string | ||
| wantSummaryQueries []summary.Query | ||
| wantError error |
There was a problem hiding this comment.
There was a problem hiding this comment.
Fixed in 789a6b7: unified the split want* fields and in-loop summary.Snapshot construction into single whole-struct want outcome fields in both TestStructuredListLogEntriesTask_Run_FetchLogs and TestDefineStructuredListLogEntriesTask.
| @@ -155,7 +155,7 @@ func TestResolveGraph_OptionalDependencies(t *testing.T) { | |||
| initialTasks []UntypedTask | |||
| availableTasks []UntypedTask | |||
| wantTaskIDs []string | |||
There was a problem hiding this comment.
There was a problem hiding this comment.
Fixed in 789a6b7: unified wantTaskIDs and wantEdges into a single want resolvedGraph outcome struct in both TestResolveGraph_OptionalDependencies and TestResolveGraph_PointToPointScopeActiveFeatures.
60d5e69
Fixes #1120
Background
Inspection summaries exposed via
khi://inspections/{id}group recorded queries, properties, and task observations into Feature sections,Common Properties, andShared & Filter Contextby walking the resolved task DAG. Previously, two gaps caused inaccurate routing and log counts:Usedependencies from optional (UseOptional) or fan-in (UseTag) dependencies, and without stopping atFormTaskor fan-in inventory aggregator boundaries. As a result, shared inventory tasks, ungated discovery tasks, form helpers, and optionally referenced tasks could be pulled into a downstream Feature section. In addition, when an upstream helper was genuinely required by multiple Features,findNearestFeaturepicked only a single Feature by hop distance and displayorder, making each Feature section's contents depend on which other Features happened to be enabled.DefineStructuredListLogEntriesTaskexecuted multiple splitStructuredLogQueryfilters (for example,GCE Serial Port Logsacross large node sets), every sub-query reused the sametaskIDkey insummary.RecordQuery, overwriting earlier queries and attaching the merged log total to the final query only.Approach
TaskEdgenow retains the resolvedDependencyScope(taking the strongest scope when duplicate edges between the same pair of tasks are merged) so downstream graph consumers can distinguish mandatory point-to-point dependencies (CardinalityPointToPointwithScopeAll) directly from DAG metadata without summary-specific task labels.FeatureTask,FormTask, and fan-in aggregator tasks (tasks declaringCardinalityFanIninputs, such asDefineInventoryTask) are classified as section boundaries whose outgoing edges do not propagate Feature ownership downstream.ScopeAll) edges starting from a task's feature gate (WithFeatureGate) if present, or the task itself otherwise, and collects all reachableFeatureTasks.Shared & Filter Context.DefineStructuredListLogEntriesTaskexecutions now key summary entries with zero-padded per-query IDs (<taskID>#<04d>) while keeping single-query IDs and Web UIQueryMetadataunchanged, recording each sub-query's fetched log count individually before k-way merging.UI / Output Changes
Multi-query log tasks in
khi://inspections/{id}now preserve every split query in execution order with its individual fetched log count instead of collapsing into the last sub-query:Alternatives Considered
Shared & Filter Contextvs. nearest-hop tie-breaking: Breaking ties by hop distance or Feature displayorderhides required upstream queries/observations from all but one Feature, whereas moving them toShared & Filter Contextcauses a task to jump between Feature and Shared sections depending on whether a second Feature is enabled. Fanning writes out to every reachable Feature keeps each Feature section deterministic and self-contained while reservingShared & Filter Contextstrictly for cross-feature fan-in aggregators and feature-independent tasks.