Skip to content

Add styledata proto definition and corresponding type definitions#533

Draft
kyasbal wants to merge 5 commits intoGoogleCloudPlatform:mainfrom
kyasbal:epic/proto-add-styledata
Draft

Add styledata proto definition and corresponding type definitions#533
kyasbal wants to merge 5 commits intoGoogleCloudPlatform:mainfrom
kyasbal:epic/proto-add-styledata

Conversation

@kyasbal
Copy link
Member

@kyasbal kyasbal commented Mar 2, 2026

This PR defines a proto type definition used for conveying style information in the new file format.

The most of changes included in this change is the generated code file from proto and variable definitions matching with the current values defined under pkg/enum.

@kyasbal kyasbal force-pushed the epic/proto-add-styledata branch from 6dcaa48 to 4e06832 Compare March 2, 2026 07:38
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a new styledata protobuf definition to standardize the representation of styling information for logs, timelines, and revision states within the application. This change centralizes visual configurations, allowing the frontend to render data consistently without hardcoding specific styles. It also updates the build process to generate corresponding Go and TypeScript types and integrates these new style definitions into the core inspection task registry and various task packages.

Highlights

  • New Proto Definition for Style Data: Introduced a new protobuf definition, styledata.proto, to standardize the representation of styling information for logs, timelines, and revision states across the application.
  • Automated Type Generation: Configured buf to automatically generate Go and TypeScript type definitions from the new styledata.proto, ensuring consistency between backend and frontend.
  • Centralized Style Management: Integrated the new style data types (Severity, Verb, LogType, RevisionState, TimelineType) into the core InspectionTaskRegistry, allowing for centralized management and registration of visual configurations.
  • Enhanced Test Cleanup: Added a Dispose method to the InspectionTaskServer and integrated it into test functions to ensure proper cleanup and reset of registered style data, improving test reliability.
  • Expanded Styling Contracts: Created dedicated contract files across various inspection task packages to define specific LogType, RevisionState, and TimelineType instances using the new proto-defined structures, enriching the application's visual customization capabilities.
