refac!: explicit provider contract - #15
Merged
Merged
Conversation
Signed-off-by: utkuerol <utkuerol@users.noreply.github.com>
cemysf
reviewed
Aug 18, 2026
There was a problem hiding this comment.
Pull request overview
This PR refactors the managed service provider contract to make Codesphere-defined fields explicit in provider method signatures, separating them from provider-specific schemas and removing example model types that could mislead implementers.
Changes:
- Redesign the
provider.Providerandprovider.Backupsinterfaces to pass contract fields explicitly and standardize status viaServiceStatus/NewServiceStatus. - Update HTTP route handlers to decode/unpack contract envelopes (
plan.parameters,msId) and forward contract fields as separate arguments. - Add route-level unit tests for create/update/status/backup behavior; update Go toolchain and CI/security workflows to use
go.mod.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Updates documentation to explain the explicit split between contract fields and provider-defined schemas. |
| provider/routes.go | Refactors Gin handlers to decode contract-defined fields/envelopes and call the new provider interfaces. |
| provider/routes_test.go | Adds tests covering the new decoding/unwrapping behavior and handler wiring. |
| provider/interface.go | Introduces the new provider contracts and ServiceStatus helper for the status envelope. |
| model/common.go | Removes example/common schema types to avoid implying they must be used by providers. |
| go.mod | Bumps Go toolchain patch version. |
| .github/workflows/ci.yml | Switches setup-go to go-version-file: go.mod for CI. |
| .github/workflows/security.yml | Switches setup-go to go-version-file: go.mod for security checks. |
| NOTICE | Updates dependency NOTICE entries to match updated indirect module versions. |
Suppressed comments (1)
provider/routes.go:188
- Backup requests require
msId(service ID) to be present in the JSON body, butparseBackupcurrently accepts a missing/empty value and passes it through. This will call the provider with an emptyServiceID, which is almost certainly invalid; returning a 400 here makes the contract enforcement explicit.
var body backupBody[Config, Secrets]
if err := c.ShouldBindJSON(&body); err != nil {
return "", body, err
}
return model.BackupId(c.Param("id")), body, nil
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
cemysf
approved these changes
Aug 21, 2026
utkuerol
pushed a commit
that referenced
this pull request
Aug 21, 2026
🤖 I have created a release *beep* *boop* --- ## [0.7.0](v0.6.0...v0.7.0) (2026-08-21) ### ⚠ BREAKING CHANGES * explicit provider contract ([#15](#15)) ### refac * explicit provider contract ([#15](#15)) ([31fe171](31fe171)) ### Bug Fixes * **deps:** update module github.com/onsi/ginkgo/v2 to v2.32.1 ([#20](#20)) ([ebdaaa2](ebdaaa2)) * **deps:** update module github.com/stretchr/testify to v1.12.1 ([#25](#25)) ([632d92b](632d92b)) * retry jobs in separate pods to retain logs ([#13](#13)) ([4bc7bc4](4bc7bc4)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.
The provider interface wasn't clear about what is custom to the provider and what is received from Codesphere. This PR makes the distinction explicit by separating Codesphere provided fields from custom provider types. Also removes the example types because they didn't add much value and mostly confused developers into believing they had to use those types.