standard_ledger 0.5.0 → 0.6.0

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: 89af058a7d94051bc75f8e853d1be397270b52bc5a02020dfdd41484c6cacda5
4
- data.tar.gz: 50eef558981621f3561c42095d294f87f09d7ed18e8fc5a5919c0801262f257b
3
+ metadata.gz: 8f6aa5d56ba73fe170790d016b50f00aec95f563346a08c36f8823d05fbddd98
4
+ data.tar.gz: dc1ef4c96e69b6a8d4832ce1f80dc6a979d63dc25ff059ed77794b829f414e7f
5
5
  SHA512:
6
- metadata.gz: 16d8c529a99909adb4739feb0ea76e996ebd709c044bc56dd2722bc041f4c17670d2bb383a48072df9a686bc02b1c2a49add8206618ddeb7fb86dd2b45e61c9f
7
- data.tar.gz: 5f152b064c69e8da3f7e2767c4b3914da197599ed64ecc8e512be6c34e334af25337f83fd68080c7811a3f4772df647d5799ae635cb0116409286455bd86bf0e
6
+ metadata.gz: 54f927af7564ee7e9319a2fd87358a86e91ab55c7d3fea872dc9f821efc40cde0cd31b55cdf4b90e7bfb138bb501a7e9888358a2645f27c662058ba2fd2ef869
7
+ data.tar.gz: 108ce4c242c054512e6f3f173cf683dc9f71ee08882ed82dd505be092af6fb08f7b97b635aa5685ed5c08f7257e6ad285d327a2b4a9bd1f07c2ee1bcfcda19d2
data/CHANGELOG.md CHANGED
@@ -6,6 +6,109 @@ project adheres to [Semantic Versioning](https://semver.org/).
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.6.0] - 2026-09-24
10
+
11
+ A breaking release. The declarative projection engine is removed, and the gem
12
+ now ships only what its four consumers use: `Entry`, `post`, `Projection`,
13
+ `refresh!`, `Config`, the events, and the RSpec matcher. Before this release,
14
+ every consumer's `main` (jumpdrive-web, sidekick-web, fundbright-web,
15
+ luminality-web) was grepped (app, lib, config, spec, db). None of them
16
+ referenced anything listed under **Removed**.
17
+
18
+ ### Removed
19
+ - **Projection DSL:** `StandardLedger::Projector`, `projects_onto`,
20
+ `standard_ledger_projections`, `standard_ledger_projections_for`, and the
21
+ `Projector::Definition` struct.
22
+ - **All projection modes:** `StandardLedger::Modes::Inline`, `::Async`, `::Sql`,
23
+ `::Trigger`, `::Matview` (its refresh logic moved to the private
24
+ `StandardLedger::Matview`), and `:manual`.
25
+ - **Jobs:** `StandardLedger::ProjectionJob` and
26
+ `StandardLedger::MatviewRefreshJob`. The gem no longer depends on `activejob`
27
+ (or declares `concurrent-ruby` directly).
28
+ - **`StandardLedger.rebuild!`**. `Projection#rebuild` stays as a method your own
29
+ code calls.
30
+ - **Test-mode overrides:** `StandardLedger.with_modes`,
31
+ `StandardLedger.mode_override_for`, `StandardLedger.reset_mode_overrides!`,
32
+ `StandardLedger::RSpec::Helpers`, and the `before(:each)` hook that
33
+ `require "standard_ledger/rspec"` used to register. The file now defines only
34
+ the `post_ledger_entry` matcher.
35
+ - **`rake standard_ledger:doctor`** and `StandardLedger::Engine`. The engine
36
+ had no routes or tables, and its initializer was a no-op. The install
37
+ generator still works without it.
38
+ - **Errors:** `StandardLedger::PartialFailure` (never raised) and
39
+ `StandardLedger::UnhandledKind` (only raised by the projection DSL).
40
+ - **Config:** `default_async_job`, `default_async_retries`, and `scheduler`.
41
+ None of them was read by anything outside the engine, and no consumer
42
+ initializer sets them (jumpdrive-web's generated initializer only has them
43
+ as comments).
44
+ - **Events:** `<prefix>.projection.applied` and `<prefix>.projection.rebuilt`
45
+ (only the engine emitted them). `entry.created`, `projection.refreshed` and
46
+ `projection.failed` are unchanged.
47
+ - `StandardLedger.post` no longer reports `projections[:inline]`. It always
48
+ passes `projections: {}`. The keyword is still passed to `result_adapter`,
49
+ so existing six-keyword adapters keep working.
50
+
51
+ ### Added
52
+ - `StandardLedger.refresh!(view, concurrently: :auto)` uses
53
+ `REFRESH MATERIALIZED VIEW CONCURRENTLY` only when it can succeed: no open
54
+ transaction, the view is populated (`pg_class.relispopulated`), and it has a
55
+ valid unique index without a `WHERE` clause or expressions (`pg_index`).
56
+ Otherwise it runs a plain refresh. If the catalog probe raises, the error is
57
+ reported through `Rails.error` (`handled: true`, `severity: :warning`,
58
+ `source: "standard_ledger"`) and the refresh falls back to plain. This
59
+ replaces the rescue-and-retry around `PG::ObjectNotInPrerequisiteState` /
60
+ `RefreshInsideTransaction` in sidekick-web's `RefreshMaterializedViewsJob`.
61
+ It was verified against PostgreSQL 17 for an empty view, unique, non-unique,
62
+ partial and expression indexes, a refresh inside a transaction, and a
63
+ missing view.
64
+ - `Config#matview_refresh_strategy` accepts `:auto`.
65
+
66
+ ### Changed
67
+ - `refresh!` now raises `ArgumentError` for an unknown `concurrently:` value
68
+ or an unknown `matview_refresh_strategy`. Before, an unknown strategy
69
+ silently meant a blocking refresh.
70
+ - `RefreshInsideTransaction`'s message now suggests `concurrently: :auto`.
71
+ - The gemspec summary, description, README, design doc, `AGENTS.md`, and
72
+ `docs/MIGRATION_GUIDE.md` now describe the slimmed gem. The design doc keeps
73
+ a history section on the removed engine (§8).
74
+
75
+ ### Upgrade note (0.5.x → 0.6.0)
76
+ 1. Bump to `gem "standard_ledger", "~> 0.6"`. No consumer on 2026-09-24
77
+ referenced anything removed, so no application code changes are needed.
78
+ 2. **Sorbet/Tapioca apps:** regenerate the RBIs (`bin/tapioca gem
79
+ standard_ledger` and `bin/tapioca dsl`). Delete any stale
80
+ `sorbet/rbi/dsl/standard_ledger/{projector,projection_job,matview_refresh_job}.rbi`.
81
+ All four consumers carry these today, and they describe constants that no
82
+ longer exist, so `tapioca dsl --verify` will flag them.
83
+ 3. If your initializer sets `c.default_async_job`, `c.default_async_retries`
84
+ or `c.scheduler`, delete the line (it now raises `NoMethodError`). The
85
+ generated initializer only has them as comments, which you can remove too.
86
+ 4. Optional: replace hand-rolled "try CONCURRENTLY, fall back to plain"
87
+ logic with `StandardLedger.refresh!(view, concurrently: :auto)`, or set
88
+ `c.matview_refresh_strategy = :auto`.
89
+ 5. If you ever did depend on the engine, pin `~> 0.5` and see git tag
90
+ `v0.5.1` and design doc §8.
91
+
92
+ ## [0.5.1] - 2026-09-24
93
+
94
+ ### Fixed
95
+ - The `post_ledger_entry` RSpec matcher now listens on the channel
96
+ `StandardLedger::EventEmitter` emits through. It only subscribed to
97
+ `ActiveSupport::Notifications`, but on Rails 8.1+ the gem emits through
98
+ `Rails.event.notify`, so the matcher saw no events at all: every positive
99
+ expectation failed and every `not_to post_ledger_entry` passed without
100
+ checking anything. When `EventEmitter.rails_event_available?` is true, the
101
+ matcher now subscribes a collector to `Rails.event` for the block and
102
+ unsubscribes it afterwards.
103
+
104
+ ### Documentation
105
+ - README **Testing** section (and `AGENTS.md`) said the RSpec support hook
106
+ calls `StandardLedger.reset!`. It calls `reset_mode_overrides!`, which keeps
107
+ host initializer configuration intact.
108
+ - The engine initializer comment now tells hosts to subscribe via
109
+ `Rails.event.subscribe` on Rails 8.1+ rather than
110
+ `ActiveSupport::Notifications.subscribe`.
111
+
9
112
  ## [0.5.0] - 2026-09-22
10
113
 
11
114
  ### Changed
@@ -446,7 +549,9 @@ roadmap.
446
549
  and `:trigger` (host-owned, gem records rebuild SQL).
447
550
  - `standard_ledger:doctor` rake task (verifies trigger presence, etc.).
448
551
 
449
- [Unreleased]: https://github.com/rarebit-one/standard_ledger/compare/v0.5.0...HEAD
552
+ [Unreleased]: https://github.com/rarebit-one/standard_ledger/compare/v0.6.0...HEAD
553
+ [0.6.0]: https://github.com/rarebit-one/standard_ledger/compare/v0.5.1...v0.6.0
554
+ [0.5.1]: https://github.com/rarebit-one/standard_ledger/compare/v0.5.0...v0.5.1
450
555
  [0.5.0]: https://github.com/rarebit-one/standard_ledger/compare/v0.4.0...v0.5.0
451
556
  [0.4.0]: https://github.com/rarebit-one/standard_ledger/compare/v0.3.0...v0.4.0
452
557
  [0.3.0]: https://github.com/rarebit-one/standard_ledger/compare/v0.2.0...v0.3.0