Repository navigation
feat: introduce Workbench service with backend CEL filtering and on-demand struct loading - #892
Merged
Merged
Conversation
feat(api): Added workbench API
…ter to BackendFilter
kyasbal
requested review from
K53,
RyuSA,
jyane,
kkuchima and
renamoo
as code owners
August 20, 2026 02:45
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces a new CEL-based validation service and a workbench management system to handle inspection datasets. It includes necessary dependency updates, server initialization logic, and new services for CEL query validation and workbench session handling. The reviewer provided actionable feedback regarding a potential integer wrap-around issue in severity comparisons, a race condition in the GetOrOpen method that could lead to redundant resource loading, and a recommendation to reuse existing utility methods for timeline path resolution instead of duplicating them.
…n IndexedTimeline
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.
Summary
This PR introduces the Workbench Service backend architecture and migrates data filtering, CEL query evaluation, and interned struct decoding from the browser frontend to the Go backend.
Background & Motivation
Previously, KHI parsed all interned structs and body buffers into the browser memory upon loading
.khifiles, and executed CEL-based timeline/log filtering within frontend Web Workers. For large inspection datasets, this resulted in excessive browser memory consumption (often leading to tab OOM crashes), slow initial load times, and duplicated CEL evaluation logic across Go and TypeScript.Solution Overview
ReadStructYAMLRPC only when a user selects a diff or log entry.QueryTimeline,QueryLog).CELValidationServiceRPC to perform real-time syntax and type validation for CEL queries.BackendFilterand debounced validation.Key Changes
1. In-Memory Session Management (
WorkbenchService)proto/api/v1/workbench.protoand Connect-RPC endpoints (OpenSession,CloseSession,HeartbeatSession,GetSessionStatus).SessionManager,Sweeper, andReaderinpkg/server/workbench/to track and cache loaded inspection datasets per client.DataLoaderServiceandWorkbenchClientService.2. Server-Side Struct YAML Decoding (
ReadStructYAML)ReadStructYAMLRPC endpoint to decode interned struct objects to YAML on demand.pkg/model/khifile/v6/intern.goto support decodingInternedStructdirectly to YAML/maps on the server.DiffSmartComponent,LogSmartComponent,DiffContentComponent, andLogContentComponentto load YAML asynchronously on selection.3. Server-Side CEL-Based Filtering Pipeline & Indexing
pkg/server/workbench/cel/:TimelineandLogmodels.pkg/server/workbench/index.gowith metadata indexing and trigram substring matching for high-performance log and timeline querying.FilterHierarchy,FilterTimelineCEL,FilterLogCEL) exposed throughQueryTimelineandQueryLogRPC methods.4. CEL Validation Service (
CELValidationService)proto/api/v1/cel_validation.protoandCELValidationServiceRPC to validate syntax and types of user-defined CEL queries without needing a client-side CEL parser.CELValidationClientServiceon the frontend with debounced validation and real-time error reporting in the toolbar UI.5. Frontend Refactoring & Memory Optimization
BackendFilter(web/src/app/store/domain/filter/backend-filter.ts) to synchronize filter parameters and query results with the backend.struct-decoder.ts) and body buffers, drastically reducing the browser memory footprint.web/src/app/worker/search/) and client-side CEL evaluation runtime (cel-env.ts,cel-filter.ts, etc.).TimelineToolbarSmartComponentto map both standard filter controls and advanced CEL text inputs toBackendFilter.Included Commits
feat(api): add WorkbenchService and in-memory session lifecyclefeat(workbench): add ReadStructYAML API to WorkbenchServiceReadStructYAMLRPC and backend YAML decoding logic.feat(workbench): implement CEL-based timeline and log filtering in backendfeat(web): switch diff and log viewing to on-demand struct YAML loadingrefactor(web): remove unused frontend struct deserialization and body buffersfeat(filter): introduce CELValidationService and migrate frontend filter to BackendFilterBackendFilter, and removed frontend search Web Workers and CEL evaluator.feat(filter): move CEL filter evaluation and validation to backendVerification
make lint-go && make lint-web