Changelog
  • buf.gen.yaml
    • Added configuration for Go and TypeScript proto generation.
  • buf.yaml
    • Added configuration for buf linter and breaking change detection.
  • package-lock.json
    • Updated dependencies to include @bufbuild/buf, @bufbuild/protobuf, @bufbuild/protoc-gen-es, @bufbuild/protoplugin, and typescript.
  • package.json
    • Added @bufbuild/protoc-gen-es, @bufbuild/buf, and @bufbuild/protobuf dependencies.
  • pkg/core/init/default/defaultextension.go
    • Added Dispose call to BeforeTerminate method.
  • pkg/core/inspection/registry.go
    • Extended InspectionTaskRegistry interface with methods to add Severity, Verb, LogType, RevisionState, and TimelineType.
  • pkg/core/inspection/server.go
    • Imported khifilev4 proto, added fields to InspectionTaskServer for storing style data, initialized these fields, implemented AddSeverity, AddVerb, AddLogType, AddRevisionState, AddTimelineType, GetStyleData methods, and added a Dispose method to reset IDs.
  • pkg/generated/proto/khifile/v4/styledata.ext.go
    • Added utility functions MustHDRColor4FromHex and HDRColor4FromHex for HDRColor4 proto type.
  • pkg/generated/proto/khifile/v4/styledata.ext_test.go
    • Added unit tests for HDRColor4FromHex and MustHDRColor4FromHex functions.
  • pkg/generated/proto/khifile/v4/styledata.pb.go
    • Added generated Go protobuf code for HDRColor4, Severity, Verb, LogType, RevisionStateStyle, RevisionState, TimelineType, and StyleData.
  • pkg/server/server_test.go
    • Added defer inspectionServer.Dispose() calls in test functions for proper cleanup.
  • pkg/task/inspection/commonlogk8sauditv2/contract/log_type.go
    • Added LogTypeEvent and LogTypeAudit definitions using khifilev4.LogType.
  • pkg/task/inspection/commonlogk8sauditv2/contract/revision_state.go
    • Added various Kubernetes-related RevisionState definitions using khifilev4.RevisionState.
  • pkg/task/inspection/commonlogk8sauditv2/contract/timeline_type.go
    • Added various Kubernetes-related TimelineType definitions using khifilev4.TimelineType.
  • pkg/task/inspection/commonlogk8sauditv2/impl/registration.go
    • Updated Register function to add LogTypes, RevisionStates, and TimelineTypes to the registry.
  • pkg/task/inspection/googlecloudclustercomposer/contract/log_type.go
    • Added LogTypeComposerEnvironment definition.
  • pkg/task/inspection/googlecloudclustercomposer/contract/revision_state.go
    • Added various Composer-related RevisionState definitions.
  • pkg/task/inspection/googlecloudclustercomposer/contract/timeline_type.go
    • Added TimelineTypeAirflowTaskInstance definition.
  • pkg/task/inspection/googlecloudclustercomposer/impl/registration.go
    • Updated Register function to add LogTypes, RevisionStates, and TimelineTypes to the registry.
  • pkg/task/inspection/googlecloudcommon/contract/styledata.go
    • Added RevisionStateInferred, RevisionStateExisting, and RevisionStateDeleted definitions.
  • pkg/task/inspection/googlecloudcommon/contract/timeline_type.go
    • Added TimelineTypeOperation definition.
  • pkg/task/inspection/googlecloudcommon/impl/registration.go
    • Updated Register function to add TimelineTypes to the registry.
  • pkg/task/inspection/googlecloudk8scommon/contract/timeline_type.go
    • Added TimelineTypeNetworkEndpointGroup definition.
  • pkg/task/inspection/googlecloudk8scommon/impl/registration.go
    • Updated Register function to add TimelineTypes to the registry.
  • pkg/task/inspection/googlecloudlogcomputeapiaudit/contract/log_type.go
    • Added LogTypeComputeApi definition.
  • pkg/task/inspection/googlecloudlogcomputeapiaudit/impl/registration.go
    • Updated Register function to add LogTypes to the registry.
  • pkg/task/inspection/googlecloudlogcsm/contract/log_type.go
    • Added LogTypeCSMAccessLog definition.
  • pkg/task/inspection/googlecloudlogcsm/contract/timeline_type.go
    • Added TimelineTypeCSMAccessLog definition.
  • pkg/task/inspection/googlecloudlogcsm/impl/registration.go
    • Updated Register function to add LogTypes and TimelineTypes to the registry.
  • pkg/task/inspection/googlecloudloggkeapiaudit/contract/log_type.go
    • Added LogTypeGkeAudit definition.
  • pkg/task/inspection/googlecloudloggkeapiaudit/impl/registration.go
    • Updated Register function to add LogTypes to the registry.
  • pkg/task/inspection/googlecloudloggkeautoscaler/contract/log_type.go
    • Added LogTypeAutoscaler definition.
  • pkg/task/inspection/googlecloudloggkeautoscaler/contract/revision_state.go
    • Added RevisionAutoscalerNoError and RevisionAutoscalerHasErrors definitions.
  • pkg/task/inspection/googlecloudloggkeautoscaler/contract/timeline_type.go
    • Added TimelineTypeManagedInstanceGroup definition.
  • pkg/task/inspection/googlecloudloggkeautoscaler/impl/registration.go
    • Updated Register function to add LogTypes, RevisionStates, and TimelineTypes to the registry.
  • pkg/task/inspection/googlecloudlogk8saudit/impl/registration.go
    • Updated comment for Register function.
  • pkg/task/inspection/googlecloudlogk8scontainer/contract/log_type.go
    • Added LogTypeContainer definition.
  • pkg/task/inspection/googlecloudlogk8scontainer/impl/registration.go
    • Updated Register function to add LogTypes to the registry.
  • pkg/task/inspection/googlecloudlogk8scontrolplane/contract/log_type.go
    • Added LogTypeControlPlaneComponent definition.
  • pkg/task/inspection/googlecloudlogk8scontrolplane/contract/timeline_type.go
    • Added TimelineTypeControlPlaneComponent definition.
  • pkg/task/inspection/googlecloudlogk8scontrolplane/impl/registration.go
    • Updated Register function to add LogTypes and TimelineTypes to the registry.
  • pkg/task/inspection/googlecloudlogk8snode/contract/log_type.go
    • Added LogTypeNode definition.
  • pkg/task/inspection/googlecloudlogk8snode/contract/timeline_type.go
    • Added TimelineTypeNodeComponent definition.
  • pkg/task/inspection/googlecloudlogk8snode/impl/registration.go
    • Updated Register function to add LogTypes and TimelineTypes to the registry.
  • pkg/task/inspection/googlecloudlogmulticloudapiaudit/contract/log_type.go
    • Added LogTypeMulticloudAPI definition.
  • pkg/task/inspection/googlecloudlogmulticloudapiaudit/impl/registration.go
    • Updated Register function to add LogTypes to the registry.
  • pkg/task/inspection/googlecloudlognetworkapiaudit/contract/log_type.go
    • Added LogTypeNetworkAPI definition.
  • pkg/task/inspection/googlecloudlognetworkapiaudit/impl/registration.go
    • Updated Register function to add LogTypes to the registry.
  • pkg/task/inspection/googlecloudlogonpremapiaudit/contract/log_type.go
    • Added LogTypeOnPremAPI definition.
  • pkg/task/inspection/googlecloudlogonpremapiaudit/impl/registration.go
    • Updated Register function to add LogTypes to the registry.
  • pkg/task/inspection/googlecloudlogserialport/contract/log_type.go
    • Added LogTypeSerialPort definition.
  • pkg/task/inspection/googlecloudlogserialport/contract/timeline_type.go
    • Added TimelineTypeSerialPort definition.
  • pkg/task/inspection/googlecloudlogserialport/impl/registration.go
    • Updated Register function to add LogTypes and TimelineTypes to the registry.
  • pkg/task/inspection/inspectioncore/contract/log_type.go
    • Added LogTypeUnknown definition.
  • pkg/task/inspection/inspectioncore/contract/revision_state.go
    • Added various generic RevisionState definitions.
  • pkg/task/inspection/inspectioncore/contract/severity.go
    • Added standard Severity definitions (Unknown, Info, Warning, Error, Fatal).
  • pkg/task/inspection/inspectioncore/contract/timeline_type.go
    • Added TimelineTypeResource definition.
  • pkg/task/inspection/inspectioncore/contract/verb.go
    • Added standard Verb definitions (Nil, Create, Update, Patch, Delete, DeleteCollection).
  • pkg/task/inspection/inspectioncore/impl/registration.go
    • Modified Register function to accept a new interface registryWithStyleData and register all standard Severity, Verb, LogType, RevisionState, and TimelineType definitions.
  • proto/khifile/v4/styledata.proto
    • Added new protobuf definition for HDRColor4, Severity, Verb, LogType, RevisionStateStyle, RevisionState, TimelineType, and StyleData.
  • web/.eslintrc.json
    • Updated ignorePatterns to exclude generated TypeScript files.
  • web/src/app/generated/proto/khifile/v4/styledata.ts
    • Added generated TypeScript protobuf code for RevisionStateStyle, HDRColor4, Severity, Verb, LogType, RevisionState, TimelineType, and StyleData.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

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

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 introduces a protobuf definition for StyleData to centralize styling information, moving it out of the Go code. This is a significant and positive refactoring for maintainability. The changes include adding the proto file, buf configuration for code generation, generated Go and TypeScript files, and updating the task registration mechanism to handle the new style data types. My review focuses on the new implementation details. I've found some opportunities to reduce code duplication. Overall, this is a well-structured change.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant