solid-objects 0.17.1 → 0.17.2

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.17.2 - 2026-10-08
4
+
5
+ - The README names the agent guide at the start of Installation, and the agent
6
+ guide says that a reminder changes state only when it runs under
7
+ `runtime.run(signal)`, so a query must not compute expiry from the clock.
8
+ - Correct `docs/agents.md`: `reject` takes a code and an options object,
9
+ `this.reject(code, { message })`, not `this.reject(code, message)`.
10
+ - `docs/agents.md` now says that a worker process runs only the actor classes
11
+ that it knows. For an unregistered class, actor setup fails with
12
+ `UnknownActorType`, the worker reports `solid_objects.activation.failed`,
13
+ and the message returns to the queue without a counted attempt. Nothing
14
+ prints without an `instrumentation` callback. Register each class before
15
+ `runtime.run(signal)`.
16
+ It also tells agents to install the current release, puts the
17
+ deny-by-default reminder beside the install step, and lists the API
18
+ mistakes found in agent-written code.
19
+ - Claim the Context7 library: `context7.json` now carries the library `url` and
20
+ the maintainer `public_key`.
21
+ - Add the Context7 refresh workflow. A push to `main` that changes the README,
22
+ `context7.json`, `docs/`, or `examples/` asks Context7 to refresh the index.
23
+ It uses the `CONTEXT7_API_KEY` repository secret.
24
+
3
25
  ## 0.17.1 - 2026-10-08
4
26
 
5
27
  - Check holds with `Object.hasOwn` in the README and guide ticket sale
