toga-ai 1.0.551 → 1.0.552
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.
|
@@ -226,6 +226,16 @@ metrics**, not the database.
|
|
|
226
226
|
## Gotchas
|
|
227
227
|
|
|
228
228
|
- Class must be **`abstract`** and methods **`public static`** or routing fails.
|
|
229
|
+
- **A JSON-object parameter arrives as `stdClass`, not `array` — type it `object|array` and
|
|
230
|
+
cast.** The dispatcher decodes `Core.CronJobs.parameters` and casts **only the top level** to
|
|
231
|
+
an array (`$parameters = (array) $message->parameters;` in `Controller/Index.php`, ~L455/692),
|
|
232
|
+
then spreads it as named args. So a **nested JSON object** value stays a PHP `stdClass`; a
|
|
233
|
+
method that declares that parameter as strict `array` throws a `TypeError`
|
|
234
|
+
(*"must be of type array, stdClass given"*) at dispatch. Declare such a parameter as
|
|
235
|
+
`object|array` and `(array)`-cast it at the top of the method. (Nested JSON **arrays** decode
|
|
236
|
+
to PHP arrays fine — only JSON **objects** become `stdClass`.) This bit
|
|
237
|
+
`_Worker_Infrastructure_CloudWatch::ElasticBeanstalkHealth`'s `environments` region-map in
|
|
238
|
+
production — see [cross-account-aws-access.md](./cross-account-aws-access.md).
|
|
229
239
|
- Webhook headers are **lowercased** by API Gateway (`X-GitHub-Event` → `x-github-event`).
|
|
230
240
|
- If the action needs a client DB, register it in `initialize()` — it runs before the method.
|
|
231
241
|
- **Worker actions do NOT auto-register `DB_CLIENT`.** The dispatcher registers only
|
|
@@ -259,6 +269,12 @@ metrics**, not the database.
|
|
|
259
269
|
commit-before-SQS transaction pattern that the worker relies on.
|
|
260
270
|
|
|
261
271
|
## Change history
|
|
272
|
+
- 2026-08-11 — Added the **nested-JSON-object → `stdClass` dispatch gotcha**: the dispatcher casts
|
|
273
|
+
only the top level of `CronJobs.parameters` to an array before spreading as named args
|
|
274
|
+
(`Controller/Index.php` ~L455/692), so a nested JSON object stays `stdClass` and a strict
|
|
275
|
+
`array` param throws a `TypeError` at dispatch — type such params `object|array` and
|
|
276
|
+
`(array)`-cast. Surfaced fixing `ElasticBeanstalkHealth`'s `environments` region-map in
|
|
277
|
+
production. (jcardinal)
|
|
262
278
|
- 2026-08-10 — Documented that **`debug_mode` changes `runTask`'s dispatch** (1 = synchronous
|
|
263
279
|
`_ApiRequest` POST to `_Config::api('worker')`, running the action inside the caller's open
|
|
264
280
|
transaction so any read-back fails; 0 = SQS enqueue), plus the debug-mode side effects
|
|
@@ -153,8 +153,17 @@ their only home.
|
|
|
153
153
|
- Config keys are optional by design (in-code defaults), so a missing `[cloud]`
|
|
154
154
|
`workloads_role_*` key silently uses `WorkloadsRuntime` / `worker2-workloads` — set them
|
|
155
155
|
explicitly in prod ini to override.
|
|
156
|
+
- **`$environments` must be typed `object|array`, not `array`.** The cron dispatcher casts only
|
|
157
|
+
the top level of `CronJobs.parameters` to an array, so this nested JSON **object** arrives as a
|
|
158
|
+
PHP `stdClass` and a strict `array` type throws a `TypeError` at dispatch. Declare it
|
|
159
|
+
`object|array` and `(array)`-cast at the top. General rule for any object-valued cron param —
|
|
160
|
+
see [creating-worker-actions.md](./creating-worker-actions.md).
|
|
156
161
|
|
|
157
162
|
## Change history
|
|
163
|
+
- 2026-08-11 — Noted that `ElasticBeanstalkHealth`'s `$environments` must be typed `object|array`
|
|
164
|
+
(not `array`): the nested JSON object arrives as `stdClass` because the dispatcher casts only
|
|
165
|
+
the top level of `CronJobs.parameters`, so a strict `array` throws a `TypeError` at dispatch.
|
|
166
|
+
Cross-referenced the general rule in creating-worker-actions.md. (jcardinal)
|
|
158
167
|
- 2026-08-11 — `ElasticBeanstalkHealth` signature changed to
|
|
159
168
|
`(string $awsAccountId, array $environments, string $oneuptimeUrl)`: `$environments` is a
|
|
160
169
|
region → env-names map, so one monitor can watch EB environments across multiple regions
|
package/package.json
CHANGED