Skip to content

Flatten resolved browser pool references - #73

Merged
IlyaasK merged 2 commits into
mainfrom
hypeship/browser-pool-resolved-refs
Jul 29, 2026
Merged

Flatten resolved browser pool references#73
IlyaasK merged 2 commits into
mainfrom
hypeship/browser-pool-resolved-refs

Conversation

@IlyaasK

@IlyaasK IlyaasK commented Jul 11, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • flatten browser-pool profile_id from the authoritative resolved API field
  • flatten ordered extension_ids from the authoritative resolved API field
  • retain compatibility with legacy responses whose selector echoes contain IDs
  • preserve Terraform null versus explicit-empty-list intent
  • reject malformed authoritative reference fields instead of hiding contract errors

Why

Terraform state must contain stable durable identities. Browser-pool configuration
echoes can contain names, while Kernel now returns canonical resolved profile and
extension IDs separately. Reading those resolved fields prevents selector names
from entering state and producing drift.

Scope

This changes only kernel_browser_pool response flattening and focused unit tests.
It does not add a browser-pool data source or change schema, mutations, deletion,
import, or runtime behavior.

Terraform state semantics

  • profile_id stores the canonical resolved profile ID when present
  • extension_ids stores canonical resolved extension IDs in API order
  • omitted resolved fields fall back to legacy selector echoes
  • explicit null or malformed resolved fields fail refresh
  • an authoritative empty extension list preserves prior null/empty configuration intent

Tests run

  • gofmt -l cmd internal
  • go test -short -timeout=2m ./internal/resources/browserpool
  • go test -race -short -timeout=2m ./internal/resources/browserpool
  • go test -short -timeout=2m ./...
  • go vet ./...
  • terraform fmt -check -recursive examples
  • bash scripts/check-docs.sh
  • git diff --check origin/main...HEAD

Acceptance status

Live acceptance was not run because credentials are unavailable. Browser-pool
acceptance against the final release commit remains a release gate.

Intentionally unsupported

  • browser-pool data source
  • force deletion
  • acquired or available runtime counters in Terraform state
  • browser acquire/release/flush, sessions, logs, screenshots, or live view

Note

Medium Risk
Changes only read-path flattening for kernel_browser_pool state, but wrong ID sourcing would cause refresh drift or failed applies; scope is limited to flatten logic and unit tests.

Overview
Browser pool refresh now writes profile_id and extension_ids from the API’s top-level resolved fields (profile_id, extension_ids) instead of config selector echoes that may only carry names. That keeps Terraform state on stable IDs and avoids drift when echoes differ from resolved references.

When those resolved fields are absent, flattening still uses legacy browser_pool_config.profile / extensions ID echoes. Malformed or explicit-null resolved values surface refresh errors rather than silently falling back. An authoritative empty extension_ids list still honors prior null vs explicit-empty extension_ids intent in state.

Tests were updated and expanded for resolved-vs-legacy behavior and invalid resolved reference handling.

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

@IlyaasK
IlyaasK requested review from Sayan- and tnsardesai July 11, 2026 09:28
Comment thread internal/resources/browserpool/flatten.go
@IlyaasK
IlyaasK removed request for Sayan- and tnsardesai July 13, 2026 13:25
@IlyaasK
IlyaasK force-pushed the hypeship/extension-example branch from 7bf41e8 to 12a1136 Compare July 13, 2026 13:35
@IlyaasK
IlyaasK force-pushed the hypeship/browser-pool-resolved-refs branch 2 times, most recently from 546feff to c8beaf5 Compare July 13, 2026 14:32
@IlyaasK
IlyaasK force-pushed the hypeship/extension-example branch from 12a1136 to bf17fc0 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 c8beaf5. Configure here.

Comment thread internal/resources/browserpool/flatten.go
@IlyaasK
IlyaasK force-pushed the hypeship/browser-pool-resolved-refs branch from c8beaf5 to 8a17e4c Compare July 13, 2026 15:39
@IlyaasK
IlyaasK force-pushed the hypeship/browser-pool-resolved-refs branch from 8a17e4c to 8791796 Compare July 20, 2026 19:38
@IlyaasK
IlyaasK force-pushed the hypeship/extension-example branch from 11a1872 to 210546c Compare July 20, 2026 19:38
@IlyaasK
IlyaasK force-pushed the hypeship/browser-pool-resolved-refs branch from 8791796 to 21051bf Compare July 21, 2026 14:46
@IlyaasK
IlyaasK force-pushed the hypeship/extension-example branch from 210546c to 1207b12 Compare July 21, 2026 14:46
@IlyaasK
IlyaasK force-pushed the hypeship/browser-pool-resolved-refs branch from 21051bf to c1cb593 Compare July 21, 2026 18:10
@IlyaasK
IlyaasK force-pushed the hypeship/extension-example branch from a7a7a38 to df9604e Compare July 21, 2026 19:51
@IlyaasK
IlyaasK force-pushed the hypeship/browser-pool-resolved-refs branch 2 times, most recently from 0418ff5 to e569d69 Compare July 21, 2026 20:15
@IlyaasK
IlyaasK requested review from Sayan- and removed request for Sayan- July 24, 2026 15:54
Prefer the API's authoritative resolved profile ID and ordered extension IDs over echoed selectors, validate their raw response shape before writing Terraform state, and retain only an ID-based compatibility path for older responses. This prevents name selectors from becoming non-canonical durable state.
@IlyaasK
IlyaasK force-pushed the hypeship/browser-pool-resolved-refs branch from dbade85 to 3fa1515 Compare July 27, 2026 18:13
@IlyaasK
IlyaasK changed the base branch from hypeship/extension-example to main July 27, 2026 18:13
When Kernel resolves a pool's extension IDs to an empty list, retain Terraform's prior distinction between an omitted attribute and an explicitly empty list. Validate the authoritative response first so malformed data still fails visibly, and cover both convergence paths.
@IlyaasK
IlyaasK force-pushed the hypeship/browser-pool-resolved-refs branch from 3fa1515 to c7c576d Compare July 27, 2026 18:17
@IlyaasK
IlyaasK requested review from Sayan- and removed request for Sayan- July 27, 2026 18:21
@IlyaasK
IlyaasK merged commit b97ab97 into main Jul 29, 2026
2 checks passed
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.

2 participants