partition_gardener 0.3.9 → 0.3.10

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: 98b92281aeb4170b89c00bb5572877f61f09ae57165466d501ac978b426c12e0
4
- data.tar.gz: 56ef9a4140d737bc9c056b7a8d212776a7833c2a3ffadc1feaf2d1732554a0ef
3
+ metadata.gz: 9eed30d07f65d2f44a6eecdf810203aa5f8795c2a21335a524712223afe11441
4
+ data.tar.gz: 8128a4853d2f7ffdaa135fd7207b4435cf21d594a2eccc881f18d12ffdc0f303
5
5
  SHA512:
6
- metadata.gz: 16d5658b4b310269f3a4c20da3b4b50ae0716b1c411d41c209ec817748b2ce6d08e57a5f4b7dff3dcb416583546f42edd06eeb3133a9a6d5a1000be5836a9eab
7
- data.tar.gz: 97ed6b345cb06a8ba74023c2cf18ba664c1dac91fbd7d275570d8b81ca8843dbe0494b3861fc7b0e04e777de08c7a7363fb0b171e58e2d36fd2e51e69a8e6b6f
6
+ metadata.gz: c0250bd7fc94ce768ec218d468bfd1b555ad71aa5138d2024d6f38a322be35602efbcdc18d270bb91d8914dea6e7d584ef782e1025d5e7fc1c986229302174b5
7
+ data.tar.gz: a274a06f511ce1d7d65fdda3626a68d933916bf543b33dc7c6b9780461ae2ecf6995388a3ff4bedac89ae4dbeccd3e86593c8c9489887d1fd8cae57ac4d1c42a
data/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.3.10 (2026-11-19)
6
+
7
+ - Fix monthly premake so overlapping rows already in the default partition are moved into the new month child and attached under a parent write lock before create, instead of failing with a partition check violation
8
+
5
9
  ## 0.3.9 (2026-11-13)
6
10
 
