Commit graph

11 commits

Author SHA1 Message Date
Viktor Torstensson
7b3916596f
session: cover empty caveat verification ids
Add migration coverage for nested empty caveat verification IDs
and normalize the migrated SQL representation so empty byte
slices compare consistently with the KV store.
2026-05-19 11:27:12 +02:00
Viktor Torstensson
80dead031f
session: use sqlcmig6 for kvdb to sql migration
This commit updates the session package to use the new `sqlcmig6`
package for kvdb to SQL migration.
2026-05-14 11:38:06 +02:00
Viktor Torstensson
252d1206b6
multi: use sqldb/v2 in session package
Update the session package to use the `sqldb/v2` package instead of the
older version.
2026-05-14 11:37:43 +02:00
ffranr
a0e63124c0
multi: reformat long lines for readability
- Replace occurrences of `// nolint:lll` with `// nolint:ll` across
  files for consistency.
- Reformat multiline strings, comments, and function parameters to
  improve clarity and adhere to style guidelines.
- Add `// nolint:ll` comments where necessary to prevent linter
  warnings.
2025-12-09 16:12:03 +00:00
Viktor Torstensson
3d10572280
session: fix empty config for features in sql mig
In the bbolt store, an empty config for a feature is represented as an
empty array, while in for the SQL store, the same config is represented
as nil. Therefore, in the scenario where a specific feature has an empty
config, we override the SQL FeatureConfig for that feature to also be
set to an empty array. This is needed to ensure that the deep equals
check in the migration validation does not fail in this scenario.
2025-11-10 13:40:51 +01:00
Viktor Torstensson
b4b36f653f
session: handle removed linked account
If a user creates a session linked to an account, but later deletes that
account using the `litcli accounts remove` command, the KVDB session
will still contain the account ID of the removed account.

During the KVDB to SQL migration, the accounts migration runs before the
sessions migration. Since the deleted account no longer exists, it
cannot be migrated. As a result, the migrated SQL session cannot link to
the now non-existent account in the SQL store.

In such cases, we will migrate the session and not link to any account
in the SQL session.
2025-09-26 20:46:50 +02:00
Viktor Tigerström
dfe0fa8b07
session: handle multiple sessions with the same ID
The logic to avoid duplicate session IDs was first added with the
session linking linking functionality. That means that there may be old
legacy sessions that were added prior to that which may have duplicate
IDs. Before this commit, such sessions would cause the kvdb to SQL
migration to error, as there is a uniqueness constraint on the legacy
session alias in the SQL sessions table.

We want to keep that constraint, so in such rare cases, we update the
kvdb to SQL migration logic to drop all but the session with the
latest CreatedAt time if for sessions that share the same ID.
That follows the logic in c8b78bd10d as
closely as possible, as that migration ensured that all sessions but the
latest one was revoked if multiple sessions shared the same ID.
2025-08-21 16:03:31 +02:00
Viktor Tigerström
2d3564b36b
session: add expected results to migration tests
In the upcoming commit, we will update the kvdb to sql migration to not
always include all sessions in the kvdb store. Therefore, we update the
kvdb to migration tests in order to be able to handle such cases by
including the expected results for each test case.
2025-08-19 23:22:15 +02:00
Oliver Gugger
c417adf318
mod+accounts+session: update to latest lnd RC 2025-07-11 18:41:16 +02:00
Viktor Tigerström
2007d538ec
session: add randomized session migration test 2025-06-12 13:06:27 +02:00
Viktor Tigerström
8f1aa99ee5
session: add migration code from kvdb to SQL
This commit introduces the migration logic for transitioning the
sessions store from kvdb to SQL.

Note that as of this commit, the migration is not yet triggered by any
production code, i.e. only tests execute the migration logic.
2025-06-12 11:52:39 +02:00