standard_ledger 0.5.1 → 0.7.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: 74163637dfcb14c019f6481391644b45849cad04108b580e5a8de524720ed1ca
4
- data.tar.gz: d022e52db16ba6e838c47c9e94ead8fa1f876afb37ffa5f8b3b5390d4877b157
3
+ metadata.gz: ddedb70c2937f7108178cce27f7150b58c39c5aadfdab2561947b626bd345d9c
4
+ data.tar.gz: be910d616703d17691bdc6f184247b5efe78bc959006c24f43ee4bfbeb5df263
5
5
  SHA512:
6
- metadata.gz: e9b7f1b51851431f1e44c5129dac815517ce064860a83d210d8f94ed8b30e7a90dc393d92af4e702516fcc0a804e613cc7859d582b4ce042d31220970835fb5d
7
- data.tar.gz: c11d063fd3e01c8feb06176742df0167ff363c375de4c03d979a7dee52ca21e1388917fd2e1b10e770409b2a703aa5f223f496bc8f2619368b40fa0c323a1cb9
6
+ metadata.gz: 1bd764a4596fb6468f5ffa9b2d51e39a5203f6135bbdbde6cacec33091aa0e86cedaa1393392f417378a720f6e26987438c8a46fc80028204ecf0250ed3a7c49
7
+ data.tar.gz: 829aad11a875317df036555736281f0ca6d961045bd3a5b2dd6090592ce0aabce772583b34d7fd403c69a4f331bb11f46e6a9622ccc62f510fb0574dea8bd85a
data/CHANGELOG.md CHANGED
@@ -6,6 +6,134 @@ project adheres to [Semantic Versioning](https://semver.org/).
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.7.0] - 2026-09-24
10
+
11
+ The Phase 4 release. The removals the cleanup plan scheduled for it (the
12
+ `scheduler` config, `PartialFailure`, and the engine's no-op initializer)
13
+ already shipped in 0.6.0, and 0.6.0 deprecated nothing, so this release only
14
+ changes how `refresh!` reports failures. It is a minor bump because hosts that
15
+ report refresh failures themselves should delete that code.
16
+
17
+ ### Changed
18
+ - **`StandardLedger.refresh!` reports SQL failures through `Rails.error`.**
19
+ When the `REFRESH` statement raises, the gem emits `projection.failed` (as
20
+ before), then calls `Rails.error.report(error, handled: false,
21
+ severity: :error, context: { view:, concurrently: }, source:
22
+ "standard_ledger")`, then re-raises. It falls back to
23
+ `ActiveSupport.error_reporter` outside Rails. A reporter that raises is
24
+ ignored, so it can never mask the refresh error. Input errors raised before
25
+ any SQL runs are not reported (`ArgumentError`, `RefreshInsideTransaction`).
26
+ **No double reports:** Rails' `ErrorReporter` flags a reported exception
27
+ and skips it when the same object is reported again. That covers a host
28
+ rescue that reports and re-raises, and the executor wrapping the job.
29
+ - The `:auto` catalog-probe failure report (handled, `:warning`) now goes
30
+ through the same `StandardLedger.report_error` helper (`@api private`).
31
+ Its payload is unchanged.
32
+
33
+ ### Upgrade notes (0.6.x → 0.7.0)
34
+ 1. Bump to `gem "standard_ledger", "~> 0.7"`. Nothing was removed, so no code
35
+ change is required.
36
+ 2. **Optional cleanup:** delete any report-and-re-raise rescue around
37
+ `refresh!`. Grepped `origin/main` of all consumers on 2026-09-24:
38
+ - luminality-web `app/jobs/refresh_admin_dashboard_metrics_job.rb:20-27`
39
+ (`rescue StandardError => e; Rails.error.report(e, handled: true,
40
+ context: { view: "admin_dashboard_metrics" }); raise`). Delete the rescue
41
+ and fix the header comment ("…does not report").
42
+ - sidekick-web `app/jobs/refresh_materialized_views_job.rb` has no rescue.
43
+ Its refresh failures are now reported by the gem, with view context,
44
+ before the job runner sees them.
45
+ - jumpdrive-web and fundbright-web don't call `refresh!`.
46
+ 3. **Expect a different Sentry grouping context** for refresh failures:
47
+ `source: "standard_ledger"` and `context.view`. The error class and
48
+ backtrace are unchanged.
49
+ 4. Sorbet apps: regenerate the gem RBI (`bin/tapioca gem standard_ledger`).
50
+ jumpdrive-web's `control-plane/config/initializers/standard_ledger.rb:12-13`
51
+ still mentions the removed `scheduler`/`default_async_*` config in a
52
+ comment. The comment is historical and harmless.
53
+
54
+ ## [0.6.0] - 2026-09-24
55
+
56
+ A breaking release. The declarative projection engine is removed, and the gem
57
+ now ships only what its four consumers use: `Entry`, `post`, `Projection`,
58
+ `refresh!`, `Config`, the events, and the RSpec matcher. Before this release,
59
+ every consumer's `main` (jumpdrive-web, sidekick-web, fundbright-web,
60
+ luminality-web) was grepped (app, lib, config, spec, db). None of them
61
+ referenced anything listed under **Removed**.
62
+
63
+ ### Removed
64
+ - **Projection DSL:** `StandardLedger::Projector`, `projects_onto`,
65
+ `standard_ledger_projections`, `standard_ledger_projections_for`, and the
66
+ `Projector::Definition` struct.
67
+ - **All projection modes:** `StandardLedger::Modes::Inline`, `::Async`, `::Sql`,
68
+ `::Trigger`, `::Matview` (its refresh logic moved to the private
69
+ `StandardLedger::Matview`), and `:manual`.
70
+ - **Jobs:** `StandardLedger::ProjectionJob` and
71
+ `StandardLedger::MatviewRefreshJob`. The gem no longer depends on `activejob`
72
+ (or declares `concurrent-ruby` directly).
73
+ - **`StandardLedger.rebuild!`**. `Projection#rebuild` stays as a method your own
74
+ code calls.
75
+ - **Test-mode overrides:** `StandardLedger.with_modes`,
76
+ `StandardLedger.mode_override_for`, `StandardLedger.reset_mode_overrides!`,
77
+ `StandardLedger::RSpec::Helpers`, and the `before(:each)` hook that
78
+ `require "standard_ledger/rspec"` used to register. The file now defines only
79
+ the `post_ledger_entry` matcher.
80
+ - **`rake standard_ledger:doctor`** and `StandardLedger::Engine`. The engine
81
+ had no routes or tables, and its initializer was a no-op. The install
82
+ generator still works without it.
83
+ - **Errors:** `StandardLedger::PartialFailure` (never raised) and
84
+ `StandardLedger::UnhandledKind` (only raised by the projection DSL).
85
+ - **Config:** `default_async_job`, `default_async_retries`, and `scheduler`.
86
+ None of them was read by anything outside the engine, and no consumer
87
+ initializer sets them (jumpdrive-web's generated initializer only has them
88
+ as comments).
89
+ - **Events:** `<prefix>.projection.applied` and `<prefix>.projection.rebuilt`
90
+ (only the engine emitted them). `entry.created`, `projection.refreshed` and
91
+ `projection.failed` are unchanged.
92
+ - `StandardLedger.post` no longer reports `projections[:inline]`. It always
93
+ passes `projections: {}`. The keyword is still passed to `result_adapter`,
94
+ so existing six-keyword adapters keep working.
95
+
96
+ ### Added
97
+ - `StandardLedger.refresh!(view, concurrently: :auto)` uses
98
+ `REFRESH MATERIALIZED VIEW CONCURRENTLY` only when it can succeed: no open
99
+ transaction, the view is populated (`pg_class.relispopulated`), and it has a
100
+ valid unique index without a `WHERE` clause or expressions (`pg_index`).
101
+ Otherwise it runs a plain refresh. If the catalog probe raises, the error is
102
+ reported through `Rails.error` (`handled: true`, `severity: :warning`,
103
+ `source: "standard_ledger"`) and the refresh falls back to plain. This
104
+ replaces the rescue-and-retry around `PG::ObjectNotInPrerequisiteState` /
105
+ `RefreshInsideTransaction` in sidekick-web's `RefreshMaterializedViewsJob`.
106
+ It was verified against PostgreSQL 17 for an empty view, unique, non-unique,
107
+ partial and expression indexes, a refresh inside a transaction, and a
108
+ missing view.
109
+ - `Config#matview_refresh_strategy` accepts `:auto`.
110
+
111
+ ### Changed
112
+ - `refresh!` now raises `ArgumentError` for an unknown `concurrently:` value
113
+ or an unknown `matview_refresh_strategy`. Before, an unknown strategy
114
+ silently meant a blocking refresh.
115
+ - `RefreshInsideTransaction`'s message now suggests `concurrently: :auto`.
116
+ - The gemspec summary, description, README, design doc, `AGENTS.md`, and
117
+ `docs/MIGRATION_GUIDE.md` now describe the slimmed gem. The design doc keeps
118
+ a history section on the removed engine (§8).
119
+
120
+ ### Upgrade note (0.5.x → 0.6.0)
121
+ 1. Bump to `gem "standard_ledger", "~> 0.6"`. No consumer on 2026-09-24
122
+ referenced anything removed, so no application code changes are needed.
123
+ 2. **Sorbet/Tapioca apps:** regenerate the RBIs (`bin/tapioca gem
124
+ standard_ledger` and `bin/tapioca dsl`). Delete any stale
125
+ `sorbet/rbi/dsl/standard_ledger/{projector,projection_job,matview_refresh_job}.rbi`.
126
+ All four consumers carry these today, and they describe constants that no
127
+ longer exist, so `tapioca dsl --verify` will flag them.
128
+ 3. If your initializer sets `c.default_async_job`, `c.default_async_retries`
129
+ or `c.scheduler`, delete the line (it now raises `NoMethodError`). The
130
+ generated initializer only has them as comments, which you can remove too.
131
+ 4. Optional: replace hand-rolled "try CONCURRENTLY, fall back to plain"
132
+ logic with `StandardLedger.refresh!(view, concurrently: :auto)`, or set
133
+ `c.matview_refresh_strategy = :auto`.
134
+ 5. If you ever did depend on the engine, pin `~> 0.5` and see git tag
135
+ `v0.5.1` and design doc §8.
136
+
9
137
  ## [0.5.1] - 2026-09-24
10
138
 
11
139
  ### Fixed
@@ -466,7 +594,8 @@ roadmap.
466
594
  and `:trigger` (host-owned, gem records rebuild SQL).
467
595
  - `standard_ledger:doctor` rake task (verifies trigger presence, etc.).
468
596
 
469
- [Unreleased]: https://github.com/rarebit-one/standard_ledger/compare/v0.5.1...HEAD
597
+ [Unreleased]: https://github.com/rarebit-one/standard_ledger/compare/v0.6.0...HEAD
598
+ [0.6.0]: https://github.com/rarebit-one/standard_ledger/compare/v0.5.1...v0.6.0
470
599
  [0.5.1]: https://github.com/rarebit-one/standard_ledger/compare/v0.5.0...v0.5.1
471
600
  [0.5.0]: https://github.com/rarebit-one/standard_ledger/compare/v0.4.0...v0.5.0
472
601
  [0.4.0]: https://github.com/rarebit-one/standard_ledger/compare/v0.3.0...v0.4.0