7
11
  - 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`
@@ -29,7 +29,7 @@ root minitest 6.1.0 MIT
29
29
  root nokogiri 1.19.7 MIT
30
30
  root parallel 2.3.0 MIT
31
31
  root parser 3.3.13.0 MIT
32
- root partition_gardener 0.3.9 MIT
32
+ root partition_gardener 0.3.10 MIT
33
33
  root pg 1.6.3 BSD-2-Clause
34
34
  root polyrun 3.0.0 MIT
35
35
  root pp 0.6.4 Ruby|BSD-2-Clause
@@ -16,6 +16,7 @@ Andrei Makarov (@amkisko)
16
16
  - Synced path-gem lockfile versions to 0.3.9.
17
17
  - Tightened boot footprint `$LOADED_FEATURES` matching to `lib/partition_gardener` so checkout paths under `vendor/bundle` are not counted as gardener files.
18
18
  - GitHub release notes now come from the matching `CHANGELOG.md` section via `--notes-file` instead of `--generate-notes`.
19
+ - Pass `--title` with the version: `--notes-file` alone left release `name` empty ("undefined" in Discord/Slack). Live `0.3.9` title repaired with `gh release edit`.
19
20
 
20
21
  ## Next
21
22
 
@@ -0,0 +1,26 @@
1
+ # GitHub release create with --notes-file left release name empty.
2
+
3
+ ## Participants
4
+
5
+ Andrei Makarov (@amkisko)
6
+
7
+ ## Decisions
8
+
9
+ - Pass `--title` with the gem version whenever creating a release from changelog notes.
10
+ - Repair the published `0.3.9` release name in place (`gh release edit`); do not re-cut the gem.
11
+
12
+ ## Effects
13
+
14
+ - `gh release create` without `--generate-notes` does not fill `name`; empty name shows as "undefined" in Discord/Slack GitHub notifications.
15
+ - `usr/bin/release.rb` now runs `gh release create VERSION --title VERSION --notes-file ...`.
16
+ - Live release `0.3.9` name set to `0.3.9` (was empty string).
17
+
18
+ ## Next
19
+
20
+ - Commit the release script and spec fix on `main`.
21
+
22
+ ## Source
23
+
24
+ - usr/bin/release.rb
25
+ - spec/release_spec.rb
26
+ - https://github.com/amkisko/partition_gardener.rb/releases/tag/0.3.9
@@ -0,0 +1,30 @@
1
+ # Propagate CHANGELOG GitHub release notes across amkisko Ruby gems.
2
+
3
+ ## Participants
4
+
5
+ Andrei Makarov (@amkisko)
6
+
7
+ ## Decisions
8
+
9
+ - Same contract as partition_gardener and pray `github.sh`: release body from the matching `CHANGELOG.md` section; always pass `--title` with the version/tag.
10
+ - Batch-update every amkisko gem that uses `usr/bin/release.rb` plus `usr/lib/release_version_check.rb`.
11
+ - Skip `annotator` (app zip release, already has `--title`, still on `--generate-notes`).
12
+ - Do not create per-language GitHub releases for pray; that tree already publishes one `vX.Y.Z` release from root CHANGELOG.
13
+
14
+ ## Effects
15
+
16
+ - 24 gems received `changelog_notes_for` / `require_changelog_notes!` and `gh release create VERSION --title VERSION --notes-file tmp/github-release-notes.md`.
17
+ - 5 gems with `spec/release_spec.rb` assert `--title` and `--notes-file` (plus partition_gardener).
18
+ - Changelog reads use `File.foreach(..., encoding: "UTF-8")`.
19
+ - `lepiota.rb` still has `## 0.1.0 (Unreleased)` while `VERSION` is `0.1.0`; `require_changelog_notes!` will refuse until that heading is cut to a dated release section (same class of failure as the existing version heading check).
20
+
21
+ ## Next
22
+
23
+ - Commit each gem repo on its own (operator).
24
+ - Optional later: annotator notes-file; Elixir/Rust/Crystal/CLI scripts; repair empty historical GitHub release names with `gh release edit`.
25
+
26
+ ## Source
27
+
28
+ - `usr/bin/release.rb` / `usr/lib/release_version_check.rb` in the updated gem checkouts under `amkisko/`
29
+ - `kiskolabs/pray/scripts/release/github.sh`
30
+ - `docs/changelogs/20261113132159_github-release-title-from-version.md`
@@ -0,0 +1,25 @@
1
+ # Premake monthly default overlap create
2
+
3
+ ## Participants
4
+
5
+ Andrei Makarov
6
+
7
+ ## Decisions
8
+
9
+ - Fix PremakeMonthlyMaintenance so missing month children are materialized through ensure_archive_partition_attached! with the default partition as the source when it exists.
10
+ - Add materialize_partition_from_source! that locks the parent for writes, drains overlapping rows into a detached child, then attaches.
11
+ - Keep create/attach CheckViolation recovery via a savepoint so an outer advisory transaction stays usable.
12
+
13
+ ## Effects
14
+
15
+ - Integration fixtures with synthetic rows in the default for the current and next month complete without CheckViolation; row identity stays on the parent; children hold the moved rows.
16
+ - Second maintenance pass is a no-op for already-attached months.
17
+
18
+ ## Next
19
+
20
+ - Cut into CHANGELOG under `## 0.3.10 (2026-11-19)`.
21
+ - Commit, tag `0.3.10`, push, and run `make release`.
22
+
23
+ ## Source
24
+
25
+ - docs/issues/20261119083632_premake-monthly-default-overlap-create.md
@@ -0,0 +1,26 @@
1
+ # Cut patch release 0.3.10
2
+
3
+ ## Participants
4
+
5
+ Andrei Makarov
6
+
7
+ ## Decisions
8
+
9
+ - Bump `PartitionGardener::VERSION` to `0.3.10`.
10
+ - Record the monthly premake default-overlap create fix in `CHANGELOG.md` under `## 0.3.10 (2026-11-19)`.
11
+ - Stay on `main`. No trunk branch.
12
+
13
+ ## Effects
14
+
15
+ - Moved the Unreleased notes into the 0.3.10 section.
16
+ - Synced path-gem lockfile versions to 0.3.10.
17
+
18
+ ## Next
19
+
20
+ - Commit the prepared tree on `main`, tag `0.3.10`, push, and run `make release` (gem push, tag push, GitHub release).
21
+
22
+ ## Source
23
+
24
+ - Fix note: `docs/changelogs/20261119083632_premake-monthly-default-overlap-create.md`
25
+ - Issue: `docs/issues/20261119083632_premake-monthly-default-overlap-create.md`
26
+ - `CHANGELOG.md`, `lib/partition_gardener/version.rb`
@@ -0,0 +1,28 @@
1
+ # Premake monthly create fails when the default partition already holds that month
2
+
3
+ ## Participants
4
+
5
+ Andrei Makarov
6
+
7
+ ## Decisions
8
+
9
+ - On the first-create path, move overlapping default rows into a detached child and attach under a parent `SHARE ROW EXCLUSIVE` write lock in one transaction (or under the existing advisory transaction when one is open).
10
+ - Reuse the archive materialize helper from date-range maintenance so premake and archive attach share the same drain-then-attach contract.
11
+ - Wrap speculative `CREATE TABLE ... PARTITION OF` and bare `ATTACH` attempts in a savepoint when an outer transaction is open so a `CheckViolation` does not abort the whole table run.
12
+
13
+ ## Effects
14
+
15
+ - Before: PremakeMonthlyMaintenance called `create_partition` for missing months before `drain_default_partition`. A row already in the default for that month raised `ActiveRecord::CheckViolation` (`updated partition constraint for default partition ... would be violated by some row`).
16
+ - After: the same fixture ends with the matching rows in the monthly children, November-style horizon children attached, default empty for those keys, and a second ordinary maintenance pass clean.
17
+ - Regression coverage: `spec/integration/premake_monthly_spec.rb` (overlap create and second pass); `spec/partition_gardener/attach_retry_spec.rb` updated for the lock path.
18
+
19
+ ## Next
20
+
21
+ - Publish `0.3.10` (`make release` after commit and clean tree). Host apps that added a one-off preparation step before `run!` can drop it once that version is locked.
22
+
23
+ ## Source
24
+
25
+ - lib/partition_gardener/premake_monthly_maintenance.rb
26
+ - lib/partition_gardener/date_range_maintenance.rb
27
+ - spec/integration/premake_monthly_spec.rb
28
+ - docs/changelogs/20261119083632_premake-monthly-default-overlap-create.md
@@ -14,7 +14,7 @@ Andrei Makarov (@amkisko)
14
14
 
