feat(be): add a session record to the account reference schema - #4241
Merged
Merged
Conversation
|
✅ No security or compliance issues detected. Reviewed everything up to 709ce21. Security Overview
Detected Code Changes
|
sea-snake
force-pushed
the
feat/session-record-storage
branch
from
August 19, 2026 02:57
6a6c5f6 to
da0fd37
Compare
sea-snake
force-pushed
the
feat/session-record-storage
branch
from
August 19, 2026 06:28
da0fd37 to
7d057e5
Compare
sea-snake
force-pushed
the
feat/session-record-storage
branch
from
August 19, 2026 07:07
7d057e5 to
0573b6b
Compare
sea-snake
force-pushed
the
feat/session-record-storage
branch
from
August 19, 2026 08:17
0573b6b to
e6333ae
Compare
sea-snake
force-pushed
the
feat/session-record-storage
branch
from
August 19, 2026 08:37
e6333ae to
dcee0af
Compare
sea-snake
force-pushed
the
feat/session-record-storage
branch
from
August 20, 2026 10:57
dcee0af to
1e5b98f
Compare
sea-snake
force-pushed
the
feat/session-record-storage
branch
from
August 20, 2026 13:08
1e5b98f to
40a61a3
Compare
sea-snake
force-pushed
the
feat/session-record-storage
branch
3 times, most recently
from
August 22, 2026 17:24
a47c5f2 to
373891e
Compare
sea-snake
force-pushed
the
feat/session-record-storage
branch
2 times, most recently
from
August 22, 2026 18:58
28a2358 to
cfb3840
Compare
…l-index # Conflicts: # src/internet_identity/src/storage.rs
…al-index-backfill
`remove_reference_list` discarded the `Result` that `apply_reference_counter_deltas` now returns, so a failed counter write was dropped on the path that retires a row. The tests do not see it because an unused `Result` is a warning until CI runs clippy with `-D warnings`. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…rack-default-accounts
…l-index # Conflicts: # src/internet_identity/src/storage.rs
…al-index-backfill
…notonic-application-numbers
…ccount-empty-list-is-not-default
…rack-default-accounts
…al-index-backfill
An error occurred while trying to automatically change base from
feat/account-principal-index-backfill
to
feat/account-principal-index
September 8, 2026 13:10
The six pull requests below this one were squash-merged, so main carries their content under different commits. The trees are identical, so this merge takes no content from main and only puts the branch back on top of it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LVi99RYo2jyi2kCurgovNJ
sea-snake
changed the base branch from
feat/account-principal-index-backfill
to
main
September 8, 2026 14:13
The identifier a session record carries names a browser, which is what the registry above this stores and what the settings page shows. Naming it here keeps the rename out of the branch that introduces the registry, and away from `device`, which this repository already uses for a passkey. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LVi99RYo2jyi2kCurgovNJ
MRmarioruci
reviewed
Sep 8, 2026
MRmarioruci
reviewed
Sep 8, 2026
MRmarioruci
reviewed
Sep 8, 2026
MRmarioruci
approved these changes
Sep 8, 2026
MRmarioruci
reviewed
Sep 8, 2026
The sweep has shipped and run everywhere it had to: it was in release-2026-09-08, and the write path has kept the index in step by itself since the index existed. What is left is a timer that walks every reference list after each upgrade — its completion flag is heap state, so an upgrade forgets it — to write entries that are already there. Goes together with the monitoring query, the cursor and outcome types, and the tests that covered them. The index itself and the write-path maintenance stay: those are what keep it true. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LVi99RYo2jyi2kCurgovNJ
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LVi99RYo2jyi2kCurgovNJ # Conflicts: # src/internet_identity/src/storage/tests.rs
sea-snake
changed the base branch from
main
to
chore/retire-account-principal-index-backfill
September 8, 2026 15:53
MRmarioruci
approved these changes
Sep 9, 2026
Base automatically changed from
chore/retire-account-principal-index-backfill
to
main
September 9, 2026 10:53
`is_over` left the caller to find out which bound it meant, and its doc had to say "on either bound" to make up for it — so the name says it and the doc explains why it is one question. `demonstrated_use` returns a span rather than a use, and `reclaim_order` returns a key rather than an order. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LVi99RYo2jyi2kCurgovNJ
#4312 and #4318 landed: the backfill is gone, and so is the account counter discrepancy counter this stack never touched. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LVi99RYo2jyi2kCurgovNJ
`SessionRecord` is a session, not a record of one, and `Record` reads the way `Object` would in JavaScript. The storable follows the sibling convention — `StorableSession` in `storable/session.rs`, next to the other storables named after their domain type. `#[cbor(map)]` stores integer indices, so no field name reaches disk and there is nothing to migrate. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LVi99RYo2jyi2kCurgovNJ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Design: #4224, on the storage of #4222. Overview: #4230. The schema only — #4266 is what writes a session.
An app delegation is unrevocable for as long as it is valid, which is up to 30 days: the client holds a self-contained canister-signed artifact whose verification never consults the canister again. The fix needs somewhere to put a long-lived, revocable record, and #4222 gives a capped, evictable per-account store to hang it on.
A session is
(created_at, valid_till, last_refreshed, browser_id, read_only)on the account reference. Nothing else. Putting it there rather than in a map of its own means it inherits the per-anchor caps that already bound references, so revoking, expiring and evicting reuse machinery that exists.Option, so references written under the previous schema decode unchanged, and an empty list is not stored.last_refreshedis mutable, which is why it is the one field that will not feed the session's seed: a mutable input would change the session's principal every time it was stamped.reclaim_orderranks dead sessions first, then live ones onlast_used + (last_used - created_at)— recency extended by how long the session stayed in service, so an app in weekly use outranks one opened once yesterday. feat(be): cap sessions per identity #4267 is what enforces a cap with it.AccountReference::newreplaces the struct literals, so adding the field did not spread across every construction site.Tests:
session_tests(11), including a reference written before sessions existed decoding with none, a list holding a session being evictable like any other, and a flood of unused sessions failing to displace a used one.