@gaia-ai/addon-remote-drupal 0.6.4 → 0.6.5

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.
Files changed (2) hide show
  1. package/dist/src/index.js +21 -6
  2. package/package.json +3 -3
package/dist/src/index.js CHANGED
@@ -6,6 +6,16 @@
6
6
  import { resolveAuth } from 'dropsh';
7
7
  import { createHttpClient, createJsonApiClient } from 'dropsh/plugin';
8
8
  const ACTIVE = ['claimed', 'running'];
9
+ /**
10
+ * Terminal ticket states — the reap work list's state branch (GAIA-243).
11
+ *
12
+ * Mirrors the server's `TypeWorkflows::isTerminal()`, which derives terminality
13
+ * from `gaia_core.workflows.yml` (a state no transition leaves). Every ticket
14
+ * workflow there currently ends in exactly these two. When a workflow gains a
15
+ * terminal state, this is the list to extend — and the access handler needs no
16
+ * change, since it asks the workflow definition directly.
17
+ */
18
+ const TERMINAL = ['done', 'cancelled'];
9
19
  export class DrupalGaiaRemote {
10
20
  api;
11
21
  constructor(api) {
@@ -271,16 +281,21 @@ export class DrupalGaiaRemote {
271
281
  // Finished tickets whose worktree is not yet torn down (cleaned_up=0),
272
282
  // driven by the durable `cleaned_up` flag (GAIA-89) AND scoped to this
273
283
  // conductor (GAIA-121): only tickets assigned to `id` are loaded, so a
274
- // ticket owned by another conductor never reaches the reaper loop. "Finished"
275
- // = reached `done` OR already `closed`; the collection builder has no OR, so
276
- // this is two AND-queries merged + de-duped by uuid. The `conductor_id`
277
- // relationship carries the assigned conductor's `machine_id` the same
278
- // nested filter the sibling reaper queries (`fetchFinalizableRuns` etc.) use.
284
+ // ticket owned by another conductor never reaches the reaper loop.
285
+ // "Finished" = reached a TERMINAL state (`done` or `cancelled` GAIA-243)
286
+ // OR already `closed`. A cancelled ticket keeps closed=0, since nothing
287
+ // server-side closes a ticket on a transition, so it needs the state branch
288
+ // to reach it at all. The collection builder has no OR across DIFFERENT
289
+ // fields, so state-or-closed stays two AND-queries merged + de-duped by
290
+ // uuid; whereIn covers the several states within one of them, at no extra
291
+ // round-trip. The `conductor_id` relationship carries the assigned
292
+ // conductor's `machine_id` — the same nested filter the sibling reaper
293
+ // queries (`fetchFinalizableRuns` etc.) use.
279
294
  const fields = ['branch_name', 'state', 'closed'];
280
295
  const done = await this.api
281
296
  .collection('gaia_ticket')
282
297
  .where('conductor_id.machine_id', '=', id)
283
- .where('state', '=', 'done')
298
+ .whereIn('state', TERMINAL)
284
299
  .where('cleaned_up', '=', '0')
285
300
  .fields(fields)
286
301
  .page(100)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gaia-ai/addon-remote-drupal",
3
- "version": "0.6.4",
3
+ "version": "0.6.5",
4
4
  "description": "GAIA conductor remote addon: the Drupal/JSON:API control-plane remote.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -23,7 +23,7 @@
23
23
  "dropsh": "^0.5.8"
24
24
  },
25
25
  "peerDependencies": {
26
- "@gaia-ai/conductor": "^0.6.4",
27
- "@gaia-ai/core": "^0.6.4"
26
+ "@gaia-ai/conductor": "^0.6.5",
27
+ "@gaia-ai/core": "^0.6.5"
28
28
  }
29
29
  }