15
15
  - Bump `PartitionGardener::VERSION` and path-gem lockfiles to 0.3.9. Move the Unreleased bullets under `## 0.3.9 (2026-11-13)`.
16
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.
17
+ - Publish GitHub release body from the matching `CHANGELOG.md` section (`gh release create --title VERSION --notes-file`), not commit auto-notes. First cut omitted `--title` and left `name` empty; repaired live `0.3.9` and the script.
18
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
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
20
  - `release_spec`: 2 examples, 0 failures.
@@ -0,0 +1,40 @@
1
+ # Engineering audit and release preparation
2
+
3
+ ## Participants
4
+
5
+ Andrei Makarov
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.10 for the monthly premake default-overlap create fix. Set the CHANGELOG heading date to 2026-11-19.
11
+
12
+ ## Effects
13
+
14
+ - Bump `PartitionGardener::VERSION` and path-gem lockfiles to 0.3.10. Move the Unreleased bullet under `## 0.3.10 (2026-11-19)`.
15
+ - Final serial JSON report: 201 examples, 0 failures with `INTEGRATION=1` and PostgreSQL; no pending examples. Parallel polyrun with five workers: exit 0.
16
+ - Required project checks passed: rubocop (121 files, no offenses), rbs validate, `INTEGRATION=1` polyrun parallel-rspec. Environment: Ruby 4.0.2.
17
+ - `release_spec`: 5 examples, 0 failures.
18
+ - Build the gem, verify it with `Gem::Package#verify`, and confirm the changelog heading matches version 0.3.10. Compressed package: 128000 bytes across 122 packaged paths.
19
+ - Cold process measurement on macOS arm64 with `/usr/bin/time -p` and `bundle exec ruby -Ilib`: 0.19 CPU seconds, 0.33 elapsed seconds. Peak RSS was not captured in this run (`time -l` failed under the agent sandbox). Local smoke ceilings: 1 MiB compressed gem, 128 MiB RSS, 2 CPU seconds. Measured gem size and CPU fit those ceilings. CPU seconds are the energy proxy; electricity use was not measured.
20
+ - Parse every workflow YAML, verify lockfile own-gem versions at 0.3.10, and run `git diff --check`. All passed. RubyGems has no `0.3.10` yet.
21
+
22
+ ## Next
23
+
24
+ - Commit, tag 0.3.10, 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.
25
+ - Host apps that added a one-off preparation step before monthly premake `run!` can drop it once this version is locked.
26
+ - Hosted GitHub Actions and the complete supported Ruby/framework matrix were not executed locally beyond the default Gemfile path.
27
+ - 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.
28
+ - 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.
29
+ - Database-boundary mode applies to PostgreSQL maintenance DDL for monthly premake create when the default partition already holds overlapping rows.
30
+
31
+ ## Source
32
+
33
+ - AGENTS.md
34
+ - .agents/skills/engineering-audit/SKILL.md
35
+ - .agents/skills/changelog-update/SKILL.md
36
+ - CHANGELOG.md
37
+ - Makefile
38
+ - docs/changelogs/20261119085211_cut-patch-release-0-3-10.md
39
+ - docs/changelogs/20261119083632_premake-monthly-default-overlap-create.md
40
+ - docs/issues/20261119083632_premake-monthly-default-overlap-create.md
@@ -234,47 +234,117 @@ module PartitionGardener
234
234
 
