lex-llm-ledger 0.2.9 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6719c8b6ccdca27627040432c378248b93a95e95fd5deb4873262ed1ba287655
4
- data.tar.gz: fb09090ebb8a2ec6aef542f03fbd804e11bcc9c33a9b97d5e4004cded0a11ba3
3
+ metadata.gz: bedae52b0629ce6755fc321019b9c35917e8d4f8a304c7294956cbba864fa676
4
+ data.tar.gz: c3f171de566906d37cb02c755f0336df1ce0f09dcdf769e84961f574e3b9d77e
5
5
  SHA512:
6
- metadata.gz: 43f307490c3f943e932eea1abf2584cfd115d472de59b12c56acb6201f295890b9d42d34c1c56d0394a604d432c18b1bb2bc80b27396d060e50e386dc858b1fd
7
- data.tar.gz: b452b9ef5639bb01c7c1ccb311a97ed29fad412efa4bb14a0a05cdcaf6dac6eea3fd728679709f8f05f6030d7a9e0cdddeb4b359a6bf36b5ebf8d391d2228605
6
+ metadata.gz: f8623ee921c7e0b610217925aea11e9f0f5b315b89b56d2ea239aefa9b0ac9d17b298b1f95978f784f6932ab005fa906c5c32bdd78d1f3eb47dcefb73f3762f9
7
+ data.tar.gz: 278ed50a3f63394470ede944211cc0893e1c8c52bda2200209161040eba3a07a0d62aa47dbfbf37e913ecdaa8d474a4144f1961b60b3e0dcfdb3af936daf155e
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.3.0] - 2026-05-08
4
+
5
+ ### Changed
6
+ - Renamed all `portable_identity_*` table references to canonical identity table names (`identities`, `identity_principals`, `identity_providers`).
7
+ - Renamed internal methods: `resolve_portable_identity` → `resolve_identity`, `find_or_create_portable_identity` → `find_or_create_identity`.
8
+
3
9
  ## [0.2.9] - 2026-05-07
4
10
 
5
11
  ### Fixed
@@ -4,7 +4,7 @@ module Legion
4
4
  module Extensions
5
5
  module Llm
6
6
  module Ledger
7
- VERSION = '0.2.9'
7
+ VERSION = '0.3.0'
8
8
  end
9
9
  end
10
10
  end
@@ -322,11 +322,11 @@ module Legion
322
322
  refs = { principal_id: explicit_principal_id, identity_id: explicit_identity_id }.compact
323
323
  unless refs[:principal_id] && refs[:identity_id]
324
324
  if explicit_identity_id && !explicit_principal_id && identity_tables_available?(db)
325
- row = db[:portable_identities].where(id: explicit_identity_id).first
325
+ row = db[:identities].where(id: explicit_identity_id).first
326
326
  refs[:principal_id] = row[:principal_id] if row
327
327
  end
328
328
 
329
- resolved = resolve_portable_identity(db, body)
329
+ resolved = resolve_identity(db, body)
330
330
  refs[:principal_id] ||= resolved[:principal_id]
331
331
  refs[:identity_id] ||= resolved[:identity_id]
332
332
  end
@@ -334,7 +334,7 @@ module Legion
334
334
  end
335
335
  end
336
336
 
337
- def resolve_portable_identity(db, body)
337
+ def resolve_identity(db, body)
338
338
  return {} unless identity_tables_available?(db)
339
339
 
340
340
  descriptor = parsed_identity_descriptor(body)
@@ -342,7 +342,7 @@ module Legion
342
342
 
343
343
  provider = find_or_create_identity_provider(db, descriptor[:provider_name])
344
344
  principal = find_or_create_identity_principal(db, descriptor)
345
- identity = find_or_create_portable_identity(db, principal, provider, descriptor)
345
+ identity = find_or_create_identity(db, principal, provider, descriptor)
346
346
 
347
347
  { principal_id: principal[:id], identity_id: identity[:id] }
348
348
  rescue StandardError => e
@@ -392,12 +392,12 @@ module Legion
392
392
  end
393
393
 
