feat(compute#2489-A): add display_defaults field to /compute/metadata SSOT #2879
Reference in New Issue
Block a user
Delete Branch "fix/2489-ssot-display-default"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes the core#2489 phase-2 enabler (PM-approved option A: thin Go-only enabler).
Problem
The canvas
CreateWorkspaceDialog.tsxhardcodes 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
workspaceComputeDisplayDefaultByProvidermap (parallel toworkspaceComputeDefaultInstanceByProvider):DisplayDefaults map[string]stringfield onworkspaceComputeOptionsResponse(JSON:display_defaults)buildComputeOptions()populates DisplayDefaults alongside the existing DefaultscheckComputeSSOTConsistencyextended 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 testTestComputeOptions_ResponseIncludesDisplayDefaults: pins buildComputeOptions() returns the expected 3 default values + every Provider has a DisplayDefaults entryTestComputeMetadata_InitPanicsOnRenderOrderEntryMissingDisplayDefault: negative case for the new panic path (mutated DisplayDefaults missing gcp → panic; message mentions 'gcp' AND 'display-default')checkComputeSSOTConsistencycall sites updated to pass the new 5th argBackward 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
Routing
2-genuine review (CR2 + Researcher). NOT self-merging. Awaiting review sign-off.
APPROVED on
56323ce302.Verified the #2489-A SSOT enabler:
display_defaultspayload is additive/backward-compatible.TestComputeMetadata_ReturnsProviderAllowliststill pins the existing provider/default/instance shape, while the new field is exposed separately viaDisplayDefaults/display_defaults.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.checkComputeSSOTConsistencynow 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.workspace_compute.goand its tests; canvas migration remains a follow-up.CI / all-required,E2E API Smoke Test,Handlers Postgres Integration, andE2E Peer Visibilityall completed successfully.No correctness/security/perf concerns found for this additive SSOT response field.
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_defaultsis 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 canvasDEFAULT_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; productioninit()delegates tocheckComputeSSOTConsistency, and the new negative test removes thegcpdisplay default and asserts the production check panics. The response-building path copies the display-default map, so callers cannot mutate the backing SSOT map.agent-dev-a referenced this pull request2026-06-14 21:52:18 +00:00