Repository navigation
fix(csm): return structured.Node from TrackAndGetManifest to fix ResourceBody intern error - #943
Merged
Conversation
…urceBody intern error In the CSM Traffic Director parser, ResourceBody was wrapped in structured.NewStandardScalarNode(manifest) using a YAML string returned by TrackAndGetManifest. When TimelineChangeSet.Flush was executed, ToInternedStruct failed with "expected map node, got 1" because it expects MapNodeType. This change modifies GCPOperationTracker.TrackAndGetManifest to return (structured.Node, bool) directly from audit.Response or audit.Request, assigns manifestNode directly to StagingRevision.ResourceBody, and updates unit tests to verify that ResourceBody can be interned without error.
kyasbal
requested review from
K53,
RyuSA,
jyane,
kkuchima and
renamoo
as code owners
September 2, 2026 09:15
Contributor
There was a problem hiding this comment.
Code Review
This pull request refactors TrackAndGetManifest in GCPOperationTracker to return a structured.Node instead of a string, updating its usage and corresponding tests across the codebase. Feedback suggests adding a defensive nil check for the audit parameter in TrackAndGetManifest to prevent potential nil pointer dereferences.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
When parsing CSM (Cloud Service Mesh) Traffic Director audit logs into timelines, an inspection failure occurred with the following error:
Root Cause
StagingRevision.ResourceBodystores resource tree structures as interned dictionary-compressed protobuf structures (InternedStruct) viakhifilev6.ToInternedStruct(node, pool).ToInternedStructstrictly requiresnode.Type() == structured.MapNodeType(value3).GCPOperationTracker.TrackAndGetManifestreturned the resource manifest as a YAML string (string).CSMTrafficDirectorLogToTimelineMapper.ProcessLogByGroup, this YAML string was wrapped intostructured.NewStandardScalarNode(manifest)(ScalarNodeType=1) before being assigned toStagingRevision.ResourceBody. WhenTimelineChangeSet.Flush()calledToInternedStruct, it threw a validation error expecting a MapNode instead of a ScalarNode.structured.NewStandardScalarNode(...)without callingFlush()orToInternedStruct(), which allowed this discrepancy to slip through.Changes
pkg/task/inspection/googlecloudcommon/contract/operation_tracker.go:TrackAndGetManifest(audit *GCPAuditLogFieldSet)signature to return(structured.Node, bool).structured.Nodefromaudit.Response.Nodeoraudit.Request.Node, while preserving deduplication comparison using YAML string representations.pkg/task/inspection/googlecloudlogcsm/impl/traffic_director_parser_task.go:manifestNodedirectly toStagingRevision.ResourceBodywithout wrapping it in a scalar node.structuredpackage import.TestGCPOperationTracker_TrackAndGetManifestinoperation_tracker_test.gocovering node extraction and deduplication.traffic_director_parser_task_test.goto expect the map nodereqNodeinwantMeshPathand addedcs.Flush(builder.TimelineAccumulator)verification to ensure serialization intoInternedStructsucceeds without errors.Test Plan
make build-gomake test-gomake lint-gomake format-gomake pre-commit