package/README.md CHANGED
@@ -49,7 +49,8 @@ subscriptions. Start with the [Cloudflare example](examples/cloudflare/README.md
49
49
  ## Installation
50
50
 
51
51
  Solid Objects is ESM-only and requires Node.js 24.4 or newer. TypeScript users
52
- need TypeScript 5.9 or newer.
52
+ need TypeScript 5.9 or newer. Coding agents should follow the
53
+ [agent guide](docs/agents.md), which gives each step in order.
53
54
 
54
55
  ```bash
55
56
  npm install solid-objects
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.17.1";
1
+ export declare const VERSION = "0.17.2";
2
2
  //# sourceMappingURL=version.d.ts.map
package/dist/version.js CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = "0.17.1";
1
+ export const VERSION = "0.17.2";
2
2
  //# sourceMappingURL=version.js.map
package/docs/agents.md CHANGED
@@ -68,6 +68,10 @@ The quickstart runs 25 concurrent calls against one identity on a temporary
68
68
  SQLite database. It proves that no update is lost. Add `pg` or `mysql2` when
69
69
  you use PostgreSQL or MySQL.
70
70
 
71
+ Install the current release. `npm install solid-objects` selects it. Do not
72
+ pin a version that you remember from earlier work; the API changed between
73
+ releases. The current version is on <https://www.npmjs.com/package/solid-objects>.
74
+
71
75
  Create the runtime and its tables at startup:
72
76
 
73
77
  ```typescript
@@ -81,7 +85,9 @@ const runtime = configure({
81
85
  await runtime.install()
82
86
  ```
83
87
 
84
- [Configuration](configuration.md) lists each option and database adapter.
88
+ Every authorization callback denies by default. Do step 5 before you call an
89
+ actor. [Configuration](configuration.md) lists each option and database
90
+ adapter.
85
91
 
86
92
  ## 5. Authorize
87
93
 
@@ -184,13 +190,26 @@ Obey these rules in actor code:
184
190
  object argument.
185
191
  - Use `this.schedule({ at, key })` for delayed work. A new `schedule` with the
186
192
  same key moves the alarm.
187
- - Use `this.reject(code, message)` for a business rule failure that must not
188
- retry.
193
+ - Use `this.reject(code, { message })` for a business rule failure that must
194
+ not retry. The second argument is an object, for example
195
+ `this.reject("room_full", { message: "The room is full" })`.
189
196
  - Do not write application tables directly from an operation. Use
190
197
  `this.commitAction()` for a short write in the same database.
191
198
  - Do not call an external API in an operation. Use `this.emit()` and an effect
192
199
  handler.
193
200
  - Write each operation so that it can run again. Delivery is at least once.
201
+ - A reminder changes state only when it runs, and it runs only while a process
202
+ calls `runtime.run(signal)`. Do not compute expiry from the clock in a query;
203
+ read the state that the reminder committed.
204
+
205
+ Avoid these mistakes:
206
+
207
+ | Mistake | Correct form |
208
+ | ---------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
209
+ | `this.schedule({ at, key })` with no operation after it | `this.schedule({ at, key }).expire({ buyer })`. `schedule()` stages a reminder only when you call an operation on its result |
210
+ | `this.reject("room full")` or `this.reject(code, message)` | `this.reject("room_full", { message: "The room is full" })` |
211
+ | `registerEffect(name, (context, argumentsValue) => ...)` | `registerEffect(name, (argumentsValue, context) => ...)`. The staged arguments come first |
212
+ | A worker process that never names the actor class | `runtime.register(TicketSale)` before `runtime.run(signal)`. See step 7 |
194
213
 
195
214
  [State and lifecycle](state-and-lifecycle.md) and the
196
215
  [public API](api.md) give the full rules.
@@ -206,13 +225,25 @@ runs in the caller. These features need a process that calls
206
225
  - Messages to other actors.
207
226
  - Realtime broadcasts.
208
227
 
228
+ The worker process runs only the actor classes that it knows. For a message
229
+ whose class is not registered, actor setup fails with `UnknownActorType`. The
230
+ worker reports `solid_objects.activation.failed` through instrumentation,
231
+ returns the message to the queue without counting an attempt, and tries again.
232
+ Nothing prints unless the application sets an `instrumentation` callback, so
233
+ the message seems to wait with no error. Register each class before `run()`:
234
+
209
235
  ```typescript
236
+ runtime.register(TicketSale)
237
+
210
238
  const controller = new AbortController()
211
239
  process.once("SIGTERM", () => controller.abort())
212
240
  await runtime.run(controller.signal)
213
241
  await runtime.close()
214
242
  ```
215
243
 
244
+ `TicketSale.ref(...)` also registers the class, so a script that calls `ref()`
245
+ before `run()`, like the direct call above, already works.
246
+
216
247
  The packaged `solid-objects start` command does the same for a runtime that
217
248
  `solid-objects.config.js` exports. When no process runs, committed work waits
218
249
  in SQL and runs later. [Operations](operations.md) covers roles and shutdown.
package/docs/parity.md CHANGED
@@ -4,7 +4,7 @@ This ledger tracks capability parity with the Ruby `solid_objects` gem.
4
4
  Parity preserves a capability and its correctness or security boundary. It does
5
5
  not copy a Rails API into Node.
6
6
 
7
- Reference: Ruby `solid_objects` 0.17.1. The JavaScript package began at the Ruby
7
+ Reference: Ruby `solid_objects` 0.17.2. The JavaScript package began at the Ruby
8
8
  design's `0.12` capability generation; that version number did not imply earlier
9
9
  JavaScript releases.
10
10
 
package/docs/releasing.md CHANGED
@@ -60,5 +60,6 @@ npm already holds, it still creates a missing release.
60
60
 
61
61
  After the tag publishes, refresh the solidobjects.dev documentation snapshot
62
62
  from the tag and redeploy the site. The site's `check:release` step refuses a
63
- snapshot that is not the latest published tag. Then trigger a Context7 refresh
64
- for this repository.
63
+ snapshot that is not the latest published tag. The Context7 refresh workflow
64
+ refreshes the index after each push to `main` that changes the documentation.
65
+ Confirm that its run succeeded.
@@ -113,6 +113,10 @@ buyer gets the ticket. The hold and its reminder commit in one transaction. If
113
113
  the worker stops, the reminder stays in `tickets.sqlite3`. It runs when the
114
114
  worker starts again.
115
115
 
116
+ The `work` branch can run the reminder because `TicketSale.ref(...)` registers
117
+ the class first. A separate worker process must call
118
+ `runtime.register(TicketSale)` before `runtime.run(signal)`.
119
+
116
120
  The authorization callbacks above allow every caller. Use them only for a
117
121
  local example. The package release check runs this file against the packed
118
122
  npm tarball. The source is [`examples/ticket-sale.ts`](../examples/ticket-sale.ts).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "solid-objects",
3
- "version": "0.17.1",
3
+ "version": "0.17.2",
4
4
  "description": "SQL-backed virtual actor library for TypeScript and Node.js, with durable state, ordered operations, and automatic activation on SQLite, PostgreSQL, or MySQL",
5
5
  "type": "module",
6
6
  "license": "MIT",