startback 1.2.4 → 2.1.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.
data/CHANGELOG.md ADDED
@@ -0,0 +1,954 @@
1
+ ## 2.1.0 - 2026-09-30
2
+
3
+ Ruby 4.0 support, docker images for several ruby versions, and the Bunny
4
+ event bus finally under test -- which is how two silent bugs and a RabbitMQ
5
+ 4.3 incompatibility came to light.
6
+
7
+ **Almost nothing here asks anything of you.** Startback's API is unchanged
8
+ and the bus upgrade needs no broker-side migration. The one thing that does
9
+ move: the un-suffixed docker tags go from Ruby 3.3 to Ruby 3.4, a minor
10
+ bump. The details are below because the *reasons* matter, not because there
11
+ is much to do.
12
+
13
+ ### Ruby 4.0 is supported
14
+
15
+ The test grid now runs **Ruby 3.2, 3.3, 3.4 and 4.0** -- the whole range
16
+ `required_ruby_version` allows, so the floor is a tested claim rather than an
17
+ assumed one. Startback needed no source change for 4.0: the gem,
18
+ `startback-jobs`, `startback-web` and the example application's webspicy
19
+ specs are green on all four, with no deprecation warning from Startback's own
20
+ code.
21
+
22
+ `required_ruby_version` stays `>= 3.2`.
23
+
24
+ ### Docker images are released for Ruby 3.4 and 4.0
25
+
26
+ Images are built for each ruby version of the release matrix. The tags that
27
+ name no ruby version follow `DEFAULT_MRI_VERSION`, which is **Ruby 3.4**:
28
+ 2.0.0 published them from Ruby 3.3, so `enspirit/startback:api` and `:web`
29
+ move by one minor version here, and stay put from now on.
30
+
31
+ | Tag | Ruby |
32
+ |---|---|
33
+ | `enspirit/startback:api`, `:api-2.1.0`, `:api-2.1` | 3.4 (was 3.3 in 2.0.0) |
34
+ | `enspirit/startback:api-ruby3.4`, `:api-2.1.0-ruby3.4`, `:api-2.1-ruby3.4` | 3.4 |
35
+ | `enspirit/startback:api-ruby4.0`, `:api-2.1.0-ruby4.0`, `:api-2.1-ruby4.0` | 4.0 |
36
+
37
+ Same for the `web` target. **No Ruby 3.3 image is published any more**: an
38
+ application pinned to `:api-ruby3.3` stays at 2.0.0 and should move to
39
+ `:api-ruby3.4`. Only `DEFAULT_MRI_VERSION` in the Makefile publishes the
40
+ un-suffixed tags, so adding a ruby version to the matrix can
41
+ never change what `:api` means depending on which release job finished last.
42
+ `make images.all` walks the whole matrix the way the release workflow does.
43
+
44
+ The `web` image moves from **nodejs 20 to nodejs 22**, node 20 having reached
45
+ end of life in April 2026.
46
+
47
+ ### The Bunny event bus is now covered by the test suite
48
+
49
+ It was the one part of Startback with no automated coverage, on the grounds
50
+ that the grid had no broker. It now has one, and 19 specs that talk to it for
51
+ real -- mocking bunny would only assert that Startback calls the methods
52
+ Startback calls. They cover connecting, autoconnect, the emit/listen round
53
+ trip, fanout across processor queues, type isolation, adoption of a
54
+ pre-existing topology, and the asynchronous contract that emit errors must
55
+ not reach the emitter.
56
+
57
+ Without a broker those specs skip, so `make tests` stays green for a
58
+ contributor without docker; `make rabbitmq.up` starts one through the new
59
+ `docker-compose.yml`. CI sets `STARTBACK_SPEC_REQUIRE_BUNNY=1`, which turns
60
+ "no broker" into a failure, because otherwise a broken service container
61
+ would take the coverage away without anything turning red.
62
+
63
+ ### The bus stops working on RabbitMQ 4.3, and now does not
64
+
65
+ `queue_options` defaulted to `{}`, which declares a *transient non-exclusive*
66
+ queue. RabbitMQ deprecated that, and flips it from `permitted_by_default` to
67
+ `denied_by_default` in 4.3:
68
+
69
+ | RabbitMQ | transient non-exclusive queues | Startback <= 2.0 bus |
70
+ |---|---|---|
71
+ | 4.0, 4.1, 4.2 | permitted | works |
72
+ | **4.3+** | **denied** | **`listen` receives nothing, then `Timeout::Error`** |
73
+
74
+ The defaults are now durable for both the exchange and the queue, which is
75
+ also what a named processor queue wants: events waiting in it outlive a
76
+ broker restart instead of being dropped, and a durable queue bound to a
77
+ transient exchange would come back after a restart with nothing routing to
78
+ it.
79
+
80
+ ```ruby
81
+ fanout_options: { durable: true },
82
+ queue_options: { durable: true },
83
+ ```
84
+
85
+ **No migration is required, deliberately.** AMQP refuses to redeclare an
86
+ object with different properties, so on a broker up since an older Startback
87
+ declared its topology the durable declaration is rejected with
88
+ `PRECONDITION_FAILED`. Rather than make that your problem, the bus *adopts*
89
+ whatever is already there (`passive: true` matches an existing object
90
+ whatever its properties) and logs a warning. Transient objects do not survive
91
+ a broker restart, so the durable declaration takes over by itself at the next
92
+ one, with nobody having done anything.
93
+
94
+ Left alone that would have been a nasty upgrade: `emit` runs inside
95
+ `stop_errors`, so the rejection was swallowed and the application went on
96
+ returning 200s while silently dropping every event.
97
+
98
+ Applications already passing their own `queue_options`/`fanout_options` are
99
+ unaffected: explicit options still win.
100
+
101
+ ### Two silent bunny bugs fixed
102
+
103
+ Both predate this release and neither announced itself:
104
+
105
+ * **A dead channel was cached forever.** A channel-level error closes the
106
+ channel, and the bus kept one per thread without checking it was still
107
+ open. One such error therefore broke the bus for that thread permanently --
108
+ every later `emit` failing with `cannot use a closed channel`, for *any*
109
+ event type, swallowed by `stop_errors`. The channel is now renewed when
110
+ found closed.
111
+
112
+ * **Declaring could unsubscribe your listeners.** A rejected declaration
113
+ closes the channel it happened on, which was the shared one carrying the
114
+ consumers. Topology is now probed on a scratch channel, memoized per
115
+ connection so `emit` does not pay for it on every call.
116
+
117
+ ### Known wart, documented rather than fixed
118
+
119
+ A Bunny listener receives the raw JSON `String` off the queue, where a
120
+ `Bus::Memory::Async` listener receives a `Startback::Event`. Listeners are
121
+ not portable between the two busses. The bus even carries a `factor_event`
122
+ method for this, defined and never called. A spec pins the current
123
+ behaviour; changing it would break every existing listener.
124
+
125
+ ### Other changes
126
+
127
+ * CI housekeeping: `actions/checkout` v2/v3 -> v4, `actions/setup-node` v3
128
+ -> v4 on nodejs 22 (14 was long end of life, and it is the javascript
129
+ runtime `startback-web`'s sprockets specs need), `docker/login-action` v1
130
+ -> v3. The image release workflow reads the version to tag from
131
+ `github.ref_name` rather than `git describe --contains`, which silently
132
+ yielded nothing on a shallow checkout and downgraded a release to
133
+ unversioned tags.
134
+
135
+ * The 2.0.0 notes said `benchmark`, `json`, `logger` and `ostruct` stop being
136
+ default gems "in Ruby 3.5". That release became 4.0, and `json` is still a
137
+ default gem there. Corrected in place.
138
+
139
+ ## 2.0.0 - 2026-09-29
140
+
141
+ Major dependency upgrade. Sinatra 4 (hence Rack 3) is now required, and the
142
+ ranges of the other dependencies are widened so that their latest major
143
+ release is picked by default while applications remain free to pin an older
144
+ one in their own Gemfile.
145
+
146
+ **Startback's own API is unchanged.** Every class, require path, constructor
147
+ argument and public method behaves as in 1.2.x. The major bump is about the
148
+ dependency floor, and about what that floor asks of the applications built on
149
+ top -- which is most of what follows.
150
+
151
+ **See [UPGRADING.md](UPGRADING.md) for the migration guide**: what you will
152
+ see, why, and what to do about it. The short version is that a typical API
153
+ service needs two changes, setting `RACK_ENV` and lowercasing the response
154
+ triples it builds by hand.
155
+
156
+ ### BREAKING: Sinatra 4 and Rack 3 are now required
157
+
158
+ Startback's own middlewares now rely on `Rack::Headers`, which only exists in
159
+ Rack 3. There is no way to stay on Sinatra 3 with this release.
160
+
161
+ * **Response headers must be lowercase.** The Rack 3 SPEC states that header
162
+ keys "must not contain uppercase ASCII characters". Any place where your
163
+ application builds a response triple by hand, e.g.
164
+ `[200, {"Content-Type" => "application/json"}, [body]]`, must now use
165
+ `"content-type"`. Nothing crashes if you don't, but a Rack 3 middleware
166
+ looking the header up in lowercase will not find it and will happily add its
167
+ own, so the response goes out with the header twice. This is exactly the bug
168
+ that `AutoCaching` and `CorsHeaders` had, and that this release fixes.
169
+
170
+ * **Response bodies must respond to `each` or `call`.** A bare String is no
171
+ longer a valid body: `[404, {}, "NotFound"]` must become
172
+ `[404, {}, ["NotFound"]]`.
173
+
174
+ * Rack 2-only middlewares in your stack (anything using the removed
175
+ `Rack::Utils::HeaderHash`, or `Rack::File`) will break. This is the usual
176
+ Rack 2 to 3 migration and is not specific to Startback.
177
+
178
+ * **`Rack::Protection::HostAuthorization` is enabled by Sinatra 4.** In the
179
+ `development` environment — which is the one used whenever neither `RACK_ENV`
180
+ nor `APP_ENV` is set — only `localhost`, `*.localhost`, `*.test` and IP
181
+ literals are accepted as `Host`. Anything else gets a `403 Host not
182
+ permitted` before reaching any route. In every other environment the check is
183
+ disabled, so *production deployments are not affected*. What is affected:
184
+
185
+ - local development behind a custom hostname or a docker-compose service name;
186
+ - test suites, since `Rack::Test` issues requests against `example.org`.
187
+
188
+ Set `RACK_ENV` (`test` in test suites, as Startback's own specs now do), or
189
+ configure the permitted hosts explicitly:
190
+
191
+ class MyApi < Startback::Web::Api
192
+ set :host_authorization, { permitted_hosts: [".my-app.internal"] }
193
+ end
194
+
195
+ ### BREAKING: Ruby >= 3.2 is now required
196
+
197
+ Declared through `required_ruby_version`, because that is what bunny 3,
198
+ finitio 1.0, http 6, json 3 and nokogiri 1.19 all require. Ruby 3.1 reached
199
+ end of life in March 2025 and was never part of the test matrix.
200
+
201
+ ### BREAKING: `JSON.fast_generate` is gone
202
+
203
+ Removed by json 3. Startback used it in `Security::RateLimiter` and
204
+ `Caching::EntityCache#encode_key`, both of which now use `JSON.generate`. The
205
+ generated keys are identical, so caches and rate limit counters are not
206
+ invalidated. Applications calling `JSON.fast_generate` themselves must do the
207
+ same substitution.
208
+
209
+ ### BREAKING: rack-robustness 2 is now required
210
+
211
+ `Web::Shield` and `Web::CatchAll` subclass it. 2.0.0 requires Rack 3, and
212
+ emits lowercase header names everywhere -- including the last resort
213
+ response, the one returned when error handling itself fails, which is a raw
214
+ Rack triple and so never went through `Rack::Response` normalization. That
215
+ was the only genuinely Rack 3 non-compliant response Startback produced.
216
+
217
+ It also normalizes the header names given to its DSL, fixing a silent bug
218
+ where `g.headers('content-type' => ...)` lost to the `'Content-Type'`
219
+ default. Startback spells it `content_type` and never hit that one, but
220
+ applications configuring their own `Shield` subclass in lowercase did.
221
+
222
+ ### Dependencies whose major version is now the default
223
+
224
+ Startback does not use most of these itself: they are shipped as a convenience,
225
+ and their ranges have been widened rather than moved, so `< 4.0` style
226
+ constraints in your own Gemfile keep working. A plain `bundle update` will
227
+ however resolve to the newest of each, and each has its own breaking changes:
228
+
229
+ * **puma 6 -> 8** (`>= 6.0.2, < 9.0`). Puma 7 renamed every lifecycle hook
230
+ (`on_worker_boot` -> `before_worker_boot`, and so on), made `preload_app!`
231
+ the default in clustered mode, and lowercased its response headers. Puma 8
232
+ changed the default production bind from `0.0.0.0` to `::` when an IPv6
233
+ interface is available, which matters for container port publishing.
234
+
235
+ * **jwt 2 -> 3** (`>= 2.1, < 4.0`). This one has teeth: RSA keys must now be at
236
+ least 2048 bits, base64 decoding follows RFC 4648 strictly, the payload
237
+ cannot be read before the signature is verified, `HS512256` is dropped, and
238
+ custom algorithms must include `JWT::JWA::SigningAlgorithm`. Since 3.3, code
239
+ that rescues `JWT::DecodeError`, `JWT::IncorrectAlgorithm` or `ArgumentError`
240
+ *around `JWT.encode`* must rescue `JWT::EncodeError` instead. Applications
241
+ doing anything non-trivial with JWT should read its `UPGRADING.md` and pin
242
+ `jwt` themselves if they are not ready.
243
+
244
+ * **bunny 2 -> 3** (`>= 2.14, < 4.0`). Used by `Event::Bus::Bunny::Async`.
245
+ Versioned delivery tags are removed, passive declarations are no longer
246
+ replayed by topology recovery, and the `openssl` gem >= 3.3 is now required,
247
+ which means a native build in slim images.
248
+
249
+ * **finitio 0.12 -> 1.0** (`>= 0.12, < 2.0`). Two changes affect `.fio`
250
+ schemas: the `Fixnum` and `Bignum` aliases are removed (use `Integer`), and
251
+ the `FalseClass` alias is fixed — it used to be an alias of `.TrueClass`, so
252
+ it accepted `true` and rejected `false`. A schema that worked around that bug
253
+ now means the opposite of what it did.
254
+
255
+ * **http 5 -> 6** (`>= 5.0, < 7.0`) and **nokogiri**, **tzinfo**, **i18n**,
256
+ **mustache**: unchanged ranges or widened, never loaded by Startback itself.
257
+
258
+ ### Other changes
259
+
260
+ * `Web::HealthCheck` now returns a lowercase `content-type` header, as do
261
+ `Jobs::Support::JobResult::Embedded` and `::Redirect` in `startback-jobs`.
262
+ HTTP header names are case-insensitive and every client normalizes them, so
263
+ this only matters if you assert on the raw Rack triple.
264
+
265
+ * Development dependency on `webspicy` is dropped from `startback.gemspec`:
266
+ Startback's own specs never used it. `rack-test`, which used to arrive
267
+ transitively through it, is now an explicit development dependency.
268
+
269
+ * `benchmark`, `json`, `logger` and `ostruct` are now explicit runtime
270
+ dependencies. They are required by `lib/startback.rb` and stop being default
271
+ gems in Ruby 4.0 -- `json` excepted, which is still one there.
272
+
273
+ * The example application and both contrib gems moved to webspicy 1.0, whose
274
+ own ranges are what makes finitio 1.0, http 6 and rack-robustness 2.0
275
+ reachable at all here: every 0.27.x release capped the three of them. On the
276
+ way through 0.27 they also started validating unstructured response bodies
277
+ against `output_schema` instead of skipping them.
278
+
279
+ ### Known gaps
280
+
281
+ * The Bunny event bus has no automated coverage — the test matrix has no
282
+ RabbitMQ — so bunny 3 is upgraded but unverified by the suite. Likewise,
283
+ `http`, `jwt`, `puma`, `nokogiri`, `tzinfo`, `i18n` and `mustache` are never
284
+ loaded by Startback, so the suite says nothing about their new majors.
285
+ *(The bus is covered as of 2.1.0.)*
286
+
287
+ * Applications testing with webspicy must move to its 1.x line. Every 0.27.x
288
+ release requires `finitio < 0.13`, `http < 6.0` and `rack-robustness < 2.0`,
289
+ which conflicts with what Startback now asks for: bundler fails to resolve
290
+ rather than quietly holding a version back.
291
+
292
+ ## 1.2.4 - 2026-09-01
293
+
294
+ * Allow bmg 0.24.0
295
+
296
+ ## 1.2.3 - 2026-03-31
297
+
298
+ * Fix redactor when handling invalid string encoding.
299
+
300
+ ## 1.2.2 - 2026-02-03
301
+
302
+ * Add `emits_on_commit` event hook to avoid race conditions between sender and
303
+ receiver against the database.
304
+
305
+ ## 1.2.1 - 2025-09-03
306
+
307
+ * Add :fail strategy and dynamic options to Startback::Security::RateLimiter
308
+
309
+ ## 1.2.0 - 2025-09-03
310
+
311
+ * BREAKING change: only ruby 3.3 is kept in build & test matrix.
312
+
313
+ * Don't debug caller on WARN message about default logger.
314
+
315
+ * Exposed `logger_for` publicly in Robustness module, in addition to `log`.
316
+
317
+ * Added SpyLogger that helps integration tests wanting to lightly observe
318
+ call flows.
319
+
320
+ * Added Startback::Security::RateLimiter to help limiting operation executions
321
+ as a security measure.
322
+
323
+ * Added Env#test?, in addition to production? and development?
324
+
325
+ ## 1.1.0 - 2025-02-09
326
+
327
+ * Added ruby 3.3 to the build & release matrix
328
+ * Ruby dependencies upgraded in a backward compatibility way.
329
+
330
+ ## 1.0.3 - 2024-06-27
331
+
332
+ * Allow usage of Bmg 0.23.x, that makes no broken API.
333
+
334
+ ## 1.0.2 - 2024-04-24
335
+
336
+ * The Bus abstraction now exposes a `connected?` method, implemented by the
337
+ various implementations.
338
+
339
+ ## 1.0.1 - 2023-10-25
340
+
341
+ * Tracer and LogFormatter now both use the Redactor, that correctly redacts
342
+ credentials in URLs.
343
+
344
+ ## 1.0 - 2023-06-23
345
+
346
+ This gem is used in production for several years, so we bump it to 1.x to use
347
+ better semantics versioning schemes. See README for the definition of the public
348
+ API.
349
+
350
+ * BREAKING: the `base` `api` and `engine` gems have been removed.
351
+
352
+ The main `startback` gems provides what base/api/engine already provided (they
353
+ were actually the same), while `-web` became a contrib, like `-jobs`.
354
+
355
+ * BREAKING: Only `api` and `web` docker images are kept, while `web` will be
356
+ discontinued in the future. You can use the api image for engine, as it was
357
+ the same.
358
+
359
+ * BREAKING: the images no longer have the startback gem installed. You have to
360
+ install it yourself as part of your own `bundle`.
361
+
362
+ * BREAKING: the `engine` default CMD is no longer provided by default.
363
+ For reference, we used `bundle exec puma -t 1:1 -w 0 -p 3000 config.engine.ru`
364
+ that you probably want to add to your own docker image. We recommand using
365
+ a `puma.rb` file instead, and rely on the default command of the `api` image.
366
+
367
+ * Upgraded dependencies, notably http (5.x), tzinfo (2.x) and webspicy (0.26.x).
368
+ This may force clients to upgrade them as well.
369
+
370
+ ## 0.19.4 - 2023-06-22
371
+
372
+ * Fix a bug in EntityCache error handling: do not hide primary key resolution
373
+ issues.
374
+
375
+ ## 0.19.3 - 2023-06-22
376
+
377
+ * Fix backward compatibility bug when using entity_cache without loading the
378
+ entire caching module.
379
+
380
+ ## 0.19.2 - 2023-06-22
381
+
382
+ * Improved Caching::EntityCache with more observability and error handling.
383
+
384
+ A Prometheus listener is now provided and can be installed via options passed at
385
+ cache construction (or via subclass overriding). An option also allows not raising
386
+ errors when the cache fails, and loading the entity instead. One is supposed to at
387
+ least log or monitor those errors.
388
+
389
+ ## 0.19.1 - 2023-06-01
390
+
391
+ * Startback::Support::Env exposes the development?, staging? & production? helpers
392
+
393
+ ## 0.19.0 - 2023-05-26
394
+
395
+ * BREAKING: drop support for ruby < 2.7
396
+ * Upgraded webspicy to 0.24.x
397
+ * Upgraded finitio to 0.12.x
398
+
399
+ ## 0.18.2 - 2023-05-19
400
+
401
+ * Ensure all tracing spans are propagated properly even upon catch.
402
+
403
+ ## 0.18.1 - 2023-05-19
404
+
405
+ * [startback-jobs] BREAKING: the context may no longer be provided as input to the CreateJob operation (`opContext`). The operation itself dumps the current context. Fork it if required before calling the operation.
406
+
407
+ ## 0.18.0 - 2023-05-19
408
+
409
+ * BREAKING: Audit::Trailer is removed and replaced by Audit::Tracer, inspired by open telemetry.
410
+ The following changes are necessary:
411
+
412
+ 1. Replace `around_run(Audit::Trailer.new)` by `around_run(Audit::OperationTracer.new)`
413
+ 2. (optional) Make sure an instance of `Tracer` is available on the context
414
+ 3. (optional) Make sure you add an instance of `TraceLogger` as listener on that tracer
415
+ 4. (optional) Use the Audit::Middleware to reattach to existing traces provided by api callers
416
+ through the X-Span-Id and X-Trace-Id HTTP headers.
417
+
418
+ * [startback-websocket] BREAKING: contribution is discontinued and removed. Please use Pusher instead.
419
+
420
+ * [startback-jobs] BREAKING: Bmg minimal dependency is now 0.21.0, to get a startback-jobs bug fix.
421
+
422
+ The keys of the jobs created by 0.17.x are not the same as those created by 0.18.x. Finding a job
423
+ by id may fail even if the job exists.
424
+
425
+ * [startback-jobs] BREAKING: the context may no longer be provided as input to the CreateJob operation (`opContext`). The operation itself dumps the current context. Fork it if required before calling the operation.
426
+
427
+ * The data logs are now pretty printed by default in development mode.
428
+
429
+ * Sensitive data sanitization (now called "redacting") now hides emails and adresses. The redactor
430
+ no longer remove hash entries, but replaces the values by a '---redacted---' string.
431
+
432
+ ## 0.17.4 - 2023-04-20
433
+
434
+ * Fix wrong return in proc
435
+
436
+ ## 0.17.3 - 2023-04-20
437
+
438
+ * Allow event emitters to decide not to emit anything at a later time (ignore event data when it is nil).
439
+
440
+ ## 0.17.2 - 2023-04-20
441
+
442
+ * Adds the possibility to start only :sync or :async agents in Engine#create_agents
443
+
444
+ ## 0.17.1 - 2023-03-07
445
+
446
+ * API#loaded_body now supports x-www-form-urlencoded and returns
447
+ a dup of the request params.
448
+
449
+ * [startback-websocket] Add a way to unsubscribe from a room.
450
+
451
+ ## 0.17.0 - 2023-02-22
452
+
453
+ * Upgraded sinatra to 3.x
454
+ * Upgraded webspicy to 0.23.x
455
+
456
+ ## 0.16.0 - 2023-01-24
457
+
458
+ * Upgraded puma to 6.x
459
+
460
+ * The .api and .web images no longer specify default -t
461
+ (threads) and -w (workers) options to puma commandline.
462
+
463
+ One should use PUMA_MIN_THREADS, PUMA_MAX_THREADS and
464
+ WEB_CONCURRENCY envionment variables instead. For the record,
465
+ the default values (under MRI & puma 6.0.x) are 0, 5 and 0
466
+ (no forking model), respectively.
467
+
468
+ Stricly speaking, this is a broken API, even if you will
469
+ probably not notice the change.
470
+
471
+ Also, note that the .engine image now uses `-t 1:1 -w 0`,
472
+ which should be backward compatible as well. We stopped
473
+ using the workers mode, since only one worker makes little
474
+ sense.
475
+
476
+ * Default ruby version is now 3.1 instead of 2.7
477
+
478
+ If you need ruby 2.7, you must say it explicitely, e.g.
479
+ `enspirit/startback:base-0.16-ruby2.7`
480
+
481
+ ## 0.15.5 - 2023-01-11
482
+
483
+ * [startback-jobs] add support for job failures. Failed jobs
484
+ are considered ready (`isReady: true`) but have a new flag
485
+ (`hasFailed: true`) that tracks the failure. The failure
486
+ itself is dumped in `opResult`. The API that serves the job
487
+ result always dumps the `opResult` and uses a 200 status code
488
+ in case of success and 272 in case of failure.
489
+
490
+ ## 0.15.4 - 2022-10-13
491
+
492
+ * BadRequestError and subclasses (40x) are now logged in WARN
493
+ severity instead of ERROR by the Trailer. This is considered
494
+ a good idea on almost all Enspirit projects, so we dare doing
495
+ it on a tiny version bump (angel emoji).
496
+
497
+ ## 0.15.3 - 2022-09-30
498
+
499
+ * Rebuilding of docker images on latest ruby versions.
500
+
501
+ ## 0.15.2 - 2022-08-03
502
+
503
+ * Allow finitio 0.11 to be used. It's safe.
504
+
505
+ ## 0.15.1 - 2022-06-22
506
+
507
+ * Fix Web::CorsHeaders. An empty value is not allowed, the
508
+ header should simply not be present.
509
+
510
+ ## 0.15.0 - 2022-06-22
511
+
512
+ * POSSIBLY BREAKING: when a Finitio::TypeError is raised
513
+ (typically by an operation failing to validate its input),
514
+ the `location` field of the error is now dumped. This may
515
+ possibly break webspicy tests that validate error responses
516
+ very strictly.
517
+
518
+ * Web::CorsHeaders now support more bouncing options and can be
519
+ used to whitelist some urls (with wildcards) that are
520
+ authorized to bounce.
521
+
522
+ ## 0.14.4 - 2022-06-15
523
+
524
+ * Removed startback-tests.gemspec that is not a valid gem
525
+ anyway.
526
+
527
+ ## 0.14.3 - 2022-06-15
528
+
529
+ * [startback-jobs] properly let inspect a job and its embedded
530
+ results.
531
+
532
+
533
+ ## 0.14.2 - 2022-06-08
534
+
535
+ * [startback-websocket] Fix inclusion of javascript files in gem.
536
+
537
+ ## 0.14.1 - 2022-06-08
538
+
539
+ * Fix the build chain: release of ruby gems.
540
+
541
+ ## 0.14.0 - 2022-06-07
542
+
543
+ * Fix Engine: memoize the bus and run main agent class in
544
+ addition to its subclasses.
545
+
546
+ * BREAKING: Remove serverengine and webrick. Engines should now be started with
547
+ puma and a config.engine.ru instead of engine.rb
548
+
549
+ ## 0.13.0 - 2022-05-31
550
+
551
+ * Contributes Startback::Model, Startback::Services, as well
552
+ as Startback::Support::DataObject and Startback::Support::World
553
+
554
+ * Added the notion of context world, through Context.world,
555
+ Context#world and Context#with_world.
556
+
557
+ * Context.new yields the context instance if a block is given
558
+
559
+ * Bmg minimal dependency is now 0.20.0
560
+
561
+ * POSSIBLY BREAKING: Operation now has a default constructor that
562
+ expects a Hash and installs it under `@input` with an attr_reader.
563
+
564
+ This may break the audit trailer and/or bus dump for legacy
565
+ operations that named their input `request`.
566
+
567
+ ## 0.12.3 - 2022-05-25
568
+
569
+ * Event.json is idempotent.
570
+
571
+ ## 0.12.2 - 2022-05-20
572
+
573
+ * See 0.12.0, same release
574
+
575
+ ## 0.12.1 - 2022-05-19
576
+
577
+ * See 0.12.0, same release
578
+
579
+ ## 0.12.0 - 2022-05-19
580
+
581
+ This release enhances the event layer of Startback with the
582
+ Event, Bus, Engine and Agent collaborating classes.
583
+
584
+ Unfortunately it comes with a couple of BREAKING changes:
585
+
586
+ * `Context::Middleware` now longer takes a context_class
587
+ option, but simply a Context instance (or subclass). That
588
+ instance will be duped and result installed in Rack env.
589
+ Doing so allows building a default context instance with,
590
+ e.g. a logger, and make sure it will be properly reused.
591
+
592
+ * `Startback::Bus` is moved to `Startback::Event::Bus`
593
+
594
+ * `Startback::Event.json` contract has changed. The default
595
+ contract expects the event type to be a fully classified
596
+ class name (subclass of Event) and will attempt to factor
597
+ one. The second argument is no longer a world (Hash) but
598
+ a context instance to attach to the event. A context fork
599
+ is made, using the event context data passed through the
600
+ Context h_factory (if event contains context info).
601
+
602
+ * `Startback::Engine` constructor takes ServerEngine options
603
+ under a `:server_engine` key (was the options themselves).
604
+
605
+ * `Startback::Agent` has a new protocol that relies on agent
606
+ instances and the presence of an `Engine`. The `listen` class
607
+ method no longer exists. You must use the `sync` and `async`
608
+ instance methods instead. Your agent instance should be
609
+ created withing the engine (see `create_agents` and
610
+ `auto_create_agents` there)
611
+
612
+ * `Bus::Bunny` now has `autoconnect: false` by default. You
613
+ should explicit connect your engine instance instead.
614
+
615
+ * `Bus::Bunny` now has `abort_on_exception: true` by default.
616
+ It's much safer but you need a supervisor like Kubernetes
617
+ in pratice.
618
+
619
+ ## 0.11.6 - Unreleased
620
+
621
+ * Extend the Bus abstraction with connect/disconnect.
622
+
623
+ * Bunny::Async now has an autoconnect option (defaulting to true
624
+ for backward compatibility) that can be used to avoid connecting
625
+ too early.
626
+
627
+ * Bunny::Async now has `:abort_on_exception` and
628
+ `:consumer_pool_size` options that control the main channel
629
+ behavior. Their default values are chosen to stay backward
630
+ compatible.
631
+
632
+ ## 0.11.5 - 2022-05-18
633
+
634
+ * Add Startback::Support::Env with `env` and `env!` helper
635
+ methods.
636
+
637
+ * Startback no longer includes a trace in the warning message
638
+ sometimes seen because one uses the default logger.
639
+
640
+ * Added Startback::Event::Agent class, for agents reacting to
641
+ events on a bus.
642
+
643
+ * Added Startback::Event::Engine class, that runs an infinite
644
+ loop using ServerEngine and includes a Webrick small rack
645
+ app with a default and overridable healthcheck behavior.
646
+
647
+ ## 0.11.4 - 2022-05-18
648
+
649
+ * Allow logging Strings & Exceptions directly in both trailer
650
+ and Robusness helpers.
651
+
652
+ ## 0.11.3 - 2022-05-10
653
+
654
+ * Keep allowing `require 'audit/trailer'` alone without an
655
+ error.
656
+
657
+ ## 0.11.2 - 2022-05-10
658
+
659
+ * Audit::Trailer and Audit::Prometheus support any op object
660
+ responding to `op_name` and `op_data` and use them in
661
+ priority over dedicated logic to extract logging info.
662
+
663
+ Their `#call` method are now part of the public API and
664
+ can thus be called by end-user code.
665
+
666
+ ## 0.11.1 - 2022-05-10
667
+
668
+ * We no longer let the Sinatra layer dump errors in log.
669
+
670
+ ## 0.11.0 - 2022-04-21
671
+
672
+ * Require bmg >= 0.19.0
673
+
674
+ ## 0.10.1 - 2021-12-23
675
+
676
+ * Add support for causes in Startback::Errors::Error
677
+
678
+ * The Shield rack middleware dumps the causes to json, provided
679
+ they are subclasses of Startback::Error.
680
+
681
+ * Error & their causes are now properly dumped in the audit
682
+ trail.
683
+
684
+ ## 0.10.0 - 2021-12-22
685
+
686
+ * Add support for operations's transaction policy and transaction
687
+ manager helper
688
+
689
+ * Fix audit trail on multi operations. The op_data recursively
690
+ collect data of sub operations.
691
+
692
+ ## 0.9.1 - 2021-12-13
693
+
694
+ * Fixing thread safetiness of async bus (bunny channels)
695
+
696
+ ## 0.9.0 - 2021-08-27
697
+
698
+ * BREAKING CHANGE: all docker images now run Puma as app on port 3000 instead
699
+ of root on port 80.
700
+
701
+ * Upgrades uglify.js to 4.2, to enable support for ES6.
702
+
703
+ ## 0.8.3 - 2021-05-25
704
+
705
+ * Update dependencies for security patches.
706
+
707
+ ## 0.8.2
708
+
709
+ * Release gem in jenkins pipeline.
710
+
711
+ ## 0.8.1
712
+
713
+ * Web::Api#serve not support Path instances as entities to serve. Sinatra's send_file is
714
+ then used on the path. DTOs returning Path instances are supported too.
715
+
716
+ ## 0.8.0 - 2021/03/12
717
+
718
+ - Bumped finitio to 0.10
719
+ - Bumped webspicy to 0.20
720
+ - Bumped bmg to 0.18
721
+
722
+ ## 0.7.6 - 2020/12/11
723
+
724
+ * Include version.
725
+
726
+ ## 0.7.5 - 2020/12/11
727
+
728
+ * Prometheus metrics include startback_version and have customisable with prefix and labels.
729
+
730
+ ## 0.7.4 - 2020/12/10
731
+
732
+ * Move prometheus-client as a dependency for base.
733
+
734
+ ## 0.7.3 - 2020/12/08
735
+
736
+ * Add prometheus auditor and rack middleware exposing metrics for
737
+ operations. The auditor implements the around_run contract.
738
+
739
+ # Usage example:
740
+ around_run(Startback::Audit::Prometheus.new)
741
+
742
+ # ... in api (exposing /metrics endpoint)
743
+ use Startback::Web::Prometheus
744
+
745
+ ## 0.7.2 - 2020/08/27
746
+
747
+ * Api#with_context and Operation#with_context allow running a block
748
+ with an ephemeral context. The original one is restored after the
749
+ block execution.
750
+
751
+ # With an explicit context created from scratch
752
+ ctx = ...
753
+ with_context(ctx) do
754
+ # will be run using `ctx`, instead of the original one
755
+ run MyOperation.new
756
+ end
757
+ ... # original context is restored here
758
+
759
+ # With a context dup
760
+ with_context do |ctx|
761
+ ctx.foo = "bar"
762
+ # will be run using `ctx`, instead of the original one
763
+ run MyOperation.new
764
+ end
765
+ ... # original context restored; foo=bar is no longer true
766
+
767
+ * DateTime and Time monkey patches are corrected regarding `to_s`
768
+ when the latter takes a parameter (activesupport does).
769
+
770
+ * Bmg "0.17.5" is now a minimum.
771
+
772
+ ## 0.7.1
773
+
774
+ * Context#dup now correctly cleans all factored abstractions.
775
+
776
+ ## 0.7.0
777
+
778
+ * Bumped bmg dependency to 0.17.x to get recent optimizations and bug
779
+ fixes.
780
+
781
+ ## 0.6.0
782
+
783
+ * Docker images now have the startback gem install together with all
784
+ dependencies. This saves build time of image users, since many gems
785
+ that require native extensions are already installed and will be
786
+ reused by bundler.
787
+
788
+ ## 0.5.5
789
+
790
+ * All docker images now run the software as app:app, for improved security.
791
+
792
+ ## 0.5.4
793
+
794
+ * Docker images added for the various variants we have: base, api, web,
795
+ engine.
796
+
797
+ ## 0.5.3 - 2019/10/23
798
+
799
+ * Added a `Startback::Caching::NoStore` abstraction, the easiest way
800
+ to disable caching in practice.
801
+
802
+ ## 0.5.2 - 2019/10/23
803
+
804
+ * Fine-tuned `Robustness` once again, to trace when default logger is
805
+ (incorrectly?) used.
806
+
807
+ * Fixed `EntityCache` and `CatchAll` logging to use the context when
808
+ defined and avoid therefore to end up on the default logger.
809
+
810
+ ## 0.5.1 - 2019/10/19
811
+
812
+ * Improved `EntityCache` with a protocol to convert candidate keys to
813
+ primary keys. The class documentation and vocabulary has been improved
814
+ to be more intuitive for users with a relational database background.
815
+
816
+ Methods `full_key` and `load_raw_data` are renamed in a backwards
817
+ compatible way to `primary_key` and `load_entity`, respectively. The
818
+ old methods will be removed in 0.6.0.
819
+
820
+ * Improved `EntityCache` with logging. Cache hits are logged in debug.
821
+ Cache miss & outdated are logged in info.
822
+
823
+ * Fine-tuned `Robustness`, log & audit trail to make them easier to use.
824
+ In particular, the 25 lines of the backtrace are dumped in `op_data`
825
+ on fatal errors.
826
+
827
+ ## 0.5.0 - 2019/10/16
828
+
829
+ * BREAKING CHANGE: Operation#bind no longer returns new operation
830
+ instances, it mutates the operation on which it is called. This is to
831
+ prevent counterintuitive behaviors when operations are passed around
832
+ while binding is actually rather hidden.
833
+
834
+ * BREAKING CHANGE: Web::CatchAll only dumps 10 stacktrace lines, to
835
+ prevent logs from growing too much, and make sure that logs under
836
+ passenger do not end up being broken.
837
+
838
+ * Add support for run `around` hooks in `Web::Api`, through an
839
+ OperationRunner support module. The same module is included by
840
+ the `Operation` class itself, since it can run sub operations.
841
+
842
+ * Before (resp. after) hooks are added to the `Operation` abstraction.
843
+ They are called right before (resp. after) `call` by operation runners,
844
+ that is `Web::Api` and `Operation` itself.
845
+
846
+ * Introduce an `operation_world` overridable method to participate
847
+ to the world construction in `Web::Api`. This aims at preventing
848
+ `run` cowboy overriding.
849
+
850
+ * The `Context` abstraction now has a dump & reload protocol that allows
851
+ being passed around in a distributed architecture.
852
+
853
+ * The `Context` abstraction now acts as a factory for related abstractions.
854
+ That factory has a caching mechanism, to prevent creating the same classes
855
+ over and over again and reduce memory footprint.
856
+
857
+ * Add Startback::Web::Middleware helper module, that gives access to the
858
+ running context installed by Startback::Context::Middleware under a
859
+ simple `context` method.
860
+
861
+ * Add eventing support through the `Startback::Event` and `Startback::Bus`
862
+ abstractions. Please `require 'startback/bus'` explicitely to use them.
863
+
864
+ * Add `Startback::Caching::EntityCache` abstraction and protocol for making
865
+ caching and invalidation easier on individual objects.
866
+ Please `require 'startback/caching/entity_cache'` explicitely to use them.
867
+
868
+ * Add log & audit trail abstractions, through the `Stackback::Audit::Trailer`
869
+ class. The class can be registered as an operation's around callback and
870
+ will dump a json log of operation executions and their timing.
871
+
872
+ ## 0.4.5 - 2019/06/24
873
+
874
+ * [CatchAll] Log error message and error backtrace as two different lines,
875
+ to avoid message being stripped because the stacktrace is too long.
876
+
877
+ ## 0.4.4 - 2019/03/12
878
+
879
+ * Startback::Web::HealthCheck correctly returns an empty array as third
880
+ rack 204 response, to meet the spec and avoid crashes with webrick.
881
+
882
+ ## 0.4.3 - 2019/03/08
883
+
884
+ * `Context::Middleware.context(env)` can now be used to return the context
885
+ installed on an environment. To avoid having to know the key itself that
886
+ might change in the future.
887
+
888
+ * The Errors module now expose many utility methods to raise errors without
889
+ having to know all error classes. Those methods are available in Operation
890
+ and Api instances. The module can also be included by users to get the new
891
+ methods available elsewhere.
892
+
893
+ * The error `No method unsupported_content_type` is now fixed when a media
894
+ type is unsupported. A correct 415 HTTP error is returned instead.
895
+
896
+ * Ruby's NotImplementedError are now catched by the Shield and transformed
897
+ to a 501 HTPP response.
898
+
899
+ * Severe errors catched by CatchAll are not logged with both the message and
900
+ the full stack trace.
901
+
902
+ ## 0.4.2 - 2019/03/08
903
+
904
+ * Startback::Web::AutoCaching no longer overrides Cache-Control headers
905
+ set down the middleware chain. It trusts existing headers by default.
906
+
907
+ ## 0.4.1 - 2019/03/06
908
+
909
+ * Add a NgHtmlTransformer tool to MagicAssets. Useful for angular assets
910
+ with a component folder structure.
911
+
912
+ ## 0.4.0 - 2019/03/06
913
+
914
+ * BREAKING CHANGE: the various web components are not longer required by
915
+ default. The user must require each component it uses.
916
+
917
+ * Add a Startback::Web::AutoCaching rack middleware to help setting
918
+ the Cache-Control header in development/production environments,
919
+ according to middleware construction parameters and/or environment
920
+ variables.
921
+
922
+ * Add a Startback::Web::CorsHeaders rack middleware to help setting
923
+ the various Cross-Origin Response Headers correctly, while supporting
924
+ good default values and configuration through middleware construction
925
+ parameters and/or environment variables.
926
+
927
+ * Add a Startback::Web::MagicAssets middleware and application, to help
928
+ managing js/css assets using Sprockets.
929
+
930
+ ## 0.3.2 - 2018/11/27
931
+
932
+ * Subclassing error classes keep orginal status codes, unless overriden
933
+
934
+ ## 0.3.1 - 2019/01/30
935
+
936
+ * Fix file upload raising an exception about `file` not being defined.
937
+
938
+ ## 0.3.0 - 2018/10/12
939
+
940
+ * Enhanced CatchAll to support an `error_handler` on the context. Fatal
941
+ exceptions are passed to the error handler when provided.
942
+
943
+ ## 0.2.0 - 2018/09/26
944
+
945
+ * Context::Middleware now accepts a `context_class` option allowing
946
+ to specify a subclass of Context as actual context class. This allows
947
+ application to make the context more specific without monkey patching
948
+ Startback classes.
949
+
950
+ * Main abstractions cleaned and documented
951
+
952
+ ## 0.1.0
953
+
954
+ Birthday