Move the shown cursor of each session to its last event: schema version 3 #75

Merged
mikluko merged 1 commit from server-shown-head into main 2026-11-16 09:52:26 +00:00
Owner

From roomcity-ee, after specs-58's review of #68 (the shown cursor): on the city the shown column of version 2 is stale. Nothing moved it since the migration to version 2 put it at the head of that moment (09:16Z: guest 1096 of 1166, host 631), so the first server that keeps the cursor would show each room again from there.

Schema version 3: UPDATE sessions SET shown = COALESCE((SELECT MAX(seq) FROM events WHERE events.session = sessions.name), 0), applied when the server opens a version-2 database, in the same transaction mechanism as version 2's, and after the copy of the database as it was (roomcity.v2.<time>.db, from #64's copy). A database of version 1 goes through both. A later version is refused as before.

Test: a version-2 store whose cursors are behind the head (guest's at 2 of 6, host's at 0 of 1) is moved to the head, is of version 3, has made the version-2 copy, and a version-3 database is not moved or copied again; the two tests of version 1 now expect version 3.

#68 should not merge before this.

Assisted-By: Claude noreply@anthropic.com

From roomcity-ee, after specs-58's review of #68 (the shown cursor): on the city the `shown` column of version 2 is stale. Nothing moved it since the migration to version 2 put it at the head of that moment (09:16Z: guest 1096 of 1166, host 631), so the first server that keeps the cursor would show each room again from there. Schema version 3: `UPDATE sessions SET shown = COALESCE((SELECT MAX(seq) FROM events WHERE events.session = sessions.name), 0)`, applied when the server opens a version-2 database, in the same transaction mechanism as version 2's, and after the copy of the database as it was (`roomcity.v2.<time>.db`, from #64's copy). A database of version 1 goes through both. A later version is refused as before. Test: a version-2 store whose cursors are behind the head (guest's at 2 of 6, host's at 0 of 1) is moved to the head, is of version 3, has made the version-2 copy, and a version-3 database is not moved or copied again; the two tests of version 1 now expect version 3. #68 should not merge before this. Assisted-By: Claude <noreply@anthropic.com>
Move the shown cursor of each session to its last event: schema version 3
All checks were successful
test / changelog (pull_request) Successful in 5s
image / image (pull_request) Successful in 17s
test / go (pull_request) Successful in 57s
003c89ca89
Version 2 had the column and nothing kept it, so on the city it stands
where the migration to version 2 put it, up to an hour behind; the first
server that keeps the cursor would show each room again from there. The
migration to version 3 sets each cursor to the session's last event, after
the copy of the database as it was (roomcity.v2.<time>.db).

Assisted-By: Claude <noreply@anthropic.com>
mikluko force-pushed server-shown-head from 003c89ca89
All checks were successful
test / changelog (pull_request) Successful in 5s
image / image (pull_request) Successful in 17s
test / go (pull_request) Successful in 57s
to 641ab522cc
Some checks failed
image / image (pull_request) Successful in 15s
test / changelog (pull_request) Failing after 6s
test / go (pull_request) Successful in 45s
2026-11-16 09:45:23 +00:00
Compare
mikluko force-pushed server-shown-head from 641ab522cc
Some checks failed
image / image (pull_request) Successful in 15s
test / changelog (pull_request) Failing after 6s
test / go (pull_request) Successful in 45s
to 478742947e
All checks were successful
image / image (pull_request) Successful in 4s
test / changelog (pull_request) Successful in 5s
test / go (pull_request) Successful in 45s
2026-11-16 09:47:19 +00:00
Compare
mikluko force-pushed server-shown-head from 478742947e
All checks were successful
image / image (pull_request) Successful in 4s
test / changelog (pull_request) Successful in 5s
test / go (pull_request) Successful in 45s
to b1b325b806
All checks were successful
image / image (pull_request) Successful in 18s
test / changelog (pull_request) Successful in 6s
test / go (pull_request) Successful in 45s
2026-11-16 09:51:05 +00:00
Compare
mikluko deleted branch server-shown-head 2026-11-16 09:52:26 +00:00
Commenting is not possible because the repository is archived.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
mikluko/roomcity!75
No description provided.