Repository navigation
feat: multi-CSP groundwork — IR, ModelSource, provider config, auth adapters (Phase 2) - #135
Merged
Merged
Conversation
…dapters Phase 2 of docs/roadmap.md: make adding a second cloud provider an addition rather than a fork. No non-AWS service ships here, and no AWS behaviour changes — the boto3 suite stays at 775 passing and `make codegen` output is byte-identical. Four seams, each of which used to be an edit and is now an append: codegen — the parser produced a SmithyModel that generators read directly, so the only format DevCloud could read was the one its type was named after. internal/codegen/ir now holds the provider-neutral *ir.Model, and ModelSource reads one format into it. SmithySource is the first implementation and owns its own detection, so cmd/codegen hands each file to SourceFor and never names a format. A file no source claims is an error rather than a quiet skip; the extension filter that used to decide that was format knowledge in the driver. config — service blocks can be written as providers.aws.services.*, forward compatible with providers.azure.*. The top-level services block is the same block under its historical name and is not deprecated; providers.aws.services wins when both are written, and names the loser in a warning. A block for a provider this build cannot serve loads with a warning instead of failing, so a config written for a later DevCloud still starts this one. AWS data dirs stay flat because that layout is a 1.x guarantee; other providers nest under their own name so same-named services cannot collide. plugin — ServicePlugin needed no change; the review is written up in docs/plugin-api.md. The CSP is carried by the optional ProviderScoped interface, read through plugin.ProviderOf. Making it a ServicePlugin method would have forced an edit to all 104 in-tree providers so each could state the value it already defaults to, and would have broken the v1.x contract for no gain. Startup resolves config with cfg.ProviderService(plugin.ProviderOf(p), id). auth — internal/auth holds one Adapter per provider, SigV4 being AWS's. The caller's claimed identity reaches every plugin via auth.FromContext and shows up as a new region field on GET /devcloud/api/logs. Nothing is verified: rejecting unsigned calls would break every SDK pointed at DevCloud with placeholder credentials, which compatibility-policy.md documents as deliberate. The adapter also removes a duplicate parse. protocol.go had its own SigV4 credential-scope reader used for routing; it now delegates, so routing and identity cannot disagree about what the caller signed for.
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
Completes Phase 2 — Architectural Preparation of docs/roadmap.md: the internal refactor that makes adding a second cloud provider an addition rather than a fork. No non-AWS service ships here and no AWS behaviour changes.
Related Issue
No tracking issue exists — this implements the Phase 2 checklist in
docs/roadmap.mddirectly. Refs the roadmap, closes nothing.Changes
Intermediate Representation —
internal/codegen/irholds the provider-neutral*ir.Model. The parser used to produce aSmithyModelthat generators read directly, so the only format DevCloud could ever read was the one its type was named after. Generators now read only the IR;SmithyModelis gone.ModelSource—internal/codegen/source.go. One interface per API description format.SmithySourceis the first implementation and owns its own detection (a top-levelsmithyversion key), socmd/codegenhands each file toSourceForand never names a format. A file no source claims is now an error rather than a quiet skip — the.jsonextension filter that used to decide that was format knowledge living in the driver.Provider namespacing in config — service blocks can be written as
providers.aws.services.*, forward-compatible withproviders.azure.*. The top-levelservicesblock is the same block under its historical name and is not deprecated;providers.aws.serviceswins when both are written and names the loser in a warning. A block for a provider this build cannot serve loads with a warning instead of failing, so a config written for a later DevCloud still starts this one. AWS data dirs stay flat (<base>/<id>) because that layout is a 1.x guarantee; other providers nest under their own name so same-named services cannot collide.Plugin CSP-neutrality review —
ServicePluginneeds no change; the review is written up indocs/plugin-api.md. The CSP is carried by the optionalProviderScopedinterface, read throughplugin.ProviderOf. Making it aServicePluginmethod would have forced an edit to all 104 in-tree providers so each could state the value it already defaults to, and would have broken the v1.x contract for no gain. Startup now resolves config withcfg.ProviderService(plugin.ProviderOf(p), id).Per-provider auth adapters —
internal/authholds oneAdapterper provider,SigV4being AWS's. The caller's claimed identity reaches every plugin viaauth.FromContextand appears as a newregionfield onGET /devcloud/api/logs. Nothing is verified: rejecting unsigned calls would break every SDK pointed at DevCloud with placeholder credentials, whichcompatibility-policy.mddocuments as deliberate.The adapter also removes a duplicate parse:
protocol.gohad its own SigV4 credential-scope reader used for routing, and now delegates — so routing and identity cannot disagree about what the caller signed for. One side effect worth noting in review: presigned URLs (X-Amz-Credentialquery) now yield a signing name where previously only theAuthorizationheader did, which routes presigned non-S3 requests by scope instead of defaulting them to S3.Test Plan
go build ./...,go vet ./...,gofmt -l— cleangolangci-lint run— 0 issuesgo test ./...— all packages passmake test-compat— 775 passed, run against the final tree. This is the check that matters for theprotocol.gochange.make codegenre-run — generated output byte-identical, no driftinternal/codegen/source_test.go(format detection, including that an OpenAPI document is not claimed by Smithy),internal/auth/sigv4_test.go(header, presigned query, SigV2/unsigned rejection, truncated scope, context round-trip), and fourinternal/configtests covering both config spellings, the both-written warning, unknown-provider forward compatibility, andDEVCLOUD_SERVICESstaying AWS-scoped.Checklist
golangci-lint run)roadmap.md(Phase 2 → Complete, Phase 3 → Next),architecture.md(provider seams table, auth section, codegen pipeline),plugin-api.md(CSP-neutrality review, caller identity),configuration.md(provider namespacing),compatibility-policy.mdchanges/unreleased/