@bongos/core 1.19.705 → 1.19.707
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/.bongos-core.json +33 -13
- package/docs/module-api-changelog.md +4 -0
- package/modules/agents/spawn.js +24 -3
- package/package-lock.json +2 -2
- package/package.json +1 -1
- package/scripts/gds/agent-invoke.js +711 -0
- package/scripts/gds/smoke-write.sh +88 -0
- package/src/module-api.js +1 -1
- package/tests/agent_invoke.mjs +566 -0
- package/tests/agent_invoke_live.mjs +111 -0
- package/tests/smoke_write_contract.mjs +110 -0
|
@@ -11,6 +11,9 @@
|
|
|
11
11
|
# session_logs row exists for this claim
|
|
12
12
|
# public/recent-shipped does NOT contain the smoke title
|
|
13
13
|
# public/progress weighting unchanged (smoke tasks filtered)
|
|
14
|
+
# 6. On PASS, abandon the throwaway task so the ledger does not refill with
|
|
15
|
+
# test noise (task 1002018). A FAILED run deliberately KEEPS its task and
|
|
16
|
+
# claim so the failure can be read from the ledger afterwards.
|
|
14
17
|
#
|
|
15
18
|
# The synthetic task has credits_reward=0 so no credit_log row is written
|
|
16
19
|
# and the leaderboard is unaffected. The credit-award path is implicitly
|
|
@@ -68,6 +71,51 @@ VERSION_ID=$(node "$(dirname "$0")/version-select.js") || {
|
|
|
68
71
|
}
|
|
69
72
|
echo "Version: ${VERSION_ID}"
|
|
70
73
|
|
|
74
|
+
# Caused by task 1003598 (BV1.R11, ADR 0250 D4), found and fixed under task
|
|
75
|
+
# 1002018: goal_id became REQUIRED on POST /tasks and this script still sent none, so step 1 died on a 400 goal_id_required
|
|
76
|
+
# and the whole smoke could not run. Resolved at RUNTIME, not hardcoded, for the
|
|
77
|
+
# same reason version-select.js exists (task 1003166): an id literal goes stale
|
|
78
|
+
# the moment the version rolls, and the failure then looks like a broken API
|
|
79
|
+
# rather than a stale constant. Every version auto-creates exactly ONE
|
|
80
|
+
# is_maintenance goal (BV1.R18), and a synthetic row is maintenance-goal work.
|
|
81
|
+
#
|
|
82
|
+
# node, not python3, on purpose: this script already shells out to node for
|
|
83
|
+
# version-select.js, and node is the interpreter a Windows builder box actually
|
|
84
|
+
# has — the python3 the rest of this file depends on is frequently absent there
|
|
85
|
+
# (it is the Microsoft Store stub), so a python3 step cannot be verified locally.
|
|
86
|
+
GOAL_ID=$(call GET "/api/gds/goals?version=${VERSION_ID}" | node -e '
|
|
87
|
+
let s = "";
|
|
88
|
+
process.stdin.on("data", (d) => { s += d; });
|
|
89
|
+
process.stdin.on("end", () => {
|
|
90
|
+
const goals = JSON.parse(s).goals || [];
|
|
91
|
+
const m = goals.filter((g) => g.is_maintenance && g.status === "open");
|
|
92
|
+
if (m.length !== 1) {
|
|
93
|
+
process.stderr.write("expected exactly 1 open maintenance goal, found " + m.length + "\n");
|
|
94
|
+
process.exit(1);
|
|
95
|
+
}
|
|
96
|
+
// The caller splices this straight into a python3 -c SOURCE string, unquoted,
|
|
97
|
+
// so a non-numeric id would be executed as Python rather than read as data.
|
|
98
|
+
// Validating the COUNT is not validating the ID: check its shape too.
|
|
99
|
+
const id = String(m[0].id);
|
|
100
|
+
if (!/^[0-9]+$/.test(id)) {
|
|
101
|
+
process.stderr.write("goal id is not numeric: " + JSON.stringify(id) + "\n");
|
|
102
|
+
process.exit(1);
|
|
103
|
+
}
|
|
104
|
+
process.stdout.write(id);
|
|
105
|
+
});
|
|
106
|
+
') || {
|
|
107
|
+
echo "FAIL: could not resolve the maintenance goal for ${VERSION_ID}" >&2
|
|
108
|
+
exit 1
|
|
109
|
+
}
|
|
110
|
+
# Belt-and-braces at the point of use: the resolver above already refuses a
|
|
111
|
+
# non-numeric id, but this value is interpolated into python3 source below as
|
|
112
|
+
# CODE, not as a quoted literal, so it is re-checked where the risk actually is.
|
|
113
|
+
[[ "${GOAL_ID}" =~ ^[0-9]+$ ]] || {
|
|
114
|
+
echo "FAIL: resolved goal id is not numeric: ${GOAL_ID}" >&2
|
|
115
|
+
exit 1
|
|
116
|
+
}
|
|
117
|
+
echo "Goal: ${GOAL_ID}"
|
|
118
|
+
|
|
71
119
|
echo "--- 0. snapshot progress before ---"
|
|
72
120
|
PROGRESS_BEFORE=$(snapshot_progress)
|
|
73
121
|
echo "${PROGRESS_BEFORE}"
|
|
@@ -78,6 +126,7 @@ CREATE_BODY=$(python3 -c "
|
|
|
78
126
|
import json
|
|
79
127
|
print(json.dumps({
|
|
80
128
|
'version_id': '${VERSION_ID}',
|
|
129
|
+
'goal_id': ${GOAL_ID},
|
|
81
130
|
'title': '${SMOKE_TITLE}',
|
|
82
131
|
'description': 'Synthetic smoke task. Auto-shipped by smoke-write.sh.',
|
|
83
132
|
'status': 'ready',
|
|
@@ -177,6 +226,45 @@ else
|
|
|
177
226
|
echo "SKIP session_logs DB check (set GDS_SMOKE_DB_SSH + GDS_SMOKE_DB_NAME to enable)"
|
|
178
227
|
fi
|
|
179
228
|
|
|
229
|
+
echo
|
|
230
|
+
echo "--- 5. clean up the throwaway task ---"
|
|
231
|
+
# task 1002018 — this smoke CREATES a real task to exercise the create API, and
|
|
232
|
+
# used to leave it in the ledger forever: 94 rows accumulated under PMS-V1 before
|
|
233
|
+
# the task-2016 sweep cleared them by hand. Abandon is the right terminal state —
|
|
234
|
+
# a smoke row is not shipped work, and the route refuses to abandon a shipped one
|
|
235
|
+
# anyway (cannot_abandon_shipped). The row sits at 'completed' after step 3, and
|
|
236
|
+
# only 'shipped' and an unreleased claim are refused, so this is always legal here.
|
|
237
|
+
#
|
|
238
|
+
# ONLY on success, deliberately: a FAILED run leaves its task and claim in place
|
|
239
|
+
# so the failure can be inspected in the ledger, which is why the FAIL branch of
|
|
240
|
+
# the summary below still prints both ids.
|
|
241
|
+
#
|
|
242
|
+
# Strictly best-effort. A cleanup that cannot run must never turn a passing smoke
|
|
243
|
+
# into a failing one, so this never touches ${fail} and never trips set -e:
|
|
244
|
+
# task.abandon is floor-metic (ADR 0152), so a Xenos/Thetes token gets a 403 here
|
|
245
|
+
# while every assertion above genuinely passed.
|
|
246
|
+
cleanup_throwaway_task() {
|
|
247
|
+
local out code
|
|
248
|
+
local reason='{"reason":"smoke cleanup (task 1002018) - write-path smoke passed; the throwaway row has served its purpose"}'
|
|
249
|
+
out=$(curl -sS -X POST \
|
|
250
|
+
-H "Authorization: Bearer ${TOKEN}" -H "Content-Type: application/json" \
|
|
251
|
+
-d "${reason}" -w "\n%{http_code}" \
|
|
252
|
+
"${API}/api/gds/tasks/${TASK_ID}/abandon") || true
|
|
253
|
+
code="${out##*$'\n'}"
|
|
254
|
+
case "${code}" in
|
|
255
|
+
2*) echo "PASS cleaned up throwaway task #${TASK_ID} (abandoned)" ;;
|
|
256
|
+
403) echo "SKIP cleanup — task.abandon needs Metic+ (ADR 0152); task #${TASK_ID} left in the ledger" ;;
|
|
257
|
+
000) echo "SKIP cleanup — POST /tasks/${TASK_ID}/abandon got no response; task #${TASK_ID} left in the ledger" ;;
|
|
258
|
+
*) echo "SKIP cleanup — POST /tasks/${TASK_ID}/abandon returned HTTP ${code:-none}; task #${TASK_ID} left in the ledger" ;;
|
|
259
|
+
esac
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
if [[ "${fail}" -eq 0 ]]; then
|
|
263
|
+
cleanup_throwaway_task
|
|
264
|
+
else
|
|
265
|
+
echo "SKIP cleanup — run FAILED; task #${TASK_ID} and claim #${CLAIM_ID} kept for post-mortem"
|
|
266
|
+
fi
|
|
267
|
+
|
|
180
268
|
echo
|
|
181
269
|
echo "--- summary ---"
|
|
182
270
|
if [[ "${fail}" -eq 0 ]]; then
|
package/src/module-api.js
CHANGED
|
@@ -71,7 +71,7 @@ const { responsibilityFor, ROLE_RESPONSIBILITIES } = require('./role-responsibil
|
|
|
71
71
|
// there. scripts/gds/bump-version.js still rewrites the literal below; it appends
|
|
72
72
|
// the entry to that file. Look for a version's history there, not here.
|
|
73
73
|
// ---------------------------------------------------------------------------
|
|
74
|
-
const CORE_VERSION = '1.19.
|
|
74
|
+
const CORE_VERSION = '1.19.707'; // CI auto-patch carrier (ADR 0161); changelog: docs/module-api-changelog.md
|
|
75
75
|
|
|
76
76
|
// A namespaced logger so a module's log lines are attributable + consistent.
|
|
77
77
|
// Usage: const log = api.logger('dev-box'); log.info('mounted');
|