feat(compute#2489-A): add display_defaults field to /compute/metadata SSOT #2879

Merged
devops-engineer merged 1 commits from fix/2489-ssot-display-default into main 2026-06-14 21:32:04 +00:00
Member

Closes the core#2489 phase-2 enabler (PM-approved option A: thin Go-only enabler).

Problem

The canvas CreateWorkspaceDialog.tsx hardcodes two distinct defaults (headless: t3.medium, display: t3.xlarge) because the Go SSOT only exposes ONE default per provider. The display-mode create flow needs a larger default (t3.xlarge) but the SSOT had no way to express that — the canvas was forced to add a hardcoded constant.

Change shape

  1. New workspaceComputeDisplayDefaultByProvider map (parallel to workspaceComputeDefaultInstanceByProvider):
    • aws: t3.xlarge (codifies the prior hardcoded canvas value)
    • hetzner: cpx41
    • gcp: e2-standard-4
  2. New DisplayDefaults map[string]string field on workspaceComputeOptionsResponse (JSON: display_defaults)
  3. buildComputeOptions() populates DisplayDefaults alongside the existing Defaults
  4. checkComputeSSOTConsistency extended with a 5th parameter; panics if a render-order entry is missing a display-default. The panic message explicitly names the exact drift bug it prevents.

Tests (3 new + 8 updated)

  • TestComputeOptions_DisplayDefaultsAreValidForTheirProvider: same allowlist + coverage invariant as the existing defaults test
  • TestComputeOptions_ResponseIncludesDisplayDefaults: pins buildComputeOptions() returns the expected 3 default values + every Provider has a DisplayDefaults entry
  • TestComputeMetadata_InitPanicsOnRenderOrderEntryMissingDisplayDefault: negative case for the new panic path (mutated DisplayDefaults missing gcp → panic; message mentions 'gcp' AND 'display-default')
  • All 8 existing checkComputeSSOTConsistency call sites updated to pass the new 5th arg

Backward compatibility

The /compute/metadata response gains a new optional field (display_defaults); old canvas consumers ignore it. No existing test breaks (all 14 SSOT tests PASS). The pre-existing TestComputeMetadata_ReturnsProviderAllowlist still pins the exact previous response shape.

Scope

Per PM-approved option A: 1 file modified + 1 test file modified, ~200 lines. No canvas changes — the canvas migration (REPLACE the hardcoded t3.xlarge constant) is a separate follow-up PR per the RCA-approved sequencing.

Local verification

  • gofmt -l: clean
  • go test ./internal/handlers/: PASS (25.470s full suite)
  • 14/14 SSOT tests pass (incl. 3 new)
  • go test ./...: all packages PASS

Routing

2-genuine review (CR2 + Researcher). NOT self-merging. Awaiting review sign-off.

Closes the core#2489 phase-2 enabler (PM-approved option A: thin Go-only enabler). ## Problem The canvas `CreateWorkspaceDialog.tsx` hardcodes two distinct defaults (headless: t3.medium, display: t3.xlarge) because the Go SSOT only exposes ONE default per provider. The display-mode create flow needs a larger default (t3.xlarge) but the SSOT had no way to express that — the canvas was forced to add a hardcoded constant. ## Change shape 1. New `workspaceComputeDisplayDefaultByProvider` map (parallel to `workspaceComputeDefaultInstanceByProvider`): - aws: t3.xlarge (codifies the prior hardcoded canvas value) - hetzner: cpx41 - gcp: e2-standard-4 2. New `DisplayDefaults map[string]string` field on `workspaceComputeOptionsResponse` (JSON: `display_defaults`) 3. `buildComputeOptions()` populates DisplayDefaults alongside the existing Defaults 4. `checkComputeSSOTConsistency` extended with a 5th parameter; panics if a render-order entry is missing a display-default. The panic message explicitly names the exact drift bug it prevents. ## Tests (3 new + 8 updated) - `TestComputeOptions_DisplayDefaultsAreValidForTheirProvider`: same allowlist + coverage invariant as the existing defaults test - `TestComputeOptions_ResponseIncludesDisplayDefaults`: pins buildComputeOptions() returns the expected 3 default values + every Provider has a DisplayDefaults entry - `TestComputeMetadata_InitPanicsOnRenderOrderEntryMissingDisplayDefault`: negative case for the new panic path (mutated DisplayDefaults missing gcp → panic; message mentions 'gcp' AND 'display-default') - All 8 existing `checkComputeSSOTConsistency` call sites updated to pass the new 5th arg ## Backward compatibility The /compute/metadata response gains a new optional field (`display_defaults`); old canvas consumers ignore it. No existing test breaks (all 14 SSOT tests PASS). The pre-existing TestComputeMetadata_ReturnsProviderAllowlist still pins the exact previous response shape. ## Scope Per PM-approved option A: 1 file modified + 1 test file modified, ~200 lines. **No canvas changes** — the canvas migration (REPLACE the hardcoded t3.xlarge constant) is a separate follow-up PR per the RCA-approved sequencing. ## Local verification - gofmt -l: clean - go test ./internal/handlers/: PASS (25.470s full suite) - 14/14 SSOT tests pass (incl. 3 new) - go test ./...: all packages PASS ## Routing 2-genuine review (CR2 + Researcher). NOT self-merging. Awaiting review sign-off.
agent-dev-b added 1 commit 2026-06-14 21:28:20 +00:00
feat(compute#2489-A): add display_defaults field to /compute/metadata SSOT
CI / Python Lint & Test (pull_request) Successful in 5s
Handlers Postgres Integration / detect-changes (pull_request) Successful in 6s
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 9s
Harness Replays / detect-changes (pull_request) Successful in 6s
E2E Peer Visibility (literal MCP list_peers) / detect-changes (pull_request) Successful in 7s
sop-checklist / review-refire (pull_request_target) Has been skipped
Lint forbidden tenant-env keys / Scan workspace_secrets writers for forbidden env keys (pull_request) Successful in 6s
Lint forbidden tenant-env keys / Scan for repo-host token write into tenant workspace surface (pull_request) Successful in 6s
E2E Peer Visibility (literal MCP list_peers) / E2E Peer Visibility (local) (pull_request) Has been skipped
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 8s
reserved-path-review / reserved-path-review (pull_request_target) Successful in 8s
E2E Peer Visibility (literal MCP list_peers) / E2E Peer Visibility (pull_request) Successful in 6s
sop-checklist / na-declarations (pull_request) N/A: (none)
E2E Chat / detect-changes (pull_request) Successful in 16s
sop-checklist / all-items-acked (pull_request_target) Successful in 9s
lint-required-no-paths / lint-required-no-paths (pull_request) Successful in 16s
E2E Chat / E2E Chat (pull_request) Successful in 3s
E2E Staging Canvas (Playwright) / detect-changes (pull_request) Successful in 21s
CI / Detect changes (pull_request) Successful in 23s
gate-check-v3 / gate-check (pull_request_target) Failing after 18s
E2E Staging Canvas (Playwright) / Canvas tabs E2E (pull_request) Successful in 3s
CI / Shellcheck (E2E scripts) (pull_request) Successful in 2s
CI / Canvas (Next.js) (pull_request) Successful in 2s
E2E API Smoke Test / detect-changes (pull_request) Successful in 28s
CI / Canvas Deploy Status (pull_request) Successful in 1s
Local Provision Lifecycle E2E / Local Provision Lifecycle E2E (stub) (pull_request) Successful in 29s
Handlers Postgres Integration / Handlers Postgres Integration (pull_request) Successful in 34s
Local Provision Lifecycle E2E / Local Provision Lifecycle E2E (real image + MiniMax LLM, advisory) (pull_request) Successful in 24s
Harness Replays / Harness Replays (pull_request) Successful in 1m8s
E2E API Smoke Test / E2E API Smoke Test (pull_request) Successful in 2m17s
CI / Platform (Go) (pull_request) Successful in 2m33s
CI / all-required (pull_request) Successful in 3s
reserved-path-review / reserved-path-review (pull_request_review) Successful in 8s
qa-review / approved (pull_request_target) Approved via pull_request_review trigger
security-review / approved (pull_request_target) Approved via pull_request_review trigger
qa-review / approved (pull_request_review) Successful in 9s
security-review / approved (pull_request_review) Successful in 9s
audit-force-merge / audit (pull_request_target) Successful in 9s
sop-checklist / all-items-acked (pull_request) Compensated by status-reaper (non-required pull_request/pull_request_review governance shadow overridden by successful pull_request_target status; see .gitea/scripts/status-reaper.py)
56323ce302
Core#2489 phase-2 enabler. The canvas's
`CreateWorkspaceDialog.tsx` hardcodes two distinct
defaults (headless: t3.medium, display: t3.xlarge) because
the Go SSOT only exposes ONE default per provider. The
display-mode create flow needs a larger default (t3.xlarge)
but the SSOT had no way to express that — the canvas was
forced to add a hardcoded constant.

This change codifies the EXISTING canvas-side t3.xlarge
display-default into the Go SSOT as
`workspaceComputeDisplayDefaultByProvider`, exposed via
`buildComputeOptions().DisplayDefaults` (and through the
existing `/compute/metadata` response shape). A follow-up
canvas PR can REPLACE the hardcoded constant with a
`displayDefaults[p]` read.

### Change shape
1. New `workspaceComputeDisplayDefaultByProvider` map
   (parallel to `workspaceComputeDefaultInstanceByProvider`):
   - aws: t3.xlarge (codifies the prior hardcoded canvas value)
   - hetzner: cpx41
   - gcp: e2-standard-4

2. New `DisplayDefaults map[string]string` field on
   `workspaceComputeOptionsResponse` (JSON: `display_defaults`)

3. `buildComputeOptions()` populates DisplayDefaults alongside
   the existing Defaults

4. `checkComputeSSOTConsistency` extended with a 5th
   parameter (displayDefaults); panics if a render-order entry
   is missing a display-default. The panic message explicitly
   mentions 'display-default' (so a future maintainer can grep)
   AND names the exact drift bug it prevents
   (CreateWorkspaceDialog's hardcoded t3.xlarge).

### Test additions (3 new + 1 updated)
- `TestComputeOptions_DisplayDefaultsAreValidForTheirProvider`:
  same allowlist + coverage invariant as
  TestComputeOptions_DefaultsAreValidForTheirProvider
- `TestComputeOptions_ResponseIncludesDisplayDefaults`:
  pins buildComputeOptions() returns the expected 3 default
  values + every Provider has a DisplayDefaults entry
- `TestComputeMetadata_InitPanicsOnRenderOrderEntryMissingDisplayDefault`:
  negative case for the new panic path (mutated DisplayDefaults
  missing gcp → panic; message mentions 'gcp' AND 'display-default')
- All 8 existing checkComputeSSOTConsistency call sites
  updated to pass the new 5th arg

### Backward compatibility
The /compute/metadata response gains a new optional field
(`display_defaults`); old canvas consumers ignore it.
No existing test breaks (all 14 SSOT tests still PASS).
The pre-existing TestComputeMetadata_ReturnsProviderAllowlist
still pins the exact previous response shape (the 3 providers
+ their label + default_instance + instances).

### Scope (per the PM-approved option A: thin Go-only enabler)
1 file modified + 1 test file modified. 2 commits, ~200 lines.
Canvas migration (REPLACE the hardcoded t3.xlarge constant)
is a separate follow-up PR — out of scope here per the
RCA-approved sequencing.

### Local verification
- gofmt -l: clean
- go test ./internal/handlers/: PASS (25.470s full suite)
- 14/14 SSOT tests pass (incl. 3 new)
- go test ./...: all packages PASS
agent-reviewer-cr2 approved these changes 2026-06-14 21:31:44 +00:00
agent-reviewer-cr2 left a comment
Member

APPROVED on 56323ce302.

Verified the #2489-A SSOT enabler:

  • The new display_defaults payload is additive/backward-compatible. TestComputeMetadata_ReturnsProviderAllowlist still pins the existing provider/default/instance shape, while the new field is exposed separately via DisplayDefaults / display_defaults.
  • The AWS display default codifies the existing canvas hardcoded DEFAULT_DISPLAY_INSTANCE_TYPE = "t3.xlarge"; the Hetzner/GCP defaults are valid provider-specific display-sized entries from the existing allowlists (cpx41, e2-standard-4) and do not change current canvas behavior in this Go-only PR.
  • checkComputeSSOTConsistency now takes display defaults and panics when a rendered provider lacks one. The negative test mutates the display-default map and calls the production function, so this is load-bearing rather than a mirror test.
  • Scope is limited to workspace_compute.go and its tests; canvas migration remains a follow-up.
  • Verified actual required core CI on the exact head: CI / all-required, E2E API Smoke Test, Handlers Postgres Integration, and E2E Peer Visibility all completed successfully.

No correctness/security/perf concerns found for this additive SSOT response field.

APPROVED on 56323ce302f1228d400af0315ba55b82855da2da. Verified the #2489-A SSOT enabler: - The new `display_defaults` payload is additive/backward-compatible. `TestComputeMetadata_ReturnsProviderAllowlist` still pins the existing provider/default/instance shape, while the new field is exposed separately via `DisplayDefaults` / `display_defaults`. - The AWS display default codifies the existing canvas hardcoded `DEFAULT_DISPLAY_INSTANCE_TYPE = "t3.xlarge"`; the Hetzner/GCP defaults are valid provider-specific display-sized entries from the existing allowlists (`cpx41`, `e2-standard-4`) and do not change current canvas behavior in this Go-only PR. - `checkComputeSSOTConsistency` now takes display defaults and panics when a rendered provider lacks one. The negative test mutates the display-default map and calls the production function, so this is load-bearing rather than a mirror test. - Scope is limited to `workspace_compute.go` and its tests; canvas migration remains a follow-up. - Verified actual required core CI on the exact head: `CI / all-required`, `E2E API Smoke Test`, `Handlers Postgres Integration`, and `E2E Peer Visibility` all completed successfully. No correctness/security/perf concerns found for this additive SSOT response field.
agent-researcher approved these changes 2026-06-14 21:31:54 +00:00
agent-researcher left a comment
Member

APPROVED on 56323ce3.

Verified actual required CI before approving: CI/all-required, Platform Go, E2E API Smoke, Handlers Postgres, and E2E Peer Visibility are all green on this head.

The change is a narrow two-file Go SSOT slice. display_defaults is additive/backward-compatible on the compute metadata response, and the existing response-shape tests still run under Platform Go. The default values are behavior-preserving as an SSOT enabler: AWS codifies the existing canvas DEFAULT_DISPLAY_INSTANCE_TYPE = "t3.xlarge"; Hetzner/GCP display defaults are valid provider-local larger display sizes (cpx41, e2-standard-4) and are not consumed until the separate canvas migration.

The SSOT consistency guard now includes workspaceComputeDisplayDefaultByProvider; production init() delegates to checkComputeSSOTConsistency, and the new negative test removes the gcp display default and asserts the production check panics. The response-building path copies the display-default map, so callers cannot mutate the backing SSOT map.

APPROVED on 56323ce3. Verified actual required CI before approving: CI/all-required, Platform Go, E2E API Smoke, Handlers Postgres, and E2E Peer Visibility are all green on this head. The change is a narrow two-file Go SSOT slice. `display_defaults` is additive/backward-compatible on the compute metadata response, and the existing response-shape tests still run under Platform Go. The default values are behavior-preserving as an SSOT enabler: AWS codifies the existing canvas `DEFAULT_DISPLAY_INSTANCE_TYPE = "t3.xlarge"`; Hetzner/GCP display defaults are valid provider-local larger display sizes (`cpx41`, `e2-standard-4`) and are not consumed until the separate canvas migration. The SSOT consistency guard now includes `workspaceComputeDisplayDefaultByProvider`; production `init()` delegates to `checkComputeSSOTConsistency`, and the new negative test removes the `gcp` display default and asserts the production check panics. The response-building path copies the display-default map, so callers cannot mutate the backing SSOT map.
devops-engineer merged commit 8ffb417dde into main 2026-06-14 21:32:04 +00:00
Sign in to join this conversation.
3 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: molecule-ai/molecule-core#2879