Repository navigation
feat(api,web): introduce Connect-RPC and chunked .khi file import workflow - #891
Merged
Merged
Conversation
…c service feat(api): Added workbench API
kyasbal
requested review from
K53,
RyuSA,
jyane,
kkuchima and
renamoo
as code owners
August 19, 2026 08:32
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces a new chunked file import mechanism for inspection files, including a new Connect-RPC service, backend session management with automatic cleanup, and a corresponding frontend client service. The changes also include necessary updates to build and lint configurations, as well as new utility functions for path resolution. I have reviewed the feedback provided and kept all comments as they offer actionable improvements for code robustness and style consistency.
…lute import paths in specs
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
Introduces Connect-RPC (proto-based RPC framework) to KHI and implements
ImportInspectionServicefor chunked.khiinspection file uploads and imports across backend and frontend.Also includes refactored API
basePathresolution utilities and a bug fix preventingNaNdivision in progress metadata when handling imported inspections.Key Changes
1. Proto Management & Connect-RPC Integration
buf.gen.yamland Makefile for Connect-RPC code generation for both Go (connect-go) and Web (@connectrpc/connect-web).RegisterConnectServiceHandlerto mount Connect-RPC handlers on Gin while transparently stripping subpath prefixes (basePath).2. Frontend API Base Path Resolution Refactoring
APIPathUtil.resolveApiPathto unify path resolution across relative paths, absolute paths, and custom base paths for both REST and Connect-RPC endpoints.3. Backend: Chunked Inspection File Import Service
proto/api/v1/import_inspection.proto):StartImportInspection: Initializes an upload session, generates an upload token, and returns recommended chunk size.UploadInspectionChunk: Handles binary chunk uploads with offset validation.CompleteImportInspection: Validates complete byte range coverage, extracts KHI v6 binary metadata, and registers the imported inspection intoInspectionTaskServer.AbortImportInspection: Cleans up abandoned sessions and temporary files.ImportSessionManager:WriteAtprotected by mutex).SessionCleanerto automatically purge expired sessions.khi.default/import-inspection):ImportInspectionInitializerto the DAG initialization pipeline to register Connect-RPC routes during server boot.ImportedInspectionRunner:.khifiles as pre-computed completed results inInspectionTaskServer, keeping full compatibility with task listing and existing result download endpoints.4. Frontend: Parallel Chunk Upload & UI Integration
ImportInspectionClientService:@connectrpc/connect-webwith parallel worker pool (maxConcurrency, default: 4) for high-speed chunk uploads.AbortControllerand remote session abortion on failure.InspectionDataLoaderService& Startup Dialog:NaN) Fix:Progress.updateTotalTaskProgress()generating0 / 0 = NaNwhentotalTaskCountis 0 (as in pre-computed imported inspections), which causedjson.MarshalonGET /api/v3/inspectionto fail with HTTP 500.Included Revisions
wpmvzvov:feat(api): introduce proto-based API management with Connect-RPCwvqrvvyl:feat(api): add a common utility function to register a new connect rpc serviceryptzyqy:Refactored API base path management logicqtyknlqz:feat(api): add ImportInspectionService for chunked inspection file upload and importxzwqxqou:feat(web): implement ImportInspectionClientService and update data loaderttuvsqzn:fix(core): prevent NaN percentage when total task count is zero on imported inspectionsVerification
make test-go: All tests passing (including table-driven unit tests forImportSessionManager,ValidateAndExtractMetadata,ImportInspectionInitializer, andProgressMetadata).make lint-go: 0 issues.make format-go: Formatted.make test-web: 741 / 741 tests passing (ImportInspectionClientService,APIPathUtil,InspectionDataLoaderService, etc.).make lint-web: 0 issues.make build-storybook: Build successful.make pre-commit: All pre-commit checks passed.