@hyperfixation/workflows 0.1.7 → 0.1.8
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/dist/reconcile.js +8 -5
- package/package.json +4 -4
package/dist/reconcile.js
CHANGED
|
@@ -33,10 +33,13 @@ const LIVE_DBOS_STATUSES = ["PENDING", "ENQUEUED", "DELAYED"];
|
|
|
33
33
|
* round-2 finding 3 happened, and per-period drift is exact because a call is billed to the
|
|
34
34
|
* period stamped on its own row.
|
|
35
35
|
*/
|
|
36
|
-
export const DRIFT_STATEMENT = "SELECT b.period, b.spent_usd::text AS spent_usd, " +
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"FROM hf_budget_period b
|
|
36
|
+
export const DRIFT_STATEMENT = "SELECT b.period, b.spent_usd::numeric(12,6)::text AS spent_usd, " +
|
|
37
|
+
"l.ledger::numeric(12,6)::text AS ledger_usd, " +
|
|
38
|
+
"(b.spent_usd - l.ledger)::numeric(12,6)::text AS drift_usd " +
|
|
39
|
+
"FROM hf_budget_period b CROSS JOIN LATERAL (" +
|
|
40
|
+
"SELECT COALESCE(SUM(c.cost_usd), 0) AS ledger FROM hf_llm_call c " +
|
|
41
|
+
"WHERE c.period = b.period AND c.status = 'ok') l " +
|
|
42
|
+
"ORDER BY b.period";
|
|
40
43
|
/**
|
|
41
44
|
* Step (1)'s scan. A plain `SELECT`, joined against `dbos.workflow_status` rather than asking
|
|
42
45
|
* the SDK per run: one statement for the whole scan, and the application role reads that table
|
|
@@ -148,7 +151,7 @@ export async function reconcile(pool, dbosClient, options) {
|
|
|
148
151
|
period: row.period,
|
|
149
152
|
spentUsd: row.spent_usd,
|
|
150
153
|
ledgerUsd: row.ledger_usd,
|
|
151
|
-
driftUsd:
|
|
154
|
+
driftUsd: row.drift_usd,
|
|
152
155
|
}));
|
|
153
156
|
await expireApprovals(pool, dbosClient, options, report);
|
|
154
157
|
console.info(RECONCILE_PASS_MARKER, JSON.stringify(summaryOf(report)));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperfixation/workflows",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "startWorker, defineFlow and the run lifecycle, the step wrapper, approvals, actions, queues, and the reconciler",
|
|
6
6
|
"repository": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@dbos-inc/dbos-sdk": "4.27.6",
|
|
29
|
-
"@hyperfixation/db": "0.1.
|
|
29
|
+
"@hyperfixation/db": "0.1.8",
|
|
30
30
|
"@langfuse/otel": "5.11.1",
|
|
31
31
|
"@opentelemetry/api": "1.9.1",
|
|
32
32
|
"@opentelemetry/context-async-hooks": "2.11.0",
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"zod": "4.6.5"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@hyperfixation/eslint-config": "0.1.
|
|
43
|
-
"@hyperfixation/testing": "0.1.
|
|
42
|
+
"@hyperfixation/eslint-config": "0.1.8",
|
|
43
|
+
"@hyperfixation/testing": "0.1.8",
|
|
44
44
|
"@microsoft/api-extractor": "^7.59.1",
|
|
45
45
|
"@sentry/node": "^10.74.0",
|
|
46
46
|
"@types/pg": "^8.23.1",
|