235
235
  return if Connection.partition_attached?(table_name, partition_name)
236
236
 
237
- if Connection.count_rows_in_partition(source_partition_name, where_condition).positive?
237
+ if overlapping_source_rows?(source_partition_name, where_condition)
238
+ materialize_partition_from_source!(
239
+ partition_name: partition_name,
240
+ source_partition_name: source_partition_name,
241
+ for_values_clause: for_values_clause,
242
+ where_condition: where_condition
243
+ )
244
+ elsif Connection.partition_exists?(partition_name)
245
+ attach_archive_partition!(table_name, partition_name, for_values_clause, where_condition)
246
+ else
247
+ create_partition_or_materialize_from_default!(
248
+ partition_name: partition_name,
249
+ for_values_clause: for_values_clause,
250
+ where_condition: where_condition
251
+ )
252
+ end
253
+ end
254
+
255
+ def overlapping_source_rows?(source_partition_name, where_condition)
256
+ return false unless Connection.partition_exists?(source_partition_name)
257
+
258
+ Connection.count_rows_in_partition(source_partition_name, where_condition).positive?
259
+ end
260
+
261
+ def create_partition_or_materialize_from_default!(partition_name:, for_values_clause:, where_condition:)
262
+ with_statement_savepoint do
263
+ @executor.create_partition(table_name, partition_name, for_values_clause)
264
+ end
265
+ rescue => error
266
+ raise unless check_violation?(error)
267
+
268
+ materialize_partition_from_source!(
269
+ partition_name: partition_name,
270
+ source_partition_name: default_partition_name(table_name),
271
+ for_values_clause: for_values_clause,
272
+ where_condition: where_condition
273
+ )
274
+ end
275
+
276
+ def materialize_partition_from_source!(partition_name:, source_partition_name:, for_values_clause:, where_condition:)
277
+ with_parent_write_lock do
238
278
  @executor.ensure_detached_partition_table!(table_name, partition_name, conflict_key: conflict_key)
