fix(proto): keep EventsSinceRequest.since_id's wire name
The cursor change renamed the field to 'cursor' as well as widening its type, which buf breaking flags as FIELD_SAME_NAME and FIELD_SAME_JSON_NAME on top of the type change. The name buys nothing: the field is already documented as an opaque cursor, and the number and name are the wire identity. Adopt the gate's verdict and change only the type, keeping the break confined to the one rule already recorded in proto/buf.yaml.
This commit is contained in:
5 files changed
+29
-22
No files matched your search
@@ -4134,10 +4134,12 @@ func (x *InsertEventResponse) GetId() int64 {
|
||||
|
||||
type EventsSinceRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
// cursor is the opaque resume cursor returned by the previous page (the SSE
|
||||
// since_id is the opaque resume cursor returned by the previous page (the SSE
|
||||
// id: field, echoed back as Last-Event-ID). Empty means "from the
|
||||
// beginning".
|
||||
Cursor string `protobuf:"bytes,1,opt,name=cursor,proto3" json:"cursor,omitempty"`
|
||||
// beginning". The field keeps its name and number so the wire name stays
|
||||
// put; only its type widened, from the SQLite rowid to the fixed-width
|
||||
// "<at>|<row id>" cursor.
|
||||
SinceId string `protobuf:"bytes,1,opt,name=since_id,json=sinceId,proto3" json:"since_id,omitempty"`
|
||||
Limit int64 `protobuf:"varint,2,opt,name=limit,proto3" json:"limit,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
@@ -4173,9 +4175,9 @@ func (*EventsSinceRequest) Descriptor() ([]byte, []int) {
|
||||
return file_state_v1_state_proto_rawDescGZIP(), []int{70}
|
||||
}
|
||||
|
||||
func (x *EventsSinceRequest) GetCursor() string {
|
||||
func (x *EventsSinceRequest) GetSinceId() string {
|
||||
if x != nil {
|
||||
return x.Cursor
|
||||
return x.SinceId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
@@ -7928,9 +7930,9 @@ const file_state_v1_state_proto_rawDesc = "" +
|
||||
"\x12InsertEventRequest\x12%\n" +
|
||||
"\x05event\x18\x01 \x01(\v2\x0f.state.v1.EventR\x05event\"%\n" +
|
||||
"\x13InsertEventResponse\x12\x0e\n" +
|
||||
"\x02id\x18\x01 \x01(\x03R\x02id\"B\n" +
|
||||
"\x12EventsSinceRequest\x12\x16\n" +
|
||||
"\x06cursor\x18\x01 \x01(\tR\x06cursor\x12\x14\n" +
|
||||
"\x02id\x18\x01 \x01(\x03R\x02id\"E\n" +
|
||||
"\x12EventsSinceRequest\x12\x19\n" +
|
||||
"\bsince_id\x18\x01 \x01(\tR\asinceId\x12\x14\n" +
|
||||
"\x05limit\x18\x02 \x01(\x03R\x05limit\">\n" +
|
||||
"\x13EventsSinceResponse\x12'\n" +
|
||||
"\x06events\x18\x01 \x03(\v2\x0f.state.v1.EventR\x06events\",\n" +
|
||||
|
||||
@@ -216,7 +216,7 @@ func (c *Client) InsertEvent(ctx context.Context, e events.Event) (int64, error)
|
||||
}
|
||||
|
||||
func (c *Client) EventsSince(ctx context.Context, cursor string, limit int) ([]events.Event, error) {
|
||||
r, err := c.client.EventsSince(ctx, &pb.EventsSinceRequest{Cursor: cursor, Limit: int64(limit)})
|
||||
r, err := c.client.EventsSince(ctx, &pb.EventsSinceRequest{SinceId: cursor, Limit: int64(limit)})
|
||||
if err != nil {
|
||||
return nil, unmapError(err)
|
||||
}
|
||||
|
||||
@@ -283,7 +283,7 @@ func (s *server) InsertEvent(ctx context.Context, r *pb.InsertEventRequest) (*pb
|
||||
}
|
||||
|
||||
func (s *server) EventsSince(ctx context.Context, r *pb.EventsSinceRequest) (*pb.EventsSinceResponse, error) {
|
||||
evs, err := s.deps.Tasks.EventsSince(ctx, r.Cursor, int(r.Limit))
|
||||
evs, err := s.deps.Tasks.EventsSince(ctx, r.SinceId, int(r.Limit))
|
||||
if err != nil {
|
||||
return nil, s.logErr("EventsSince", err)
|
||||
}
|
||||
|
||||
+12
-9
@@ -7,15 +7,18 @@ lint:
|
||||
breaking:
|
||||
use:
|
||||
- FILE
|
||||
# The PocketBase migration moved the event-capture contract's record ids from
|
||||
# the SQLite rowid (int64) to PocketBase's string record ids, in place, on the
|
||||
# same field numbers: 16 fields across CapturedEvent, Mapping, Binding,
|
||||
# RecordDispatchRequest, EnqueueBindingTaskRequest, Task.binding_id and the
|
||||
# Id-bearing request/response messages. That is an intentional wire break, and
|
||||
# both ends of the State Store contract ship from this repository together, so
|
||||
# the two halves cannot be versioned apart. Only the type rule is relaxed, and
|
||||
# only in this file: every other FILE breaking rule still applies here, and no
|
||||
# other contract is affected.
|
||||
# Two intentional wire breaks, both widening an id-shaped field from int64 to
|
||||
# string in place, on the same field numbers and names. The PocketBase
|
||||
# migration moved the event-capture contract's record ids to PocketBase's
|
||||
# string record ids: CapturedEvent, Mapping, Binding, RecordDispatchRequest,
|
||||
# EnqueueBindingTaskRequest, Task.binding_id and the Id-bearing
|
||||
# request/response messages. Separately, EventsSinceRequest.since_id now
|
||||
# carries the opaque "<at>|<row id>" resume cursor instead of a rowid.
|
||||
#
|
||||
# The State Store contract's two halves ship from this repository together, so
|
||||
# they cannot be versioned apart. Only the type rule is relaxed, and only in
|
||||
# this file: every other FILE breaking rule still applies here, so a rename,
|
||||
# a renumber or a removal is still caught, and no other contract is affected.
|
||||
ignore_only:
|
||||
FIELD_SAME_TYPE:
|
||||
- state/v1/state.proto
|
||||
@@ -470,10 +470,12 @@ message InsertEventRequest { Event event = 1; }
|
||||
message InsertEventResponse { int64 id = 1; }
|
||||
|
||||
message EventsSinceRequest {
|
||||
// cursor is the opaque resume cursor returned by the previous page (the SSE
|
||||
// since_id is the opaque resume cursor returned by the previous page (the SSE
|
||||
// id: field, echoed back as Last-Event-ID). Empty means "from the
|
||||
// beginning".
|
||||
string cursor = 1;
|
||||
// beginning". The field keeps its name and number so the wire name stays
|
||||
// put; only its type widened, from the SQLite rowid to the fixed-width
|
||||
// "<at>|<row id>" cursor.
|
||||
string since_id = 1;
|
||||
int64 limit = 2;
|
||||
}
|
||||
message EventsSinceResponse { repeated Event events = 1; }
|
||||
|
||||
Reference in new issue
Block a user