Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/max-safe-event-revisions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"hunkdiff": patch
---

Accept the full safe-integer revision range when resuming browser review event streams.
9 changes: 9 additions & 0 deletions src/session/reviewEventProtocol.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ describe("review event names and ids", () => {
type: "publication",
address: ADDRESS,
});

const maximumAddress = { ...ADDRESS, stateRevision: Number.MAX_SAFE_INTEGER };
expect(parseReviewEventId(reviewEventId("publication", maximumAddress))).toEqual({
type: "publication",
address: maximumAddress,
});
});

// A client echoes `Last-Event-ID` back at the server, so the parser is the boundary an
Expand All @@ -75,6 +81,9 @@ describe("review event names and ids", () => {
expect(
parseReviewEventId(`revent:publication:generation:test:3@${"9".repeat(40)}`),
).toBeUndefined();
expect(
parseReviewEventId("revent:publication:generation:test:3@9007199254740992"),
).toBeUndefined();
expect(parseReviewEventId(42)).toBeUndefined();
});
});
Expand Down
2 changes: 1 addition & 1 deletion src/session/reviewEventProtocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export function parseReviewEventId(
if (typeof value !== "string" || value.length > MAX_REVIEW_EVENT_ID_BYTES) {
return undefined;
}
const match = /^revent:([a-z-]+):(.+)@(\d{1,15})$/.exec(value);
const match = /^revent:([a-z-]+):(.+)@(\d{1,16})$/.exec(value);
if (!match) {
return undefined;
}
Expand Down