Flatten extension metadata for resource state - #64
Open
IlyaasK wants to merge 1 commit into
Open
Conversation
IlyaasK
requested review from
Sayan- and
tnsardesai
and removed request for
Sayan- and
tnsardesai
July 11, 2026 05:56
IlyaasK
force-pushed
the
hypeship/extension-create-framework
branch
from
July 13, 2026 13:34
3443e16 to
28c2d37
Compare
IlyaasK
force-pushed
the
hypeship/extension-read-flatten
branch
from
July 13, 2026 13:34
47260c0 to
e55250f
Compare
IlyaasK
force-pushed
the
hypeship/extension-create-framework
branch
from
July 13, 2026 14:32
28c2d37 to
f61e55b
Compare
IlyaasK
force-pushed
the
hypeship/extension-read-flatten
branch
2 times, most recently
from
July 13, 2026 15:39
b36a0ed to
fb5840f
Compare
IlyaasK
force-pushed
the
hypeship/extension-create-framework
branch
from
July 13, 2026 15:39
f61e55b to
bdf2829
Compare
IlyaasK
force-pushed
the
hypeship/extension-read-flatten
branch
2 times, most recently
from
July 21, 2026 14:46
aaa65c1 to
82bf203
Compare
IlyaasK
force-pushed
the
hypeship/extension-create-framework
branch
from
July 21, 2026 18:10
2aacf29 to
bdb3002
Compare
IlyaasK
force-pushed
the
hypeship/extension-read-flatten
branch
from
July 21, 2026 18:10
82bf203 to
8c1c7b0
Compare
IlyaasK
force-pushed
the
hypeship/extension-create-framework
branch
from
July 21, 2026 19:51
bdb3002 to
f94ef65
Compare
IlyaasK
force-pushed
the
hypeship/extension-read-flatten
branch
from
July 21, 2026 19:51
8c1c7b0 to
b8baf88
Compare
IlyaasK
force-pushed
the
hypeship/extension-read-flatten
branch
from
July 21, 2026 20:15
b8baf88 to
a890eb5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Why this is v1 work
Resource Read has stricter state semantics than the existing extension data source. This pure flattener establishes durable drift and legacy-import behavior before adding the API call and Terraform Read adapter.
Intentionally unsupported
Verification
gofmt -l cmd internalgo test -count=20 ./internal/resources/extensiongo test -race -count=1 ./internal/resources/extensiongo test -count=1 -short -timeout=2m ./...go vet ./...go mod verifygo mod tidy -diffterraform fmt -check -recursive examplesbash scripts/check-docs.shbash scripts/check-examples.shbash scripts/check-markdown-links.shgit diff --checkAll commands passed locally. Tests are pure, deterministic, and require no network or container.
Acceptance status
No API or Terraform lifecycle call is introduced, so live acceptance testing is not applicable to this pure flattener.
Remaining risk
Extension metadata does not include project identity, so Read must continue using scope recorded in Terraform state. Legacy and Chrome Web Store records may lack checksum evidence and remain metadata-only until replaced from a local managed archive.
Note
Low Risk
Pure, test-only state-mapping logic with no lifecycle or network calls; behavior is isolated until Read is integrated.
Overview
Adds
flattenExtensionRead, a pure mapper from KernelExtensionGetResponseto TerraformextensionModelfor future resource Read, without wiring an API call or lifecycle method yet.It validates SDK identity, nullable name, and checksum fields; keeps
project_idfrom prior state (API metadata does not return project scope); clears write-onlysource_pathon refresh; and maps remote checksum intosource_sha256so drift is visible. Errors when a managed extension loses checksum evidence; allows omitted checksum for legacy/unmanaged prior state. Ignores runtime/metadata fields (timestamps, size, etc.).Unit tests cover happy path, legacy nulls, checksum loss, remote checksum drift, and invalid responses.
Reviewed by Cursor Bugbot for commit a890eb5. Bugbot is set up for automated code reviews on this repo. Configure here.