Repository navigation
feat(mcp): unify annotation string IDs, fix subtree highlights, and emit resolved evidence manifest - #1315
feat(mcp): unify annotation string IDs, fix subtree highlights, and emit resolved evidence manifest#1315kyasbal wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
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.
| 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, | ||
| }, | ||
| { |
There was a problem hiding this comment.
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
- 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').
Go Quality Report (
|
| 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 = anchorTimelineIDSimilar 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
…mit resolved evidence manifest
db6e060 to
c4f806b
Compare
Summary
Part 2/5 of the
render_timelinesvisual clarity, evidence manifest, andkhi-investigationskill stack.timelineIdandlogIdfields insiderender_timelinesannotations (Anchor,RevisionRef,ManifestExcerpt,LogExcerpt,RowHighlight) tostringacrosspkg/server/mcp/sceneso IDs matchsearch_timelines,search_logs, andget_timeline_logswithout cross-tool type mismatches.rowHighlightsincludeSubtreehandling so highlighting rendered descendant rows never re-introduces filtered-out descendants into the scene.## Resolved evidencetable directly inrender_timelinestool output (badge, kind, UTC time, resource path, KHI pointer, Cloud LogginginsertId, and summary) and returnsNO_TIMELINES_MATCHEDcleanly when zero timelines match.pkg/server/mcp/scene/*,workbench_render_test.go, andworkbench_render_evidence_test.go.Stack
fix(workbench): exempt KHI synthetic IDs, globs, and K8s refs in validate_report(main<-push-qylzxxkzxpry)feat(mcp): unify annotation string IDs, fix subtree highlights, and emit resolved evidence manifest(push-qylzxxkzxpry<-push-zxtpyqnnnxrr)fix(mcp): harden Chrome timeline renderer timeouts, pixel cap, and warm session reuse(push-zxtpyqnnnxrr<-push-yyqtuxrlvmvt)feat(web): improve static timeline export clarity, leader routing, and inspection caching(push-yyqtuxrlvmvt<-push-yowxrnppozmk)feat(skills): guide visual-first two-layer reporting in khi-investigation skill(push-yowxrnppozmk<-push-nywmlvytopkk)Verification
go test -race ./pkg/server/mcp/...�� PASSmake qa-fast-must QA_LANG=go— PASS (0 mustfix, 0 advisory, 0 skipped)make lint-go— PASS (0 issues)