feat(vcs): extract interfaces and types from gitea/ (Phase 1, #78)
Add vcs/interfaces.go and vcs/types.go as the foundation for multi-platform VCS support. Interfaces are discovered from working gitea/client.go code, not invented in a vacuum. vcs/interfaces.go — role-based interfaces: - PRReader: GetPullRequest, GetPullRequestDiff, GetPullRequestFiles - FileReader: GetFileContent (path + ref), ListContents - Reviewer: PostReview (ReviewRequest), ListReviews, DeleteReview - Identity: GetAuthenticatedUser - Client: all four composed vcs/types.go — types extracted from gitea/: - PullRequest, ChangedFile, ContentEntry, Review (identical to gitea/) - ReviewComment: uses GitHub diff-position convention (Position int, CommitID string) instead of Gitea's NewPosition int64 - ReviewRequest: new type wrapping Body, Event, Comments vcs/check.go (//go:build ignore) — documents the gaps gitea.Client must bridge in Phase 2: 1. PostReview signature mismatch (event+body+[]ReviewComment vs ReviewRequest) 2. GetFileContent missing ref parameter 3. ReviewComment type mismatch (NewPosition vs Position/CommitID) No behavior changes. All existing tests pass.
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
//go:build ignore
|
||||
|
||||
// This file is excluded from normal builds.
|
||||
// Run `go build -v .` inside this file to see the documented gaps between
|
||||
// gitea.Client and vcs.Client that Phase 2 (Gitea adapter) must bridge.
|
||||
//
|
||||
// Known gaps (as of Phase 1):
|
||||
//
|
||||
// 1. PostReview signature mismatch:
|
||||
// gitea.Client: PostReview(ctx, owner, repo, number, event, body string, comments []gitea.ReviewComment)
|
||||
// vcs.Reviewer: PostReview(ctx, owner, repo, number, req vcs.ReviewRequest)
|
||||
//
|
||||
// 2. GetFileContent signature mismatch:
|
||||
// gitea.Client: GetFileContent(ctx, owner, repo, filepath string) [no ref; uses default branch]
|
||||
// vcs.FileReader: GetFileContent(ctx, owner, repo, path, ref string)
|
||||
// (gitea.Client has GetFileContentRef for the ref variant)
|
||||
//
|
||||
// 3. ReviewComment type mismatch:
|
||||
// gitea.ReviewComment uses NewPosition int64 (Gitea line-number convention)
|
||||
// vcs.ReviewComment uses Position int (GitHub diff-position convention)
|
||||
//
|
||||
// The Gitea adapter (Phase 2) will wrap gitea.Client to bridge these gaps.
|
||||
|
||||
package vcs
|
||||
|
||||
import "gitea.weiker.me/rodin/review-bot/gitea"
|
||||
|
||||
// This compile-time assertion intentionally fails.
|
||||
// It documents what the Gitea adapter must implement to satisfy vcs.Client.
|
||||
var _ Client = (*gitea.Client)(nil)
|
||||
Reference in New Issue
Block a user