Skip to content

feat(mcp): unify annotation string IDs, fix subtree highlights, and emit resolved evidence manifest - #1315

Open
kyasbal wants to merge 1 commit into
push-qylzxxkzxpryfrom
push-zxtpyqnnnxrr
Open

kyasbal wants to merge 1 commit into
push-qylzxxkzxpryfrom
push-zxtpyqnnnxrr

Conversation

@kyasbal

@kyasbal kyasbal commented Dec 1, 2026

Copy link
Copy Markdown
Member

Summary

Part 2/5 of the render_timelines visual clarity, evidence manifest, and khi-investigation skill stack.

  • Unifies timelineId and logId fields inside render_timelines annotations (Anchor, RevisionRef, ManifestExcerpt, LogExcerpt, RowHighlight) to string across pkg/server/mcp/scene so IDs match search_timelines, search_logs, and get_timeline_logs without cross-tool type mismatches.
  • Fixes rowHighlights includeSubtree handling so highlighting rendered descendant rows never re-introduces filtered-out descendants into the scene.
  • Emits a structured ## Resolved evidence table directly in render_timelines tool output (badge, kind, UTC time, resource path, KHI pointer, Cloud Logging insertId, and summary) and returns NO_TIMELINES_MATCHED cleanly when zero timelines match.
  • Expands unit and golden tests across pkg/server/mcp/scene/*, workbench_render_test.go, and workbench_render_evidence_test.go.

Stack

  1. fix(workbench): exempt KHI synthetic IDs, globs, and K8s refs in validate_report (main <- push-qylzxxkzxpry)
  2. This PR: feat(mcp): unify annotation string IDs, fix subtree highlights, and emit resolved evidence manifest (push-qylzxxkzxpry <- push-zxtpyqnnnxrr)
  3. fix(mcp): harden Chrome timeline renderer timeouts, pixel cap, and warm session reuse (push-zxtpyqnnnxrr <- push-yyqtuxrlvmvt)
  4. feat(web): improve static timeline export clarity, leader routing, and inspection caching (push-yyqtuxrlvmvt <- push-yowxrnppozmk)
  5. feat(skills): guide visual-first two-layer reporting in khi-investigation skill #1313: feat(skills): guide visual-first two-layer reporting in khi-investigation skill (push-yowxrnppozmk <- push-nywmlvytopkk)

Verification

  • go test -race ./pkg/server/mcp/... �� PASS
  • make qa-fast-must QA_LANG=go — PASS (0 mustfix, 0 advisory, 0 skipped)
  • make lint-go — PASS (0 issues)

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the MCP scene package to use string IDs instead of uint32 IDs for timelines and logs across annotations, anchors, and excerpts. It also introduces a resolved evidence table in the rendered timeline output, which chronologically lists markers and excerpts with their resource paths, KHI pointers, and Cloud Logging insert IDs. Additionally, the palette assignment logic is refactored into modular helper functions. The review feedback points out a compilation error in the new test file workbench_render_evidence_test.go due to a duplicate definition of the formatKHIPointer helper function, which is already defined in workbench_render.go within the same package.

Comment on lines +463 to +478
InsertID: "orig-excerpt-insert",
Label: "Log marker backfills timelineId and revisionIndex without overwriting excerpt metadata",
timeMs: baseTime.Add(12 * time.Minute).UnixMilli(),
isExcerpt: true,
},
{
Badge: "M1",
Kind: "marker",
UTCTime: "2026-10-01T09:13:00Z",
Resource: "-",
KHIPointer: "timelineId=15 / revisionIndex=0",
Label: "Revision marker does not merge with non-revision excerpt",
timeMs: baseTime.Add(13 * time.Minute).UnixMilli(),
isExcerpt: false,
},
{

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The helper function formatKHIPointer is already defined in pkg/server/mcp/workbench_render.go within the same package mcp. Defining it again here in workbench_render_evidence_test.go will cause a compilation error due to redeclaration of the function in the same package block. Please remove this duplicate definition.

References
  1. In Go, package-level variables and functions are shared across all files within the same package. Do not redeclare them in other files of the same package, as this will cause a compilation error ('redeclared in this block').
@github-actions

github-actions Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Go Quality Report (origin/push-qylzxxkzxpry) — ✅ PASS (0 blocking, 1 advisory finding(s))

Metric Result
Changed Scope 8 prod file(s), 10 test file(s), 46 unit(s)
Patch Coverage 97.8% (364/372 lines)
Mutation Score 100.0% (163/163 killed, 0 survived)
Function Similarity Advisory (1/26 new unit(s) matched across 3220 corpus units)

Quality Rule Violations

# Rule Status Value (Limit) Location Subject
[Q1] func_uncovered_lines ADVISORY 3 (<= 0) pkg/server/mcp/scene/anchor.go:145 resolveAnchor
[Q1] func_uncovered_lines — pkg/server/mcp/scene/anchor.go:145 (resolveAnchor)
  • Why: Substantive branches in touched functions were never executed by unit tests (boilerplate error guards are already excluded).
  • Fix: Add focused table-driven test cases covering the unexecuted branch, or delete unreachable production code.
  • Detail: 3 substantive uncovered line(s) across 2 span(s)
 144 | 		if anchorTimelineID != 0 {
 145 | 			if idx.TimelineMap[anchorTimelineID] == nil {
 146 | 				res, _, _ := timelineNotFoundResult(inspectionID, anchorTimelineID)
 149 | 			pt.timelineID = anchorTimelineID

Similar Existing Go Functions (Advisory)

New Unit Top Existing Candidate AST-Norm Score Action
sharesEvidenceAnchor (pkg/server/mcp/workbench_render.go:407) isSameMarkerExcerptAnchor (pkg/server/mcp/scene/resolver_excerpt_badge.go:177) 0.973 Similar logic exists in another module; extract a shared helper or verify intentional symmetry.

Commit: c4f806b2d8f0 · Cloud Build Logs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant