@bongos/core 1.19.318 → 1.19.320
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 +125 -40
- package/.claude/skills/merge-mode/SKILL.md +3 -1
- package/.devcontainer/init-firewall.sh +41 -5
- package/clients/bongos-client/examples/hello-world.mjs +11 -2
- package/docs/copy-inventory.md +20 -20
- package/docs/copy-registry.json +22 -22
- package/modules/hall-ui/public/builders.js +0 -1
- package/package-lock.json +2 -2
- package/package.json +1 -1
- package/scripts/gds/audit-replay.sh +20 -3
- package/scripts/gds/box.js +79 -86
- package/scripts/gds/db-backup-nightly.sh +17 -4
- package/scripts/gds/db-backup-offsite.sh +23 -6
- package/scripts/gds/discipline-modes.json +1 -1
- package/scripts/gds/doc-cli-guard.js +34 -2
- package/scripts/gds/fitness.js +8 -4
- package/scripts/gds/gds-db-backup.service +15 -4
- package/scripts/gds/gds-db-backup.timer +12 -1
- package/scripts/gds/gds-db-offsite.service +16 -5
- package/scripts/gds/gds-db-offsite.timer +12 -1
- package/scripts/gds/go-live.js +142 -48
- package/scripts/gds/instance-apex.js +28 -0
- package/scripts/gds/newcomer-floor.templates.json +2 -2
- package/scripts/gds/provision.js +7 -3
- package/scripts/gds/ship-deploy-target.js +388 -0
- package/scripts/gds/ship-finish.js +377 -0
- package/scripts/gds/ship-flow.js +814 -0
- package/scripts/gds/ship-git.js +100 -0
- package/scripts/gds/ship-grade-steps.js +376 -0
- package/scripts/gds/ship-grade.js +319 -0
- package/scripts/gds/ship-io.js +100 -0
- package/scripts/gds/ship-land.js +539 -0
- package/scripts/gds/ship-memory-sync.js +192 -0
- package/scripts/gds/ship-merge.js +297 -0
- package/scripts/gds/ship-preflight-steps.js +323 -0
- package/scripts/gds/ship-regen.js +286 -0
- package/scripts/gds/ship-resume.js +151 -0
- package/scripts/gds/ship-session-upload.js +216 -0
- package/scripts/gds/ship-state.js +73 -0
- package/scripts/gds/ship-surprise.js +84 -0
- package/scripts/gds/ship.js +105 -4195
- package/scripts/gds/update-channel.js +12 -0
- package/scripts/status-probe.mjs +30 -2
- package/src/module-api.js +5 -1
- package/tests/go_live.mjs +65 -32
- package/tests/helpers.mjs +13 -0
- package/tests/provision.mjs +7 -1
- package/tests/regrade_eligibility.mjs +43 -0
- package/tests/ship_assurance.mjs +4 -2
- package/tests/ship_publish_error.mjs +43 -0
- package/tests/update_channel.mjs +33 -0
package/scripts/gds/go-live.js
CHANGED
|
@@ -76,8 +76,9 @@ function isSafeToken(v) {
|
|
|
76
76
|
// The fields a target must carry, and the ones it may. Unknown keys are reported
|
|
77
77
|
// rather than ignored: a typo'd `healthURL` that silently disables the health gate
|
|
78
78
|
// is precisely the class of quiet failure this pipeline keeps being bitten by.
|
|
79
|
-
|
|
80
|
-
const
|
|
79
|
+
// `ssh` is NOT required: a target with no ssh host is LOCAL (the box driving itself).
|
|
80
|
+
const REQUIRED_FIELDS = ['instanceDir', 'service', 'healthUrl', 'versionUrl', 'deployTimer'];
|
|
81
|
+
const OPTIONAL_FIELDS = ['ssh', 'local', 'deployService', 'npmEnvFile', 'runAs', 'backupDb', 'backupDir', 'env', 'registryPackage'];
|
|
81
82
|
|
|
82
83
|
function validateTarget(name, t) {
|
|
83
84
|
const errors = [];
|
|
@@ -100,6 +101,10 @@ function validateTarget(name, t) {
|
|
|
100
101
|
continue;
|
|
101
102
|
}
|
|
102
103
|
if (!known.has(k)) continue;
|
|
104
|
+
if (k === 'local') { // a flag, never interpolated into a command
|
|
105
|
+
if (typeof v !== 'boolean') errors.push(`target "${name}".local must be true or false`);
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
103
108
|
if (!isSafeToken(v)) errors.push(`target "${name}".${k} contains characters that are unsafe in a shell (got ${JSON.stringify(v)})`);
|
|
104
109
|
}
|
|
105
110
|
return errors;
|
|
@@ -166,8 +171,32 @@ function selectTarget(config, name) {
|
|
|
166
171
|
// the remote login shell). Values are validated above; this is the second layer.
|
|
167
172
|
// ---------------------------------------------------------------------------
|
|
168
173
|
|
|
174
|
+
// Privilege preamble for any phase that touches systemd.
|
|
175
|
+
//
|
|
176
|
+
// Over ssh these phases run as ROOT, so `systemctl stop …` just works — which is what
|
|
177
|
+
// they originally assumed. Run LOCALLY by the nightly lane they run as the instance
|
|
178
|
+
// OWNER, where the same line fails with "Interactive authentication required" and the
|
|
179
|
+
// timer is never stopped: the pull-deploy `git reset --hard` then stays armed for the
|
|
180
|
+
// whole upgrade, which is the exact hazard the stop exists to remove. Deciding at RUN
|
|
181
|
+
// time keeps one script correct for both callers.
|
|
182
|
+
const SUDO_PREAMBLE = 'SUDO=""; [ "$(id -u)" -eq 0 ] || SUDO="sudo -n"';
|
|
183
|
+
|
|
184
|
+
// A target is LOCAL when it names no ssh host: the phases run through a local shell
|
|
185
|
+
// instead of a remote one. Everything else — the phases, the halts, the reporting —
|
|
186
|
+
// is byte-identical, which is the point: one deployment engine, reachable from a
|
|
187
|
+
// laptop (remote) or from the box itself (local, how the nightly lane uses it).
|
|
188
|
+
// Without this the unattended path would need its own second implementation, and the
|
|
189
|
+
// two would drift — which is exactly how the nightly deploy ended up with weaker
|
|
190
|
+
// checks than the manual one (task 1003219).
|
|
191
|
+
function isLocalTarget(target) {
|
|
192
|
+
return !target || !target.ssh;
|
|
193
|
+
}
|
|
194
|
+
|
|
169
195
|
function remote(target, script, { run = spawnSync, timeoutMs = 900000 } = {}) {
|
|
170
|
-
const
|
|
196
|
+
const [cmd, args] = isLocalTarget(target)
|
|
197
|
+
? ['bash', ['-s']]
|
|
198
|
+
: ['ssh', ['-o', 'ConnectTimeout=20', '-o', 'BatchMode=yes', target.ssh, 'bash', '-s']];
|
|
199
|
+
const res = run(cmd, args, {
|
|
171
200
|
input: script, encoding: 'utf8', timeout: timeoutMs, maxBuffer: 32 * 1024 * 1024,
|
|
172
201
|
});
|
|
173
202
|
if (!res || res.error) return { ok: false, status: null, stdout: '', stderr: res && res.error ? res.error.message : 'spawn failed' };
|
|
@@ -177,36 +206,47 @@ function remote(target, script, { run = spawnSync, timeoutMs = 900000 } = {}) {
|
|
|
177
206
|
// `sudo -u <user> -H env K=V … <cmd>` — the shape every runbook entry uses. Returns
|
|
178
207
|
// a string safe to embed because every component was allowlist-validated.
|
|
179
208
|
//
|
|
180
|
-
//
|
|
181
|
-
//
|
|
182
|
-
//
|
|
183
|
-
//
|
|
184
|
-
//
|
|
185
|
-
// and NOT sufficient.
|
|
209
|
+
// A privileged child needs npm auth, and there is NO WAY to hand it a secret through
|
|
210
|
+
// sudo without logging it (task 1003218, corrected).
|
|
211
|
+
//
|
|
212
|
+
// `env NPM_TOKEN="$NPM_TOKEN" …` → sudo logs it in COMMAND=
|
|
213
|
+
// `sudo --preserve-env=NPM_TOKEN …` → sudo logs it in ENV=
|
|
186
214
|
//
|
|
187
|
-
//
|
|
188
|
-
//
|
|
189
|
-
//
|
|
190
|
-
//
|
|
191
|
-
//
|
|
192
|
-
//
|
|
193
|
-
//
|
|
194
|
-
//
|
|
215
|
+
// The first was the original bug; the second was my "fix", which only MOVED the value
|
|
216
|
+
// to a different field of the same log line. Both put a live credential in a
|
|
217
|
+
// persistent journal. What matters is that sudo logs its whole invocation, so the
|
|
218
|
+
// secret must never be part of it.
|
|
219
|
+
//
|
|
220
|
+
// So the child DERIVES the token itself, from a file it can already read. Only the
|
|
221
|
+
// `sed` appears in argv; the value never does. This is the shape docs/recipes/
|
|
222
|
+
// core-release-pipeline.md already documents as the safe one. The guard matters as
|
|
223
|
+
// much as the derivation: an EMPTY token silently sends npm to the public registry,
|
|
224
|
+
// which 404s the private package, which auto-rolls-back "cleanly" having taught you
|
|
225
|
+
// nothing — so an empty read aborts loudly instead of half-running.
|
|
226
|
+
//
|
|
227
|
+
// (The nightly lane never takes this path: it runs under systemd as the owner with an
|
|
228
|
+
// EnvironmentFile, no sudo, and leaks nothing. This is the manual/agent path only.)
|
|
229
|
+
const NPM_AUTH_PREAMBLE = [
|
|
230
|
+
'export NPM_TOKEN="${NPM_TOKEN:-$(sed -n \'s/.*_authToken=//p\' "$HOME/.npmrc" 2>/dev/null | head -1)}"',
|
|
231
|
+
'[ -n "$NPM_TOKEN" ] || { echo "go-live: EMPTY NPM_TOKEN — npm would 404 the private core and roll back; aborting" >&2; exit 12; }',
|
|
232
|
+
].join('; ');
|
|
233
|
+
|
|
234
|
+
// `sudo -u <user> -H env K=V … <cmd>` — the shape every runbook entry uses. Returns
|
|
235
|
+
// a string safe to embed because every component was allowlist-validated.
|
|
195
236
|
//
|
|
196
|
-
//
|
|
197
|
-
//
|
|
198
|
-
|
|
237
|
+
// `needsNpm` wraps the command so it derives its own npm auth (see above) instead of
|
|
238
|
+
// having a secret handed across the privilege boundary. Only NON-secret configuration
|
|
239
|
+
// (PGDATABASE, HOME) travels in the plain `env K=V` list — seeing those in a log is
|
|
240
|
+
// useful rather than harmful.
|
|
241
|
+
function asOwner(target, cmd, { needsNpm = false } = {}) {
|
|
242
|
+
const inner = needsNpm ? `sh -c ${shq(`${NPM_AUTH_PREAMBLE}; ${cmd}`)}` : cmd;
|
|
199
243
|
const envPairs = Object.entries(target.env || {}).map(([k, v]) => `${k}=${v}`);
|
|
200
|
-
const preserve = forward.filter((k) => SAFE_ENV_KEY_RE.test(k)); // never interpolate an unvetted name
|
|
201
244
|
if (!target.runAs) {
|
|
202
|
-
// No privilege drop: the child already inherits our environment, so a forwarded
|
|
203
|
-
// secret needs no mention at all.
|
|
204
245
|
const joined = envPairs.join(' ');
|
|
205
|
-
return `${joined ? `env ${joined} ` : ''}${
|
|
246
|
+
return `${joined ? `env ${joined} ` : ''}${inner}`.trim();
|
|
206
247
|
}
|
|
207
|
-
const keep = preserve.length ? `--preserve-env=${preserve.join(',')} ` : '';
|
|
208
248
|
const joined = [...envPairs, `HOME=/home/${target.runAs}`].join(' ');
|
|
209
|
-
return `sudo
|
|
249
|
+
return `sudo -u ${target.runAs} -H env ${joined} ${inner}`.trim();
|
|
210
250
|
}
|
|
211
251
|
|
|
212
252
|
// POSIX single-quote a value for embedding in a shell command.
|
|
@@ -264,6 +304,12 @@ function parseMarkerHits(raw) {
|
|
|
264
304
|
return Number(first);
|
|
265
305
|
}
|
|
266
306
|
|
|
307
|
+
// Does this process sit inside a git repo that knows the given ref?
|
|
308
|
+
function gitRefExists(ref, { run = spawnSync } = {}) {
|
|
309
|
+
const r = run('git', ['rev-parse', '--verify', '--quiet', ref], { cwd: ROOT, encoding: 'utf8' });
|
|
310
|
+
return !!r && !r.error && r.status === 0;
|
|
311
|
+
}
|
|
312
|
+
|
|
267
313
|
// Refresh origin/main before reading anything from it.
|
|
268
314
|
//
|
|
269
315
|
// deploy-divergence reads CORE_VERSION at the local `origin/main` REF, and a ref is
|
|
@@ -283,13 +329,6 @@ function refreshMain({ run = spawnSync } = {}) {
|
|
|
283
329
|
return { ok: true };
|
|
284
330
|
}
|
|
285
331
|
|
|
286
|
-
// Which variables an npm-running command needs forwarded. Only when the target
|
|
287
|
-
// declares an env file to source them from — otherwise `K="$K"` would expand to
|
|
288
|
-
// empty and quietly do nothing.
|
|
289
|
-
function npmForward(target) {
|
|
290
|
-
return target.npmEnvFile ? ['NPM_TOKEN'] : [];
|
|
291
|
-
}
|
|
292
|
-
|
|
293
332
|
// Parse a `key=value` marker into its parts. Kept pure + exported: the marker is
|
|
294
333
|
// the answer to the trap that the release current when your fix merges usually
|
|
295
334
|
// does NOT contain your fix (ADR 0161 carriers bump on their own cadence).
|
|
@@ -435,13 +474,13 @@ function probeRemote(target, targetVersion, marker, opts = {}) {
|
|
|
435
474
|
set -uo pipefail
|
|
436
475
|
${src}
|
|
437
476
|
echo "##REGISTRY##"
|
|
438
|
-
${asOwner(target, `npm view ${pkg}@${targetVersion} version`, {
|
|
477
|
+
${asOwner(target, `npm view ${pkg}@${targetVersion} version`, { needsNpm: true })} 2>&1 | tail -1
|
|
439
478
|
echo "##TREE##"
|
|
440
479
|
( cd ${target.instanceDir} && ${target.runAs ? `sudo -u ${target.runAs} -H ` : ''}git status --porcelain | head -20 )
|
|
441
480
|
echo "##INSTALLED##"
|
|
442
481
|
${asOwner(target, `node -e "console.log(require('${target.instanceDir}/node_modules/${pkg}/package.json').version)"`)} 2>&1 | tail -1
|
|
443
482
|
${marker ? `echo "##MARKER##"
|
|
444
|
-
${asOwner(target, `sh -c ${shq(markerProbe(pkg, targetVersion, marker))}`, {
|
|
483
|
+
${asOwner(target, `sh -c ${shq(markerProbe(pkg, targetVersion, marker))}`, { needsNpm: true })}` : ''}
|
|
445
484
|
echo "##END##"
|
|
446
485
|
`;
|
|
447
486
|
const res = remote(target, script, opts);
|
|
@@ -479,7 +518,8 @@ function applyGoLive(target, targetName, targetVersion, from, opts = {}) {
|
|
|
479
518
|
: 'echo "(no backupDb configured — skipping)"';
|
|
480
519
|
const phaseA = remote(target, `
|
|
481
520
|
set -euo pipefail
|
|
482
|
-
|
|
521
|
+
${SUDO_PREAMBLE}
|
|
522
|
+
echo "##TIMER##"; $SUDO systemctl stop ${target.deployTimer} && $SUDO systemctl is-active ${target.deployTimer} || true
|
|
483
523
|
echo "##BACKUP##"; ${backup}
|
|
484
524
|
echo "##END##"
|
|
485
525
|
`, opts);
|
|
@@ -499,7 +539,7 @@ echo "##END##"
|
|
|
499
539
|
const phaseB = remote(target, `
|
|
500
540
|
set -uo pipefail
|
|
501
541
|
${src}
|
|
502
|
-
${asOwner(target, `bash -c "cd ${target.instanceDir} && ${upgrade}"`, {
|
|
542
|
+
${asOwner(target, `bash -c "cd ${target.instanceDir} && ${upgrade}"`, { needsNpm: true })}
|
|
503
543
|
`, opts);
|
|
504
544
|
const rolledBack = /rolled back/i.test(phaseB.stdout + phaseB.stderr);
|
|
505
545
|
steps.push({
|
|
@@ -510,7 +550,7 @@ ${asOwner(target, `bash -c "cd ${target.instanceDir} && ${upgrade}"`, { forward:
|
|
|
510
550
|
if (!phaseB.ok || rolledBack) {
|
|
511
551
|
// Restart the timer even on failure — leaving it stopped silently disables
|
|
512
552
|
// the instance's pull-deploy until someone notices.
|
|
513
|
-
remote(target,
|
|
553
|
+
remote(target, `${SUDO_PREAMBLE}\n$SUDO systemctl start ${target.deployTimer} || true`, opts);
|
|
514
554
|
return { ok: false, steps, from, to: targetVersion, targetName, failedAt: 'UPGRADE', rolledBack, raw: phaseB };
|
|
515
555
|
}
|
|
516
556
|
|
|
@@ -519,10 +559,11 @@ ${asOwner(target, `bash -c "cd ${target.instanceDir} && ${upgrade}"`, { forward:
|
|
|
519
559
|
// not evidence; 127.0.0.1 is.
|
|
520
560
|
const phaseC = remote(target, `
|
|
521
561
|
set -uo pipefail
|
|
522
|
-
|
|
562
|
+
${SUDO_PREAMBLE}
|
|
563
|
+
echo "##TIMERSTART##"; $SUDO systemctl start ${target.deployTimer}; $SUDO systemctl is-active ${target.deployTimer}
|
|
523
564
|
echo "##PIN##"; ( cd ${target.instanceDir} && ${target.runAs ? `sudo -u ${target.runAs} -H ` : ''}git status --porcelain -- package.json package-lock.json )
|
|
524
565
|
echo "##HEAD##"; ( cd ${target.instanceDir} && ${target.runAs ? `sudo -u ${target.runAs} -H ` : ''}git log -1 --format='%h %s' )
|
|
525
|
-
${target.deployService ? `echo "##TICK##"; systemctl start ${target.deployService} || true; journalctl -u ${target.deployService} -n 20 --no-pager | tail -8` : ''}
|
|
566
|
+
${target.deployService ? `echo "##TICK##"; $SUDO systemctl start ${target.deployService} || true; $SUDO journalctl -u ${target.deployService} -n 20 --no-pager | tail -8` : ''}
|
|
526
567
|
echo "##VERSION##"; curl -s --max-time 20 ${target.versionUrl} | head -c 400
|
|
527
568
|
echo ""
|
|
528
569
|
echo "##INSTALLED##"; ${asOwner(target, `node -e "console.log(require('${target.instanceDir}/node_modules/${pkg}/package.json').version)"`)} 2>&1 | tail -1
|
|
@@ -563,6 +604,8 @@ go-live — move an enrolled instance's core pin, as one command.
|
|
|
563
604
|
node scripts/gds/go-live.js --config <path> default: ${DEFAULT_CONFIG}
|
|
564
605
|
node scripts/gds/go-live.js --allow-unreleased downgrade UNRELEASED_ON_MAIN to a warning
|
|
565
606
|
node scripts/gds/go-live.js --no-fetch skip the origin/main refresh (default: fetch)
|
|
607
|
+
node scripts/gds/go-live.js --target-json '{…}' pass a target inline instead of a config file
|
|
608
|
+
node scripts/gds/go-live.js --no-divergence skip the git-derived checks (needs --to)
|
|
566
609
|
node scripts/gds/go-live.js --json machine-readable
|
|
567
610
|
|
|
568
611
|
Host topology is NOT baked into the core. ${DEFAULT_CONFIG} (host-owned, not published):
|
|
@@ -578,6 +621,24 @@ async function main() {
|
|
|
578
621
|
const apply = hasFlag('--apply');
|
|
579
622
|
const allowUnreleased = hasFlag('--allow-unreleased');
|
|
580
623
|
|
|
624
|
+
// An inline target lets a CALLER drive this without inventing a second host-owned
|
|
625
|
+
// config file beside the one it already has. The nightly lane already holds a roster
|
|
626
|
+
// entry; making it also maintain config/go-live.json would be two sources of truth
|
|
627
|
+
// for one box, which is how they drift.
|
|
628
|
+
const inline = arg('--target-json');
|
|
629
|
+
if (inline) {
|
|
630
|
+
let parsed;
|
|
631
|
+
try { parsed = JSON.parse(inline); }
|
|
632
|
+
catch (e) { console.error(` go-live: --target-json is not valid JSON — ${e.message}`); return 2; }
|
|
633
|
+
const errors = validateTarget('inline', parsed);
|
|
634
|
+
if (errors.length) {
|
|
635
|
+
if (json) { console.log(JSON.stringify({ ok: false, halt: 'CONFIG_INVALID', detail: errors.join('; ') }, null, 2)); return 1; }
|
|
636
|
+
console.error(`\n go-live: CONFIG_INVALID — ${errors.join('; ')}\n`);
|
|
637
|
+
return 1;
|
|
638
|
+
}
|
|
639
|
+
return runGoLive({ target: parsed, targetName: arg('--target') || 'inline', configPath: '--target-json', json, apply, allowUnreleased });
|
|
640
|
+
}
|
|
641
|
+
|
|
581
642
|
const cfg = loadConfig({ configPath: arg('--config') });
|
|
582
643
|
if (cfg.error) {
|
|
583
644
|
if (json) { console.log(JSON.stringify({ ok: false, halt: cfg.error, path: cfg.path, detail: cfg.detail }, null, 2)); return 1; }
|
|
@@ -595,7 +656,10 @@ async function main() {
|
|
|
595
656
|
return 1;
|
|
596
657
|
}
|
|
597
658
|
const { target, name: targetName } = sel;
|
|
659
|
+
return runGoLive({ target, targetName, configPath: cfg.path, json, apply, allowUnreleased });
|
|
660
|
+
}
|
|
598
661
|
|
|
662
|
+
async function runGoLive({ target, targetName, configPath, json, apply, allowUnreleased }) {
|
|
599
663
|
const marker = parseMarker(arg('--verify-marker'));
|
|
600
664
|
if (marker && marker.error) { console.error(` go-live: ${marker.error}`); return 2; }
|
|
601
665
|
|
|
@@ -603,18 +667,40 @@ async function main() {
|
|
|
603
667
|
let targetVersion = arg('--to');
|
|
604
668
|
if (targetVersion && !SEMVER_RE.test(targetVersion)) { console.error(` go-live: --to "${targetVersion}" is not a version`); return 2; }
|
|
605
669
|
|
|
606
|
-
|
|
607
|
-
|
|
670
|
+
// Is there a core GIT CHECKOUT to reason about at all?
|
|
671
|
+
//
|
|
672
|
+
// Every git-derived signal — the target read from origin/main, the UNRELEASED halt,
|
|
673
|
+
// the dirty-checkout halt — presumes this process is running inside a core repo.
|
|
674
|
+
// The nightly lane is NOT: it runs on the box, against an installed package, and it
|
|
675
|
+
// resolves its target from the REGISTRY under a channel policy instead. Running the
|
|
676
|
+
// git checks there would halt every sweep on a condition that does not apply.
|
|
677
|
+
//
|
|
678
|
+
// So the git legs are SKIPPED only when both are true: there is no resolvable
|
|
679
|
+
// origin/main, AND the caller named the version explicitly. A missing checkout with
|
|
680
|
+
// no --to is still an error — silently inventing a target is exactly the class of
|
|
681
|
+
// guess this script exists to refuse.
|
|
682
|
+
// "Am I in a SOURCE checkout?" is `.git` AT OUR ROOT — not "is there a git repo
|
|
683
|
+
// somewhere above me". The installed core package lives inside the INSTANCE's repo
|
|
684
|
+
// and ships its own src/module-api.js, so a naive `git rev-parse HEAD` succeeds
|
|
685
|
+
// there and CORE_VERSION resolves — against the instance repo's main, which is a
|
|
686
|
+
// meaningless answer delivered confidently. That is the failure this check avoids.
|
|
687
|
+
const hasCheckout = fs.existsSync(path.join(ROOT, '.git'));
|
|
688
|
+
const gitless = (!hasCheckout || hasFlag('--no-divergence')) && !!targetVersion;
|
|
689
|
+
|
|
690
|
+
const fetched = (gitless || hasFlag('--no-fetch')) ? { ok: false, skipped: true } : refreshMain();
|
|
691
|
+
const div = gitless ? null : await divergence.check({ base: arg('--url') });
|
|
608
692
|
if (!targetVersion) targetVersion = div && div.onMain;
|
|
609
|
-
if (targetVersion
|
|
610
|
-
console.error(` go-live: could not resolve a target version (read ${JSON.stringify(targetVersion)} from main)`);
|
|
693
|
+
if (!targetVersion || !SEMVER_RE.test(targetVersion)) {
|
|
694
|
+
console.error(` go-live: could not resolve a target version${hasCheckout ? ` (read ${JSON.stringify(targetVersion)} from main)` : ' — this is not a core source checkout, so pass --to <version>'}`);
|
|
611
695
|
return 1;
|
|
612
696
|
}
|
|
613
697
|
|
|
614
|
-
const dirtyRes = spawnSync('git', ['status', '--porcelain'], { cwd: ROOT, encoding: 'utf8' });
|
|
698
|
+
const dirtyRes = gitless ? { status: 1 } : spawnSync('git', ['status', '--porcelain'], { cwd: ROOT, encoding: 'utf8' });
|
|
615
699
|
const dirtyCheckout = dirtyRes.status === 0 && (dirtyRes.stdout || '').trim() ? (dirtyRes.stdout || '').trim().split('\n').slice(0, 5).join(', ') : null;
|
|
616
700
|
|
|
617
|
-
const plan =
|
|
701
|
+
const plan = gitless
|
|
702
|
+
? { halts: [], notes: [{ code: 'NO_CORE_CHECKOUT', message: `no core git checkout here — target ${targetVersion} was given explicitly, so the git-derived checks (unreleased-on-main, dirty tree) are skipped` }], from: null, targetVersion, target }
|
|
703
|
+
: planGoLive({ div, target, targetVersion, dirtyCheckout, allowUnreleased });
|
|
618
704
|
plan.marker = marker;
|
|
619
705
|
if (!fetched.ok && !fetched.skipped) {
|
|
620
706
|
// Say so rather than silently planning off a ref of unknown age.
|
|
@@ -626,6 +712,14 @@ async function main() {
|
|
|
626
712
|
if (!plan.halts.length) {
|
|
627
713
|
const probe = probeRemote(target, targetVersion, marker);
|
|
628
714
|
plan.registry = probe.registry;
|
|
715
|
+
// With no source checkout there is no git-derived `from`; the installed version on
|
|
716
|
+
// the box IS the truth, and the probe just read it.
|
|
717
|
+
if (gitless && probe.installed) {
|
|
718
|
+
plan.from = probe.installed;
|
|
719
|
+
if (probe.installed === targetVersion) {
|
|
720
|
+
plan.halts.push({ code: 'ALREADY_LIVE', message: HALTS.ALREADY_LIVE, detail: `installed and target are both ${targetVersion}` });
|
|
721
|
+
}
|
|
722
|
+
}
|
|
629
723
|
if (!probe.reachable) {
|
|
630
724
|
plan.halts.push({ code: 'BOX_UNREACHABLE', message: `could not reach ${target.ssh}`, detail: (probe.raw.stderr || '').trim().split('\n').pop() });
|
|
631
725
|
} else {
|
|
@@ -656,7 +750,7 @@ async function main() {
|
|
|
656
750
|
|
|
657
751
|
if (!apply || plan.halts.length) {
|
|
658
752
|
if (json) { console.log(JSON.stringify({ ok: !plan.halts.length, mode: apply ? 'halted' : 'plan', targetName, ...plan }, null, 2)); }
|
|
659
|
-
else { console.log(renderPlan(plan, { targetName, configPath
|
|
753
|
+
else { console.log(renderPlan(plan, { targetName, configPath })); }
|
|
660
754
|
return plan.halts.length ? 1 : 0;
|
|
661
755
|
}
|
|
662
756
|
|
|
@@ -675,6 +769,6 @@ if (require.main === module) {
|
|
|
675
769
|
|
|
676
770
|
module.exports = {
|
|
677
771
|
loadConfig, selectTarget, validateTarget, planGoLive, parseMarker, parseMarkerHits,
|
|
678
|
-
renderPlan, renderReport, failureExcerpt, asOwner, isSafeToken,
|
|
772
|
+
renderPlan, renderReport, failureExcerpt, asOwner, isSafeToken, NPM_AUTH_PREAMBLE, refreshMain, isLocalTarget, gitRefExists, SUDO_PREAMBLE,
|
|
679
773
|
CONFIG_TEMPLATE, HALTS, SEMVER_RE,
|
|
680
774
|
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
// instance-apex.js — the instance's own registrable apex + the addresses derived
|
|
3
|
+
// from it, read from its branding pack (task 1002757).
|
|
4
|
+
//
|
|
5
|
+
// WHY THIS EXISTS. Operator-plane defaults used to carry the founder's apex as a
|
|
6
|
+
// literal (box DNS zones, the Cloudflare zone, the provisioner's git identity),
|
|
7
|
+
// so another operator's fleet pointed at the founder's DNS and its commits were
|
|
8
|
+
// attributed to the hub. These resolvers return NULL rather than guessing when the
|
|
9
|
+
// pack names no public origin: every caller treats null as "not configured" and
|
|
10
|
+
// refuses, which fails loudly instead of minting an unreachable host.
|
|
11
|
+
function instanceApex() {
|
|
12
|
+
try {
|
|
13
|
+
const host = new URL(require('../../src/branding').branding().domains.publicOrigin).hostname;
|
|
14
|
+
return host && !/^localhost$/i.test(host) ? host : null;
|
|
15
|
+
} catch { return null; }
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// The git identity a provisioner commits scaffold/pin changes as: explicit env →
|
|
19
|
+
// bot@<instance apex> → a neutral, deliberately-undeliverable platform address
|
|
20
|
+
// (never a live inbox by accident).
|
|
21
|
+
function provisionerBotEmail(env = process.env) {
|
|
22
|
+
const explicit = String(env.PROVISION_BOT_EMAIL || '').trim();
|
|
23
|
+
if (explicit) return explicit;
|
|
24
|
+
const apex = instanceApex();
|
|
25
|
+
return apex ? `bot@${apex}` : 'bot@cloud-bongos.invalid';
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
module.exports = { instanceApex, provisionerBotEmail };
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"est_minutes": 55,
|
|
50
50
|
"credits_reward": 15,
|
|
51
51
|
"title": "Generate one new in-world art asset of your choice (a prop, plant, animal, or accessory) via the pixel-art pipeline",
|
|
52
|
-
"description": "## What you're doing\n\
|
|
52
|
+
"description": "## What you're doing\n\nThis instance's world always needs more to look at. Your first ship as an artist is to **generate ONE new in-world asset of your own choosing** and add it to the world. You pick the subject — that's the fun part. Good candidates, all in-world (Mediterranean coast just south of Athens, mythic 'discovered secret' tone):\n- **Props**: amphora, fishing net, basket, crate, urn, torch, market awning, oar, clay pot.\n- **Plants**: olive tree, cypress, reeds, grapevine, shrub, wild herbs.\n- **Animals**: goat, chicken, duck, donkey, fish, gull, lizard.\n- **Accessories**: a sandal, a sun hat, a length of rope, a string of beads.\n\nIt is identical for every newcomer and **always valuable**, because a growing world has effectively unbounded demand for new props, flora, fauna, and detail — every newcomer picks a different subject, so two runs never collide.\n\n## How to find your way in\n\n1. Read `art/README.md` and `docs/recipes/pixel-art-pipeline.md`, plus `modules/art-pipeline/template/style_guide.md`, `modules/art-pipeline/template/rubric.json`, and `modules/art-pipeline/template/palette.json` — that's the look you must hit: 16-bit pixel art, early-Pokémon (FireRed) touchstone, top-down, 32×32, locked 64-colour Mediterranean palette (olive greens, warm tans, turquoise sea, weathered marble — NOT spring green, NOT navy, NOT pine).\n2. **Pick ONE subject.** Keep it to a SINGLE 32×32 tile/sprite — not a whole spritesheet or family (that's a bigger task).\n3. **Check the budget first**: `python3 modules/art-pipeline/pipeline/cost_ledger.py status` (the pipeline hard-stops at $80; one asset is ~$0.05–0.45).\n4. **Generate via the pipeline — do not hand-draw or freelance.** Use the `/otb-tile-generate` skill: it appends your new entry to `modules/art-pipeline/template/vocabulary.json`, runs the generate → post-process-to-32×32 → score-against-rubric → retry orchestrator, saves the final PNG to `modules/art-pipeline/generated/tiles/<id>.png`, and logs cost. (This needs the art pipeline's `GOOGLE_AI_STUDIO_KEY`, which resolves from `~/.config/otb/env`; most builder setups have it. If yours doesn't, claim the engineer or ideator newcomer chore instead, or ask an Archon to enable it.)\n5. **Confirm it PASSED** the rubric (`modules/art-pipeline/iterations/run_summary.json` shows `status: \"pass\"`). If it only reached best-effort, regenerate with the fix_hint — never paper over a fail.\n6. **See it in-game**: `node scripts/gds/art-stage.js` rebuilds the atlas and surfaces it on your sandbox preview (`sandbox-<login>.<instance-apex>`).\n7. Ship via `/builder-ship`; the ship notes name your asset and its rubric score.\n\n## Stay clear of (READ-ONLY)\n\nNever modify the locked palette (`modules/art-pipeline/template/palette.json`) or the rubric (`modules/art-pipeline/template/rubric.json`) — those are theme-defining and changing them needs an ADR (out of scope for a first ship). Touch only art assets/vocabulary under `art/` (and, only if your asset is a genuinely new base-tile TYPE, the `public/game/world/tilePalette.js` mapping). Do not touch any permission/pipeline-core/migration/infra file.",
|
|
53
53
|
"done_when": [
|
|
54
54
|
"Exactly one NEW in-world asset (your chosen subject) was generated via the pixel-art pipeline (`/otb-tile-generate` / orchestrator.py); the final PNG exists at modules/art-pipeline/generated/tiles/<id>.png.",
|
|
55
55
|
"It PASSED the rubric (modules/art-pipeline/iterations/run_summary.json status 'pass', or /otb-design-review numbers reported at/above the bar) and every pixel is on the locked palette (modules/art-pipeline/template/palette.json).",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"est_minutes": 45,
|
|
71
71
|
"credits_reward": 12,
|
|
72
72
|
"title": "Idea-seed pass: file 5-8 fresh in-world ideas (names, lore, or builder-UX) into the idea inbox",
|
|
73
|
-
"description": "## What you'll do\n\nThe seed of almost everything built here is the **idea_inbox** — a queue anyone can drop ideas into, which trusted builders later triage into real tasks. Your first ship as an ideator is simple and concrete: **add a small batch of fresh ideas to that inbox.** You write no code, touch no game, change no system — you think, write a few short well-shaped ideas, and file them with one command each.\n\nIt is identical for every newcomer and **always valuable**: the inbox is never \"done\" — every triage pass consumes ideas (promote/discard/merge), so it is permanently hungry for fresh input, and a world
|
|
73
|
+
"description": "## What you'll do\n\nThe seed of almost everything built here is the **idea_inbox** — a queue anyone can drop ideas into, which trusted builders later triage into real tasks. Your first ship as an ideator is simple and concrete: **add a small batch of fresh ideas to that inbox.** You write no code, touch no game, change no system — you think, write a few short well-shaped ideas, and file them with one command each.\n\nIt is identical for every newcomer and **always valuable**: the inbox is never \"done\" — every triage pass consumes ideas (promote/discard/merge), so it is permanently hungry for fresh input, and a growing world always wants more names, more lore, more texture. Your batch is brand-new content, so it can never duplicate \"the work\" — the supply IS the work.\n\n## Pick ONE branch\n\n- **Branch A — PRODUCT flavour (default).** Ideas that grow the world players see: **names + one line of lore** for a character, structure, landmark, district, ship, or festival; or a world-background snippet (a custom, a superstition, a line a named NPC says). Tone: mythic, mysterious, a \"discovered secret\"; Mediterranean ancient-Greek coast (just south of Athens); NOT modern, NOT tongue-in-cheek-modern. Ground it in CLAUDE.md §3/§6/§7.\n- **Branch B — INTERNAL / builder-UX.** Small user-experience improvement ideas for the GDS / builders' hall (the surfaces builders use, not the game): a clearer label, a confusing onboarding message, a quality-of-life tweak to a status page or a slash-command's output. See `docs/TRACKS.md` for product vs internal.\n\n## How to find your way in\n\n1. (Branch A) Read CLAUDE.md §3/§6/§7 for tone. (Branch B) Skim `docs/TRACKS.md` and click around your instance's /builders hall for the rough edge you'll write up.\n2. See what's already filed so you don't repeat it: `node scripts/gds/api.js GET /api/gds/inbox`.\n3. File each idea with `node scripts/gds/capture.js \"<title>\" --body-file <path>` (filing an idea is the open-to-all path — a Xenos/Thetes session is allowed to do it; you just can't triage them). Put one line of detail + a `track: product` or `track: internal` line in each body file.",
|
|
74
74
|
"done_when": [
|
|
75
75
|
"You filed 5–8 fresh ideas into the idea_inbox via `node scripts/gds/capture.js` (each prints a `Captured idea #N` confirmation), all in ONE branch (A product, or B internal/UX).",
|
|
76
76
|
"Each idea has a clear title and a body with at least one sentence of detail — for Branch A, one line of in-world lore (who/what it is); for Branch B, what the rough edge is and what 'better' looks like.",
|
package/scripts/gds/provision.js
CHANGED
|
@@ -169,6 +169,10 @@ const CONFIG = {
|
|
|
169
169
|
sshOpts: process.env.PROVISION_SSH_OPTS || '-o BatchMode=yes -o StrictHostKeyChecking=accept-new',
|
|
170
170
|
};
|
|
171
171
|
|
|
172
|
+
// task 1002757 — the provisioner's git identity resolves from the instance's own
|
|
173
|
+
// apex (env → bot@<apex> → neutral), never the hub's address hardcoded.
|
|
174
|
+
const { provisionerBotEmail } = require('./instance-apex');
|
|
175
|
+
|
|
172
176
|
const MAX_INTENT_ATTEMPTS = numEnv('PROVISION_INTENT_MAX_ATTEMPTS', 3);
|
|
173
177
|
|
|
174
178
|
// Manifest-placement verification budget (task 1002720 / QA-walk F23): a child
|
|
@@ -709,7 +713,7 @@ async function scaffoldStandaloneRepo(inst, deps) {
|
|
|
709
713
|
writeFile(giPath, INSTANCE_GITIGNORE);
|
|
710
714
|
}
|
|
711
715
|
exec(`git -C ${root} config user.name "Cloud Bongos"`);
|
|
712
|
-
exec(`git -C ${root} config user.email "
|
|
716
|
+
exec(`git -C ${root} config user.email "${provisionerBotEmail()}"`);
|
|
713
717
|
exec(`git -C ${root} add -A`);
|
|
714
718
|
const commitMsg = mode === 'adopt'
|
|
715
719
|
? `chore: adopt Cloud Bongos onto ${inst.slug} on a pinned @bongos/core ${coreV} (provision.js, ADR 0121)`
|
|
@@ -939,7 +943,7 @@ function buildCorePinRefreshCommit({ root, fromVersion, toVersion, repo, ownerTo
|
|
|
939
943
|
return {
|
|
940
944
|
config: [
|
|
941
945
|
`git -C ${root} config user.name "Cloud Bongos"`,
|
|
942
|
-
`git -C ${root} config user.email "
|
|
946
|
+
`git -C ${root} config user.email "${provisionerBotEmail()}"`,
|
|
943
947
|
],
|
|
944
948
|
add: `git -C ${root} add -A`,
|
|
945
949
|
commit: `git -C ${root} commit -m "${msg}"`,
|
|
@@ -2477,7 +2481,7 @@ async function main() {
|
|
|
2477
2481
|
if (require.main === module) main();
|
|
2478
2482
|
|
|
2479
2483
|
module.exports = {
|
|
2480
|
-
CONFIG, MAX_INTENT_ATTEMPTS,
|
|
2484
|
+
CONFIG, MAX_INTENT_ATTEMPTS, provisionerBotEmail,
|
|
2481
2485
|
// pure step generators (tested directly)
|
|
2482
2486
|
dbName, dbCreateCmd, migrateCmd, seedFirstVersionCmd, serviceUnit, serviceUnitPath, webEnvBody, webEnvPath,
|
|
2483
2487
|
backupUnitName, backupServicePath, backupTimerPath, backupScriptPath, backupService, backupTimer,
|