Skip to content

feat(inspection): migrate Inspection REST APIs to Connect-RPC and enable HTTP/2 support - #908

Merged
kyasbal merged 5 commits into
GoogleCloudPlatform:mainfrom
kyasbal:push-yvsowwwpqtvp
Aug 26, 2026
Merged

kyasbal merged 5 commits into
GoogleCloudPlatform:mainfrom
kyasbal:push-yvsowwwpqtvp

Conversation

@kyasbal

@kyasbal kyasbal commented Aug 26, 2026 •

Copy link
Copy Markdown
Member

Summary

This PR migrates all remaining inspection lifecycle and data endpoints (/api/v3/inspection/*) to Protobuf and Connect-RPC under api.v1.InspectionService, enables cleartext HTTP/2 (h2c) on the server listener using standard library net/http.Protocols, and cleans up legacy REST routes.

Background & Motivation

  1. Protocol Modernization: KHI has been migrating services to Connect-RPC (CELValidationService, ImportInspectionService, WorkbenchService, ServerStatusService). Migrating the core inspection APIs standardizes the entire backend/frontend communication on Connect-RPC with end-to-end compile-time type safety.
  2. Real-time Task Progress Streaming: Instead of polling /api/v3/inspection, InspectionService.WatchInspections provides server-side streaming with an immediate snapshot and periodic updates (closing every 30s for proxy/serverless environment resilience, matching frontend auto-reconnect semantics).
  3. HTTP/2 Support: With streaming APIs and high-volume data/chunk downloads, HTTP/2 multiplexing improves connection utilization and throughput over cleartext (h2c), configured via Go 1.24+ http.Protocols.
  4. Decoupled Asynchronous Task Lifecycle: Inspection execution context is decoupled from transient HTTP request completion via context.WithoutCancel, preventing accidental cancellation upon HTTP response delivery.

Key Changes

1. Protobuf (proto/api/v1/inspection.proto)

  • Defined InspectionService with the following RPCs:
    • GetInspectionTypes, GetInspections, WatchInspections (server streaming, 30s cycle)
    • CreateInspection, UpdateInspection
    • GetInspectionFeatures, UpdateInspectionFeatures
    • DryRunInspection, RunInspection, CancelInspection
    • GetInspectionMetadata, GetInspectionDataChunk
  • Generated Go and TypeScript bindings via make build-proto.

2. Backend (pkg/)

  • pkg/server/api/v1/inspection.go:
    • Implemented InspectionServiceServer handling all inspection RPCs.
    • Implemented data chunking via ResultStore.GetRangeReader.
    • Decoupled request context from background inspection task execution (context.WithoutCancel).
  • pkg/core/init/default/server_runner.go:
    • Configured HTTP/2 cleartext (h2c) support on http.Server.Protocols using native SetHTTP1(true) and SetUnencryptedHTTP2(true).
  • pkg/server/server.go:
    • Removed legacy REST routes under /api/v3/inspection/*.
    • Removed unused InspectionIndexer interface and IndexManager field from ServerConfig.
    • Renamed SetupKHIServerRoutes to SetupFrontendRoutes, removing the unused inspectionServer parameter.
    • Removed unused types in pkg/server/types.go.
  • Unit Tests:
    • Added comprehensive tests in pkg/server/api/v1/inspection_test.go and pkg/core/init/default/server_runner_test.go.
    • Updated pkg/server/server_test.go to remove obsolete REST tests while retaining route config validations.

3. Frontend (web/)

  • web/src/app/services/api/connect-client.service.ts:
    • Added inspectionClient: Client<typeof InspectionService>.
  • web/src/app/services/api/backend-sync.service.ts:
    • Migrated inspection type retrieval to getInspectionTypes.
    • Migrated tasks watching to watchInspections server streaming with automatic reconnection.
  • web/src/app/services/api/backend-api.service.ts:
    • Migrated inspection lifecycle methods (createInspection, runInspection, cancelInspection, dryRunInspection, etc.) to Connect-RPC.
    • Updated getInspectionData to use inspectionClient.getInspectionDataChunk with parallel chunk requests.
  • Updated frontend component & service unit tests.

Verification

  • Backend Tests: make test-go passed (all packages).
  • Backend Lint: make lint-go passed (0 issues).
  • Frontend Tests: make test-web passed (all 783 tests).
  • Frontend Lint: make lint-web passed (0 issues).
  • Pre-commit: make pre-commit passed.

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

Copy link
Copy Markdown
Contributor

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 migrates the legacy REST API endpoints to Connect-RPC (gRPC-Web/Connect protocol) for managing inspection lifecycles, configuration, and data retrieval. It introduces the new protobuf definitions, implements the Connect-RPC handlers on the backend, updates the Angular frontend to use the new streaming client, and removes the legacy REST endpoints. The review feedback highlights two important issues: a potential data race when directly mutating shared header metadata in UpdateInspection, and a lack of input validation on the offset parameter in GetInspectionDataChunk which could lead to out-of-bounds errors.

Comment thread pkg/server/api/v1/inspection.go Resolved
Comment thread pkg/server/api/v1/inspection.go Resolved
@kyasbal
kyasbal force-pushed the push-yvsowwwpqtvp branch 2 times, most recently from 9a1e76c to 6984aaf Compare August 26, 2026 06:14
@kyasbal

kyasbal commented Aug 26, 2026

Copy link
Copy Markdown
Member Author

/gemini review

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

Copy link
Copy Markdown
Contributor

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 refactors the backend API from REST to Connect-RPC, introducing the new InspectionService handler and updating both the Go server initialization and the Angular frontend to use the new RPC client. The review feedback highlights a critical issue where the COOP/COEP middleware was accidentally removed during refactoring, which could break SharedArrayBuffer functionality on the frontend. Additionally, it suggests removing a redundant context.WithoutCancel call in the inspection runner since context wrapping is already handled internally.

I am having trouble creating individual review comments. Click here to see my feedback.

pkg/server/server.go (67-76)

critical

This middleware, which sets Cross-Origin-Opener-Policy and Cross-Origin-Embedder-Policy headers, appears to have been removed during refactoring. The comment indicates these headers are required for SharedArrayBuffer functionality on the frontend. Removing them could break the application.

Please restore this middleware and ensure it's applied to the Gin engine, for example, within the new SetupFrontendMiddleware function.

pkg/server/api/v1/inspection.go (278-280)

medium

The context.WithoutCancel(ctx) call here is redundant. The task.Run method, which corresponds to (*coreinspection.InspectionTaskRunner).Run, already wraps its context with context.WithoutCancel internally. To avoid this redundancy and keep context management responsibility within the task runner, it's best to remove the wrapping here.

err := task.Run(ctx, &inspectioncore_contract.InspectionRequest{
		Values: values,
	})
@kyasbal
kyasbal force-pushed the push-yvsowwwpqtvp branch from 6984aaf to 4ad15c6 Compare August 26, 2026 07:00
@kyasbal
kyasbal merged commit 3ed86c2 into GoogleCloudPlatform:main Aug 26, 2026
16 checks passed
@kyasbal
kyasbal deleted the push-yvsowwwpqtvp branch August 26, 2026 07:12
pull Bot pushed a commit to TheTechOddBug/khi that referenced this pull request Sep 9, 2026
…to timezoneShiftHours (GoogleCloudPlatform#978)

Following the Connect-RPC migration (GoogleCloudPlatform#908), the timezone shift parameter
was updated in Protobuf and backend RPC handlers to timezoneShiftHours
(float64). However, TimeZoneShiftInputTask and the frontend InspectionClient
retained references to the legacy timezoneShift key, causing inspections
to always fall back to UTC time.

This change:
- Unifies the context key to TaskInputKeyTimezoneShiftHours in inspectioncore
- Updates TimeZoneShiftInputTask to read TaskInputKeyTimezoneShiftHours
- Updates backend-api.service.ts and its test to use timezoneShiftHours
- Updates parser_test.go to float64(9)
- Adds unit tests for TimeZoneShiftInputTask
kyasbal added a commit that referenced this pull request Sep 11, 2026
* chore(github): reorganize issue and PR label taxonomy (#971)

* chore(github): reorganize issue and PR label taxonomy

Reorganize GitHub issue and PR label system to improve discoverability,
triage ergonomics, and release automation alignment:
- Update .github/release.yml changelog categories to use new label names (type:feature, type:bug, type:perf, type:refactor, area:cicd, area:devenv, type:docs, type:chore).
- Configure .github/ISSUE_TEMPLATE/bug-report.md with default labels "type:bug, status:needs-triage".
- Configure .github/ISSUE_TEMPLATE/feature-request.md with default labels "type:feature, status:needs-triage".

* fix(github): separate maintenance and dependencies categories in release notes

* feat(k8sevent): replace resource UIDs with readable names in event summaries (#973)

* feat(k8sevent): replace resource UIDs with readable names in event summaries

- Add ResourceIdentity.SummaryTag() method to format resources as readable tags
- Replace matched resource UIDs in Kubernetes event messages with readable tags in both GKE and OSS log ingesters
- Map matched resource UIDs to corresponding resource timelines in ProcessLogByGroup
- Add HasEventCount assertion helper to TimelineChangeSetAsserter

* fix(review): address review comments on deduplicating formatEventSummary and HasEventCount

* docs(agent): clarify cmp.Diff usage and test assertion examples in go-coding-rule (#974)

* docs(agent): clarify cmp.Diff usage and test assertion examples in go-coding-rule

* fix(agent): address review comments on collections comparison in go-coding-rule

* feat(googlecloudk8scommon): default kind filter to all kinds except leases (#975)

* feat(timeline): allow inline editing of search filter chips on click (#977)

* feat(timeline): allow inline editing of search filter chips on click

Enable in-place editing of search filter chips in ChipSearchBarComponent
when clicked. Clicking a chip renders an inline text input with text
pre-selected and auto-focused. Changes can be committed with Enter or blur,
or cancelled with Escape. Delimiter splitting and whitespace removal are
supported.

* fix(review): address review comments on blur race condition and focus preservation

* fix(inspection): resolve timezone offset fallback to UTC by unifying to timezoneShiftHours (#978)

Following the Connect-RPC migration (#908), the timezone shift parameter
was updated in Protobuf and backend RPC handlers to timezoneShiftHours
(float64). However, TimeZoneShiftInputTask and the frontend InspectionClient
retained references to the legacy timezoneShift key, causing inspections
to always fall back to UTC time.

This change:
- Unifies the context key to TaskInputKeyTimezoneShiftHours in inspectioncore
- Updates TimeZoneShiftInputTask to read TaskInputKeyTimezoneShiftHours
- Updates backend-api.service.ts and its test to use timezoneShiftHours
- Updates parser_test.go to float64(9)
- Adds unit tests for TimeZoneShiftInputTask

* fix(k8saudit): preserve immutable identity metadata after truncated logs (#979)

* fix(k8saudit): preserve immutable identity metadata after truncated logs

When Kubernetes audit logs contain truncated responses (audit.k8s.io/truncated: "true"),
groupManifestGenerator reset prevRevisionReader to nil. Subsequent patch requests merged
into an empty map reader, causing metadata.uid to be lost. Later tasks interpreted the
missing UID as a new resource creation, incorrectly emitting a ChangeEventTypeCreation
event and overwriting the initial revision at creationTimestamp.

This commit updates manifest_generator_task to preserve immutable identity metadata
(apiVersion, kind, metadata.name, metadata.namespace, metadata.uid, metadata.creationTimestamp)
upon encountering truncated logs so that subsequent patches retain the resource identity.

* fix(k8saudit): return preserved immutable identity reader for truncated log body

When a log is truncated, groupManifestGenerator now returns the preserved immutable
identity reader as ResourceBodyReader rather than nil. This allows the truncated log
itself to retain its immutable identity metadata in the generated timeline revision,
preventing the resource body from appearing completely empty in the UI and downstream
tasks.

* feat(cicd): support manual tag and release draft generation via workflow_dispatch (#980)

* feat(cicd): support manual tag creation and release draft generation via workflow_dispatch

Add a workflow_dispatch trigger to .github/workflows/release.yaml, allowing
maintainers to initiate tag creation and release draft generation directly from
the GitHub Actions Web UI without local terminal operations.

- Accept a required tag_name input parameter (e.g., v1.2.3 or v1.2.3-beta-1)
- Validate tag format and verify uniqueness via git ls-remote before starting builds
- Create and push the Git tag after successful binary compilation
- Automatically generate release notes from categorised commit history

* fix(cicd): pass step outputs via env to prevent template injection

* refactor(inspection): remove legacy LabelKeyInspectionTypes and InspectionTypeLabel (#981)

Remove deprecated LabelKeyInspectionTypes, InspectionTypeLabel, and
legacy fallback logic from inspection runner. Update tests and
documentation to use InspectionTypeLabelSelector.

* feat(inspection): set default environment name in composer form (#982)

Add WithDefaultValueFunc to InputComposerEnvironmentNameTask so that
when Composer environments are fetched via autocomplete, the first
environment is automatically selected as the default value if no
previous selection was made.

---------

Co-authored-by: kept1994 <keigof@google.com>
kyasbal added a commit that referenced this pull request Sep 14, 2026
* chore(github): reorganize issue and PR label taxonomy (#971)

* chore(github): reorganize issue and PR label taxonomy

Reorganize GitHub issue and PR label system to improve discoverability,
triage ergonomics, and release automation alignment:
- Update .github/release.yml changelog categories to use new label names (type:feature, type:bug, type:perf, type:refactor, area:cicd, area:devenv, type:docs, type:chore).
- Configure .github/ISSUE_TEMPLATE/bug-report.md with default labels "type:bug, status:needs-triage".
- Configure .github/ISSUE_TEMPLATE/feature-request.md with default labels "type:feature, status:needs-triage".

* fix(github): separate maintenance and dependencies categories in release notes

* feat(k8sevent): replace resource UIDs with readable names in event summaries (#973)

* feat(k8sevent): replace resource UIDs with readable names in event summaries

- Add ResourceIdentity.SummaryTag() method to format resources as readable tags
- Replace matched resource UIDs in Kubernetes event messages with readable tags in both GKE and OSS log ingesters
- Map matched resource UIDs to corresponding resource timelines in ProcessLogByGroup
- Add HasEventCount assertion helper to TimelineChangeSetAsserter

* fix(review): address review comments on deduplicating formatEventSummary and HasEventCount

* docs(agent): clarify cmp.Diff usage and test assertion examples in go-coding-rule (#974)

* docs(agent): clarify cmp.Diff usage and test assertion examples in go-coding-rule

* fix(agent): address review comments on collections comparison in go-coding-rule

* feat(googlecloudk8scommon): default kind filter to all kinds except leases (#975)

* feat(timeline): allow inline editing of search filter chips on click (#977)

* feat(timeline): allow inline editing of search filter chips on click

Enable in-place editing of search filter chips in ChipSearchBarComponent
when clicked. Clicking a chip renders an inline text input with text
pre-selected and auto-focused. Changes can be committed with Enter or blur,
or cancelled with Escape. Delimiter splitting and whitespace removal are
supported.

* fix(review): address review comments on blur race condition and focus preservation

* fix(inspection): resolve timezone offset fallback to UTC by unifying to timezoneShiftHours (#978)

Following the Connect-RPC migration (#908), the timezone shift parameter
was updated in Protobuf and backend RPC handlers to timezoneShiftHours
(float64). However, TimeZoneShiftInputTask and the frontend InspectionClient
retained references to the legacy timezoneShift key, causing inspections
to always fall back to UTC time.

This change:
- Unifies the context key to TaskInputKeyTimezoneShiftHours in inspectioncore
- Updates TimeZoneShiftInputTask to read TaskInputKeyTimezoneShiftHours
- Updates backend-api.service.ts and its test to use timezoneShiftHours
- Updates parser_test.go to float64(9)
- Adds unit tests for TimeZoneShiftInputTask

* fix(k8saudit): preserve immutable identity metadata after truncated logs (#979)

* fix(k8saudit): preserve immutable identity metadata after truncated logs

When Kubernetes audit logs contain truncated responses (audit.k8s.io/truncated: "true"),
groupManifestGenerator reset prevRevisionReader to nil. Subsequent patch requests merged
into an empty map reader, causing metadata.uid to be lost. Later tasks interpreted the
missing UID as a new resource creation, incorrectly emitting a ChangeEventTypeCreation
event and overwriting the initial revision at creationTimestamp.

This commit updates manifest_generator_task to preserve immutable identity metadata
(apiVersion, kind, metadata.name, metadata.namespace, metadata.uid, metadata.creationTimestamp)
upon encountering truncated logs so that subsequent patches retain the resource identity.

* fix(k8saudit): return preserved immutable identity reader for truncated log body

When a log is truncated, groupManifestGenerator now returns the preserved immutable
identity reader as ResourceBodyReader rather than nil. This allows the truncated log
itself to retain its immutable identity metadata in the generated timeline revision,
preventing the resource body from appearing completely empty in the UI and downstream
tasks.

* feat(cicd): support manual tag and release draft generation via workflow_dispatch (#980)

* feat(cicd): support manual tag creation and release draft generation via workflow_dispatch

Add a workflow_dispatch trigger to .github/workflows/release.yaml, allowing
maintainers to initiate tag creation and release draft generation directly from
the GitHub Actions Web UI without local terminal operations.

- Accept a required tag_name input parameter (e.g., v1.2.3 or v1.2.3-beta-1)
- Validate tag format and verify uniqueness via git ls-remote before starting builds
- Create and push the Git tag after successful binary compilation
- Automatically generate release notes from categorised commit history

* fix(cicd): pass step outputs via env to prevent template injection

* refactor(inspection): remove legacy LabelKeyInspectionTypes and InspectionTypeLabel (#981)

Remove deprecated LabelKeyInspectionTypes, InspectionTypeLabel, and
legacy fallback logic from inspection runner. Update tests and
documentation to use InspectionTypeLabelSelector.

* feat(inspection): set default environment name in composer form (#982)

Add WithDefaultValueFunc to InputComposerEnvironmentNameTask so that
when Composer environments are fetched via autocomplete, the first
environment is automatically selected as the default value if no
previous selection was made.

* feat(dev): support configurable ports and hosts for multi-workspace and cloudtop (#983)

* feat(dev): support configurable ports and hosts for multi-workspace and cloudtop

Support configuring ports and hosts via environment variables for KHI development servers and test runners.

- Makefile: allow overriding WEB_HOST, WEB_PORT, BACKEND_HOST, BACKEND_PORT, STORYBOOK_HOST, STORYBOOK_PORT, and KARMA_PORT. Add --allowed-hosts flag automatically when WEB_HOST is 0.0.0.0.
- Angular proxy: forward to BACKEND_HOST and BACKEND_PORT, normalizing 0.0.0.0 to 127.0.0.1 for HTTP proxy target.
- Karma: configure port from KARMA_PORT, bind to 127.0.0.1, and set --remote-debugging-port=0 to avoid debugging port collisions in headless Chrome.

* fix(dev): update karma beginsPattern regex to match 127.0.0.1 in tasks.json

* feat(task): add task description label and WithTaskDescription option (#985)

* feat(task): add task description label and WithTaskDescription option

* chore: add license header to label_test.go

* refactor(task): simplify WithTaskDescription using WithLabelValue

* test(task): replace TestWithTaskDescription with TestWithLabelValue

---------

Co-authored-by: kept1994 <keigof@google.com>
kyasbal added a commit that referenced this pull request Sep 15, 2026
* chore(github): reorganize issue and PR label taxonomy (#971)

* chore(github): reorganize issue and PR label taxonomy

Reorganize GitHub issue and PR label system to improve discoverability,
triage ergonomics, and release automation alignment:
- Update .github/release.yml changelog categories to use new label names (type:feature, type:bug, type:perf, type:refactor, area:cicd, area:devenv, type:docs, type:chore).
- Configure .github/ISSUE_TEMPLATE/bug-report.md with default labels "type:bug, status:needs-triage".
- Configure .github/ISSUE_TEMPLATE/feature-request.md with default labels "type:feature, status:needs-triage".

* fix(github): separate maintenance and dependencies categories in release notes

* feat(k8sevent): replace resource UIDs with readable names in event summaries (#973)

* feat(k8sevent): replace resource UIDs with readable names in event summaries

- Add ResourceIdentity.SummaryTag() method to format resources as readable tags
- Replace matched resource UIDs in Kubernetes event messages with readable tags in both GKE and OSS log ingesters
- Map matched resource UIDs to corresponding resource timelines in ProcessLogByGroup
- Add HasEventCount assertion helper to TimelineChangeSetAsserter

* fix(review): address review comments on deduplicating formatEventSummary and HasEventCount

* docs(agent): clarify cmp.Diff usage and test assertion examples in go-coding-rule (#974)

* docs(agent): clarify cmp.Diff usage and test assertion examples in go-coding-rule

* fix(agent): address review comments on collections comparison in go-coding-rule

* feat(googlecloudk8scommon): default kind filter to all kinds except leases (#975)

* feat(timeline): allow inline editing of search filter chips on click (#977)

* feat(timeline): allow inline editing of search filter chips on click

Enable in-place editing of search filter chips in ChipSearchBarComponent
when clicked. Clicking a chip renders an inline text input with text
pre-selected and auto-focused. Changes can be committed with Enter or blur,
or cancelled with Escape. Delimiter splitting and whitespace removal are
supported.

* fix(review): address review comments on blur race condition and focus preservation

* fix(inspection): resolve timezone offset fallback to UTC by unifying to timezoneShiftHours (#978)

Following the Connect-RPC migration (#908), the timezone shift parameter
was updated in Protobuf and backend RPC handlers to timezoneShiftHours
(float64). However, TimeZoneShiftInputTask and the frontend InspectionClient
retained references to the legacy timezoneShift key, causing inspections
to always fall back to UTC time.

This change:
- Unifies the context key to TaskInputKeyTimezoneShiftHours in inspectioncore
- Updates TimeZoneShiftInputTask to read TaskInputKeyTimezoneShiftHours
- Updates backend-api.service.ts and its test to use timezoneShiftHours
- Updates parser_test.go to float64(9)
- Adds unit tests for TimeZoneShiftInputTask

* fix(k8saudit): preserve immutable identity metadata after truncated logs (#979)

* fix(k8saudit): preserve immutable identity metadata after truncated logs

When Kubernetes audit logs contain truncated responses (audit.k8s.io/truncated: "true"),
groupManifestGenerator reset prevRevisionReader to nil. Subsequent patch requests merged
into an empty map reader, causing metadata.uid to be lost. Later tasks interpreted the
missing UID as a new resource creation, incorrectly emitting a ChangeEventTypeCreation
event and overwriting the initial revision at creationTimestamp.

This commit updates manifest_generator_task to preserve immutable identity metadata
(apiVersion, kind, metadata.name, metadata.namespace, metadata.uid, metadata.creationTimestamp)
upon encountering truncated logs so that subsequent patches retain the resource identity.

* fix(k8saudit): return preserved immutable identity reader for truncated log body

When a log is truncated, groupManifestGenerator now returns the preserved immutable
identity reader as ResourceBodyReader rather than nil. This allows the truncated log
itself to retain its immutable identity metadata in the generated timeline revision,
preventing the resource body from appearing completely empty in the UI and downstream
tasks.

* feat(cicd): support manual tag and release draft generation via workflow_dispatch (#980)

* feat(cicd): support manual tag creation and release draft generation via workflow_dispatch

Add a workflow_dispatch trigger to .github/workflows/release.yaml, allowing
maintainers to initiate tag creation and release draft generation directly from
the GitHub Actions Web UI without local terminal operations.

- Accept a required tag_name input parameter (e.g., v1.2.3 or v1.2.3-beta-1)
- Validate tag format and verify uniqueness via git ls-remote before starting builds
- Create and push the Git tag after successful binary compilation
- Automatically generate release notes from categorised commit history

* fix(cicd): pass step outputs via env to prevent template injection

* refactor(inspection): remove legacy LabelKeyInspectionTypes and InspectionTypeLabel (#981)

Remove deprecated LabelKeyInspectionTypes, InspectionTypeLabel, and
legacy fallback logic from inspection runner. Update tests and
documentation to use InspectionTypeLabelSelector.

* feat(inspection): set default environment name in composer form (#982)

Add WithDefaultValueFunc to InputComposerEnvironmentNameTask so that
when Composer environments are fetched via autocomplete, the first
environment is automatically selected as the default value if no
previous selection was made.

* feat(dev): support configurable ports and hosts for multi-workspace and cloudtop (#983)

* feat(dev): support configurable ports and hosts for multi-workspace and cloudtop

Support configuring ports and hosts via environment variables for KHI development servers and test runners.

- Makefile: allow overriding WEB_HOST, WEB_PORT, BACKEND_HOST, BACKEND_PORT, STORYBOOK_HOST, STORYBOOK_PORT, and KARMA_PORT. Add --allowed-hosts flag automatically when WEB_HOST is 0.0.0.0.
- Angular proxy: forward to BACKEND_HOST and BACKEND_PORT, normalizing 0.0.0.0 to 127.0.0.1 for HTTP proxy target.
- Karma: configure port from KARMA_PORT, bind to 127.0.0.1, and set --remote-debugging-port=0 to avoid debugging port collisions in headless Chrome.

* fix(dev): update karma beginsPattern regex to match 127.0.0.1 in tasks.json

* feat(task): add task description label and WithTaskDescription option (#985)

* feat(task): add task description label and WithTaskDescription option

* chore: add license header to label_test.go

* refactor(task): simplify WithTaskDescription using WithLabelValue

* test(task): replace TestWithTaskDescription with TestWithLabelValue

* feat(inspection): add checkbox form field type (#986)

* feat(inspection): add checkbox form field type

Add a checkbox form field type so inspection tasks can take boolean input
in the New Inspection dialog.

- proto: add CheckboxFormField with readonly and default_value, FormField.kind
  checkbox, and ParameterValue.checkbox_value.
- metadata: add CheckboxParameterFormField and its serialization.
- formtask: add CheckboxFormTaskBuilder that builds a Task[bool] on top of
  FormTaskBuilderBase[bool]. It is not generic because a checkbox only ever
  represents a boolean state.
- server: convert CheckboxParameterFormField to and from the proto messages.
- web: add CheckboxParameterComponent, register it in GroupParameterComponent,
  and convert the checkbox field and value in the inspection converter. The
  checkbox reuses the common label instead of holding its own text.

* fix(inspection): address review comments on validator, test mock, and add license headers

* refactor(inspection): remove redundant LogSorterTask and NewLogSorterByTimeTask (#988)

Remove NewLogSorterByTimeTask and its usages in commonlogk8saudit and
googlecloudclustercomposer. In KHI, all upstream log providers already
provide logs in chronological order, and filter/grouper tasks preserve
log order. The intermediate LogSorter performed redundant slice cloning
and sorting without functional necessity.

- Deleted NewLogSorterByTimeTask from pkg/core/inspection/taskbase
- Removed LogSorterTask and its registration from commonlogk8saudit
- Removed AirflowDagProcessorManagerLogSorterTask from googlecloudclustercomposer
- Rewired downstream grouper/ingester tasks directly to upstream filter tasks
- Updated pipeline documentation and Mermaid diagrams

* feat(commonlogk8saudit): add initial resource state provider contract and integrate with audit log pipeline (#990)

* feat(commonlogk8saudit): add initial resource state provider contract and integrate with audit log pipeline

Define the InitialResourceStateProvider interface to allow the audit log
pipeline to receive pre-inspection resource states from inventory providers.

- Define InitialResourceStateProvider contract and ClusterScopeNamespace constant.
- Add EmptyInitialResourceStateProviderTask as the default fallback for environments without an inventory provider.
- Suppress synthetic LogNotFound revisions in resourcemapper when an initial resource state exists.
- Seed prevRevisionReader in manifest_generator_task with initial resource state so the first patch log merges onto the pre-existing state.
- Unify cluster-scoped namespace string literals to the ClusterScopeNamespace constant.

* docs(commonlogk8saudit): document thread-safety contract on InitialResourceStateProvider

* feat(googlecloudcaik8s): implement GKE existing resource inspection via Cloud Asset Inventory (#991)

* feat(commonlogk8saudit): add initial resource state provider contract and integrate with audit log pipeline

Define the InitialResourceStateProvider interface to allow the audit log
pipeline to receive pre-inspection resource states from inventory providers.

- Define InitialResourceStateProvider contract and ClusterScopeNamespace constant.
- Add EmptyInitialResourceStateProviderTask as the default fallback for environments without an inventory provider.
- Suppress synthetic LogNotFound revisions in resourcemapper when an initial resource state exists.
- Seed prevRevisionReader in manifest_generator_task with initial resource state so the first patch log merges onto the pre-existing state.
- Unify cluster-scoped namespace string literals to the ClusterScopeNamespace constant.

* docs(commonlogk8saudit): document thread-safety contract on InitialResourceStateProvider

* feat(googlecloudcaik8s): implement GKE existing resource inspection via Cloud Asset Inventory

Implement Cloud Asset Inventory (CAI) resource fetching and timeline mapping
for GKE inspection. Populate pre-existing resource state into audit log
timelines and provide full manifest restoration including TypeMeta and
metadata fields.

- Add cloud.google.com/go/asset dependency and integrate AssetClient into ClientFactory.
- Export OrderedMapNode in structured package for manifest key ordering.
- Define CAI contracts, generic CAIFetcher interface, log types, task IDs, and revision state types.
- Implement caiFetcher supporting 100-asset chunking, quota project resolution, and progress callbacks.
- Implement CAIClusterResourceFetcherTask with exact parent resource scoping, namespace query pushdown, chunking, and progress reporting.
- Implement mapping logic to restore manifest TypeMeta (kind, apiVersion), decode base64 fieldsV1, and strip proto3 empty default metadata strings.
- Implement CAIClusterResourceLogIngesterTask and CAIClusterResourceTimelineMapperTask to render unknown period and observed snapshot revisions on timelines.
- Implement CAIInitialResourceStateProviderTask satisfying the InitialResourceStateProvider contract for the audit log pipeline.
- Register all googlecloudcaik8s inspection tasks for Google Cloud GKE clusters.

* fix(googlecloudcaik8s): address review comments on call options injector, protobuf getters, and log type color

* fix(googlecloudcaik8s): set VerbUpdate on CAI snapshot revision when creation timestamp is present (#994)

When a Kubernetes resource snapshot in Cloud Asset Inventory (CAI) contains
metadata.creationTimestamp preceding observedTime by at least the skew
tolerance, an initial body-less creation revision (state ExistingLogNotFound,
VerbType VerbCreate) is prepended to represent the resource creation before the
inspection window.

In this case, the snapshot revision at observedTime represents an observed state
of an already-existing resource, rather than an additional creation event. Setting
VerbType to VerbUpdate avoids rendering two consecutive "Create" events for the
same resource timeline.

If no creation revision is prepended (e.g. creationTimestamp is missing or within
skew tolerance), the snapshot revision retains VerbCreate as the initial anchor
for the resource timeline.

* test(web): support containerized frontend testing and harden karma configuration (#995)

* feat(inspection): include job command in metadata and allow starting inspection from job command (#993)

* feat(inspection): include job command in metadata and allow starting inspection from job command

fix(merge): resolve generated proto conflicts on plpwpmxw

* fix(new-inspection): flatten RxJS initialization stream and enhance test coverage for job command startup

* style(startup): replace job command button with a text link and refine link styling

* fix(web): address review feedback and fix GroupParameterFormField typing in test

* fix(web): restore protected visibility and strengthen dialog open assertions

* refactor(web): refactor inspection metadata dialog into smart-dumb components with accordion layout (#996)

* refactor(web): refactor inspection metadata dialog into smart-dumb components with accordion layout

* fix(web): prevent timer leak, remove dead output and fix grid area alignment in metadata code viewer

* fix(web): cleanup unused chips module, unused model fields, align grid areas, and remove redundant panel descriptions

* fix(web): remove unused CommonModule, fix error tracking key, and rename layout viewModel input

* refactor(web): extract formatBytes into shared utility and unexport internal metadata formatters

* fix(web): remove defensive checks on guaranteed metadata properties

* refactor(web): remove inner code viewer badges across metadata accordion items

* feat(web): format inspection metadata start and end times with timezoneShift in ISO 8601

* fix(web): address PR review comments on byte/time formatters, test querying, and job command integration

---------

Co-authored-by: kept1994 <keigof@google.com>
kyasbal added a commit to kyasbal/khi that referenced this pull request Sep 15, 2026
* feat(task): redefine Task interface, dependencies, and builder primitives in coretask (GoogleCloudPlatform#972)

* chore(github): reorganize issue and PR label taxonomy (GoogleCloudPlatform#971)

* chore(github): reorganize issue and PR label taxonomy

Reorganize GitHub issue and PR label system to improve discoverability,
triage ergonomics, and release automation alignment:
- Update .github/release.yml changelog categories to use new label names (type:feature, type:bug, type:perf, type:refactor, area:cicd, area:devenv, type:docs, type:chore).
- Configure .github/ISSUE_TEMPLATE/bug-report.md with default labels "type:bug, status:needs-triage".
- Configure .github/ISSUE_TEMPLATE/feature-request.md with default labels "type:feature, status:needs-triage".

* fix(github): separate maintenance and dependencies categories in release notes

* feat(k8sevent): replace resource UIDs with readable names in event summaries (GoogleCloudPlatform#973)

* feat(k8sevent): replace resource UIDs with readable names in event summaries

- Add ResourceIdentity.SummaryTag() method to format resources as readable tags
- Replace matched resource UIDs in Kubernetes event messages with readable tags in both GKE and OSS log ingesters
- Map matched resource UIDs to corresponding resource timelines in ProcessLogByGroup
- Add HasEventCount assertion helper to TimelineChangeSetAsserter

* fix(review): address review comments on deduplicating formatEventSummary and HasEventCount

* docs(agent): clarify cmp.Diff usage and test assertion examples in go-coding-rule (GoogleCloudPlatform#974)

* docs(agent): clarify cmp.Diff usage and test assertion examples in go-coding-rule

* fix(agent): address review comments on collections comparison in go-coding-rule

* feat(task): add edge attributes and dependency descriptors to taskid

* feat(task): redefine Task interface, dependencies, and builder primitives in coretask

* fix(task): address PR review comments on PR GoogleCloudPlatform#972

* feat(task): add priority options and multi-stage execution labels for FanIn dependencies

* feat(task): implement GraphResolver with fan-in cycle pruning and migrate monorepo to Task System v3 (GoogleCloudPlatform#976)

* feat(task): implement 4-phase GraphResolver, concrete edge tracking, and memory lifecycle in LocalRunner

* refactor(inspection): modernize inspection taskbase and runner for edge attributes

* refactor(task): migrate inspection tasks across monorepo to new task system

* feat(task): implement priority-based fan-in pruning and cycle detection in GraphResolver

* fix(review): address review comments on formtask aliases, inventory task multi-stage, and cycle tests

* feat(task): support stage-aware fan-in binding in TaskGraphMetadata and TaskSet

* feat(task): split cyclic multi-stage consumer tasks into DAG stages in GraphResolver

* test(inspection): verify end-to-end multi-stage inventory aggregation with cyclic producer

* fix(task): resolve LocalRunner stage tracking data race and improve naming

* refactor(task): eliminate dead BoundReferenceIDsWithTag and normalize task-scoped tag metadata

* refactor(task): decompose cycle resolution helpers and add edge routing tests

* refactor(task): clean up taskset doc comment, runner identifiers, and taskid parameter naming

* refactor(task): decompose cycle resolution helpers and extract graph utilities into graphresolver_graphutil.go

* test(task): add upstream PtP edge routing test for split multi-stage consumer

* refactor(task): eliminate obsolete refToTask and refToImplID maps in cycle resolution

* refactor(task): decompose cycle resolution and stage expansion functions

* refactor(task): standardize PointToPoint identifiers and fix inverted test description

* refactor(task): rename TaskEdge endpoints to SourceImplID and TargetImplID

* refactor(task): extract stage expansion and rerouting into graphresolver_stage.go

* fix(task): reroute fan-in edges from split producer and ensure deterministic stage edges

* refactor(task): align stage identifier names and test mock field naming

* refactor(task): extract stage tests into graphresolver_stage_test.go and co-locate stageTask

* fix(task): prevent premature deletion of self-loop stage results and add runner test

* refactor(task): decompose rerouteFanInEdges in graphresolver_stage.go

* refactor(task): standardize remainingStagesByRefID and boundFanInRefIDsByTaskImpl identifiers

* test(task): add unit tests for graphresolver_graphutil.go

* fix(task): replace scalar cmp.Diff with direct equality in runner_test.go and add stage assertions

* refactor(task): eliminate abbreviations and align identifiers in stage resolution and tests

* refactor(task): rename rem and remDep to remainingDependents in LocalRunner

* refactor(task): align stage edge identifiers and non-split naming in stage resolution

* refactor(task): flatten control flow nesting in LocalRunner cleanup

* refactor(task): fix point-to-point doc comment and disambiguate split consumer IDs

* refactor(task): rename BoundReferenceIDsForTaskWithTag to BoundReferenceIDsForTaskImplWithTag

* refactor(task): align stageTaskPairs, producer identifiers, and table-driven graphutil tests

* refactor(task): prune cyclic fan-in candidate edges into single-stage DAG and unify dependency scopes

* chore: merge main into epic/task-system-v3 (GoogleCloudPlatform#984)

* chore(github): reorganize issue and PR label taxonomy (GoogleCloudPlatform#971)

* chore(github): reorganize issue and PR label taxonomy

Reorganize GitHub issue and PR label system to improve discoverability,
triage ergonomics, and release automation alignment:
- Update .github/release.yml changelog categories to use new label names (type:feature, type:bug, type:perf, type:refactor, area:cicd, area:devenv, type:docs, type:chore).
- Configure .github/ISSUE_TEMPLATE/bug-report.md with default labels "type:bug, status:needs-triage".
- Configure .github/ISSUE_TEMPLATE/feature-request.md with default labels "type:feature, status:needs-triage".

* fix(github): separate maintenance and dependencies categories in release notes

* feat(k8sevent): replace resource UIDs with readable names in event summaries (GoogleCloudPlatform#973)

* feat(k8sevent): replace resource UIDs with readable names in event summaries

- Add ResourceIdentity.SummaryTag() method to format resources as readable tags
- Replace matched resource UIDs in Kubernetes event messages with readable tags in both GKE and OSS log ingesters
- Map matched resource UIDs to corresponding resource timelines in ProcessLogByGroup
- Add HasEventCount assertion helper to TimelineChangeSetAsserter

* fix(review): address review comments on deduplicating formatEventSummary and HasEventCount

* docs(agent): clarify cmp.Diff usage and test assertion examples in go-coding-rule (GoogleCloudPlatform#974)

* docs(agent): clarify cmp.Diff usage and test assertion examples in go-coding-rule

* fix(agent): address review comments on collections comparison in go-coding-rule

* feat(googlecloudk8scommon): default kind filter to all kinds except leases (GoogleCloudPlatform#975)

* feat(timeline): allow inline editing of search filter chips on click (GoogleCloudPlatform#977)

* feat(timeline): allow inline editing of search filter chips on click

Enable in-place editing of search filter chips in ChipSearchBarComponent
when clicked. Clicking a chip renders an inline text input with text
pre-selected and auto-focused. Changes can be committed with Enter or blur,
or cancelled with Escape. Delimiter splitting and whitespace removal are
supported.

* fix(review): address review comments on blur race condition and focus preservation

* fix(inspection): resolve timezone offset fallback to UTC by unifying to timezoneShiftHours (GoogleCloudPlatform#978)

Following the Connect-RPC migration (GoogleCloudPlatform#908), the timezone shift parameter
was updated in Protobuf and backend RPC handlers to timezoneShiftHours
(float64). However, TimeZoneShiftInputTask and the frontend InspectionClient
retained references to the legacy timezoneShift key, causing inspections
to always fall back to UTC time.

This change:
- Unifies the context key to TaskInputKeyTimezoneShiftHours in inspectioncore
- Updates TimeZoneShiftInputTask to read TaskInputKeyTimezoneShiftHours
- Updates backend-api.service.ts and its test to use timezoneShiftHours
- Updates parser_test.go to float64(9)
- Adds unit tests for TimeZoneShiftInputTask

* fix(k8saudit): preserve immutable identity metadata after truncated logs (GoogleCloudPlatform#979)

* fix(k8saudit): preserve immutable identity metadata after truncated logs

When Kubernetes audit logs contain truncated responses (audit.k8s.io/truncated: "true"),
groupManifestGenerator reset prevRevisionReader to nil. Subsequent patch requests merged
into an empty map reader, causing metadata.uid to be lost. Later tasks interpreted the
missing UID as a new resource creation, incorrectly emitting a ChangeEventTypeCreation
event and overwriting the initial revision at creationTimestamp.

This commit updates manifest_generator_task to preserve immutable identity metadata
(apiVersion, kind, metadata.name, metadata.namespace, metadata.uid, metadata.creationTimestamp)
upon encountering truncated logs so that subsequent patches retain the resource identity.

* fix(k8saudit): return preserved immutable identity reader for truncated log body

When a log is truncated, groupManifestGenerator now returns the preserved immutable
identity reader as ResourceBodyReader rather than nil. This allows the truncated log
itself to retain its immutable identity metadata in the generated timeline revision,
preventing the resource body from appearing completely empty in the UI and downstream
tasks.

* feat(cicd): support manual tag and release draft generation via workflow_dispatch (GoogleCloudPlatform#980)

* feat(cicd): support manual tag creation and release draft generation via workflow_dispatch

Add a workflow_dispatch trigger to .github/workflows/release.yaml, allowing
maintainers to initiate tag creation and release draft generation directly from
the GitHub Actions Web UI without local terminal operations.

- Accept a required tag_name input parameter (e.g., v1.2.3 or v1.2.3-beta-1)
- Validate tag format and verify uniqueness via git ls-remote before starting builds
- Create and push the Git tag after successful binary compilation
- Automatically generate release notes from categorised commit history

* fix(cicd): pass step outputs via env to prevent template injection

* refactor(inspection): remove legacy LabelKeyInspectionTypes and InspectionTypeLabel (GoogleCloudPlatform#981)

Remove deprecated LabelKeyInspectionTypes, InspectionTypeLabel, and
legacy fallback logic from inspection runner. Update tests and
documentation to use InspectionTypeLabelSelector.

* feat(inspection): set default environment name in composer form (GoogleCloudPlatform#982)

Add WithDefaultValueFunc to InputComposerEnvironmentNameTask so that
when Composer environments are fetched via autocomplete, the first
environment is automatically selected as the default value if no
previous selection was made.

---------

Co-authored-by: kept1994 <keigof@google.com>

* chore: merge main into epic/task-system-v3 (GoogleCloudPlatform#987)

* chore(github): reorganize issue and PR label taxonomy (GoogleCloudPlatform#971)

* chore(github): reorganize issue and PR label taxonomy

Reorganize GitHub issue and PR label system to improve discoverability,
triage ergonomics, and release automation alignment:
- Update .github/release.yml changelog categories to use new label names (type:feature, type:bug, type:perf, type:refactor, area:cicd, area:devenv, type:docs, type:chore).
- Configure .github/ISSUE_TEMPLATE/bug-report.md with default labels "type:bug, status:needs-triage".
- Configure .github/ISSUE_TEMPLATE/feature-request.md with default labels "type:feature, status:needs-triage".

* fix(github): separate maintenance and dependencies categories in release notes

* feat(k8sevent): replace resource UIDs with readable names in event summaries (GoogleCloudPlatform#973)

* feat(k8sevent): replace resource UIDs with readable names in event summaries

- Add ResourceIdentity.SummaryTag() method to format resources as readable tags
- Replace matched resource UIDs in Kubernetes event messages with readable tags in both GKE and OSS log ingesters
- Map matched resource UIDs to corresponding resource timelines in ProcessLogByGroup
- Add HasEventCount assertion helper to TimelineChangeSetAsserter

* fix(review): address review comments on deduplicating formatEventSummary and HasEventCount

* docs(agent): clarify cmp.Diff usage and test assertion examples in go-coding-rule (GoogleCloudPlatform#974)

* docs(agent): clarify cmp.Diff usage and test assertion examples in go-coding-rule

* fix(agent): address review comments on collections comparison in go-coding-rule

* feat(googlecloudk8scommon): default kind filter to all kinds except leases (GoogleCloudPlatform#975)

* feat(timeline): allow inline editing of search filter chips on click (GoogleCloudPlatform#977)

* feat(timeline): allow inline editing of search filter chips on click

Enable in-place editing of search filter chips in ChipSearchBarComponent
when clicked. Clicking a chip renders an inline text input with text
pre-selected and auto-focused. Changes can be committed with Enter or blur,
or cancelled with Escape. Delimiter splitting and whitespace removal are
supported.

* fix(review): address review comments on blur race condition and focus preservation

* fix(inspection): resolve timezone offset fallback to UTC by unifying to timezoneShiftHours (GoogleCloudPlatform#978)

Following the Connect-RPC migration (GoogleCloudPlatform#908), the timezone shift parameter
was updated in Protobuf and backend RPC handlers to timezoneShiftHours
(float64). However, TimeZoneShiftInputTask and the frontend InspectionClient
retained references to the legacy timezoneShift key, causing inspections
to always fall back to UTC time.

This change:
- Unifies the context key to TaskInputKeyTimezoneShiftHours in inspectioncore
- Updates TimeZoneShiftInputTask to read TaskInputKeyTimezoneShiftHours
- Updates backend-api.service.ts and its test to use timezoneShiftHours
- Updates parser_test.go to float64(9)
- Adds unit tests for TimeZoneShiftInputTask

* fix(k8saudit): preserve immutable identity metadata after truncated logs (GoogleCloudPlatform#979)

* fix(k8saudit): preserve immutable identity metadata after truncated logs

When Kubernetes audit logs contain truncated responses (audit.k8s.io/truncated: "true"),
groupManifestGenerator reset prevRevisionReader to nil. Subsequent patch requests merged
into an empty map reader, causing metadata.uid to be lost. Later tasks interpreted the
missing UID as a new resource creation, incorrectly emitting a ChangeEventTypeCreation
event and overwriting the initial revision at creationTimestamp.

This commit updates manifest_generator_task to preserve immutable identity metadata
(apiVersion, kind, metadata.name, metadata.namespace, metadata.uid, metadata.creationTimestamp)
upon encountering truncated logs so that subsequent patches retain the resource identity.

* fix(k8saudit): return preserved immutable identity reader for truncated log body

When a log is truncated, groupManifestGenerator now returns the preserved immutable
identity reader as ResourceBodyReader rather than nil. This allows the truncated log
itself to retain its immutable identity metadata in the generated timeline revision,
preventing the resource body from appearing completely empty in the UI and downstream
tasks.

* feat(cicd): support manual tag and release draft generation via workflow_dispatch (GoogleCloudPlatform#980)

* feat(cicd): support manual tag creation and release draft generation via workflow_dispatch

Add a workflow_dispatch trigger to .github/workflows/release.yaml, allowing
maintainers to initiate tag creation and release draft generation directly from
the GitHub Actions Web UI without local terminal operations.

- Accept a required tag_name input parameter (e.g., v1.2.3 or v1.2.3-beta-1)
- Validate tag format and verify uniqueness via git ls-remote before starting builds
- Create and push the Git tag after successful binary compilation
- Automatically generate release notes from categorised commit history

* fix(cicd): pass step outputs via env to prevent template injection

* refactor(inspection): remove legacy LabelKeyInspectionTypes and InspectionTypeLabel (GoogleCloudPlatform#981)

Remove deprecated LabelKeyInspectionTypes, InspectionTypeLabel, and
legacy fallback logic from inspection runner. Update tests and
documentation to use InspectionTypeLabelSelector.

* feat(inspection): set default environment name in composer form (GoogleCloudPlatform#982)

Add WithDefaultValueFunc to InputComposerEnvironmentNameTask so that
when Composer environments are fetched via autocomplete, the first
environment is automatically selected as the default value if no
previous selection was made.

* feat(dev): support configurable ports and hosts for multi-workspace and cloudtop (GoogleCloudPlatform#983)

* feat(dev): support configurable ports and hosts for multi-workspace and cloudtop

Support configuring ports and hosts via environment variables for KHI development servers and test runners.

- Makefile: allow overriding WEB_HOST, WEB_PORT, BACKEND_HOST, BACKEND_PORT, STORYBOOK_HOST, STORYBOOK_PORT, and KARMA_PORT. Add --allowed-hosts flag automatically when WEB_HOST is 0.0.0.0.
- Angular proxy: forward to BACKEND_HOST and BACKEND_PORT, normalizing 0.0.0.0 to 127.0.0.1 for HTTP proxy target.
- Karma: configure port from KARMA_PORT, bind to 127.0.0.1, and set --remote-debugging-port=0 to avoid debugging port collisions in headless Chrome.

* fix(dev): update karma beginsPattern regex to match 127.0.0.1 in tasks.json

* feat(task): add task description label and WithTaskDescription option (GoogleCloudPlatform#985)

* feat(task): add task description label and WithTaskDescription option

* chore: add license header to label_test.go

* refactor(task): simplify WithTaskDescription using WithLabelValue

* test(task): replace TestWithTaskDescription with TestWithLabelValue

---------

Co-authored-by: kept1994 <keigof@google.com>

* feat(inspection,web): implement Task Graph Diagnostics debug page and DAG viewer (GoogleCloudPlatform#989)

* docs(task): remove obsolete OrderOnly and explain dependency scopes

* feat(api,inspection): implement InspectionTaskGraphService and task output type metadata

* feat(web): implement Task Graph Diagnostics debug page and DAG viewer

* test(web): fix mock task fixtures and truncation expectation in dag viewer specs

* fix(inspection): skip monitoring metric client creation when cluster identity is incomplete in autocomplete tasks

* feat(inspection,web): add live inspection run task graph dialog and streaming watch RPC (GoogleCloudPlatform#992)

* test(web): support containerized frontend testing and harden karma configuration (GoogleCloudPlatform#995)

* feat(api,inspection): add task graph run snapshot and streaming watch RPC

* refactor(web): move dag viewer components to the shared component area

* feat(web): add inspection run task graph dialog and visual enhancements to dag viewer

* fix(web): reset consecutiveErrors on snapshot and expand stream observation unit tests

* chore: merge main into epic/task-system-v3 (GoogleCloudPlatform#997)

* chore(github): reorganize issue and PR label taxonomy (GoogleCloudPlatform#971)

* chore(github): reorganize issue and PR label taxonomy

Reorganize GitHub issue and PR label system to improve discoverability,
triage ergonomics, and release automation alignment:
- Update .github/release.yml changelog categories to use new label names (type:feature, type:bug, type:perf, type:refactor, area:cicd, area:devenv, type:docs, type:chore).
- Configure .github/ISSUE_TEMPLATE/bug-report.md with default labels "type:bug, status:needs-triage".
- Configure .github/ISSUE_TEMPLATE/feature-request.md with default labels "type:feature, status:needs-triage".

* fix(github): separate maintenance and dependencies categories in release notes

* feat(k8sevent): replace resource UIDs with readable names in event summaries (GoogleCloudPlatform#973)

* feat(k8sevent): replace resource UIDs with readable names in event summaries

- Add ResourceIdentity.SummaryTag() method to format resources as readable tags
- Replace matched resource UIDs in Kubernetes event messages with readable tags in both GKE and OSS log ingesters
- Map matched resource UIDs to corresponding resource timelines in ProcessLogByGroup
- Add HasEventCount assertion helper to TimelineChangeSetAsserter

* fix(review): address review comments on deduplicating formatEventSummary and HasEventCount

* docs(agent): clarify cmp.Diff usage and test assertion examples in go-coding-rule (GoogleCloudPlatform#974)

* docs(agent): clarify cmp.Diff usage and test assertion examples in go-coding-rule

* fix(agent): address review comments on collections comparison in go-coding-rule

* feat(googlecloudk8scommon): default kind filter to all kinds except leases (GoogleCloudPlatform#975)

* feat(timeline): allow inline editing of search filter chips on click (GoogleCloudPlatform#977)

* feat(timeline): allow inline editing of search filter chips on click

Enable in-place editing of search filter chips in ChipSearchBarComponent
when clicked. Clicking a chip renders an inline text input with text
pre-selected and auto-focused. Changes can be committed with Enter or blur,
or cancelled with Escape. Delimiter splitting and whitespace removal are
supported.

* fix(review): address review comments on blur race condition and focus preservation

* fix(inspection): resolve timezone offset fallback to UTC by unifying to timezoneShiftHours (GoogleCloudPlatform#978)

Following the Connect-RPC migration (GoogleCloudPlatform#908), the timezone shift parameter
was updated in Protobuf and backend RPC handlers to timezoneShiftHours
(float64). However, TimeZoneShiftInputTask and the frontend InspectionClient
retained references to the legacy timezoneShift key, causing inspections
to always fall back to UTC time.

This change:
- Unifies the context key to TaskInputKeyTimezoneShiftHours in inspectioncore
- Updates TimeZoneShiftInputTask to read TaskInputKeyTimezoneShiftHours
- Updates backend-api.service.ts and its test to use timezoneShiftHours
- Updates parser_test.go to float64(9)
- Adds unit tests for TimeZoneShiftInputTask

* fix(k8saudit): preserve immutable identity metadata after truncated logs (GoogleCloudPlatform#979)

* fix(k8saudit): preserve immutable identity metadata after truncated logs

When Kubernetes audit logs contain truncated responses (audit.k8s.io/truncated: "true"),
groupManifestGenerator reset prevRevisionReader to nil. Subsequent patch requests merged
into an empty map reader, causing metadata.uid to be lost. Later tasks interpreted the
missing UID as a new resource creation, incorrectly emitting a ChangeEventTypeCreation
event and overwriting the initial revision at creationTimestamp.

This commit updates manifest_generator_task to preserve immutable identity metadata
(apiVersion, kind, metadata.name, metadata.namespace, metadata.uid, metadata.creationTimestamp)
upon encountering truncated logs so that subsequent patches retain the resource identity.

* fix(k8saudit): return preserved immutable identity reader for truncated log body

When a log is truncated, groupManifestGenerator now returns the preserved immutable
identity reader as ResourceBodyReader rather than nil. This allows the truncated log
itself to retain its immutable identity metadata in the generated timeline revision,
preventing the resource body from appearing completely empty in the UI and downstream
tasks.

* feat(cicd): support manual tag and release draft generation via workflow_dispatch (GoogleCloudPlatform#980)

* feat(cicd): support manual tag creation and release draft generation via workflow_dispatch

Add a workflow_dispatch trigger to .github/workflows/release.yaml, allowing
maintainers to initiate tag creation and release draft generation directly from
the GitHub Actions Web UI without local terminal operations.

- Accept a required tag_name input parameter (e.g., v1.2.3 or v1.2.3-beta-1)
- Validate tag format and verify uniqueness via git ls-remote before starting builds
- Create and push the Git tag after successful binary compilation
- Automatically generate release notes from categorised commit history

* fix(cicd): pass step outputs via env to prevent template injection

* refactor(inspection): remove legacy LabelKeyInspectionTypes and InspectionTypeLabel (GoogleCloudPlatform#981)

Remove deprecated LabelKeyInspectionTypes, InspectionTypeLabel, and
legacy fallback logic from inspection runner. Update tests and
documentation to use InspectionTypeLabelSelector.

* feat(inspection): set default environment name in composer form (GoogleCloudPlatform#982)

Add WithDefaultValueFunc to InputComposerEnvironmentNameTask so that
when Composer environments are fetched via autocomplete, the first
environment is automatically selected as the default value if no
previous selection was made.

* feat(dev): support configurable ports and hosts for multi-workspace and cloudtop (GoogleCloudPlatform#983)

* feat(dev): support configurable ports and hosts for multi-workspace and cloudtop

Support configuring ports and hosts via environment variables for KHI development servers and test runners.

- Makefile: allow overriding WEB_HOST, WEB_PORT, BACKEND_HOST, BACKEND_PORT, STORYBOOK_HOST, STORYBOOK_PORT, and KARMA_PORT. Add --allowed-hosts flag automatically when WEB_HOST is 0.0.0.0.
- Angular proxy: forward to BACKEND_HOST and BACKEND_PORT, normalizing 0.0.0.0 to 127.0.0.1 for HTTP proxy target.
- Karma: configure port from KARMA_PORT, bind to 127.0.0.1, and set --remote-debugging-port=0 to avoid debugging port collisions in headless Chrome.

* fix(dev): update karma beginsPattern regex to match 127.0.0.1 in tasks.json

* feat(task): add task description label and WithTaskDescription option (GoogleCloudPlatform#985)

* feat(task): add task description label and WithTaskDescription option

* chore: add license header to label_test.go

* refactor(task): simplify WithTaskDescription using WithLabelValue

* test(task): replace TestWithTaskDescription with TestWithLabelValue

* feat(inspection): add checkbox form field type (GoogleCloudPlatform#986)

* feat(inspection): add checkbox form field type

Add a checkbox form field type so inspection tasks can take boolean input
in the New Inspection dialog.

- proto: add CheckboxFormField with readonly and default_value, FormField.kind
  checkbox, and ParameterValue.checkbox_value.
- metadata: add CheckboxParameterFormField and its serialization.
- formtask: add CheckboxFormTaskBuilder that builds a Task[bool] on top of
  FormTaskBuilderBase[bool]. It is not generic because a checkbox only ever
  represents a boolean state.
- server: convert CheckboxParameterFormField to and from the proto messages.
- web: add CheckboxParameterComponent, register it in GroupParameterComponent,
  and convert the checkbox field and value in the inspection converter. The
  checkbox reuses the common label instead of holding its own text.

* fix(inspection): address review comments on validator, test mock, and add license headers

* refactor(inspection): remove redundant LogSorterTask and NewLogSorterByTimeTask (GoogleCloudPlatform#988)

Remove NewLogSorterByTimeTask and its usages in commonlogk8saudit and
googlecloudclustercomposer. In KHI, all upstream log providers already
provide logs in chronological order, and filter/grouper tasks preserve
log order. The intermediate LogSorter performed redundant slice cloning
and sorting without functional necessity.

- Deleted NewLogSorterByTimeTask from pkg/core/inspection/taskbase
- Removed LogSorterTask and its registration from commonlogk8saudit
- Removed AirflowDagProcessorManagerLogSorterTask from googlecloudclustercomposer
- Rewired downstream grouper/ingester tasks directly to upstream filter tasks
- Updated pipeline documentation and Mermaid diagrams

* feat(commonlogk8saudit): add initial resource state provider contract and integrate with audit log pipeline (GoogleCloudPlatform#990)

* feat(commonlogk8saudit): add initial resource state provider contract and integrate with audit log pipeline

Define the InitialResourceStateProvider interface to allow the audit log
pipeline to receive pre-inspection resource states from inventory providers.

- Define InitialResourceStateProvider contract and ClusterScopeNamespace constant.
- Add EmptyInitialResourceStateProviderTask as the default fallback for environments without an inventory provider.
- Suppress synthetic LogNotFound revisions in resourcemapper when an initial resource state exists.
- Seed prevRevisionReader in manifest_generator_task with initial resource state so the first patch log merges onto the pre-existing state.
- Unify cluster-scoped namespace string literals to the ClusterScopeNamespace constant.

* docs(commonlogk8saudit): document thread-safety contract on InitialResourceStateProvider

* feat(googlecloudcaik8s): implement GKE existing resource inspection via Cloud Asset Inventory (GoogleCloudPlatform#991)

* feat(commonlogk8saudit): add initial resource state provider contract and integrate with audit log pipeline

Define the InitialResourceStateProvider interface to allow the audit log
pipeline to receive pre-inspection resource states from inventory providers.

- Define InitialResourceStateProvider contract and ClusterScopeNamespace constant.
- Add EmptyInitialResourceStateProviderTask as the default fallback for environments without an inventory provider.
- Suppress synthetic LogNotFound revisions in resourcemapper when an initial resource state exists.
- Seed prevRevisionReader in manifest_generator_task with initial resource state so the first patch log merges onto the pre-existing state.
- Unify cluster-scoped namespace string literals to the ClusterScopeNamespace constant.

* docs(commonlogk8saudit): document thread-safety contract on InitialResourceStateProvider

* feat(googlecloudcaik8s): implement GKE existing resource inspection via Cloud Asset Inventory

Implement Cloud Asset Inventory (CAI) resource fetching and timeline mapping
for GKE inspection. Populate pre-existing resource state into audit log
timelines and provide full manifest restoration including TypeMeta and
metadata fields.

- Add cloud.google.com/go/asset dependency and integrate AssetClient into ClientFactory.
- Export OrderedMapNode in structured package for manifest key ordering.
- Define CAI contracts, generic CAIFetcher interface, log types, task IDs, and revision state types.
- Implement caiFetcher supporting 100-asset chunking, quota project resolution, and progress callbacks.
- Implement CAIClusterResourceFetcherTask with exact parent resource scoping, namespace query pushdown, chunking, and progress reporting.
- Implement mapping logic to restore manifest TypeMeta (kind, apiVersion), decode base64 fieldsV1, and strip proto3 empty default metadata strings.
- Implement CAIClusterResourceLogIngesterTask and CAIClusterResourceTimelineMapperTask to render unknown period and observed snapshot revisions on timelines.
- Implement CAIInitialResourceStateProviderTask satisfying the InitialResourceStateProvider contract for the audit log pipeline.
- Register all googlecloudcaik8s inspection tasks for Google Cloud GKE clusters.

* fix(googlecloudcaik8s): address review comments on call options injector, protobuf getters, and log type color

* fix(googlecloudcaik8s): set VerbUpdate on CAI snapshot revision when creation timestamp is present (GoogleCloudPlatform#994)

When a Kubernetes resource snapshot in Cloud Asset Inventory (CAI) contains
metadata.creationTimestamp preceding observedTime by at least the skew
tolerance, an initial body-less creation revision (state ExistingLogNotFound,
VerbType VerbCreate) is prepended to represent the resource creation before the
inspection window.

In this case, the snapshot revision at observedTime represents an observed state
of an already-existing resource, rather than an additional creation event. Setting
VerbType to VerbUpdate avoids rendering two consecutive "Create" events for the
same resource timeline.

If no creation revision is prepended (e.g. creationTimestamp is missing or within
skew tolerance), the snapshot revision retains VerbCreate as the initial anchor
for the resource timeline.

* test(web): support containerized frontend testing and harden karma configuration (GoogleCloudPlatform#995)

* feat(inspection): include job command in metadata and allow starting inspection from job command (GoogleCloudPlatform#993)

* feat(inspection): include job command in metadata and allow starting inspection from job command

fix(merge): resolve generated proto conflicts on plpwpmxw

* fix(new-inspection): flatten RxJS initialization stream and enhance test coverage for job command startup

* style(startup): replace job command button with a text link and refine link styling

* fix(web): address review feedback and fix GroupParameterFormField typing in test

* fix(web): restore protected visibility and strengthen dialog open assertions

* refactor(web): refactor inspection metadata dialog into smart-dumb components with accordion layout (GoogleCloudPlatform#996)

* refactor(web): refactor inspection metadata dialog into smart-dumb components with accordion layout

* fix(web): prevent timer leak, remove dead output and fix grid area alignment in metadata code viewer

* fix(web): cleanup unused chips module, unused model fields, align grid areas, and remove redundant panel descriptions

* fix(web): remove unused CommonModule, fix error tracking key, and rename layout viewModel input

* refactor(web): extract formatBytes into shared utility and unexport internal metadata formatters

* fix(web): remove defensive checks on guaranteed metadata properties

* refactor(web): remove inner code viewer badges across metadata accordion items

* feat(web): format inspection metadata start and end times with timezoneShift in ISO 8601

* fix(web): address PR review comments on byte/time formatters, test querying, and job command integration

---------

Co-authored-by: kept1994 <keigof@google.com>

* test(task): add comprehensive task graph conformance tests for all registered tasks (GoogleCloudPlatform#998)

* refactor(composer): remove unused ComposerEnvironmentListFetcher dead code

* test(task): add comprehensive task graph conformance tests for all registered tasks

* refactor(googlecloud): remove orphaned ComposerService and composer API client from ClientFactory

* test(inspection): enforce non-empty form task labels and full inspection coverage in reachability test

* fix(test): record inspection completion within Layer3 and guard reachability against partial subtest filters

* docs(agent): update deprecated GetTaskResultOptional references to GetOptionalTaskResult in agent skills and rules (GoogleCloudPlatform#1000)

* docs: remove non-existent Order-Only edge kind references from concept docs

---------

Co-authored-by: kept1994 <keigof@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant