partition_gardener 0.3.8 → 0.3.9

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: 7ebf369d2fcab7b189d2c99e1ac2e55bc1c280c8a02db75c81bd1ecd60c0d841
4
- data.tar.gz: b41d5c9be9577411d70855566d21d4db12acbb2f4003633223e33932d119f6a8
3
+ metadata.gz: 98b92281aeb4170b89c00bb5572877f61f09ae57165466d501ac978b426c12e0
4
+ data.tar.gz: 56ef9a4140d737bc9c056b7a8d212776a7833c2a3ffadc1feaf2d1732554a0ef
5
5
  SHA512:
6
- metadata.gz: 870391d868e46568da268ff1ff6b5950eb6461790af61cb03f91caaf7f0cae76e9ac1db83c9098d6ba6184be2530c1cf0c7b37bcf0278cb92e4a415626d7c37e
7
- data.tar.gz: b7f6894465691e62f3c80290a350beebd553ab43be0e666fcd4a8c25dd906e33641f2dbef8ebd2178c9ce8dabc81dc4dfb09bee5628bcee6a05e65a184072042
6
+ metadata.gz: 16d5658b4b310269f3a4c20da3b4b50ae0716b1c411d41c209ec817748b2ce6d08e57a5f4b7dff3dcb416583546f42edd06eeb3133a9a6d5a1000be5836a9eab
7
+ data.tar.gz: 97ed6b345cb06a8ba74023c2cf18ba664c1dac91fbd7d275570d8b81ca8843dbe0494b3861fc7b0e04e777de08c7a7363fb0b171e58e2d36fd2e51e69a8e6b6f
data/CHANGELOG.md CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.3.9 (2026-11-13)
6
+
7
+ - Make Railtie, CLI, HotSwitchConcern, and Integer duration helpers opt-in requires instead of loading them from the default `partition_gardener` require; hosts that need Rails defaults must require `partition_gardener/railtie`, and hot-switch migrations must require `partition_gardener/migration/hot_switch_concern`
8
+ - Fix register-time `partman.part_config` probe so a missing relation does not abort an open Postgres transaction (`PG::InFailedSqlTransaction` after Ruby rescued `StatementInvalid`)
9
+
5
10
  ## 0.3.8 (2026-11-05)
6
11
 
7
12
  - Fix hot-switch migrations aborting with `SystemStackError` when included into `ActiveRecord::Migration` on Rails 8 (private `connection` override recursed through `DefaultStrategy`)
data/README.md CHANGED
@@ -49,8 +49,8 @@ Complements migration gems (e.g. [pg_party](https://github.com/rkrage/pg_party))
49
49
  ## Quick start
50
50
 
51
51
  ```ruby
52
- # Gemfile
53
- gem "partition_gardener"
52
+ # Gemfile — require the railtie only when you want Rails connection/today defaults
53
+ gem "partition_gardener", require: ["partition_gardener", "partition_gardener/railtie"]
54
54
  ```
55
55
 
56
56
  ```ruby
@@ -143,9 +143,11 @@ See [docs/partition_landscape.md](docs/partition_landscape.md) for the template
143
143
 
144
144
  ## Hot-switch migrations
145
145
 
146
- `PartitionGardener::Migration::HotSwitchConcern` (alias `HotSwitchPartitionedTable`) consolidates cutover migration helpers.
146
+ `PartitionGardener::Migration::HotSwitchConcern` (alias `HotSwitchPartitionedTable`) consolidates cutover migration helpers. Require it explicitly in the migration file:
147
147
 
148
148
  ```ruby
149
+ require "partition_gardener/migration/hot_switch_concern"
150
+
149
151
  class PartitionEventsHotSwitch < ActiveRecord::Migration[8.0]
150
152
  include PartitionGardener::Migration::HotSwitchConcern
151
153
 
@@ -1,42 +1,62 @@
1
1
  bundle gem version licenses
2
- root activemodel 8.1.4 MIT
3
- root activerecord 8.1.4 MIT
4
- root activesupport 8.1.4 MIT
2
+ root actionpack 8.1.4.1 MIT
3
+ root actionview 8.1.4.1 MIT
4
+ root activemodel 8.1.4.1 MIT
5
+ root activerecord 8.1.4.1 MIT
6
+ root activesupport 8.1.4.1 MIT
5
7
  root appraisal 2.5.0 MIT
6
8
  root ast 2.4.3 MIT
7
9
  root base64 0.3.0 Ruby|BSD-2-Clause
8
10
  root bigdecimal 4.1.3 Ruby|BSD-2-Clause
11
+ root builder 3.3.0 MIT
9
12
  root bundler 4.0.16 MIT
10
13
  root concurrent-ruby 1.3.8 MIT
11
14
  root connection_pool 3.0.2 MIT
15
+ root crass 1.0.8 MIT
12
16
  root diff-lcs 1.6.2 MIT|Artistic-1.0-Perl|GPL-2.0-or-later
13
17
  root drb 2.2.3 Ruby|BSD-2-Clause
18
+ root erb 6.0.7 Ruby|BSD-2-Clause
19
+ root erubi 1.13.1 MIT
14
20
  root i18n 1.15.2 MIT
21
+ root io-console 0.9.5 Ruby|BSD-2-Clause
22
+ root irb 1.19.0 Ruby|BSD-2-Clause
15
23
  root json 3.1.0 Ruby
16
24
  root language_server-protocol 3.17.0.6 MIT
17
25
  root lint_roller 1.1.0 MIT
18
26
  root logger 1.7.0 Ruby|BSD-2-Clause
19
- root minitest 6.0.6 MIT
27
+ root loofah 2.25.3 MIT
28
+ root minitest 6.1.0 MIT
29
+ root nokogiri 1.19.7 MIT
20
30
  root parallel 2.3.0 MIT
21
31
  root parser 3.3.13.0 MIT
22
- root partition_gardener 0.3.8 MIT
32
+ root partition_gardener 0.3.9 MIT
23
33
  root pg 1.6.3 BSD-2-Clause
24
- root polyrun 2.2.5 MIT
25
- root prism 1.9.0 MIT
26
- root prosopite 2.2.0 Apache-2.0
34
+ root polyrun 3.0.0 MIT
35
+ root pp 0.6.4 Ruby|BSD-2-Clause
36
+ root prettyprint 0.2.1 Ruby|BSD-2-Clause
37
+ root prism 2.1.0 MIT
38
+ root prosopite 2.5.0 Apache-2.0
27
39
  root racc 1.8.1 Ruby|BSD-2-Clause
28
40
  root rack 3.2.8 MIT
41
+ root rack-session 2.1.2 MIT
42
+ root rack-test 2.3.0 MIT
43
+ root rackup 2.3.1 MIT
44
+ root rails-dom-testing 2.3.0 MIT
45
+ root rails-html-sanitizer 1.7.2 MIT
46
+ root railties 8.1.4.1 MIT
29
47
  root rainbow 3.1.1 MIT
30
48
  root rake 13.4.2 MIT
31
49
  root rbs 4.2.0 BSD-2-Clause|Ruby
50
+ root rdoc 8.1.0 Ruby|GPL-2.0-only
32
51
  root regexp_parser 2.13.1 MIT
52
+ root reline 0.7.0 Ruby
33
53
  root rspec 3.13.2 MIT
34
- root rspec-core 3.13.6 MIT
35
- root rspec-expectations 3.13.5 MIT
36
- root rspec-mocks 3.13.8 MIT
37
- root rspec-support 3.13.7 MIT
54
+ root rspec-core 3.13.7 MIT
55
+ root rspec-expectations 3.13.6 MIT
56
+ root rspec-mocks 3.13.9 MIT
57
+ root rspec-support 3.13.8 MIT
38
58
  root rubocop 1.91.0 MIT
39
- root rubocop-ast 1.50.0 MIT
59
+ root rubocop-ast 1.51.0 MIT
40
60
  root rubocop-capybara 2.23.0 MIT
41
61
  root rubocop-factory_bot 2.28.0 MIT
42
62
  root rubocop-performance 1.26.1 MIT
@@ -58,3 +78,5 @@ root tzinfo 2.0.6 MIT
58
78
  root unicode-display_width 3.3.0 MIT
59
79
  root unicode-emoji 4.3.0 MIT
60
80
  root uri 1.1.2 Ruby|BSD-2-Clause
81
+ root useragent 0.16.11 MIT
82
+ root zeitwerk 2.8.3 MIT
@@ -0,0 +1,26 @@
1
+ # Register-time partman probe no longer aborts an open transaction when partman.part_config is missing.
2
+
3
+ ## Participants
4
+
5
+ Andrei Makarov (@amkisko)
6
+
7
+ ## Decisions
8
+
9
+ - Gate the `partman.part_config` SELECT on `to_regclass(...)::text` so absence is a null result, not an error that marks the transaction aborted.
10
+ - Document that a savepoint wrap also works but costs more on the common no-partman path.
11
+
12
+ ## Effects
13
+
14
+ - `Registry.register` / `MaintenanceBackend.validate!` stay safe inside RSpec transactional examples and other outer transactions without pg_partman.
15
+ - Host prepend workarounds that only checked `to_regclass` can be removed after this gem version is locked.
16
+
17
+ ## Next
18
+
19
+ - Cut into CHANGELOG under `## 0.3.9 (2026-11-13)`.
20
+ - Commit, tag `0.3.9`, push, and run `make release`.
21
+
22
+ ## Source
23
+
24
+ - docs/issues/20261113104337_partman-probe-aborts-open-transactions.md
25
+ - lib/partition_gardener/connection.rb
26
+ - spec/integration/partman_probe_transaction_spec.rb
@@ -0,0 +1,25 @@
1
+ # Default require no longer pulls Railtie, CLI, HotSwitch, or Integer duration helpers.
2
+
3
+ ## Participants
4
+
5
+ Andrei Makarov (@amkisko)
6
+
7
+ ## Decisions
8
+
9
+ - Treat side paths as opt-in requires; document Gemfile and migration require lines.
10
+ - Keep `auto_configure` on the railtie so requiring the railtie remains one clear consent switch.
11
+
12
+ ## Effects
13
+
14
+ - Apps boot without gem Railtie configuration unless they require `partition_gardener/railtie`.
15
+ - Cutover migrations and the CLI load only when those entry points are required.
16
+ - Boot footprint report and contract spec capture the default-require inventory.
17
+
18
+ ## Next
19
+
20
+ - Cut into CHANGELOG under `## 0.3.9 (2026-11-13)`.
21
+ - Commit, tag `0.3.9`, push, and run `make release`.
22
+
23
+ ## Source
24
+
25
+ - docs/issues/20261113110417_opt-in-boot-side-paths.md
@@ -0,0 +1,28 @@
1
+ # Cut patch release 0.3.9
2
+
3
+ ## Participants
4
+
5
+ Andrei Makarov (@amkisko)
6
+
7
+ ## Decisions
8
+
9
+ - Bump `PartitionGardener::VERSION` to `0.3.9`.
10
+ - Record the opt-in boot side paths and partman probe transaction fix in `CHANGELOG.md` under `## 0.3.9 (2026-11-13)`.
11
+ - Stay on `main`. No trunk branch.
12
+
13
+ ## Effects
14
+
15
+ - Moved the Unreleased notes into the 0.3.9 section.
16
+ - Synced path-gem lockfile versions to 0.3.9.
17
+ - Tightened boot footprint `$LOADED_FEATURES` matching to `lib/partition_gardener` so checkout paths under `vendor/bundle` are not counted as gardener files.
18
+ - GitHub release notes now come from the matching `CHANGELOG.md` section via `--notes-file` instead of `--generate-notes`.
19
+
20
+ ## Next
21
+
22
+ - Commit the prepared tree on `main`, tag `0.3.9`, push, and run `make release` (gem push, tag push, GitHub release).
23
+
24
+ ## Source
25
+
26
+ - Fix notes: `docs/changelogs/20261113110417_opt-in-boot-side-paths.md`, `docs/changelogs/20261113104337_partman-probe-aborts-open-transactions.md`
27
+ - Issues: `docs/issues/20261113110417_opt-in-boot-side-paths.md`, `docs/issues/20261113104337_partman-probe-aborts-open-transactions.md`
28
+ - `CHANGELOG.md`, `lib/partition_gardener/version.rb`
@@ -10,6 +10,9 @@ Pick layout and maintainer first ([decision_flow.md](decision_flow.md), [tooling
10
10
  ## Global configuration
11
11
 
12
12
  ```ruby
13
+ # Gemfile — railtie is opt-in (sets Active Record + Time.zone defaults)
14
+ gem "partition_gardener", require: ["partition_gardener", "partition_gardener/railtie"]
15
+
13
16
  # config/initializers/partition_gardener.rb
14
17
  PartitionGardener.configure do |config|
15
18
  config.notifier = ->(message_or_error, context: {}) {
@@ -25,7 +28,14 @@ PartitionGardener.configure do |config|
25
28
  end
26
29
  ```
27
30
 
28
- When the gem loads inside Rails, the railtie sets `connection_resolver` and `today_resolver` automatically.
31
+ Default `require "partition_gardener"` does not load the Railtie, CLI, hot-switch concern, or Integer duration helpers. Opt in:
32
+
33
+ - `require "partition_gardener/railtie"` — Rails defaults for `connection_resolver` and `today_resolver` (disable with `config.partition_gardener.auto_configure = false` in `config/application.rb`)
34
+ - `require "partition_gardener/cli"` — CLI (also loaded by `exe/partition_gardener`)
35
+ - `require "partition_gardener/migration/hot_switch_concern"` — cutover migrations
36
+ - `require "partition_gardener/stdlib_extensions"` then `PartitionGardener.install_stdlib_extensions!` — `Integer#minutes` / `#seconds` when Active Support is absent
37
+
38
+ When the railtie is required and `auto_configure` is true, it sets `connection_resolver` and `today_resolver` during Rails initialization.
29
39
 
30
40
  `notifier` (default: no-op proc) — receives errors and info messages with a `context:` hash (`table_name`, `job`, `action`, …).
31
41
 
data/docs/cutover.md CHANGED
@@ -34,6 +34,8 @@ For cross-database copies (production → staging, or a second cluster during mi
34
34
  Use `PartitionGardener::Migration::HotSwitchConcern` in a migration:
35
35
 
36
36
  ```ruby
37
+ require "partition_gardener/migration/hot_switch_concern"
38
+
37
39
  class PartitionEventsHotSwitch < ActiveRecord::Migration[8.0]
38
40
  include PartitionGardener::Migration::HotSwitchConcern
39
41
 
@@ -0,0 +1,29 @@
1
+ # When partman.part_config is absent, the register-time probe still aborts an open Postgres transaction after Ruby rescues StatementInvalid.
2
+
3
+ ## Participants
4
+
5
+ Andrei Makarov (@amkisko)
6
+
7
+ ## Decisions
8
+
9
+ - Probe with `to_regclass('partman.part_config')::text` before selecting from the table so a missing relation returns null instead of raising.
10
+ - Keep `MaintenanceBackend.partman_parent_configured?` rescue as defense for unrelated statement failures.
11
+ - Prefer `to_regclass` over a savepoint wrap: local measurement showed the missing-relation savepoint path about 3x slower than the catalog null check.
12
+
13
+ ## Effects
14
+
15
+ - Reproduced before the fix: `MaintenanceBackend.partman_parent_configured?` returned false inside an open transaction, then `SELECT 1` raised `PG::InFailedSqlTransaction`.
16
+ - After the fix: the same sequence leaves the outer transaction usable; `Registry.register` no longer poisons transactional RSpec examples on DBs without pg_partman.
17
+ - Integration specs cover absent probe, register inside a transaction, and a hit when a stub `partman.part_config` lists the parent.
18
+
19
+ ## Next
20
+
21
+ - Publish `0.3.9` (`make release` after commit and clean tree). Host apps can drop prepend workarounds once that version is locked.
22
+ - Optional later: cache the relation presence check across a register burst if register volume ever makes the extra round trip when partman is installed measurable.
23
+
24
+ ## Source
25
+
26
+ - lib/partition_gardener/connection.rb (`partman_parent_configured?`)
27
+ - lib/partition_gardener/maintenance_backend.rb
28
+ - spec/integration/partman_probe_transaction_spec.rb
29
+ - docs/changelogs/20261113104337_partman-probe-aborts-open-transactions.md
@@ -0,0 +1,36 @@
1
+ # Default require loaded CLI, HotSwitch, Railtie (when Rails::Railtie was defined), and an Integer duration monkey-patch without an explicit host opt-in.
2
+
3
+ ## Participants
4
+
5
+ Andrei Makarov (@amkisko)
6
+
7
+ ## Decisions
8
+
9
+ - Keep maintenance/register/run on the default require so existing jobs and initializers keep working.
10
+ - Make Railtie, CLI, HotSwitchConcern, and stdlib Integer helpers explicit requires.
11
+ - Railtie uses `config.partition_gardener.auto_configure` (default true once the railtie is loaded) so hosts can require the railtie file without overwriting resolvers.
12
+ - Record boot footprint with `usr/reports/boot_footprint.rb` and a subprocess contract spec.
13
+
14
+ ## Effects
15
+
16
+ - Before (this machine, 20 cold subprocesses): mean 37.64 ms, 55 gardener files; Integer duration patch installed when Active Support Duration was absent; CLI and HotSwitch constants always defined; Railtie auto-loaded whenever `Rails::Railtie` was already defined.
17
+ - After (same method, 20 cold subprocesses): mean 34.75 ms, 52 gardener files; CLI / HotSwitch / Railtie / stdlib_extensions absent from default require.
18
+ - Absolute time win is small while the maintenance stack stays eager; the contract win is consent (no silent Railtie or monkey-patch).
19
+ - Specs that use CLI or HotSwitch require those files directly.
20
+
21
+ ## Next
22
+
23
+ - Publish `0.3.9` (`make release` after commit and clean tree).
24
+ - Host apps that relied on silent Railtie defaults must add `partition_gardener/railtie` to the Gemfile require list (or set resolvers in an initializer, which many already do).
25
+ - Hot-switch migrations must `require "partition_gardener/migration/hot_switch_concern"`.
26
+ - Optional later: further slim the default require if app boot budgets demand it; keep that behind an explicit runtime entry point rather than silent autoload.
27
+
28
+ ## Source
29
+
30
+ - lib/partition_gardener.rb
31
+ - lib/partition_gardener/railtie.rb
32
+ - lib/partition_gardener/rails.rb
33
+ - lib/partition_gardener/stdlib_extensions.rb
34
+ - spec/partition_gardener/boot_footprint_spec.rb
35
+ - usr/reports/boot_footprint.rb
36
+ - docs/changelogs/20261113110417_opt-in-boot-side-paths.md
@@ -0,0 +1,46 @@
1
+ # Engineering audit and release preparation
2
+
3
+ ## Participants
4
+
5
+ Andrei Makarov (@amkisko)
6
+
7
+ ## Decisions
8
+
9
+ - Continue on main. Do not commit, tag, push, or publish in this session.
10
+ - Cut patch release version 0.3.9 for opt-in boot side paths and the partman probe transaction fix. Set the CHANGELOG heading date to 2026-11-13.
11
+ - Re-check lint, executable coverage, workflow YAML parse, package boundaries, and cold-require cost after the cut.
12
+
13
+ ## Effects
14
+
15
+ - Bump `PartitionGardener::VERSION` and path-gem lockfiles to 0.3.9. Move the Unreleased bullets under `## 0.3.9 (2026-11-13)`.
16
+ - Fix boot footprint counting so paths under a checkout named `partition_gardener.rb` (including `vendor/bundle`) do not inflate `gardener_files`. Loose filter reported 68; `lib/partition_gardener` filter reports 52 and restores the `< 55` contract.
17
+ - Publish GitHub release body from the matching `CHANGELOG.md` section (`gh release create --notes-file`), not commit auto-notes.
18
+ - Final serial JSON report: 196 examples, 0 failures with `INTEGRATION=1` and PostgreSQL; no pending examples. Parallel polyrun with five workers: exit 0.
19
+ - Required project checks passed: rubocop (84 files, no offenses), rbs validate, `INTEGRATION=1` polyrun parallel-rspec. Environment: Ruby 4.0.2, `BUNDLE_PATH=vendor/bundle`.
20
+ - `release_spec`: 2 examples, 0 failures.
21
+ - Build the gem, verify it with `Gem::Package#verify`, and confirm the changelog heading matches version 0.3.9. Compressed package: 124928 bytes; source payload: 433997 bytes across 116 packaged paths. These are compressed versus uncompressed sizes, not interchangeable quantities.
22
+ - Cold process measurement on macOS arm64 with `/usr/bin/time -p` and `bundle exec ruby -Ilib`: 0.17 CPU seconds, 0.25 elapsed seconds. Peak RSS via `/usr/bin/time -l`: 30687232 bytes. Local smoke ceilings: 1 MiB compressed gem, 128 MiB RSS, 2 CPU seconds. Measured gem size, RSS, and CPU fit those ceilings. CPU seconds are the energy proxy; electricity use was not measured.
23
+ - Parse every workflow YAML, verify lockfile own-gem versions at 0.3.9, and run `git diff --check`. All passed. RubyGems has no `0.3.9` yet.
24
+
25
+ ## Next
26
+
27
+ - Commit, tag 0.3.9, push, and publish remain operator steps; this session did not run them. When the tree is clean, `make release` runs gem push, tag, and GitHub release.
28
+ - Host apps that relied on silent Railtie defaults must require `partition_gardener/railtie`. Hot-switch migrations must require `partition_gardener/migration/hot_switch_concern`.
29
+ - Hosted GitHub Actions and the complete supported Ruby/framework matrix were not executed locally beyond the default Gemfile path used by `make test`.
30
+ - Scope limits: production traffic, production database size and query plans, external service retention, and co-located resource interference were not measured. The local byte/CPU results do not establish those properties.
31
+ - Trace review follows local file/log and protocol emissions. No live customer identities or credentials were used. Data retention and deletion in embedding applications remain host contracts.
32
+ - Database-boundary mode applies to PostgreSQL maintenance DDL and the register-time partman catalog probe.
33
+
34
+ ## Source
35
+
36
+ - AGENTS.md
37
+ - .agents/skills/engineering-audit/SKILL.md
38
+ - .agents/skills/changelog-update/SKILL.md
39
+ - CHANGELOG.md
40
+ - Makefile
41
+ - spec/README.md
42
+ - docs/changelogs/20261113130745_cut-patch-release-0-3-9.md
43
+ - docs/changelogs/20261113110417_opt-in-boot-side-paths.md
44
+ - docs/changelogs/20261113104337_partman-probe-aborts-open-transactions.md
45
+ - docs/issues/20261113110417_opt-in-boot-side-paths.md
46
+ - docs/issues/20261113104337_partman-probe-aborts-open-transactions.md
@@ -1,6 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require "partition_gardener"
4
+ require "partition_gardener/stdlib_extensions"
5
+ PartitionGardener.install_stdlib_extensions!
4
6
  require "partition_gardener/cli"
5
7
 
6
8
  PartitionGardener::CLI.start
@@ -246,6 +246,13 @@ module PartitionGardener
246
246
  end
247
247
 
248
248
  def partman_parent_configured?(table_name)
249
+ # to_regclass returns null when the relation is missing; a direct SELECT would
250
+ # abort an open transaction even if Ruby rescues StatementInvalid.
251
+ relation = connection.execute(
252
+ "SELECT to_regclass('partman.part_config')::text AS relation_oid"
253
+ ).first
254
+ return false if Blank.blank?(relation&.fetch("relation_oid", nil))
255
+
249
256
  qualified_name = "#{schema_name}.#{table_name}"
250
257
  sql = <<~SQL
251
258
  SELECT 1
@@ -1,11 +1,16 @@
1
- require "rails"
2
-
3
1
  module PartitionGardener
4
2
  class Railtie < Rails::Railtie
5
- initializer "partition_gardener.connection" do
6
- PartitionGardener.configure do |config|
7
- config.connection_resolver = -> { ActiveRecord::Base.connection }
8
- config.today_resolver = -> { Time.zone.today }
3
+ config.partition_gardener = ActiveSupport::OrderedOptions.new
4
+ # Requiring partition_gardener/railtie opts in; set false to load the railtie
5
+ # without overwriting connection_resolver / today_resolver.
6
+ config.partition_gardener.auto_configure = true
7
+
8
+ initializer "partition_gardener.connection" do |app|
9
+ next unless app.config.partition_gardener.auto_configure
10
+
11
+ PartitionGardener.configure do |configuration|
12
+ configuration.connection_resolver = -> { ActiveRecord::Base.connection }
13
+ configuration.today_resolver = -> { Time.zone.today }
9
14
  end
10
15
  end
11
16
  end
@@ -0,0 +1,12 @@
1
+ # Opt-in Rails integration. Host apps that want Active Record and Time.zone
2
+ # defaults should require this file (Gemfile require list or an initializer).
3
+ #
4
+ # gem "partition_gardener", require: ["partition_gardener", "partition_gardener/railtie"]
5
+ #
6
+ # Or:
7
+ #
8
+ # # config/application.rb / an initializer
9
+ # require "partition_gardener/railtie"
10
+ #
11
+ require "rails/railtie"
12
+ require_relative "rails"
@@ -8,8 +8,12 @@ module PartitionGardener
8
8
  self
9
9
  end
10
10
  end
11
- end
12
11
 
13
- unless defined?(ActiveSupport::Duration)
14
- Integer.include(PartitionGardener::IntegerDurationMethods)
12
+ # Opt-in for non-ActiveSupport hosts (CLI/scripts). Rails apps already have Duration.
13
+ def self.install_stdlib_extensions!
14
+ return if defined?(ActiveSupport::Duration)
15
+ return if Integer.included_modules.include?(IntegerDurationMethods)
16
+
17
+ Integer.include(IntegerDurationMethods)
18
+ end
15
19
  end
@@ -1,3 +1,3 @@
1
1
  module PartitionGardener
2
- VERSION = "0.3.8"
2
+ VERSION = "0.3.9"
3
3
  end
@@ -3,8 +3,6 @@ require "date"
3
3
  require_relative "partition_gardener/version"
4
4
  require_relative "partition_gardener/date_calendar"
5
5
  require_relative "partition_gardener/date_bucket"
6
- require_relative "partition_gardener/stdlib_extensions"
7
- require "pg"
8
6
  require_relative "partition_gardener/pg_connection"
9
7
  require_relative "partition_gardener/blank"
10
8
  require_relative "partition_gardener/predicate"
@@ -53,8 +51,12 @@ require_relative "partition_gardener/audit"
53
51
  require_relative "partition_gardener/archive_retention"
54
52
  require_relative "partition_gardener/registry"
55
53
  require_relative "partition_gardener/config_document"
56
- require_relative "partition_gardener/cli"
57
- require_relative "partition_gardener/migration/hot_switch_concern"
54
+
55
+ # Side paths are opt-in (not loaded by default require):
56
+ # require "partition_gardener/cli"
57
+ # require "partition_gardener/migration/hot_switch_concern"
58
+ # require "partition_gardener/railtie"
59
+ # require "partition_gardener/stdlib_extensions" then PartitionGardener.install_stdlib_extensions!
58
60
 
59
61
  module PartitionGardener
60
62
  MOVE_BATCH_SIZE = 10_000
@@ -213,5 +215,3 @@ module PartitionGardener
213
215
  private :plan_all, :emit_run_metadata, :run_single_table!
214
216
  end
215
217
  end
216
-
217
- require_relative "partition_gardener/rails" if defined?(Rails::Railtie)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: partition_gardener
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.8
4
+ version: 0.3.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrei Makarov
@@ -85,14 +85,14 @@ dependencies:
85
85
  requirements:
86
86
  - - ">="
87
87
  - !ruby/object:Gem::Version
88
- version: 2.2.0
88
+ version: 2.2.9
89
89
  type: :development
90
90
  prerelease: false
91
91
  version_requirements: !ruby/object:Gem::Requirement
92
92
  requirements:
93
93
  - - ">="
94
94
  - !ruby/object:Gem::Version
95
- version: 2.2.0
95
+ version: 2.2.9
96
96
  - !ruby/object:Gem::Dependency
97
97
  name: prosopite
98
98
  requirement: !ruby/object:Gem::Requirement
@@ -281,6 +281,9 @@ files:
281
281
  - docs/changelogs/20261021220000_cut-patch-release-0-3-7.md
282
282
  - docs/changelogs/20261105085411_hot-switch-migration-connection-stack-overflow.md
283
283
  - docs/changelogs/20261105090326_cut-patch-release-0-3-8.md
284
+ - docs/changelogs/20261113104337_partman-probe-aborts-open-transactions.md
285
+ - docs/changelogs/20261113110417_opt-in-boot-side-paths.md
286
+ - docs/changelogs/20261113130745_cut-patch-release-0-3-9.md
284
287
  - docs/cli.md
285
288
  - docs/configuration.md
286
289
  - docs/cutover.md
@@ -292,6 +295,8 @@ files:
292
295
  - docs/issues/20260916113300_opaque-composite-public-ids.md
293
296
  - docs/issues/20260917123253_ci-drop-automatic-dependency-audit.md
294
297
  - docs/issues/20261105085411_hot-switch-migration-connection-stack-overflow.md
298
+ - docs/issues/20261113104337_partman-probe-aborts-open-transactions.md
299
+ - docs/issues/20261113110417_opt-in-boot-side-paths.md
295
300
  - docs/monitoring.md
296
301
  - docs/naming.md
297
302
  - docs/operations.md
@@ -305,6 +310,7 @@ files:
305
310
  - docs/reviews/20261029150855_engineering-audit-release-preparation.md
306
311
  - docs/reviews/20261105085411_engineering-audit-hot-switch-connection.md
307
312
  - docs/reviews/20261105090507_engineering-audit-release-preparation.md
313
+ - docs/reviews/20261113130745_engineering-audit-release-preparation.md
308
314
  - docs/schemas/partition_garden.schema.json
309
315
  - docs/schemas/plan_report.schema.json
310
316
  - docs/tooling_split.md
@@ -349,6 +355,7 @@ files:
349
355
  - lib/partition_gardener/predicate.rb
350
356
  - lib/partition_gardener/premake_monthly_maintenance.rb
351
357
  - lib/partition_gardener/rails.rb
358
+ - lib/partition_gardener/railtie.rb
352
359
  - lib/partition_gardener/registry.rb
353
360
  - lib/partition_gardener/run_failed.rb
354
361
  - lib/partition_gardener/run_metrics.rb