odba 1.2.0 → 1.2.1

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: 384e9358b0cfe5735935d1b1d2e43706b01adaceb9a0c2cce51a357a2a8321eb
4
- data.tar.gz: 79568f015a42389ee5abe8f159f6baefc0e300ac0c6d692b1856ab7c3613d08b
3
+ metadata.gz: ea8626e332e7e9650d0221804e2cc6b6767e0fdedbabb507faaa2ad104b4199e
4
+ data.tar.gz: '06848ad3f7def177deec9c62385e1b63c56fcbf3e6d161f3a73e60a70a0c92a9'
5
5
  SHA512:
6
- metadata.gz: a2a5cac7871f9d46476e7f45edc3c2afc31dfc2517cfa67b5fdd97e740f331c8b39b018ce2c3928046215d5fcdc11e4dbe2e9b5b70bf6231c33e0690b6bc364f
7
- data.tar.gz: 967b6811d2f8833145a9ee90ffe6c5b84c896ef23ee663e616b2a9f25efff33930cde98ea4d35b3d279ee6a74feed785badb249d5ca32cd1ba6eeb989fc794a9
6
+ metadata.gz: 2d55bb2c6b46d92bd89da28489544b8fc68e8c4fd16a94f3deefef5970376fa2a607c9c9c811506c6f66147f02fcc9981148baf89acd54ae528c51c2b0a7dda6
7
+ data.tar.gz: 2337e2c7910c89653bdb6ddb90150aa38794096f1c5110bd94ae0f4bd54f84006d6ae8cf4bb08bc467e1d0c78d5d28cbfd5e7788611cf75bb83739432d8f3a75
@@ -7,24 +7,28 @@ on:
7
7
  jobs:
8
8
  tests:
9
9
  strategy:
10
+ # without this a failure on one OS cancels the other, hiding its result
11
+ fail-fast: false
10
12
  matrix:
11
- os: [ubuntu-latest, macos-latest]
13
+ # macos-latest dropped: it costs ~8 minutes per run for a library that
14
+ # is deployed on Linux, and its Nix/devenv setup is the fragile part -
15
+ # not odba itself. Re-add it here if that ever becomes worth the wait.
16
+ os: [ubuntu-latest]
12
17
  runs-on: ${{ matrix.os }}
13
18
 
14
19
  steps:
15
20
  - uses: actions/checkout@v4
16
- - uses: cachix/install-nix-action@v26
17
- - uses: cachix/cachix-action@v14
21
+ - uses: cachix/install-nix-action@v31
22
+ - uses: cachix/cachix-action@v16
18
23
  with:
19
24
  name: devenv
20
25
  - name: Install devenv.sh
21
26
  run: nix profile install nixpkgs#devenv
22
27
 
23
- - name: Build the devenv shell and run any pre-commit hooks
28
+ # devenv test builds the shell, runs any pre-commit hooks, brings the
29
+ # postgres service up and then runs enterTest, which waits for the server
30
+ # and runs test/example.rb against it. A separate step re-running
31
+ # example.rb duplicated that work and raced initdb a second time without
32
+ # waiting, which is what kept macOS red.
33
+ - name: Build the devenv shell and run test/example.rb against a real postgres
24
34
  run: devenv test
25
-
26
- - name: Run the example.rb which uses a real database
27
- shell: devenv shell bash -- -e {0}
28
- run: |
29
- devenv up --detach
30
- devenv shell bundle exec ruby test/example.rb
@@ -25,9 +25,8 @@ jobs:
25
25
  matrix:
26
26
  os: [ ubuntu]
27
27
  ruby: [3.2, 3.3, 3.4]
28
- continue-on-error: ${{ matrix.ruby.to_s == '3.3' || matrix.ruby.to_s == '3.4' }}
29
28
  steps:
30
- - uses: actions/checkout@v2
29
+ - uses: actions/checkout@v4
31
30
  - uses: ruby/setup-ruby@v1
32
31
  with:
33
32
  ruby-version: ${{ matrix.ruby }}
data/.gitignore CHANGED
@@ -13,3 +13,7 @@ devenv.local.nix
13
13
 
14
14
  # pre-commit
15
15
  .pre-commit-config.yaml
