lex-metering 0.1.16 → 0.1.17

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: 4b90e69ccdc11eb888b7876e51028b09f31eb1af90c1bd13cd157094206e08cf
4
- data.tar.gz: cbf0e8c74af206b2473efc67ec982a9aa3ae75afe794a461035d2caa9306fc97
3
+ metadata.gz: a10fe9b6e2c40b71f7556167188a71be8d73484d765f23279d2994936cf74a2f
4
+ data.tar.gz: ad31523cc20bc16562d434ba5b58dce57bad8e881ae28312fe8dcb0018f25823
5
5
  SHA512:
6
- metadata.gz: 671d819df21bbd2d220fd18aba534847d3c048e2d131122c68d212938a6d63270a4161c22f49208599c19682c147cf4b331ecc05a04c7c3c0c01d105e0079d89
7
- data.tar.gz: 241c993213715d59c198dcae98e1145a1d0122a95b1ef8639af85466683114f609df577f6c01dec682d490bf08cd344881008195b99afe792169d8bdb2b8c1f0
6
+ metadata.gz: 777d385018eed31833102a0f5a4099159f95797590b5776bd4111d2684903ccd848217d025ebb9f15ea0b4af9291e9ad6022e2784dd1646a3fb8c1a5f3708a9e
7
+ data.tar.gz: 9479d089f44883e9e11ce9683d3d5c47090b493720ea1aba918ca8323d79056629a7cfde4c9945e8edbca0a9f4d9a673821b8163fd4e3c026a3f74aeb21bc977
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.1.17] - 2026-05-29
4
+ ### Fixed
5
+ - `rollup_hour`: group raw records in Ruby via `records_ds.all.group_by { ... }` instead of `records_ds.group_by { ... }`. `Sequel::Dataset#group_by` is an alias for `#group`, so calling it on the dataset built an invalid SQL `GROUP BY []("worker_id"), ...` clause that PostgreSQL rejected (`PG::SyntaxError: syntax error at or near "["`), failing the hourly rollup actor on every tick.
6
+ - Rollup spec: assert the generated SQL never contains a malformed array `GROUP BY` by exercising a real Sequel mock-postgres connection (previously a dataset double stubbed `group_by` to behave like `Enumerable#group_by`, masking the defect).
7
+
3
8
  ## [0.1.16] - 2026-05-17
4
9
  ### Fixed
5
10
  - Migration 001: remove indexes from `create_table?` block (Sequel creates indexes even when table exists, causing DuplicateTable error)
@@ -17,7 +17,11 @@ module Legion
17
17
  .where(::Sequel.lit('recorded_at >= ? AND recorded_at < ?', hour, hour_end))
18
18
 
19
19
  raw_count = records_ds.count
20
- groups = records_ds.group_by { |r| [r[:worker_id], r[:provider], r[:model_id]] }
20
+ # Group in Ruby, not in SQL: Sequel::Dataset#group_by is an alias for #group
21
+ # (it builds a SQL GROUP BY clause), so calling it on the dataset emits invalid
22
+ # SQL (GROUP BY []("worker_id"), ...) instead of the intended in-memory grouping.
23
+ # Materialise the rows first, then use Enumerable#group_by on the array.
24
+ groups = records_ds.all.group_by { |r| [r[:worker_id], r[:provider], r[:model_id]] }
21
25
 
22
26
  rollup_dataset = Legion::Data.connection[:metering_hourly_rollup]
23
27
  rolled_up = 0
@@ -3,7 +3,7 @@
3
3
  module Legion
4
4
  module Extensions
5
5
  module Metering
6
- VERSION = '0.1.16'
6
+ VERSION = '0.1.17'
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lex-metering
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.16
4
+ version: 0.1.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esity