@bongos/core 1.24.84 → 1.24.85

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 CHANGED
@@ -2,11 +2,11 @@
2
2
  "artifact": "bongos-core",
3
3
  "manifest_schema": 1,
4
4
  "generator": "scripts/bongos/package-core.js",
5
- "core_version": "1.24.84",
6
- "core_contract": "1.24.84",
7
- "source_commit": "a88200c605aef1ae82a28ab04b0ab3e37ed2d007",
5
+ "core_version": "1.24.85",
6
+ "core_contract": "1.24.85",
7
+ "source_commit": "427e2c398053becc659baf23c101f6e8f08d321d",
8
8
  "source_ref": "HEAD",
9
- "built_at": "2026-11-11T21:52:13.589Z",
9
+ "built_at": "2026-11-11T22:21:34.009Z",
10
10
  "redaction": {
11
11
  "model": "docs-redacted+functional-verbatim",
12
12
  "docs_redacted": 649,
@@ -17,7 +17,7 @@
17
17
  "gate": "passed"
18
18
  },
19
19
  "file_count": 4643,
20
- "tree_sha256": "967fd31eb0288a656123acc767cef654f1132bfa3dafee9761410236db93f1cd",
20
+ "tree_sha256": "35f80ad673b03ea0315d02cce1106c6ce0cf0ee393aac0f056b2837c025f23db",
21
21
  "files": [
22
22
  {
23
23
  "path": ".claude/skills/ask-for-help/SKILL.md",
@@ -3032,7 +3032,7 @@
3032
3032
  {
3033
3033
  "path": "docs/module-api-changelog.md",
3034
3034
  "mode": "0000644",
3035
- "sha256": "1d3fff080abc60c21cd46c052ce7507fbf02f74ef6cd7e5fba5815d33c601ca4"
3035
+ "sha256": "a7e0a193dc835e76f2bfeb2ddd97093bfed314cd98b7488a53721bf18db3b9fa"
3036
3036
  },
3037
3037
  {
3038
3038
  "path": "docs/modules-contract.md",
@@ -3137,7 +3137,7 @@
3137
3137
  {
3138
3138
  "path": "docs/recipes/autobongos-runner-setup.md",
3139
3139
  "mode": "0000644",
3140
- "sha256": "8d63ed509569a3bed3c036eed58a91ec3a4446fab2b71f7f0ebe3f3f395be1a3"
3140
+ "sha256": "b69efdb3f9021b2e609602412d21acf6071008a8ffe47abb1b1e91358d982ec2"
3141
3141
  },
3142
3142
  {
3143
3143
  "path": "docs/recipes/autobongos-windows-host.md",
@@ -12092,12 +12092,12 @@
12092
12092
  {
12093
12093
  "path": "package-lock.json",
12094
12094
  "mode": "0000644",
12095
- "sha256": "06d33e2874668039d3ca018731234bf312bad841e4c4b4e161609a0426764d89"
12095
+ "sha256": "a663d6a0afd78979f2de86f13e7ba781e775348a34d897fef783cc62008b7b33"
12096
12096
  },
12097
12097
  {
12098
12098
  "path": "package.json",
12099
12099
  "mode": "0000644",
12100
- "sha256": "eec413a19cbf85e3ba24c9777135af3d3cb16cfbb1f7f840f6314f3f348b7856"
12100
+ "sha256": "abe3bea2dad97c4c622585e65172362a4f9abfccbc52882521f58ed17fb83ed2"
12101
12101
  },
12102
12102
  {
12103
12103
  "path": "public-docs/index.html",
@@ -12117,7 +12117,7 @@
12117
12117
  {
12118
12118
  "path": "release-notes.json",
12119
12119
  "mode": "0000644",
12120
- "sha256": "39ebd17eca26e71fbd43a70acf127ae5c513679f0c26197097e9993a3fd4db34"
12120
+ "sha256": "b272c1bd53032ad7c769a92d029dda4b65737a15d2e20937b196fc1a6659dcd5"
12121
12121
  },
12122
12122
  {
12123
12123
  "path": "scripts/bongos/CLAUDE.md",
@@ -12242,7 +12242,7 @@
12242
12242
  {
12243
12243
  "path": "scripts/bongos/autobongos-bootstrap.sh",
12244
12244
  "mode": "0000755",
12245
- "sha256": "3a919b371e76491935049a90196d95600b3c953e4ce04c9ed77a0274b1ec0afb"
12245
+ "sha256": "e7eff1bd58cdc4f8568862c8dfdc5e1c674eb830cae9ad46299c33533f6027e6"
12246
12246
  },
12247
12247
  {
12248
12248
  "path": "scripts/bongos/autobongos-digest.js",
@@ -12257,7 +12257,7 @@
12257
12257
  {
12258
12258
  "path": "scripts/bongos/autobongos-host.js",
12259
12259
  "mode": "0000755",
12260
- "sha256": "fa8cc6245fb0e6f5bd63e15314de796e396e5a0a8b7ab7817aefac2d69b26d95"
12260
+ "sha256": "5fc39d1b1c98c23ef7cc9549de376ed2c9751575934af550194cb29a5a5f7a4d"
12261
12261
  },
12262
12262
  {
12263
12263
  "path": "scripts/bongos/autobongos-loop.js",
@@ -13807,7 +13807,7 @@
13807
13807
  {
13808
13808
  "path": "scripts/bongos/wedge-remedy.js",
13809
13809
  "mode": "0000644",
13810
- "sha256": "1f1346ddb3871a4bf21950aa8cd606f00effb0e08ef1cbb32aa70c7f6ec1cdf1"
13810
+ "sha256": "5651d789fa741a172f2373d0cd40e770c1149ae1c2d5a8049ea29ade2a861646"
13811
13811
  },
13812
13812
  {
13813
13813
  "path": "scripts/bongos/worktree-claim-guard.js",
@@ -16122,7 +16122,7 @@
16122
16122
  {
16123
16123
  "path": "src/module-api.js",
16124
16124
  "mode": "0000644",
16125
- "sha256": "d16199f138decb72e60eb109eba27e5f2f2a07f67c6a17002167302fb64ea6f0"
16125
+ "sha256": "3b61f7a829de7c225cbeec3fc711f8a5b51dcd305ef43a05273873d19f581f7c"
16126
16126
  },
16127
16127
  {
16128
16128
  "path": "src/module-loader/catalog.js",
@@ -16682,7 +16682,7 @@
16682
16682
  {
16683
16683
  "path": "tests/autobongos_host.mjs",
16684
16684
  "mode": "0000644",
16685
- "sha256": "76bef425e2b3adcc4317b383636bdb3e81de64ae3e9fd2ae3ab09c5483bd8171"
16685
+ "sha256": "58a0784be92fbef91d9ea63614c23fb9d932f1c34cca2d1511b4df785ce76e91"
16686
16686
  },
16687
16687
  {
16688
16688
  "path": "tests/autobongos_host_access.mjs",
@@ -22197,7 +22197,7 @@
22197
22197
  {
22198
22198
  "path": "tests/shell_stat_portability.mjs",
22199
22199
  "mode": "0000644",
22200
- "sha256": "c4c0a4d3f5b41205be6abbea2a8c0892b215b008f40869c18ec30d6cd66fcd7b"
22200
+ "sha256": "6d1fafcc33de5f489303aca892718ab5db6aa483939e34318be9e7e47af018a5"
22201
22201
  },
22202
22202
  {
22203
22203
  "path": "tests/ship_assurance.mjs",
@@ -22352,7 +22352,7 @@
22352
22352
  {
22353
22353
  "path": "tests/ship_vendored_instance.mjs",
22354
22354
  "mode": "0000644",
22355
- "sha256": "3a76f7c5b64471ef5c6e91e46ef21a02594b942986c7bd4a84d7934c918ee7a3"
22355
+ "sha256": "f08ead59eeffd4572532929c1b08080a469d7ce55e3e877e6944869e7e59df09"
22356
22356
  },
22357
22357
  {
22358
22358
  "path": "tests/ship_visual_regrade.mjs",
@@ -22952,7 +22952,7 @@
22952
22952
  {
22953
22953
  "path": "tests/update_sweep_home.mjs",
22954
22954
  "mode": "0000644",
22955
- "sha256": "2a676bec91bded743eed048900d1ab72c375e23c7875acd11759cb299fe272d1"
22955
+ "sha256": "38b14ecc7d9f063b54c80825f7608ab48ce13e892108f78cde81cf82d3c7ebf9"
22956
22956
  },
22957
22957
  {
22958
22958
  "path": "tests/upgrade.mjs",
@@ -23117,7 +23117,7 @@
23117
23117
  {
23118
23118
  "path": "tests/wedge_remedy.mjs",
23119
23119
  "mode": "0000644",
23120
- "sha256": "c3bf835dd5cf4285705f9d42a2580b92f80e99c410d93fade97214e109582c49"
23120
+ "sha256": "8aef63e97ae564b6acb31ad86d892a122f0c7fe7f6fe7e14e9908bc9d6015f22"
23121
23121
  },
23122
23122
  {
23123
23123
  "path": "tests/welcome_boot.mjs",
@@ -3418,5 +3418,7 @@ is load-bearing: the script throws rather than guess if it is missing, and
3418
3418
  landed since 1.24.82 with no explicit bump. run 43103028863. (task 1002620)
3419
3419
  1.24.84 — CI auto-patch (publish-on-merge, ADR 0161): carrier for merges
3420
3420
  landed since 1.24.83 with no explicit bump. run 43106638119. (task 1002620)
3421
+ 1.24.85 — CI auto-patch (publish-on-merge, ADR 0161): carrier for merges
3422
+ landed since 1.24.84 with no explicit bump. run 43110908190. (task 1002620)
3421
3423
  ---------------------------------------------------------------------------
3422
3424
  ```
@@ -138,6 +138,7 @@ worker decided on its own, what it cost, and where your Claude usage stands.
138
138
  | **Resting** for hours | That is your Claude usage limit, and it is working as designed. It resumes at the time on the button. |
139
139
  | **Running**, but nothing ships for a long time | The tasks in the goals you chose may all be waiting on something. Run the digest above: it says what is on hold and why. |
140
140
  | You added the same device twice | Remove one card. One runner per device. |
141
+ | **Repository not found**, and you *are* signed in to GitHub | You are signed in as more than one GitHub account, and the device is using the wrong one. Run `gh auth switch` and pick the account that can see the project, then paste the setup command again. The setup names the account it used, so you can tell which it picked. |
141
142
 
142
143
  ## An always-on PC that starts with nobody signed in
143
144
 
package/package-lock.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@bongos/core",
3
- "version": "1.24.84",
3
+ "version": "1.24.85",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@bongos/core",
9
- "version": "1.24.84",
9
+ "version": "1.24.85",
10
10
  "license": "AGPL-3.0-or-later",
11
11
  "dependencies": {
12
12
  "express": "^4.21.2",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bongos/core",
3
- "version": "1.24.84",
3
+ "version": "1.24.85",
4
4
  "description": "Cloud Bongos — the AI-first build platform core (GDS + platform surfaces + module system), installed as a versioned dependency (ADR 0108).",
5
5
  "license": "AGPL-3.0-or-later",
6
6
  "main": "src/platform-server.js",
@@ -11607,5 +11607,11 @@
11607
11607
  "id": "1005195",
11608
11608
  "text": "The in-game visor is now minimal: two thin arcs, the place name, your credits, one salmon button for the current action and a quiet row of key hints. It stays readable over a bright daytime sky as well as at night."
11609
11609
  }
11610
+ ],
11611
+ "1.24.85": [
11612
+ {
11613
+ "id": "1005096",
11614
+ "text": "Autobongos now runs on a Mac for real: the setup command, start, stop and remove all proven on one, and the Mac-only test failures are gone."
11615
+ }
11610
11616
  ]
11611
11617
  }
@@ -59,6 +59,28 @@ esac
59
59
 
60
60
  have() { command -v "$1" >/dev/null 2>&1; }
61
61
 
62
+ # github_remedy — what to actually DO when git cannot see the project (task 1005096).
63
+ #
64
+ # THE CIRCLE THIS BREAKS, found on a real Mac. "Sign in to GitHub" is the wrong advice for
65
+ # the commonest way this fails: the person IS signed in — twice — and git picked the other
66
+ # one. git asks its FIRST credential helper, which on a Mac is the login keychain, and that
67
+ # answers with whichever GitHub account is active, not with one that can see this project.
68
+ # A private project then 404s as "Repository not found", which reads as a typo rather than
69
+ # as the wrong account, and `gh auth login` again changes nothing.
70
+ #
71
+ # So when the GitHub CLI is here, name the account that is actually active and the one
72
+ # command that changes it. With no gh, the old advice is still the right advice.
73
+ github_remedy() {
74
+ if have gh; then
75
+ active="$(gh auth status --active 2>/dev/null | sed -n 's/.*account \([A-Za-z0-9-]*\).*/\1/p' | head -n 1)"
76
+ if [ -n "${active:-}" ]; then
77
+ echo "git is using your '$active' GitHub account, which may not be able to see this project. Switch with gh auth switch (it lists the accounts signed in here), then paste the setup command again. If the right account is not listed, add it with gh auth login first."
78
+ return
79
+ fi
80
+ fi
81
+ echo "Sign in to GitHub on this device with an account that can see the project (the GitHub CLI's gh auth login is the simplest way), then paste the setup command again."
82
+ }
83
+
62
84
  # The setup command is piped into bash, so the keyboard is /dev/tty, not stdin.
63
85
  # OPENED, not just tested: with no terminal at all (CI, a remote command) the
64
86
  # device node still exists and reads as readable, and opening it is what fails.
@@ -133,12 +155,12 @@ mkdir -p "$RUNNER_HOME"
133
155
  if [ -d "$REPO_DIR/.git" ]; then
134
156
  echo "The runner's copy is already here; bringing it up to date..."
135
157
  if [ "$HAVE_TTY" = 1 ]; then git -C "$REPO_DIR" fetch --quiet origin main </dev/tty; else git -C "$REPO_DIR" fetch --quiet origin main; fi \
136
- || stop_setup "this device could not fetch the project's code from GitHub." "Sign in to GitHub on this device (the GitHub CLI's gh auth login is the simplest way), then paste the setup command again."
158
+ || stop_setup "this device could not fetch the project's code from GitHub." "$(github_remedy)"
137
159
  git -C "$REPO_DIR" reset --quiet --hard origin/main
138
160
  else
139
161
  echo "Making the runner's own copy of the project (GitHub may ask you to sign in)..."
140
162
  if [ "$HAVE_TTY" = 1 ]; then git clone --quiet "$REPO" "$REPO_DIR" </dev/tty; else git clone --quiet "$REPO" "$REPO_DIR"; fi \
141
- || stop_setup "this device could not copy the project from GitHub." "Sign in to GitHub on this device with an account that can see the project (the GitHub CLI's gh auth login is the simplest way), then paste the setup command again."
163
+ || stop_setup "this device could not copy the project from GitHub." "$(github_remedy)"
142
164
  fi
143
165
 
144
166
  HOST_JS="$REPO_DIR/scripts/bongos/autobongos-host.js"
@@ -125,6 +125,28 @@ class Stop extends Error {
125
125
  constructor(what, fix) { super(what); this.name = 'Stop'; this.fix = fix || null; }
126
126
  }
127
127
 
128
+ // githubRemedy — what to DO when git cannot see the project (task 1005096). The JS twin of
129
+ // autobongos-bootstrap.sh's github_remedy; the two say the same thing because a person can
130
+ // meet either one, and the bootstrap's own header carries the full reasoning.
131
+ //
132
+ // IN SHORT: "sign in to GitHub" is the wrong advice for the commonest failure. git asks its
133
+ // FIRST credential helper — on a Mac, the login keychain — which answers with whichever
134
+ // GitHub account is ACTIVE, not with one that can see this project. A private project then
135
+ // 404s as "Repository not found", which reads as a typo rather than as the wrong account,
136
+ // and signing in again changes nothing. So name the active account when the GitHub CLI can
137
+ // tell us, and give the one command that changes it.
138
+ const GITHUB_REMEDY_GENERIC = 'Sign in to GitHub on this device with an account that can see the project (the GitHub CLI\'s gh auth login is the simplest way), then run the setup command again.';
139
+ function githubRemedy(run = spawnSync) {
140
+ try {
141
+ const r = run('gh', ['auth', 'status', '--active'], { encoding: 'utf8', windowsHide: true, timeout: 10000 });
142
+ const m = /account ([A-Za-z0-9-]+)/.exec(String((r && r.stdout) || '') + String((r && r.stderr) || ''));
143
+ if (m) {
144
+ return `git is using your '${m[1]}' GitHub account, which may not be able to see this project. Switch with gh auth switch (it lists the accounts signed in here), then run the setup command again. If the right account is not listed, add it with gh auth login first.`;
145
+ }
146
+ } catch (_) { /* no gh, or it could not answer — the generic line is still right */ }
147
+ return GITHUB_REMEDY_GENERIC;
148
+ }
149
+
128
150
  // ── the runner's own copy ──────────────────────────────────────────────────
129
151
 
130
152
  function runnerCopyMarkPath(repoRoot = REPO_ROOT) { return path.join(repoRoot, '.git', RUNNER_COPY_MARK); }
@@ -289,7 +311,14 @@ function git(args, opts = {}) {
289
311
  function refreshCheckout(log = () => {}) {
290
312
  assertRunnerCopy();
291
313
  const f = git(['fetch', '--quiet', 'origin', 'main']);
292
- if (f.status !== 0) { log(`git fetch failed — running the code already here (${String(f.stderr || '').trim().slice(0, 200)})`); return false; }
314
+ if (f.status !== 0) {
315
+ // The log is the ONLY place this is said (the card reads check-ins, not fetches), so it
316
+ // carries the remedy too — a fetch that fails for a credential reason fails every loop,
317
+ // and the runner then works forever on the code it happens to have (task 1005096).
318
+ log(`git fetch failed — running the code already here (${String(f.stderr || '').trim().slice(0, 200)})`);
319
+ log(` if that keeps happening, it is not transient: ${githubRemedy()}`);
320
+ return false;
321
+ }
293
322
  const r = git(['reset', '--quiet', '--hard', 'origin/main']);
294
323
  if (r.status !== 0) { log(`git reset failed (${String(r.stderr || '').trim().slice(0, 200)})`); return false; }
295
324
  return true;
@@ -726,7 +755,7 @@ async function setup(argv, { paths = hostPaths(), say = console.log } = {}) {
726
755
 
727
756
  say('4/5 Checking this device can fetch the project’s code…');
728
757
  if (git(['ls-remote', 'origin', 'refs/heads/main'], { timeout: 60000 }).status !== 0) {
729
- throw new Stop('This device could not fetch the project’s code from GitHub.', 'Sign in to GitHub on this device (run git fetch in the runner’s folder and follow the sign-in), then run the setup command again.');
758
+ throw new Stop('This device could not fetch the project’s code from GitHub.', githubRemedy());
730
759
  }
731
760
 
732
761
  say('5/5 Starting the runner…');
@@ -895,4 +924,5 @@ module.exports = {
895
924
  windowsRunArgv, windowsRunCommand, windowsStartSpawn, legacyBootTaskInstalled, launchdPlist,
896
925
  stopRunner, stopReport, exchangeCode, claudeState, waitForCheckIn,
897
926
  signIn, cleanBase, install, removeStartEntry, installedState, status, digestArgv,
927
+ githubRemedy, GITHUB_REMEDY_GENERIC,
898
928
  };
@@ -90,12 +90,19 @@ function planRemedy(inst, reason, o = {}) {
90
90
  if (!SHELL_SAFE_RE.test(backupDir)) return { refused: 'the backup folder is not a path this runner will put in a command' };
91
91
  // EXACTLY db-backup-nightly.sh's name, so this never touches a sibling project's dumps
92
92
  // (`test` must not prune `test-nk`'s — task 1003948). The timestamp sorts by name, so
93
- // `sort | head -n -K` drops all but the newest K. Nothing is deleted when K or fewer exist.
93
+ // dropping all but the last K leaves the newest K. Nothing is deleted when K or fewer exist.
94
+ //
95
+ // ALL-BUT-THE-LAST-K IN POSIX awk, NOT `head -n -K` (task 1005096). `head -n -K` is a GNU
96
+ // extension: BSD/macOS head answers `illegal line count`, exits 1, and the pipeline then
97
+ // deletes nothing — and `xargs -r` is GNU-only too. Same family as the `stat -c` sweep
98
+ // (task 1004170): the command runs on a Linux box, but the test that runs it for real runs
99
+ // wherever a builder builds, so on a Mac it could never pass. POSIX `xargs` with no input
100
+ // may still run `rm -f --`, which succeeds with no operands, so `-r` is not needed.
94
101
  const D = '[0-9]';
95
102
  const glob = `${db}-${D}${D}${D}${D}-${D}${D}-${D}${D}T${D}${D}${D}${D}${D}${D}Z.sql.gz`;
96
103
  return {
97
104
  reason, cwd: null, env: null,
98
- cmd: `find ${backupDir} -maxdepth 1 -type f -name '${glob}' | sort | head -n -${DUMP_KEEP_FLOOR} | xargs -r rm -f --`,
105
+ cmd: `find ${backupDir} -maxdepth 1 -type f -name '${glob}' | sort | awk -v k=${DUMP_KEEP_FLOOR} '{a[NR]=$0} END{for(i=1;i<=NR-k;i++) print a[i]}' | xargs rm -f --`,
99
106
  describe: `pruned ${db}'s old database backups in ${backupDir}, keeping the newest ${DUMP_KEEP_FLOOR}`,
100
107
  };
101
108
  }
package/src/module-api.js CHANGED
@@ -81,7 +81,7 @@ const { sleep } = require('./sleep');
81
81
  // MAJOR (see allowBoxScope below): passes the request through untouched.
82
82
  function deprecatedNoopMiddleware(_req, _res, next) { next(); }
83
83
 
84
- const CORE_VERSION = '1.24.84'; // CI auto-patch carrier (ADR 0161); changelog: docs/module-api-changelog.md
84
+ const CORE_VERSION = '1.24.85'; // CI auto-patch carrier (ADR 0161); changelog: docs/module-api-changelog.md
85
85
 
86
86
  // A namespaced logger so a module's log lines are attributable + consistent.
87
87
  // Usage: const log = api.logger('discord'); log.info('mounted');
@@ -663,3 +663,36 @@ test('the digest is read from the RUNNER’s run log: bare, the digest CLI looks
663
663
  assert.equal(bare.status, 0, 'the digest never fails a morning');
664
664
  assert.equal(bare.stdout.includes('424242'), false, 'which is why the guide sends people through the device program');
665
665
  });
666
+
667
+ // --- "sign in to GitHub" is the wrong advice when you already are (task 1005096) -------
668
+ //
669
+ // Found by running the real setup on a real Mac. The device had TWO GitHub accounts signed
670
+ // in through the GitHub CLI; git asks its first credential helper — the login keychain —
671
+ // which answers with whichever is ACTIVE, and that one could not see the private project.
672
+ // git then says "Repository not found", which reads as a typo, and the setup answered
673
+ // "Sign in to GitHub … gh auth login is the simplest way" — advice that changes nothing,
674
+ // because the person is signed in. The remedy has to NAME the account git is using.
675
+ test('githubRemedy names the active GitHub account, and the command that changes it', () => {
676
+ const said = host.githubRemedy(() => ({ stdout: 'github.com\n ✓ Logged in to github.com account mcip-labs (keyring)\n', stderr: '' }));
677
+ assert.match(said, /'mcip-labs'/, 'the account git is actually using must be named, or the advice is a circle');
678
+ assert.match(said, /gh auth switch/, 'and the one command that changes it');
679
+ assert.notEqual(said, host.GITHUB_REMEDY_GENERIC);
680
+ });
681
+
682
+ test('githubRemedy falls back to the plain advice when gh cannot answer', () => {
683
+ // No GitHub CLI on the device, it failed, or it is signed in to nothing: there is no
684
+ // account to name, and "sign in" is then exactly the right thing to say.
685
+ assert.equal(host.githubRemedy(() => ({ stdout: '', stderr: 'command not found' })), host.GITHUB_REMEDY_GENERIC);
686
+ assert.equal(host.githubRemedy(() => { throw new Error('ENOENT'); }), host.GITHUB_REMEDY_GENERIC);
687
+ assert.equal(host.githubRemedy(() => ({ stdout: 'You are not logged into any GitHub hosts.\n', stderr: '' })), host.GITHUB_REMEDY_GENERIC);
688
+ });
689
+
690
+ test('the shell bootstrap gives the same remedy, so either half says the same thing', () => {
691
+ const sh = readFileSync(fileURLToPath(new URL('../scripts/bongos/autobongos-bootstrap.sh', import.meta.url)), 'utf8');
692
+ assert.match(sh, /github_remedy\(\)/, 'the bootstrap has the twin');
693
+ assert.match(sh, /gh auth switch/);
694
+ // Both clone/fetch stops route through it rather than re-typing the old line.
695
+ const stops = sh.split('\n').filter((l) => /stop_setup "this device could not (copy|fetch)/.test(l));
696
+ assert.equal(stops.length, 2, 'the two GitHub stops');
697
+ for (const l of stops) assert.match(l, /\$\(github_remedy\)/, l.trim());
698
+ });
@@ -47,3 +47,37 @@ test('the rule catches a lone GNU or BSD stat, and passes the paired form and pr
47
47
  assert.equal(offending('U=$(stat -c %U "$d" 2>/dev/null || stat -f %Su "$d" 2>/dev/null)').length, 0);
48
48
  assert.equal(offending(" # was stat -c '%s', which BSD refuses").length, 0, 'a comment is not a call');
49
49
  });
50
+
51
+ // --- `head -n -K` — the same bug, a different GNU extension (task 1005096) ------------
52
+ //
53
+ // `head -n -K` means "all but the last K" to GNU and is an ERROR to BSD/macOS head
54
+ // ("illegal line count", exit 1). wedge-remedy.js's disk-full prune used it, so on a Mac
55
+ // the pipeline deleted nothing and the test that runs that command for real could never
56
+ // pass. The command itself runs on a Linux box — but a builder builds wherever they are,
57
+ // so a one-dialect idiom still reds their suite. POSIX awk answers it everywhere:
58
+ // … | sort | awk -v k=K '{a[NR]=$0} END{for(i=1;i<=NR-k;i++) print a[i]}'
59
+ //
60
+ // Scanned in the .js files too, not only *.sh: this one lived inside a shell string a
61
+ // Node script builds, which the stat scan above would never have seen.
62
+ const GNU_HEAD = /(^|[^\w-])head\s+(-n\s*-\d|--lines[\s=]-\d|-\s*-\d)/;
63
+
64
+ test('no tracked script asks for `head -n -K`, which BSD/macOS head refuses', () => {
65
+ const files = execFileSync('git', ['ls-files', '*.sh', 'scripts/*.js', 'scripts/**/*.js'], { cwd: ROOT, encoding: 'utf8' })
66
+ .split('\n').filter(Boolean);
67
+ assert.ok(files.length > 20, `the scan must see the scripts, got ${files.length}`);
68
+ const hits = files.flatMap((f) => fs.readFileSync(path.join(ROOT, f), 'utf8')
69
+ .split('\n').map((l, i) => ({ n: i + 1, l }))
70
+ .filter(({ l }) => !/^\s*(#|\/\/)/.test(l) && GNU_HEAD.test(l))
71
+ .map(({ n, l }) => `${f}:${n}: ${l.trim()}`));
72
+ assert.deepEqual(hits, [], "all but the last K: sort | awk -v k=K '{a[NR]=$0} END{for(i=1;i<=NR-k;i++) print a[i]}'");
73
+ });
74
+
75
+ test('the head rule catches the GNU forms and leaves an ordinary head alone', () => {
76
+ const hit = (s) => GNU_HEAD.test(s);
77
+ assert.equal(hit("… | head -n -7 | xargs rm -f --"), true);
78
+ assert.equal(hit('… | head -n-7'), true);
79
+ assert.equal(hit('… | head --lines=-7'), true);
80
+ assert.equal(hit('… | head -n 7'), false, 'the ordinary form is portable');
81
+ assert.equal(hit('… | head -7'), false);
82
+ assert.equal(hit('git log | head -n 20'), false);
83
+ });
@@ -76,7 +76,11 @@ function writeFile(p, body) {
76
76
 
77
77
  // Build one fixture. `mainAt`: 'primary' | 'linked' | 'none'.
78
78
  function buildFixture(mainAt) {
79
- const root = fs.mkdtempSync(path.join(os.tmpdir(), `bongos-vendored-${mainAt}-`));
79
+ // realpath'd (task 1005096): on a Mac os.tmpdir() is /var/folders/…, a symlink to
80
+ // /private/var/folders/…, and resolveRoots answers with git's own answer — the /private
81
+ // form. Comparing the two spellings failed on every Mac and passed on CI's Linux, which
82
+ // has no such link. The fixture names the path the code under test will name.
83
+ const root = fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(), `bongos-vendored-${mainAt}-`)));
80
84
  const origin = path.join(root, 'origin.git');
81
85
  const inst = path.join(root, 'instance');
82
86
  git(root, 'init', '--bare', '-b', 'main', origin);
@@ -14,7 +14,7 @@ import { test } from 'node:test';
14
14
  import assert from 'node:assert/strict';
15
15
  import { createRequire } from 'node:module';
16
16
  import { spawnSync } from 'node:child_process';
17
- import { mkdtempSync, mkdirSync, writeFileSync, readFileSync } from 'node:fs';
17
+ import { mkdtempSync, mkdirSync, writeFileSync, readFileSync, realpathSync } from 'node:fs';
18
18
  import { tmpdir } from 'node:os';
19
19
  import path from 'node:path';
20
20
  import { fileURLToPath } from 'node:url';
@@ -23,6 +23,12 @@ const require = createRequire(import.meta.url);
23
23
  const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
24
24
  const SWEEP = path.join(ROOT, 'scripts', 'bongos', 'update-sweep.js');
25
25
  const sweep = require(SWEEP);
26
+
27
+ // A temp folder the code under test and this test can BOTH name the same way (task 1005096).
28
+ // On a Mac os.tmpdir() is /var/folders/…, a symlink to /private/var/folders/…: anything that
29
+ // resolves a real path — as the sweep's resolver and git both do — answers the /private form,
30
+ // and the comparison failed on every Mac while passing on CI's Linux, which has no such link.
31
+ const tmpRoot = (prefix) => realpathSync(mkdtempSync(path.join(tmpdir(), prefix)));
26
32
  const { isPublishable } = require('../scripts/bongos/publish-manifest.js');
27
33
 
28
34
  test('the sweep and every core file it requires are in the published package', () => {
@@ -50,7 +56,7 @@ test('its target-instance resolver searches the same packages, in the same order
50
56
  });
51
57
 
52
58
  test('coreModulePathFrom finds a target instance\'s INSTALLED core, root first', () => {
53
- const inst = mkdtempSync(path.join(tmpdir(), 'sweep-home-'));
59
+ const inst = tmpRoot('sweep-home-');
54
60
  const pkg = path.join(inst, 'node_modules', '@bongos', 'core', 'scripts', 'bongos');
55
61
  mkdirSync(pkg, { recursive: true });
56
62
  writeFileSync(path.join(pkg, 'upgrade.js'), '');
@@ -62,11 +68,11 @@ test('coreModulePathFrom finds a target instance\'s INSTALLED core, root first',
62
68
  });
63
69
 
64
70
  test('run from elsewhere, it reads the roster named by --instance and says which core is sweeping', () => {
65
- const rosterRoot = mkdtempSync(path.join(tmpdir(), 'sweep-roster-'));
71
+ const rosterRoot = tmpRoot('sweep-roster-');
66
72
  mkdirSync(path.join(rosterRoot, 'config'));
67
73
  writeFileSync(path.join(rosterRoot, 'config', 'update-subscriptions.json'),
68
74
  JSON.stringify({ instances: [{ slug: 'held', dir: path.join(rosterRoot, 'nowhere'), channel: 'pinned' }] }));
69
- const cwd = mkdtempSync(path.join(tmpdir(), 'sweep-cwd-'));
75
+ const cwd = tmpRoot('sweep-cwd-');
70
76
  const r = spawnSync(process.execPath, [SWEEP, '--instance', rosterRoot], { cwd, encoding: 'utf8', env: { ...process.env, DATABASE_URL: '', PGDATABASE: '' } });
71
77
  assert.equal(r.status, 0, r.stderr);
72
78
  assert.match(r.stdout, new RegExp(`update-sweep · running from .+ \\(core \\d+\\.\\d+\\.\\d+\\) · roster ${rosterRoot.replace(/[\\^$.*+?()[\]{}|]/g, '\\$&')}`));
@@ -75,7 +81,7 @@ test('run from elsewhere, it reads the roster named by --instance and says which
75
81
  });
76
82
 
77
83
  test('without --instance it reads the roster in its working directory (the unit\'s WorkingDirectory)', () => {
78
- const cwd = mkdtempSync(path.join(tmpdir(), 'sweep-cwd-'));
84
+ const cwd = tmpRoot('sweep-cwd-');
79
85
  const r = spawnSync(process.execPath, [SWEEP], { cwd, encoding: 'utf8', env: { ...process.env, DATABASE_URL: '', PGDATABASE: '' } });
80
86
  assert.equal(r.status, 0, r.stderr);
81
87
  assert.match(r.stdout, /no roster file — nothing subscribed/);
@@ -75,7 +75,11 @@ await t('a cloud-host project is fixed in ITS folder, not the control plane\'s',
75
75
  await t('disk full: prunes only THIS database\'s dumps, keeping the newest week', () => {
76
76
  const p = W.planRemedy(inst(), 'disk_full', { selfRoot, backupDir: '/var/backups/gds' });
77
77
  assert.match(p.cmd, /^find \/var\/backups\/gds -maxdepth 1 -type f -name 'charter-\[0-9\]/);
78
- assert.match(p.cmd, new RegExp(`head -n -${W.DUMP_KEEP_FLOOR} \\| xargs -r rm -f --$`));
78
+ // All-but-the-last-K in POSIX awk, never `head -n -K`: that is a GNU extension BSD/macOS
79
+ // head refuses outright, so the pipeline deleted nothing on a Mac (task 1005096).
80
+ assert.match(p.cmd, new RegExp(`awk -v k=${W.DUMP_KEEP_FLOOR} `));
81
+ assert.match(p.cmd, /\| xargs rm -f --$/);
82
+ assert.doesNotMatch(p.cmd, /head -n -/, 'GNU-only; BSD head answers "illegal line count"');
79
83
  assert.equal(W.DUMP_KEEP_FLOOR, 7);
80
84
  });
81
85