239
- @executor.drain_rows_between_partitions!(
279
+ drain_overlapping_rows_into_partition!(
240
280
  source_partition_name,
241
281
  partition_name,
242
- where_condition,
243
- conflict_key,
244
- cursor_columns: cursor_columns
282
+ where_condition
245
283
  )
284
+
285
+ default_name = default_partition_name(table_name)
286
+ if default_name != source_partition_name
287
+ drain_overlapping_rows_into_partition!(default_name, partition_name, where_condition)
288
+ end
289
+
290
+ @executor.attach_partition(table_name, partition_name, for_values_clause)
246
291
  end
292
+ end
247
293
 
248
- if Connection.partition_exists?(partition_name)
249
- attach_archive_partition!(table_name, partition_name, for_values_clause, where_condition)
294
+ def drain_overlapping_rows_into_partition!(source_partition_name, partition_name, where_condition)
295
+ return unless Connection.partition_exists?(source_partition_name)
296
+ return unless Connection.count_rows_in_partition(source_partition_name, where_condition).positive?
297
+
298
+ @executor.drain_rows_between_partitions!(
299
+ source_partition_name,
300
+ partition_name,
301
+ where_condition,
302
+ conflict_key,
303
+ cursor_columns: cursor_columns
304
+ )
305
+ end
306
+
307
+ def with_parent_write_lock
308
+ lock_sql = "LOCK TABLE #{Connection.quoted_table(table_name)} IN SHARE ROW EXCLUSIVE MODE"
309
+
310
+ if connection.respond_to?(:transaction_open?) && connection.transaction_open?
311
+ connection.execute(lock_sql)
312
+ yield
250
313
  else
251
- @executor.create_partition(table_name, partition_name, for_values_clause)
314
+ connection.transaction do
315
+ connection.execute(lock_sql)
316
+ yield
317
+ end
318
+ end
319
+ end
320
+
321
+ def with_statement_savepoint
322
+ if connection.respond_to?(:transaction_open?) && connection.transaction_open?
323
+ connection.transaction(requires_new: true) { yield }
324
+ else
325
+ yield
252
326
  end
253
327
  end
254
328
 
255
329
  def attach_archive_partition!(table_name, partition_name, for_values_clause, where_condition)
256
- @executor.attach_partition(table_name, partition_name, for_values_clause)
330
+ with_statement_savepoint do
331
+ @executor.attach_partition(table_name, partition_name, for_values_clause)
332
+ end
257
333
  rescue => error
258
334
  raise unless check_violation?(error)
259
335
 
260
- default_name = default_partition_name(table_name)
261
- if Connection.partition_exists?(default_name) &&
262
- Connection.count_rows_in_partition(default_name, where_condition).positive?
263
- @executor.drain_rows_between_partitions!(
264
- default_name,
265
- partition_name,
266
- where_condition,
267
- conflict_key,
268
- cursor_columns: cursor_columns
269
- )
270
- end
271
-
272
- @executor.attach_partition(table_name, partition_name, for_values_clause)
336
+ materialize_partition_from_source!(
337
+ partition_name: partition_name,
338
+ source_partition_name: default_partition_name(table_name),
339
+ for_values_clause: for_values_clause,
340
+ where_condition: where_condition
341
+ )
273
342
  end
274
343
 
275
344
  def check_violation?(error)
276
345
  message = error.message.to_s
277
346
  return true if message.include?("CheckViolation") || message.include?("check constraint")
347
+ return true if message.include?("updated partition constraint")
278
348
 
279
349
  error.cause && check_violation?(error.cause)
280
350
  end
@@ -24,13 +24,21 @@ module PartitionGardener
24
24
 
25
25
  def ensure_month_partition!(identifier)
26
26
  partition_name = @config[:partition_name_format].call(identifier)
27
- for_values_clause = @config[:partition_definition].call(identifier)
28
-
29
27
  return if Connection.partition_attached?(table_name, partition_name)
30
28
 
29
+ default_name = default_partition_name(table_name)
30
+ if Connection.partition_exists?(default_name)
31
+ ensure_archive_partition_attached!(
32
+ identifier,
33
+ partition_name: partition_name,
34
+ source_partition_name: default_name
35
+ )
36
+ return
37
+ end
38
+
39
+ for_values_clause = @config[:partition_definition].call(identifier)
31
40
  if Connection.partition_exists?(partition_name)
32
- send(
33
- :attach_archive_partition!,
41
+ attach_archive_partition!(
34
42
  table_name,
35
43
  partition_name,
36
44
  for_values_clause,
@@ -1,3 +1,3 @@
1
1
  module PartitionGardener
2
- VERSION = "0.3.9"
2
+ VERSION = "0.3.10"
3
3
  end
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.9
4
+ version: 0.3.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrei Makarov
@@ -284,6 +284,10 @@ files:
284
284
  - docs/changelogs/20261113104337_partman-probe-aborts-open-transactions.md
285
285
  - docs/changelogs/20261113110417_opt-in-boot-side-paths.md
286
286
  - docs/changelogs/20261113130745_cut-patch-release-0-3-9.md
287
+ - docs/changelogs/20261113132159_github-release-title-from-version.md
288
+ - docs/changelogs/20261113154500_ruby-gems-changelog-github-release-notes.md
289
+ - docs/changelogs/20261119083632_premake-monthly-default-overlap-create.md
290
+ - docs/changelogs/20261119085211_cut-patch-release-0-3-10.md
287
291
  - docs/cli.md
288
292
  - docs/configuration.md
289
293
  - docs/cutover.md
@@ -297,6 +301,7 @@ files:
297
301
  - docs/issues/20261105085411_hot-switch-migration-connection-stack-overflow.md
298
302
  - docs/issues/20261113104337_partman-probe-aborts-open-transactions.md
299
303
  - docs/issues/20261113110417_opt-in-boot-side-paths.md
304
+ - docs/issues/20261119083632_premake-monthly-default-overlap-create.md
300
305
  - docs/monitoring.md
301
306
  - docs/naming.md
302
307
  - docs/operations.md
@@ -311,6 +316,7 @@ files:
311
316
  - docs/reviews/20261105085411_engineering-audit-hot-switch-connection.md
312
317
  - docs/reviews/20261105090507_engineering-audit-release-preparation.md
313
318
  - docs/reviews/20261113130745_engineering-audit-release-preparation.md
319
+ - docs/reviews/20261119085211_engineering-audit-release-preparation.md
314
320
  - docs/schemas/partition_garden.schema.json
315
321
  - docs/schemas/plan_report.schema.json
316
322
  - docs/tooling_split.md