394
394
  def find_or_create_identity_provider(db, provider_name)
395
- table = db[:portable_identity_providers]
395
+ table = db[:identity_providers]
396
396
  existing = table.where(name: provider_name).first
397
397
  return existing if existing
398
398
 
399
- id = insert_row(db, :portable_identity_providers, {
400
- uuid: deterministic_uuid("portable_identity_provider:#{provider_name}"),
399
+ id = insert_row(db, :identity_providers, {
400
+ uuid: deterministic_uuid("identity_provider:#{provider_name}"),
401
401
  name: provider_name,
402
402
  provider_type: provider_name == 'local' ? 'local' : 'external',
403
403
  facing: 'internal',
@@ -412,12 +412,12 @@ module Legion
412
412
  end
413
413
 
414
414
  def find_or_create_identity_principal(db, descriptor)
415
- table = db[:portable_identity_principals]
415
+ table = db[:identity_principals]
416
416
  existing = table.where(canonical_name: descriptor[:canonical_name], kind: descriptor[:kind]).first
417
417
  return existing if existing
418
418
 
419
- id = insert_row(db, :portable_identity_principals, {
420
- uuid: deterministic_uuid("portable_identity_principal:#{descriptor[:kind]}:#{descriptor[:canonical_name]}"),
419
+ id = insert_row(db, :identity_principals, {
420
+ uuid: deterministic_uuid("identity_principal:#{descriptor[:kind]}:#{descriptor[:canonical_name]}"),
421
421
  canonical_name: descriptor[:canonical_name],
422
422
  kind: descriptor[:kind],
423
423
  display_name: descriptor[:canonical_name],
@@ -431,8 +431,8 @@ module Legion
431
431
  table.where(canonical_name: descriptor[:canonical_name], kind: descriptor[:kind]).first
432
432
  end
433
433
 
434
- def find_or_create_portable_identity(db, principal, provider, descriptor)
435
- table = db[:portable_identities]
434
+ def find_or_create_identity(db, principal, provider, descriptor)
435
+ table = db[:identities]
436
436
  existing = table.where(
437
437
  principal_id: principal[:id],
438
438
  provider_id: provider[:id],
@@ -440,8 +440,8 @@ module Legion
440
440
  ).first
441
441
  return existing if existing
442
442
 
443
- uuid_key = "portable_identity:#{principal[:id]}:#{provider[:id]}:#{descriptor[:provider_identity_key]}"
444
- id = insert_row(db, :portable_identities, {
443
+ uuid_key = "identity:#{principal[:id]}:#{provider[:id]}:#{descriptor[:provider_identity_key]}"
444
+ id = insert_row(db, :identities, {
445
445
  uuid: deterministic_uuid(uuid_key),
446
446
  principal_id: principal[:id],
447
447
  provider_id: provider[:id],
@@ -451,18 +451,18 @@ module Legion
451
451
  is_default: true,
452
452
  created_at: Time.now.utc,
453
453
  updated_at: Time.now.utc
454
- }, operation: 'official_record_writer.portable_identity')
454
+ }, operation: 'official_record_writer.identity')
455
455
  table[id: id]
456
456
  rescue Sequel::UniqueConstraintViolation => e
457
- handle_exception(e, level: :debug, handled: true, operation: 'official_record_writer.portable_identity_race')
457
+ handle_exception(e, level: :debug, handled: true, operation: 'official_record_writer.identity_race')
458
458
  table.where(principal_id: principal[:id], provider_id: provider[:id],
459
459
  provider_identity_key: descriptor[:provider_identity_key]).first
460
460
  end
461
461
 
462
462
  def identity_tables_available?(db)
463
- db.table_exists?(:portable_identity_providers) &&
464
- db.table_exists?(:portable_identity_principals) &&
465
- db.table_exists?(:portable_identities)
463
+ db.table_exists?(:identity_providers) &&
464
+ db.table_exists?(:identity_principals) &&
465
+ db.table_exists?(:identities)
466
466
  end
467
467
 
468
468
  def normalize_caller_type(value)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lex-llm-ledger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.9
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esity