Skip to content

Add workload forms and failed-run Troubleshoot to DAK - #591

Open
copybara-service[bot] wants to merge 1 commit into
mainfrom
test_1033011518
Open

copybara-service[bot] wants to merge 1 commit into
mainfrom
test_1033011518

Conversation

@copybara-service

Copy link
Copy Markdown
Contributor

Add workload forms and failed-run Troubleshoot to DAK

What this does
DAK lists and runs Managed Spark workloads. But to create a workload or run
local code, a developer must use the Cloud console or workloads.py. Also, a
failed run shows its errors, and the user must find the cause alone. This CL
adds the Create workload, Start ad-hoc run and Update workload forms (CUJs 1
to 3, b/591845594). It also adds a Troubleshoot button for a failed run that
hands the failure to the coding agent of the IDE (CUJ 9, b/591846409).

What changed

  • dataproc/shared/workloads_forms.ts, pages/workloads/workload_form.*:
    one form page with three modes, a consent banner and a conflict banner.
    Leaf update mask with etag. Consent link check.
  • dataproc/exthost/workloads_staging.ts: content-hashed object names, MD5
    duplicate skip, ifGenerationMatch=0, resumable upload above 5 MiB, and
    only a regional bucket in the region of the run.
  • dataproc/exthost/workloads_form_actions.ts, workloads_rest_client.ts:
    the form RPCs, and CreateWorkload, CreateRun and UpdateWorkload.
  • dataproc/exthost/workloads_troubleshoot.ts, pages/workloads/run_details.*:
    the Troubleshoot prompt, the handoff to the agent panel, chat or clipboard,
    and the button for a failed run.
  • Tree, table, workload page, package.json: commands and buttons. The flag
    DatacloudSpark__enable_workloads gates each new command and menu.

