toga-ai 1.0.268 → 1.0.269
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.
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|-----|---------|-------|
|
|
5
5
|
| [Library (1.0 Framework) Architecture](architecture.md) | `library` is the shared library repository for **all 1.0 (legacy) applications** — the `App_` framework. | library/_.php, library/app/, library/browser/ |
|
|
6
6
|
| [App_Sso — Reusable 1.0 SSO Initiation (SP-initiated SAML via saml.togahub.com)](features/app-sso-initiation.md) | `App_Sso` (`library/app/sso.php`) is the **1.0 port of the 2.0 SAML gateway's SP-initiated SSO initiation**, packaged as a reusable, framework-level capability | library/app/sso.php, library/sso/togahub_private_key.key |
|
|
7
|
+
| [Cron Execution Monitoring (App_Framework check-in/out → CronJobExecutions)](features/cron-execution-monitoring.md) | `App_Framework::cronInitialization()` / `App_Framework::cronFinished()` (in `library/app/framework.php`) give every 1.0 (`App_`) cron job a check-in/check-out l | library/app/framework.php |
|
|
7
8
|
| [Diagnostic Dialog — View Recommended Services Routing](features/diagnostic-dialog-view-recommended-services.md) | `App_Model_Toga_Diagnostic::initializeDiagnosticDialog()` renders the device modal used across all TOGa service request views. | library/app/model/toga/diagnostic.php |
|
|
8
9
|
| [Elite Freshservice Sync (library)](features/elite-freshservice-sync.md) | `App_Api_Toga2` in `library/app/api/toga2.php` orchestrates bidirectional sync between TOGA 2 and TOGaDesk. | library/app/api/toga2.php |
|
|
9
10
|
| [Branded HTML Email Templates (App_Email_Template)](features/email-templates.md) | `App_Email_Template` (`app/email/template.php`) is the base class for branded HTML emails in the 1.0 (`App_`) framework. | library/app/email/template.php, library/app/email/agilant.php |
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Cron Execution Monitoring (App_Framework check-in/out → CronJobExecutions)
|
|
3
|
+
framework: "1.0"
|
|
4
|
+
repo: library
|
|
5
|
+
project: Library
|
|
6
|
+
client: shared
|
|
7
|
+
type: feature
|
|
8
|
+
status: active
|
|
9
|
+
updated: 2026-07-06
|
|
10
|
+
owners: [dfranks]
|
|
11
|
+
files:
|
|
12
|
+
- library/app/framework.php
|
|
13
|
+
related:
|
|
14
|
+
- ../../worker/architecture.md
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Summary
|
|
18
|
+
|
|
19
|
+
`App_Framework::cronInitialization()` / `App_Framework::cronFinished()` (in
|
|
20
|
+
`library/app/framework.php`) give every 1.0 (`App_`) cron job a check-in/check-out
|
|
21
|
+
lifecycle recorded in the **`CronJobExecutions`** table in **`db_common`**. On start the job
|
|
22
|
+
INSERTs an execution row; on finish it UPDATEs that row with completion state and an
|
|
23
|
+
`executionTimeSeconds` duration. This is the shared-DB monitoring surface for 1.0 crons
|
|
24
|
+
across all 1.0 apps (worker, togadesk, toga, …), independent of the older `Log`/`CRON_START`
|
|
25
|
+
row in `db_log` and of the per-job Sentry check-in monitors.
|
|
26
|
+
|
|
27
|
+
## How it works
|
|
28
|
+
|
|
29
|
+
- **`cronInitialization()`** — INSERTs one row into `CronJobExecutions` (`db_common`) via the
|
|
30
|
+
execution-id registry variable, records start time, and returns/stores the execution id used
|
|
31
|
+
to close the row later.
|
|
32
|
+
- **`cronFinished()`** — UPDATEs the same `CronJobExecutions` row (matched by execution id)
|
|
33
|
+
with completion status and `executionTimeSeconds`.
|
|
34
|
+
- **Connection:** every `CronJobExecutions` read/write goes against **`db_common`**. The table
|
|
35
|
+
exists **only** in `db_common` — it does **not** exist on the `db_log` connection.
|
|
36
|
+
- **Duration precision:** `executionTimeSeconds` is `round(microtime(true) - $start, 3)` —
|
|
37
|
+
millisecond precision landing in a `decimal(10,3)` column. Do **not** `(int)`-cast it; the
|
|
38
|
+
cast silently discards the sub-second precision even when the schema column is `decimal(10,3)`.
|
|
39
|
+
- **Schema:** the table is provisioned by the dbchanges migration
|
|
40
|
+
`dbchanges/Common/DF/2026-5-7 Cron Checkin.sql` (table `CronJobExecutions`,
|
|
41
|
+
`executionTimeSeconds decimal(10,3)`, no `note` column).
|
|
42
|
+
- **Design decision:** 1.0 records executions by writing **directly to the shared DB**
|
|
43
|
+
(`db_common`), *not* by POSTing from 1.0 to a 2.0 API endpoint. Per Jeff Cardinal, 1.0 code
|
|
44
|
+
must not POST to 2.0 code; the direct shared-DB write is the sanctioned path (TRUE-78182).
|
|
45
|
+
|
|
46
|
+
## Gotchas
|
|
47
|
+
|
|
48
|
+
- **`db_log` has no `CronJobExecutions` table.** A `cronFinished()` UPDATE that runs against the
|
|
49
|
+
`db_log` connection throws on **every** 1.0 cron job. Both the INSERT and the UPDATE must
|
|
50
|
+
target `db_common`.
|
|
51
|
+
- **A `git merge` can silently resurrect pre-refactor logic.** These functions were cleanly
|
|
52
|
+
consolidated to a single `db_common`-only INSERT/UPDATE pair (commit `0a3a6f75`), but a later
|
|
53
|
+
`git merge origin/_production` (`509614036605…`) reintroduced the old dual-path structure from
|
|
54
|
+
`_production`'s still-unmigrated copy of the file — leaving duplicate INSERT/UPDATE blocks, and
|
|
55
|
+
reverting one path's connection argument back to `db_log`. Automatic merge resolution updated
|
|
56
|
+
the SQL text (renamed the table) but restored the wrong connection name, producing a
|
|
57
|
+
platform-wide breaking bug disguised as a simple PR-feedback rework. **When a merge touches a
|
|
58
|
+
function you already refactored on your branch and the base branch never got that refactor,
|
|
59
|
+
diff against the merge-base — do not just eyeball the current file** — to catch resurrected
|
|
60
|
+
logic. (Fixed 2026-07-06: consolidated back to one `db_common` INSERT/UPDATE pair.)
|
|
61
|
+
|
|
62
|
+
## Change history
|
|
63
|
+
- 2026-07-06 — Fixed a merge (`origin/_production`) that reintroduced duplicate
|
|
64
|
+
`CronJobExecutions` writes and pointed one `cronFinished()` UPDATE at `db_log` (where the
|
|
65
|
+
table doesn't exist), which would have thrown on every 1.0 cron. Consolidated to one
|
|
66
|
+
`db_common` INSERT/UPDATE pair and switched `executionTimeSeconds` to `round(…, 3)` for the
|
|
67
|
+
`decimal(10,3)` precision the migration provides. (dfranks, TRUE-78182)
|
|
68
|
+
- 2026-05-07 — Introduced `CronJobExecutions` check-in/out in `App_Framework` cron lifecycle;
|
|
69
|
+
direct `db_common` write chosen over a 1.0→2.0 API POST. (dfranks)
|
|
70
|
+
</content>
|
|
71
|
+
</invoke>
|
package/knowledge/INDEX.md
CHANGED
|
@@ -4,7 +4,7 @@ _Auto-generated by `knowledge.js index`. Do not hand-edit._
|
|
|
4
4
|
|
|
5
5
|
## 1.0 framework
|
|
6
6
|
|
|
7
|
-
- **library** (Library) _(framework core)_ —
|
|
7
|
+
- **library** (Library) _(framework core)_ — 11 doc(s) → [1.0/apps/library/INDEX.md](1.0/apps/library/INDEX.md)
|
|
8
8
|
- **worker** (Worker) — 12 doc(s) → [1.0/apps/worker/INDEX.md](1.0/apps/worker/INDEX.md)
|
|
9
9
|
- **togadesk** (TOGa Desk) — 8 doc(s) → [1.0/apps/togadesk/INDEX.md](1.0/apps/togadesk/INDEX.md)
|
|
10
10
|
- **togaview** (TOGa View) — 6 doc(s) → [1.0/apps/togaview/INDEX.md](1.0/apps/togaview/INDEX.md)
|
package/package.json
CHANGED