railwatch 0.3.2 → 0.3.3

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: a2929e5724d581361c5ce2e20a4184dcde4ad190edca068527a5f565043c5a9c
4
- data.tar.gz: e63ea3bc8d89318bc4e296d17c006eb87dfb3ea06be0db5dea4dea6035a0dfc5
3
+ metadata.gz: 9c88b489c82195c106d414c397d391d8cf2e8d3e499dd67715d3db14fc4f7dae
4
+ data.tar.gz: 3a2bb00def3c244d0eb9630f1eb6b3d4fddb29ea17cf34e2c8023123c92bdaf3
5
5
  SHA512:
6
- metadata.gz: b9477f54a79df466ad5113b56d7206cc7da3d6dd76db86e30c568bc6a9e6378a6545d2a3013fae33d6cef2ffd4d986fd18e9b07051ba67429a52fe38bb33fdee
7
- data.tar.gz: '0892577170dc73fcd351ce620da0908afd9d2bd4b78f672e2931efb7130eacde83219664cd8d6afac36416d97c691d4897ab2355e6ff5c3f976ec3b4e73ac80b'
6
+ metadata.gz: f616d461f05f956503d2fa37d20dd238f98f1f77624665e6c352c675b9df12704b2a912e15b8bcf6d992192a86016b3ee39e8924b7b4a70d9bbe24f61d5c4845
7
+ data.tar.gz: 8d372cfaed4dd585b39a8bbd6f042b9af6bada233e92dc7e0021613507e6bc0d570cc120bce4f1f5ef163c223ea8855a730781c16bc5fd34321a9cff10020607
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.3 (2026-09-19)
4
+
5
+ - Fix `railwatch:install --local` writing test databases that parallel test
6
+ runners cannot share. The generated `test` entries named
7
+ `storage/test_railwatch*.sqlite3` with no `TEST_ENV_NUMBER`, so every worker
8
+ in a parallel run opened the same two SQLite files and raced through them:
9
+ `ActiveRecord::PendingMigrationError` and `SQLite3::IOException: disk I/O
10
+ error` out of `configure_connection`, on every shard. Rails' own test
11
+ database naming carries the number for this reason, and the generated names
12
+ now do too. An app with no parallel runner sets no `TEST_ENV_NUMBER`, so its
13
+ generated file is unchanged and no existing install needs migrating.
14
+
3
15
  ## 0.3.2 (2026-09-19)
4
16
 
5
17
  - Fix an embedded install's rake tasks reporting over HTTP instead of into
@@ -383,12 +383,26 @@ module Railwatch
383
383
  lines.insert(start + 1, " primary:\n")
384
384
  stop += 1
385
385
  end
386
- entries = format(RAILWATCH_DATABASES, env: env).lines.map { |line| " #{line}" }
386
+ entries = format(RAILWATCH_DATABASES, env: database_prefix(env)).lines.map { |line| " #{line}" }
387
387
  lines = insert_lines(lines, stop, entries.join).lines
388
388
  end
389
389
  lines.join
390
390
  end
391
391
 
392
+ # What the database filenames are built from. For test that has to carry
393
+ # TEST_ENV_NUMBER, the way Rails' own test database naming does: runners
394
+ # like parallel_tests give each worker its own number and expect a
395
+ # database per worker. Without it every worker in a run opens the same
396
+ # two SQLite files and they fight over them -- observed as
397
+ # PendingMigrationError and "disk I/O error" from configure_connection,
398
+ # on an app running four workers. An app with no such runner sets no
399
+ # TEST_ENV_NUMBER, so the suffix is empty and the name is unchanged.
400
+ def self.database_prefix(env)
401
+ return env unless env == "test"
402
+
403
+ %(test<%= ENV["TEST_ENV_NUMBER"] %>)
404
+ end
405
+
392
406
  # Unconditional: `bundle exec puma` evaluates this file before it loads
393
407
  # the Rack app, so `if defined?(Railwatch)` would be false there and the
394
408
  # writer would never start. The plugin itself is inert when Railwatch is
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Railwatch
4
- VERSION = "0.3.2"
4
+ VERSION = "0.3.3"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: railwatch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cole Robertson