How it was tested

  • blaze test of dataproc/exthost:unit_tests, dataproc/shared:unit_tests,
    run_details_unit_tests, workload_form_unit_tests,
    workload_details_unit_tests, workloads_list_unit_tests,
    workloads_webview_service_tests, :vsix_content_test, :tsconfig, the
    two package.json checker tests, agents/exthost:unit_tests,
    services_registry_test and the DAK skill tests: 109 targets pass
    (http://sponge2/74f07306-c209-4cc9-87a4-3ba66b290f2d).
  • The staging tests run the resumable upload with gaxios 6 and gaxios 7
    response headers, and check the multipart body byte for byte.
  • jj piper lint: 3 advisory findings (component harnesses), as in the other
    workload page tests. hamburger --dry-run: 0 files to change.
  • No live test. No create, run, upload or Troubleshoot click ran against a
    real project or in a real IDE.

Where to look
This CL merges two best-of-2 candidates for each bug. Claude: cl/1032868163
(forms) and cl/1032855007 (Troubleshoot). Jetski: cl/1032888849 (forms) and
cl/1032855993 (Troubleshoot).

Forms: the code comes from the Claude candidate. It has one form component
with three modes. The Jetski forms copy about 1,300 lines between two forms.
From the Jetski candidate came the rule "only a regional bucket in the
region" (checkBucket). Multi-region buckets can be on another continent,
and design section 3.2 keeps the code in the region. Fixes that neither
candidate had:

  • workloads_staging.ts, normalizeHeaders and buildMultipartBody: the
    VSIX runs gaxios 7, but the code compiles against the gaxios 6 typings.
    gaxios 7 gives response headers as a Headers object and reads multipart
    part headers with Headers.get. Both candidates failed here at runtime.
    Rejected: the googleapis storage_v1 client, because it has no chunked
    upload that resumes after a failed chunk.
  • workloads_forms.ts, getEucConsentUrl: both server wordings, the OAuth
    path and the Managed Spark redirect URI, as in
    common/shared/sql_query/error_parse_context.ts. Rejected: an import of
    that file, because it pulls SQL editor code into the webview bundle.
  • Update form: no placement is Serverless, a cluster workload keeps its
    cluster, and unchanged arguments stay as they are.

Troubleshoot: the structure comes from the Claude candidate. The page sends
only the run name, the extension host loads the run again, and a registered
command gives metrics and the flag check. Rejected: the Jetski request that
carries the full run from the page, because a page can then put any text in
the prompt. From the Jetski candidate came, in buildRunTroubleshootPrompt:

  • No values of Spark properties, parameters or arguments, only their names,
    as in Table 3.2 of the Spark troubleshooting agent design.
  • An <untrusted_error_log> block for the error messages.
  • A cap of about 12,000 characters, which cuts only the error messages.
  • A log time window, the duration and the Cloud console link.

Design choice: outside Antigravity, DAK copies the prompt to the clipboard
before it opens the VS Code chat. VS Code opens its chat view also with no
chat extension, and then drops the prompt.

Related
Design doc Tab 2, sections 2, 3.1 and 3.2. Open Decision 1 (UI staffing) is
still open.

**What this does**
DAK lists and runs Managed Spark workloads. But to create a workload or run
local code, a developer must use the Cloud console or workloads.py. Also, a
failed run shows its errors, and the user must find the cause alone. This CL
adds the Create workload, Start ad-hoc run and Update workload forms (CUJs 1
to 3, b/591845594). It also adds a Troubleshoot button for a failed run that
hands the failure to the coding agent of the IDE (CUJ 9, b/591846409).

**What changed**
- `dataproc/shared/workloads_forms.ts`, `pages/workloads/workload_form.*`:
  one form page with three modes, a consent banner and a conflict banner.
  Leaf update mask with etag. Consent link check.
- `dataproc/exthost/workloads_staging.ts`: content-hashed object names, MD5
  duplicate skip, `ifGenerationMatch=0`, resumable upload above 5 MiB, and
  only a regional bucket in the region of the run.
- `dataproc/exthost/workloads_form_actions.ts`, `workloads_rest_client.ts`:
  the form RPCs, and CreateWorkload, CreateRun and UpdateWorkload.
- `dataproc/exthost/workloads_troubleshoot.ts`, `pages/workloads/run_details.*`:
  the Troubleshoot prompt, the handoff to the agent panel, chat or clipboard,
  and the button for a failed run.
- Tree, table, workload page, `package.json`: commands and buttons. The flag
  `DatacloudSpark__enable_workloads` gates each new command and menu.

**How it was tested**
- `blaze test` of `dataproc/exthost:unit_tests`, `dataproc/shared:unit_tests`,
  `run_details_unit_tests`, `workload_form_unit_tests`,
  `workload_details_unit_tests`, `workloads_list_unit_tests`,
  `workloads_webview_service_tests`, `:vsix_content_test`, `:tsconfig`, the
  two `package.json` checker tests, `agents/exthost:unit_tests`,
  `services_registry_test` and the DAK skill tests: 109 targets pass
  (http://sponge2/74f07306-c209-4cc9-87a4-3ba66b290f2d).
- The staging tests run the resumable upload with gaxios 6 and gaxios 7
  response headers, and check the multipart body byte for byte.
- `jj piper lint`: 3 advisory findings (component harnesses), as in the other
  workload page tests. `hamburger --dry-run`: 0 files to change.
- No live test. No create, run, upload or Troubleshoot click ran against a
  real project or in a real IDE.

**Where to look**
This CL merges two best-of-2 candidates for each bug. Claude: cl/1032868163
(forms) and cl/1032855007 (Troubleshoot). Jetski: cl/1032888849 (forms) and
cl/1032855993 (Troubleshoot).

Forms: the code comes from the Claude candidate. It has one form component
with three modes. The Jetski forms copy about 1,300 lines between two forms.
From the Jetski candidate came the rule "only a regional bucket in the
region" (`checkBucket`). Multi-region buckets can be on another continent,
and design section 3.2 keeps the code in the region. Fixes that neither
candidate had:
- `workloads_staging.ts`, `normalizeHeaders` and `buildMultipartBody`: the
  VSIX runs gaxios 7, but the code compiles against the gaxios 6 typings.
  gaxios 7 gives response headers as a `Headers` object and reads multipart
  part headers with `Headers.get`. Both candidates failed here at runtime.
  Rejected: the googleapis `storage_v1` client, because it has no chunked
  upload that resumes after a failed chunk.
- `workloads_forms.ts`, `getEucConsentUrl`: both server wordings, the OAuth
  path and the Managed Spark redirect URI, as in
  `common/shared/sql_query/error_parse_context.ts`. Rejected: an import of
  that file, because it pulls SQL editor code into the webview bundle.
- Update form: no placement is Serverless, a cluster workload keeps its
  cluster, and unchanged arguments stay as they are.

Troubleshoot: the structure comes from the Claude candidate. The page sends
only the run name, the extension host loads the run again, and a registered
command gives metrics and the flag check. Rejected: the Jetski request that
carries the full run from the page, because a page can then put any text in
the prompt. From the Jetski candidate came, in `buildRunTroubleshootPrompt`:
- No values of Spark properties, parameters or arguments, only their names,
  as in Table 3.2 of the Spark troubleshooting agent design.
- An `<untrusted_error_log>` block for the error messages.
- A cap of about 12,000 characters, which cuts only the error messages.
- A log time window, the duration and the Cloud console link.

Design choice: outside Antigravity, DAK copies the prompt to the clipboard
before it opens the VS Code chat. VS Code opens its chat view also with no
chat extension, and then drops the prompt.

**Related**
Design doc Tab 2, sections 2, 3.1 and 3.2. Open Decision 1 (UI staffing) is
still open.

PiperOrigin-RevId: 1033011518
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant