Skip to content

server: restore Service compatibility and fix API check - #247

Merged
Flash-LHR merged 2 commits into
trpc-group:mainfrom
Rememorio:restore_service_compatibility
Jul 27, 2026
Merged

Flash-LHR merged 2 commits into
trpc-group:mainfrom
Rememorio:restore_service_compatibility

Conversation

@Rememorio

@Rememorio Rememorio commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • remove ServiceName() from the public server.Service interface
  • keep ServiceName() available on the built-in service implementation
  • verify that custom services implementing the original three-method interface remain valid
  • align the API compatibility check with trpc-group/trpc-agent-go by using joelanford/go-apidiff against the PR merge base

API check root cause

imjasonh/apidiff-action@v0.0.3 passed the base and head Git SHAs directly to apidiff. The tool interpreted those SHAs as Go package import paths and failed to load them. The action swallowed that error and reported that no breaking changes were detected. It also could not post its PR comment because fork pull requests receive a read-only token.

The replacement follows the trpc-agent-go workflow: it calculates the merge base with the target branch and passes that revision to joelanford/go-apidiff. There is no exception or allowlist. Breaking API changes fail the check.

Compatibility

Adding a method to an exported Go interface prevents existing third-party implementations from compiling. This restores the server.Service contract from v1.0.3 without changing built-in service behavior.

This intentionally prioritizes compatibility with existing custom server.Service implementations. Code introduced against v1.0.4 that calls server.New(...).ServiceName() directly must instead use an optional interface assertion:

if namer, ok := service.(interface{ ServiceName() string }); ok {
    name := namer.ServiceName()
    _ = name
}

The corrected API check reports this removal as incompatible and is expected to fail on this PR.

Testing

  • go test ./...
  • GOTOOLCHAIN=go1.19.13 go test ./server
  • actionlint
  • verified joelanford/go-apidiff exits non-zero and reports Service.ServiceName: removed against the PR merge base

@Rememorio Rememorio changed the title server: restore Service interface compatibility server: restore Service compatibility and fix API check Jul 27, 2026
@Rememorio Rememorio added type/api-change Adds, removes, or changes an API type/ci Changes the CI configuration files and scripts labels Jul 27, 2026
@Rememorio
Rememorio force-pushed the restore_service_compatibility branch from 503145b to c1383d1 Compare July 27, 2026 12:32

@Flash-LHR Flash-LHR left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Flash-LHR
Flash-LHR merged commit 56878a2 into trpc-group:main Jul 27, 2026
5 of 6 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 27, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

type/api-change Adds, removes, or changes an API type/ci Changes the CI configuration files and scripts

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants