@bongos/core 1.19.808 → 1.19.809

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,22 +2,22 @@
2
2
  "artifact": "bongos-core",
3
3
  "manifest_schema": 1,
4
4
  "generator": "scripts/gds/package-core.js",
5
- "core_version": "1.19.808",
6
- "core_contract": "1.19.808",
7
- "source_commit": "2a921818a3fc484b4f92c886ee223930bad60a61",
5
+ "core_version": "1.19.809",
6
+ "core_contract": "1.19.809",
7
+ "source_commit": "8a0d6205ab8651338ec9f196b0d2a76457ecd7de",
8
8
  "source_ref": "HEAD",
9
- "built_at": "2026-09-17T05:17:38.715Z",
9
+ "built_at": "2026-09-17T05:51:03.923Z",
10
10
  "redaction": {
11
11
  "model": "docs-redacted+functional-verbatim",
12
12
  "docs_redacted": 487,
13
13
  "agent_docs_stubbed": 25,
14
- "functional_verbatim": 2196,
14
+ "functional_verbatim": 2198,
15
15
  "rules": 3,
16
16
  "gate_literals": 3,
17
17
  "gate": "passed"
18
18
  },
19
- "file_count": 2708,
20
- "tree_sha256": "fd285930374d70ebcd43b89ab506190f5d0d2e6a7b4a4c1d1f35aa16e00bc5ca",
19
+ "file_count": 2710,
20
+ "tree_sha256": "8ffacf4d6b6f9d1185a0367eef97d3f885c3219caa5f7b483c03e568f6e244cf",
21
21
  "files": [
22
22
  {
23
23
  "path": ".claude/skills/ask-for-help/SKILL.md",
@@ -2532,7 +2532,7 @@
2532
2532
  {
2533
2533
  "path": "docs/module-api-changelog.md",
2534
2534
  "mode": "0000644",
2535
- "sha256": "46d5189d51e7dbe1160b8b83a2af194f2f1722e78a0600dc7c9937344049ef01"
2535
+ "sha256": "0fc3cc0ea86f2325096412d389457b095d7e12b175415e0f9bc41d5cd40946a1"
2536
2536
  },
2537
2537
  {
2538
2538
  "path": "docs/modules-contract.md",
@@ -5459,6 +5459,11 @@
5459
5459
  "mode": "0000644",
5460
5460
  "sha256": "7cb9dac9cb87b679e1ae50e4112b3a7928a38ebb9902c8947a74d17bec4d9009"
5461
5461
  },
5462
+ {
5463
+ "path": "modules/lifecycle/abandon-leftovers.js",
5464
+ "mode": "0000644",
5465
+ "sha256": "a9d762f64176c26b3d3058a9e769f966b838fbb8b0dabeceeeabd8ce324ca471"
5466
+ },
5462
5467
  {
5463
5468
  "path": "modules/lifecycle/activity.js",
5464
5469
  "mode": "0000644",
@@ -7722,12 +7727,12 @@
7722
7727
  {
7723
7728
  "path": "package-lock.json",
7724
7729
  "mode": "0000644",
7725
- "sha256": "6710303099e13ad8ed4480666184efecef047f30f6d8ef94a7ab197b53030747"
7730
+ "sha256": "bce83e06aea9721525e159bbe1446154fcda006c89fdcde14fd6ab46f624366a"
7726
7731
  },
7727
7732
  {
7728
7733
  "path": "package.json",
7729
7734
  "mode": "0000644",
7730
- "sha256": "81b97d964fa32391c2affaeca8e06f4676c5cf748ca47da39e6f36fac964cd1c"
7735
+ "sha256": "714b48f38c2da73d5a2353c66228b8f4aa8cd375f7c712a1421f59bb0cf22e09"
7731
7736
  },
7732
7737
  {
7733
7738
  "path": "public-docs/index.html",
@@ -7777,7 +7782,7 @@
7777
7782
  {
7778
7783
  "path": "scripts/gds/abandon.js",
7779
7784
  "mode": "0000644",
7780
- "sha256": "67e9a8dead2b0ea75f6011fd687a3db56a12df945a77f430eec2602a0ecac07c"
7785
+ "sha256": "723aea2c66f8897822507a7b3c7556170336ec021676b3cb8898e5c3bc4e98ca"
7781
7786
  },
7782
7787
  {
7783
7788
  "path": "scripts/gds/accessibility-replay.js",
@@ -9617,7 +9622,7 @@
9617
9622
  {
9618
9623
  "path": "src/module-api.js",
9619
9624
  "mode": "0000644",
9620
- "sha256": "04156823d2a170b31bb9b3b7c5314224885d89429e6f7b83dbd30aeab5edf7b9"
9625
+ "sha256": "03b5ce71d6aeab750b5bd2dad14f89d459472a4b42a701b4923bb430cafa384e"
9621
9626
  },
9622
9627
  {
9623
9628
  "path": "src/module-loader/catalog.js",
@@ -9669,6 +9674,11 @@
9669
9674
  "mode": "0000644",
9670
9675
  "sha256": "2e46d071e5c61d302f34507215dd0a5f20a0887841ae0f7b033be865c2cb8af5"
9671
9676
  },
9677
+ {
9678
+ "path": "tests/abandon_leftovers.mjs",
9679
+ "mode": "0000644",
9680
+ "sha256": "fe9562bd27fc127f5113de4316d1abe784874aa198d87be79caa302d526ecf17"
9681
+ },
9672
9682
  {
9673
9683
  "path": "tests/abandon_task.mjs",
9674
9684
  "mode": "0000644",
@@ -2090,5 +2090,7 @@ is load-bearing: the script throws rather than guess if it is missing, and
2090
2090
  landed since 1.19.806 with no explicit bump. run 35183654397. (task 1002620)
2091
2091
  1.19.808 — CI auto-patch (publish-on-merge, ADR 0161): carrier for merges
2092
2092
  landed since 1.19.807 with no explicit bump. run 35185130913. (task 1002620)
2093
+ 1.19.809 — CI auto-patch (publish-on-merge, ADR 0161): carrier for merges
2094
+ landed since 1.19.808 with no explicit bump. run 35187322516. (task 1002620)
2093
2095
  ---------------------------------------------------------------------------
2094
2096
  ```
@@ -0,0 +1,103 @@
1
+ 'use strict';
2
+
3
+ // modules/lifecycle/abandon-leftovers.js — what a retired task leaves behind
4
+ // (task 1003779).
5
+ //
6
+ // THE DEFECT THIS EXISTS FOR. Abandoning a task retires the ROW and nothing else.
7
+ // Task 1002464 was abandoned carrying two commits on `task-1002464` that are not
8
+ // ancestors of origin/main, and an open PR. Nothing said so — not at the moment
9
+ // of abandonment, not afterwards — so the branch read as live work, and a
10
+ // follow-up filed off its grading pass (task 1003626) sat at `ready` asking for
11
+ // three nits in a function that exists nowhere on main. `sequence.js --check`
12
+ // called it "clear to run". The cost landed on whoever claimed it.
13
+ //
14
+ // SIBLING OF dead-deps.js, deliberately. That file makes an abandoned
15
+ // DEPENDENCY observable; this one makes abandoned CODE observable. Same posture:
16
+ // pure and git-free here so the CLI is the only place that shells out, and the
17
+ // rule can be tested without a repository.
18
+ //
19
+ // WHAT THIS IS NOT. It does not delete a branch, close a PR, or touch the
20
+ // remote. Retiring a row is reversible (POST /tasks/:id/promote); deleting the
21
+ // only copy of unmerged work is not, and which of the two a leftover branch
22
+ // deserves is a human call. This reports, loudly, with the commands to hand.
23
+ //
24
+ // WHY NOT source_ref, which the report suggested. The incident that motivated
25
+ // this task is the counter-example: 1003626's `source_ref` is `idea:1000935`,
26
+ // not the branch or task it was stranded behind — the relationship lived only in
27
+ // the prose of its description. A source_ref sweep would have found nothing.
28
+ // The branch is the artifact that actually exists, so the branch is what is
29
+ // checked.
30
+
31
+ // A branch belongs to task N if it is `task-N` or `task-N-<slug>` (the two
32
+ // shapes worktree.js produces). Anchored at both ends so task-1002450 never
33
+ // matches task-10024501 — a prefix match here would report another task's work
34
+ // as this one's leftovers, which is worse than reporting nothing.
35
+ function branchesForTask(taskId, branches) {
36
+ const id = String(taskId == null ? '' : taskId).trim();
37
+ if (!/^\d+$/.test(id)) return [];
38
+ const re = new RegExp(`^task-${id}(?:-[A-Za-z0-9._-]+)?$`);
39
+ // Deduped after stripping the remote prefix: a caller may pass the same branch
40
+ // as both 'task-N' and 'origin/task-N' (git branch -r vs ls-remote), and the
41
+ // notice would then tell a builder to delete one branch twice.
42
+ const seen = new Set();
43
+ for (const raw of branches || []) {
44
+ const b = String(raw || '').trim().replace(/^origin\//, '');
45
+ if (re.test(b)) seen.add(b);
46
+ }
47
+ return [...seen];
48
+ }
49
+
50
+ // Pure: the leftover report for one task. `aheadCount(branch)` answers "how many
51
+ // commits does this branch carry that main does not" — a number, or null when it
52
+ // could not be determined.
53
+ //
54
+ // null is NOT folded into 0. "I could not look" and "there is nothing there"
55
+ // must not render as the same sentence (the strand-watch.js rule): an
56
+ // undetermined branch is reported as undetermined, so a network failure cannot
57
+ // quietly certify a branch as clean.
58
+ function leftoversForTask(taskId, { branches, aheadCount }) {
59
+ const out = [];
60
+ for (const branch of branchesForTask(taskId, branches)) {
61
+ let raw;
62
+ try { raw = aheadCount(branch); } catch (_) { raw = null; }
63
+ const n = Number(raw);
64
+ // Anything that is not a finite number is UNDETERMINED, not zero. The first
65
+ // cut of this tested only for null/undefined, so a NaN — what
66
+ // `Number(git rev-list output)` yields when the command prints nothing —
67
+ // fell through to the "> 0" test, failed it, and was dropped as clean. That
68
+ // is the exact failure this module's header forbids: a branch nobody could
69
+ // read certified as a branch with nothing on it.
70
+ if (raw === null || raw === undefined || !Number.isFinite(n)) {
71
+ out.push({ branch, ahead: null, undetermined: true });
72
+ continue;
73
+ }
74
+ if (n > 0) out.push({ branch, ahead: n, undetermined: false });
75
+ }
76
+ return out;
77
+ }
78
+
79
+ // The message a builder sees. Returns null when there is nothing to say, so the
80
+ // caller can stay silent on the clean path rather than printing a reassurance
81
+ // nobody reads (and which would train people to skip the line that matters).
82
+ function leftoverNotice(taskId, leftovers) {
83
+ if (!leftovers || !leftovers.length) return null;
84
+ const lines = [`\n⚠ Task #${taskId} is retired, but its work is still on the remote:`];
85
+ for (const l of leftovers) {
86
+ lines.push(l.undetermined
87
+ ? ` - ${l.branch} — could not tell whether it carries unmerged commits`
88
+ : ` - ${l.branch} — ${l.ahead} commit(s) not on main`);
89
+ }
90
+ lines.push(
91
+ '',
92
+ 'An abandoned task with a live branch reads as live work, and anything filed',
93
+ 'off its review sits against code that does not exist on main. Decide which:',
94
+ '',
95
+ ` git push origin --delete ${leftovers[0].branch} # the work is cut — drop it`,
96
+ ` node scripts/gds/api.js POST /api/gds/tasks/${taskId}/promote # it is not cut — revive the task`,
97
+ '',
98
+ 'Close or draft the branch\'s PR either way — the remote is not this tool\'s to change.',
99
+ );
100
+ return lines.join('\n');
101
+ }
102
+
103
+ module.exports = { branchesForTask, leftoversForTask, leftoverNotice };
package/package-lock.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@bongos/core",
3
- "version": "1.19.808",
3
+ "version": "1.19.809",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@bongos/core",
9
- "version": "1.19.808",
9
+ "version": "1.19.809",
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.19.808",
3
+ "version": "1.19.809",
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",
@@ -21,6 +21,38 @@ const { cliClient, requireSession, arg } = require('./cli-lib');
21
21
  // task 1003153 — the live-status set, shared with the dead-edge detector so
22
22
  // "who did this cut strand" means the same thing in both places.
23
23
  const { LIVE_STATUSES } = require('../../modules/lifecycle/dead-deps.js');
24
+ // task 1003779 — the other thing a cut leaves behind: the code itself.
25
+ const { leftoversForTask, leftoverNotice } = require('../../modules/lifecycle/abandon-leftovers.js');
26
+ const { execFileSync } = require('node:child_process');
27
+
28
+ // Best-effort git, always. Every call here is advisory decoration on an abandon
29
+ // that has ALREADY landed, so a missing git, a detached network or a shallow
30
+ // clone must return "I don't know" — never throw, and never abort the command.
31
+ function git(args, ms = 20000) {
32
+ return execFileSync('git', args, { encoding: 'utf8', timeout: ms, stdio: ['ignore', 'pipe', 'ignore'] });
33
+ }
34
+
35
+ // The remote branches this task owns. ONE network round trip, scoped to the two
36
+ // name shapes worktree.js produces — listing all 800-odd heads to filter locally
37
+ // would be the expensive way to learn the same thing.
38
+ function remoteBranchesFor(taskId) {
39
+ try {
40
+ const out = git(['ls-remote', '--heads', 'origin', `refs/heads/task-${taskId}`, `refs/heads/task-${taskId}-*`]);
41
+ return out.split('\n').map((l) => l.split('\t')[1] || '').filter(Boolean)
42
+ .map((r) => r.replace(/^refs\/heads\//, ''));
43
+ } catch (_) { return null; } // null = could not look
44
+ }
45
+
46
+ // How many commits the branch carries that main does not. Returns null when it
47
+ // cannot be determined, which leftoversForTask reports as undetermined rather
48
+ // than folding into "clean" — see that module's header.
49
+ function commitsAheadOfMain(branch) {
50
+ try {
51
+ git(['fetch', 'origin', '--quiet', branch, 'main']);
52
+ const n = Number(String(git(['rev-list', '--count', 'FETCH_HEAD', '--not', 'origin/main'])).trim());
53
+ return Number.isFinite(n) ? n : null;
54
+ } catch (_) { return null; }
55
+ }
24
56
 
25
57
 
26
58
  (async () => {
@@ -79,6 +111,22 @@ const { LIVE_STATUSES } = require('../../modules/lifecycle/dead-deps.js');
79
111
  console.log(' Sweep for any you miss: node scripts/gds/audit-deps.js --stranded');
80
112
  }
81
113
  } catch (_) { /* the abandon already landed — the report is advisory */ }
114
+
115
+ // task 1003779 — REPORT the code this cut orphaned. Abandoning retires the ROW;
116
+ // the branch and its PR stay exactly where they were, reading as live work.
117
+ // Task 1002464 was cut carrying two commits never merged to main, and the
118
+ // follow-up filed off its review (task 1003626) then sat at 'ready' asking for
119
+ // changes to a function that exists nowhere on main — 'sequence.js --check'
120
+ // called it clear to run. Nothing had said the branch was dead, so nothing could.
121
+ // Same posture as the stranded-dependents report above: best-effort, and it
122
+ // never fails an abandon that already landed.
123
+ try {
124
+ const branches = remoteBranchesFor(taskId);
125
+ if (branches && branches.length) {
126
+ const notice = leftoverNotice(taskId, leftoversForTask(taskId, { branches, aheadCount: commitsAheadOfMain }));
127
+ if (notice) console.log(notice);
128
+ }
129
+ } catch (_) { /* advisory only */ }
82
130
  })().catch((err) => {
83
131
  console.error('fatal:', err);
84
132
  process.exit(1);
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.808'; // CI auto-patch carrier (ADR 0161); changelog: docs/module-api-changelog.md
74
+ const CORE_VERSION = '1.19.809'; // 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');
@@ -0,0 +1,87 @@
1
+ // tests/abandon_leftovers.mjs — what a retired task leaves on the remote
2
+ // (task 1003779). Pure + git-free: the ancestry oracle is injected, so these run
3
+ // with no repository, no network and no fixtures.
4
+ import assert from 'node:assert/strict';
5
+ import { test } from 'node:test';
6
+ import { createRequire } from 'node:module';
7
+ import path from 'node:path';
8
+ import { fileURLToPath } from 'node:url';
9
+
10
+ const require = createRequire(import.meta.url);
11
+ const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
12
+ const { branchesForTask, leftoversForTask, leftoverNotice } =
13
+ require(path.join(ROOT, 'modules', 'lifecycle', 'abandon-leftovers.js'));
14
+
15
+ test('both branch shapes worktree.js produces belong to the task', () => {
16
+ const branches = ['task-1002464', 'task-1002503-backfill-recovery', 'main'];
17
+ assert.deepEqual(branchesForTask(1002464, branches), ['task-1002464']);
18
+ assert.deepEqual(branchesForTask(1002503, branches), ['task-1002503-backfill-recovery']);
19
+ });
20
+
21
+ test('THE MISREPORT THIS MUST NOT MAKE: a longer id is not a prefix match', () => {
22
+ // task-10024501 is ANOTHER task's branch. Matching it would tell a builder to
23
+ // delete someone else's unmerged work as their own leftovers — worse than
24
+ // reporting nothing at all, which is why the pattern is anchored at both ends.
25
+ assert.deepEqual(branchesForTask(1002450, ['task-10024501', 'task-1002450x', 'xtask-1002450']), []);
26
+ assert.deepEqual(branchesForTask(1002450, ['task-1002450', 'task-10024501']), ['task-1002450']);
27
+ });
28
+
29
+ test('the same branch given twice is reported once', () => {
30
+ // Callers may pass `git branch -r` output (origin/task-N) and `ls-remote`
31
+ // output (task-N) together; the notice would otherwise say "delete it" twice.
32
+ assert.deepEqual(branchesForTask(1002464, ['task-1002464', 'origin/task-1002464']), ['task-1002464']);
33
+ });
34
+
35
+ test('a non-numeric or missing id matches nothing rather than building a loose regex', () => {
36
+ for (const id of ['', null, undefined, 'x', '10*', '.*']) {
37
+ assert.deepEqual(branchesForTask(id, ['task-1002464', 'task-x']), [], `id ${JSON.stringify(id)}`);
38
+ }
39
+ });
40
+
41
+ test('a branch already merged into main is not a leftover — the silent path', () => {
42
+ // The load-bearing negative. Every shipped task keeps its branch, so if a
43
+ // merged branch counted, the notice would fire on nearly every abandon and
44
+ // become weather (the lesson task 1003770 recorded about the drift advisory).
45
+ assert.deepEqual(leftoversForTask(1002464, { branches: ['task-1002464'], aheadCount: () => 0 }), []);
46
+ assert.equal(leftoverNotice(1002464, []), null, 'nothing to say means say nothing');
47
+ });
48
+
49
+ test('unmerged commits are reported with their count', () => {
50
+ assert.deepEqual(
51
+ leftoversForTask(1002464, { branches: ['task-1002464'], aheadCount: () => 2 }),
52
+ [{ branch: 'task-1002464', ahead: 2, undetermined: false }],
53
+ );
54
+ });
55
+
56
+ test('"could not look" is never folded into "nothing there"', () => {
57
+ // A network failure must not silently certify a branch as clean — the
58
+ // strand-watch.js rule. null and a throw both surface as undetermined.
59
+ for (const oracle of [() => null, () => undefined, () => { throw new Error('offline'); }, () => NaN]) {
60
+ const r = leftoversForTask(1002464, { branches: ['task-1002464'], aheadCount: oracle });
61
+ assert.equal(r.length, 1);
62
+ assert.equal(r[0].undetermined, true);
63
+ assert.equal(r[0].ahead, null);
64
+ }
65
+ assert.match(leftoverNotice(1002464, leftoversForTask(1002464,
66
+ { branches: ['task-1002464'], aheadCount: () => null })), /could not tell/);
67
+ });
68
+
69
+ test('the notice names the task, the branch, and both ways out', () => {
70
+ const notice = leftoverNotice(1002464, leftoversForTask(1002464,
71
+ { branches: ['task-1002464'], aheadCount: () => 2 }));
72
+ assert.match(notice, /#1002464/);
73
+ assert.match(notice, /task-1002464 — 2 commit\(s\) not on main/);
74
+ // Both dispositions, because which one applies is a human call: the work is
75
+ // cut (drop the branch) or it is not (revive the task).
76
+ assert.match(notice, /git push origin --delete task-1002464/);
77
+ assert.match(notice, /tasks\/1002464\/promote/);
78
+ });
79
+
80
+ test('a mixed set reports only the branches that actually carry work', () => {
81
+ const branches = ['task-1002464', 'task-1002464-followup'];
82
+ const r = leftoversForTask(1002464, {
83
+ branches,
84
+ aheadCount: (b) => (b === 'task-1002464' ? 3 : 0),
85
+ });
86
+ assert.deepEqual(r, [{ branch: 'task-1002464', ahead: 3, undetermined: false }]);
87
+ });