16
+
17
+ # built gems - a committed .gem ends up in spec.files (git ls-files) and
18
+ # makes the gemspec invalid: "odba-x.y.z contains itself"
19
+ *.gem
data/History.md CHANGED
@@ -1,3 +1,23 @@
1
+ ## 1.2.1 / 21.08.2026
2
+
3
+ No library changes: lib/ is identical to 1.2.0. This release only ships a test
4
+ suite and CI that pass.
5
+
6
+ * Cleared CacheEntry's @@id_table between cache tests. Its ObjectSpace
7
+ finalizer calls ODBA.cache.invalidate, so objects left by earlier tests were
8
+ collected at unpredictable moments and deleted ids the running test had just
9
+ stored - the long standing flakiness in test_clean, test_clean__prefetched
10
+ and test_transaction
11
+ * Fixed test_to_obj for drb >= 2.2, which resolves only ids to_id handed out
12
+ rather than looking them up with ObjectSpace._id2ref
13
+ * Bumped install-nix-action to v31: v26 cannot provision Nix build users on
14
+ current macOS images
15
+ * Stopped starting the processes twice in enterTest and waited for postgres
16
+ before running test/example.rb
17
+ * Declared the git-hooks input that current devenv no longer injects implicitly
18
+ * Dropped a continue-on-error that used matrix.ruby.to_s, which GitHub Actions
19
+ expressions do not support, so it silently never applied
20
+
1
21
  ## 1.2.0 / 21.08.2026
2
22
 
3
23
  * Reconnect when the database connection was lost. ydbd-pg reports a lost
data/devenv.nix CHANGED
@@ -47,7 +47,20 @@
47
47
  languages.ruby.version = "3.4";
48
48
  # See full reference at https://devenv.sh/reference/options/
49
49
  enterTest = ''
50
- devenv up --detach
51
- bundle exec test/example.rb
50
+ # No `devenv up` here: `devenv test` already starts the processes before
51
+ # running enterTest, so starting them again aborts the whole run with
52
+ # "Processes already running with PID ...".
53
+ #
54
+ # Those processes come up in parallel with this script. On slower runners
55
+ # initdb is still creating template0 when we arrive and the first connect
56
+ # is refused, so wait for postgres to accept connections. The bare
57
+ # pg_isready afterwards turns "never came up" into a clear error rather
58
+ # than a confusing PG::ConnectionBad from the test.
59
+ for _ in $(seq 1 60); do
60
+ if pg_isready --host 127.0.0.1 --port 5432 > /dev/null 2>&1; then break; fi
61
+ sleep 1
62
+ done
63
+ pg_isready --host 127.0.0.1 --port 5432
64
+ bundle exec ruby test/example.rb
52
65
  '';
53
66
  }
data/devenv.yaml CHANGED
@@ -1,6 +1,14 @@
1
1
  inputs:
2
2
  nixpkgs:
3
3
  url: github:NixOS/nixpkgs/nixos-24.11
4
+ # Declared explicitly because devenv no longer injects it implicitly: its
5
+ # git-hooks module throws "git-hooks or pre-commit-hooks input required".
6
+ # This mirrors what devenv.lock already records, so the lock stays valid.
7
+ git-hooks:
8
+ url: github:cachix/git-hooks.nix
9
+ inputs:
10
+ nixpkgs:
11
+ follows: nixpkgs
4
12
  nixpkgs-ruby:
5
13
  url: github:bobvanderlinden/nixpkgs-ruby
6
14
  inputs:
data/lib/odba/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  class Odba
4
- VERSION = '1.2.0'
4
+ VERSION = '1.2.1'
5
5
  end
data/test/test_cache.rb CHANGED
@@ -33,6 +33,15 @@ module ODBA
33
33
  @cache.fetched = {}
34
34
  @cache.prefetched = {}
35
35
  @cache.indices = {}
36
+ ## CacheEntry registers an ObjectSpace finalizer that calls
37
+ ## ODBA.cache.invalidate, which deletes the odba_id from the shared
38
+ ## singleton cache. Objects left behind by earlier tests are collected at
39
+ ## unpredictable moments, so without dropping their finalizer bookkeeping
40
+ ## a stray GC run deletes the very ids this test just stored. That is the
41
+ ## long standing flakiness in test_clean, test_clean__prefetched and
42
+ ## test_transaction: they failed on some Ruby versions and not others,
43
+ ## and a different test failed on each run of identical code.
44
+ ODBA::CacheEntry.class_variable_set(:@@id_table, {})
36
45
  end
37
46
 
38
47
  def teardown
@@ -78,7 +78,13 @@ module ODBA
78
78
  def test_to_obj
79
79
  ODBA.cache.should_receive(:store)
80
80
  o = Object.new
81
- assert_equal(o, @idconv.to_obj(o.object_id))
81
+ ## drb >= 2.2 resolves only those ids it handed out itself: DRbIdConv
82
+ ## keeps a DRbObjectSpace WeakMap that to_id populates, and to_obj raises
83
+ ## RangeError for anything absent from it. Older drb looked the id up
84
+ ## with ObjectSpace._id2ref, which resolved any live object. Register the
85
+ ## object first, as real DRb traffic does - an id only reaches to_obj
86
+ ## after to_id produced it.
87
+ assert_equal(o, @idconv.to_obj(@idconv.to_id(o)))
82
88
  o.extend(ODBA::Persistable)
83
89
  o.instance_variable_set(:@odba_id, 4)
84
90
  o.odba_isolated_store
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: odba
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masaomi Hatakeyama, Zeno R.R. Davatz