Skip to content

Flatten extension upload responses - #59

Open
IlyaasK wants to merge 1 commit into
hypeship/extension-upload-paramsfrom
hypeship/extension-upload-flatten
Open

Flatten extension upload responses#59
IlyaasK wants to merge 1 commit into
hypeship/extension-upload-paramsfrom
hypeship/extension-upload-flatten

Conversation

@IlyaasK

@IlyaasK IlyaasK commented Jul 11, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • validate Stainless raw-field metadata for uploaded extension ID, optional name, and checksum
  • require the API name and checksum echoes to match configured durable state
  • preserve resolved project scope because extension metadata does not return it
  • explicitly null the write-only source path in Terraform state
  • exclude created time, archive size, last-used time, and all runtime data

Why this is v1 work

This is the pure success-response boundary needed before wiring kernel_extension Create. Separating flattening keeps malformed-success and drift semantics independently reviewable from API calls and Terraform state persistence.

Intentionally unsupported

  • no SDK/client call
  • no Terraform Create or uncertain-commit handling
  • no metadata Get/Read flattening
  • no archive bytes, timestamps, size, or runtime usage in state
  • no download or browser/session operation

Verification

  • gofmt -l cmd internal
  • go test -count=20 ./internal/resources/extension
  • go test -race -count=1 ./internal/resources/extension
  • go test -count=1 -short -timeout=2m ./...
  • go vet ./...
  • go mod verify
  • go mod tidy -diff
  • terraform fmt -check -recursive examples
  • bash scripts/check-docs.sh
  • bash scripts/check-examples.sh
  • bash scripts/check-markdown-links.sh
  • git diff --check HEAD

All commands passed locally. Tests are pure, deterministic, and network-free.

Acceptance status

No API call or Terraform lifecycle behavior is introduced, so live acceptance testing is not applicable to this pure flatten slice.

Remaining risk

A malformed nominal success means Kernel may already have created the extension. This helper deliberately returns no invented state; the later Create core must preserve any trustworthy canonical ID and report an uncertain commit with lookup/import/delete guidance.


Note

Low Risk
Pure mapping and validation with no Terraform lifecycle or network calls; behavior is covered by unit tests.

Overview
Adds flattenExtensionUpload as the success-response boundary for upcoming kernel_extension Create: it turns a Kernel upload response into durable Terraform state and diagnostics only—no API or lifecycle wiring yet.

Validation follows the same Stainless raw-field pattern used elsewhere (e.g. browser pool): required id and checksum, optional name when present in JSON. It errors on missing/invalid fields and on name or checksum drift versus configured values. project_id is taken from the caller when scoped (not from API metadata); source_path is explicitly nulled as write-only; timestamps, size, and runtime fields are ignored.

Unit tests cover happy paths (nullable name, unscoped project), invalid required fields, and drift rejection.

Reviewed by Cursor Bugbot for commit bed4bab. Bugbot is set up for automated code reviews on this repo. Configure here.

@IlyaasK
IlyaasK requested review from Sayan- and tnsardesai and removed request for Sayan- and tnsardesai July 11, 2026 04:32
@IlyaasK
IlyaasK force-pushed the hypeship/extension-upload-params branch from d0b421f to b4dddeb Compare July 13, 2026 13:34
@IlyaasK
IlyaasK force-pushed the hypeship/extension-upload-flatten branch from ed9e9a2 to 36b5430 Compare July 13, 2026 13:34
@IlyaasK
IlyaasK force-pushed the hypeship/extension-upload-params branch from b4dddeb to 4a377ef Compare July 13, 2026 14:32
@IlyaasK
IlyaasK force-pushed the hypeship/extension-upload-flatten branch from 36b5430 to 3f100f2 Compare July 13, 2026 14:32

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 3f100f2. Configure here.

Comment thread internal/resources/extension/flatten.go
@IlyaasK
IlyaasK force-pushed the hypeship/extension-upload-flatten branch from 3f100f2 to a413a50 Compare July 13, 2026 15:39
@IlyaasK
IlyaasK force-pushed the hypeship/extension-upload-params branch from 33ccaff to ae57a67 Compare July 20, 2026 19:38
@IlyaasK
IlyaasK force-pushed the hypeship/extension-upload-flatten branch from a413a50 to 5d952a2 Compare July 20, 2026 19:38
@IlyaasK
IlyaasK force-pushed the hypeship/extension-upload-params branch from ae57a67 to 5bc835d Compare July 21, 2026 14:46
@IlyaasK
IlyaasK force-pushed the hypeship/extension-upload-flatten branch from 5d952a2 to 5508e2a Compare July 21, 2026 14:46
@IlyaasK
IlyaasK force-pushed the hypeship/extension-upload-params branch from 5bc835d to b563e14 Compare July 21, 2026 18:10
@IlyaasK
IlyaasK force-pushed the hypeship/extension-upload-flatten branch 2 times, most recently from 52798b4 to efabe6a Compare July 21, 2026 19:51
@IlyaasK
IlyaasK force-pushed the hypeship/extension-upload-flatten branch from efabe6a to bed4bab Compare July 21, 2026 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant