Skip to content

refac!: explicit provider contract - #15

Merged
utkuerol merged 8 commits into
mainfrom
refactor/explicit-provider-contract
Aug 21, 2026
Merged

refac!: explicit provider contract#15
utkuerol merged 8 commits into
mainfrom
refactor/explicit-provider-contract

Conversation

@utkuerol

@utkuerol utkuerol commented Aug 17, 2026

Copy link
Copy Markdown
Member

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.

@utkuerol
utkuerol requested a review from a team as a code owner August 17, 2026 09:47
utkuerol and others added 4 commits August 17, 2026 11:53
@utkuerol
utkuerol requested a review from cemysf August 17, 2026 11:47
Comment thread provider/routes.go

Copilot AI 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.

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.Provider and provider.Backups interfaces to pass contract fields explicitly and standardize status via ServiceStatus/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, but parseBackup currently accepts a missing/empty value and passes it through. This will call the provider with an empty ServiceID, 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.

Comment thread provider/routes.go
Comment thread provider/routes.go
@utkuerol
utkuerol requested a review from cemysf August 21, 2026 08:36
@utkuerol
utkuerol merged commit 31fe171 into main Aug 21, 2026
4 checks passed
@utkuerol
utkuerol deleted the refactor/explicit-provider-contract branch August 21, 2026 09:16
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>
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.

3 participants