Skip to content

feat(inspection): add pending status for asynchronous validation and estimation - #909

Merged
kyasbal merged 2 commits into
GoogleCloudPlatform:mainfrom
kyasbal:push-lkmlzwlstrlw
Aug 26, 2026
Merged

kyasbal merged 2 commits into
GoogleCloudPlatform:mainfrom
kyasbal:push-lkmlzwlstrlw

Conversation

@kyasbal

@kyasbal kyasbal commented Aug 26, 2026

Copy link
Copy Markdown
Member

Summary

This PR introduces pending status representation and handling for asynchronous operations during dryrun across both backend and frontend.

Background & Motivation

  1. Server-side Asynchronous Tasks: Tasks executed during dryrun—such as file validation (e.g. archive extraction and file integrity verification) and log volume estimation—run asynchronously in background worker slots or goroutines. Previously, the client had no standardized way to know that the backend is still evaluating a parameter or estimating log counts, causing parameters to appear prematurely valid.
  2. Non-blocking Log Estimation: In CachedStructuredLogEstimator, previous implementations blocked synchronous dryrun execution while awaiting estimation. With non-blocking estimation, dryrun returns immediately with pending state while the estimation runs concurrently.
  3. Client-side Validation Latency Synchronization: When a user modifies an input field or when the backend updates default values remotely, there is an in-flight latency window before the next dryrun response arrives. Without client-side pending synchronization, fields would retain stale validation checkmarks or old error messages, and users could click "Run" before their input was validated.

Key Changes

1. Backend (pkg/)

  • Metadata Schema:
    • pkg/core/inspection/metadata/form_metadata.go: Added Pending bool \json:"pending,omitempty"`toParameterFormFieldBase`.
    • pkg/core/inspection/metadata/query_metadata.go: Added Pending bool \json:"pending,omitempty"`toQueryItemand helperSetPendingQuery`.
  • Log Estimation:
    • pkg/api/googlecloud/logestimator/cached_estimator.go: Added EstimateWithTaskSlotNonBlocking(ctx, taskSlotKey, container, query, startTime, endTime, provider) returning (*EstimateResult, bool, error) (isPending=true when running). Reimplemented EstimateWithTaskSlot to delegate to the non-blocking variant.
    • pkg/task/inspection/googlecloudcommon/contract/structured_listlogentries_task.go: Switched to EstimateWithTaskSlotNonBlocking and marked queries as pending using setStructuredQueryInfoWithPending.
  • File Upload Verification:
    • pkg/core/inspection/formtask/fileform.go: Set Pending: true and HintType: Info on file form fields while file upload/processing status is not completed.

2. Frontend (web/)

  • Schema:
    • web/src/app/common/schema/form-types.ts: Added readonly pending?: boolean; to ParameterFormFieldBase.
    • web/src/app/common/schema/metadata-types.ts: Added readonly pending?: boolean; to InspectionMetadataQuery.
  • Parameter Header (ParameterHeaderComponent):
  • Dialog Validation & Run Button (NewInspectionDialogComponent):
    • Implemented reactive pendingFieldCount and errorFieldCount computed signals.
    • Suppressed stale error counts when a field is undergoing validation or server pending.
    • Added isRunButtonDisabled = computed(() => this.hadRun() || this.errorFieldCount() !== 0 || this.pendingFieldCount() !== 0) to immediately prevent execution while unvalidated changes or pending server tasks exist.
    • Added footer indicator showing Resolving parameters: X / Y with a spinner while pending.
    • Updated computeTotalEstimatedLogs to treat pending queries as estimating.

Verification

  • Backend Unit Tests: make test-go passed (all packages).
  • Backend Lint: make lint-go passed (0 issues).
  • Frontend Unit Tests: make test-web passed (795 / 795 SUCCESS).
  • Frontend Lint & Stylelint: make lint-web passed (0 issues).
  • Pre-commit: make pre-commit passed with 0 issues.
  • Production Build: make build-go && make build-web succeeded.
@kyasbal kyasbal added type:feature New feature or request area:frontend Web frontend application and UI components labels Aug 26, 2026

@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 introduces non-blocking log estimation and pending state handling for form fields in both the backend and frontend. Key changes include adding EstimateWithTaskSlotNonBlocking to the log estimator, updating metadata schemas to include a pending flag, and modifying the Angular frontend to display loading spinners and disable the run button during pending or validating operations. Feedback highlights a critical race condition in EstimateWithTaskSlot that could lead to silent error loss, as well as an unused CSS class .pending-spinner in the frontend styles.

…estimation

Support representing and tracking asynchronous pending operations during dryrun
on both the backend and frontend.

- backend: add non-blocking EstimateWithTaskSlotNonBlocking to CachedStructuredLogEstimator
- backend: mark query items as pending during async log estimation
- backend: set Pending flag and Info hint on file form field when file status is processing
- frontend: integrate server-side pending with client-side validating state in ParameterHeaderComponent
- frontend: compute pendingFieldCount and errorFieldCount with Angular signals to disable Run button and suppress stale errors during validation
@kyasbal
kyasbal force-pushed the push-lkmlzwlstrlw branch from 11f265a to 4a8b67c Compare August 26, 2026 07:24
…s class

- Return active flightCall pointer directly under lock via estimateWithTaskSlotInternal to avoid silent error loss race condition
- Remove unused .pending-spinner CSS class in parameter-header.component.scss
@kyasbal
kyasbal force-pushed the push-lkmlzwlstrlw branch from 4a8b67c to 54e7891 Compare August 26, 2026 07:47
@kyasbal
kyasbal merged commit c6e8700 into GoogleCloudPlatform:main Aug 26, 2026
16 checks passed
@kyasbal
kyasbal deleted the push-lkmlzwlstrlw branch August 26, 2026 07:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:frontend Web frontend application and UI components type:feature New feature or request

1 participant