@bongos/core 1.19.454 → 1.19.456
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 +116 -51
- package/docs/adr/0047-discord-bugs-intake-anti-abuse.md +1 -0
- package/docs/copy-inventory.md +231 -228
- package/docs/copy-registry.json +352 -312
- package/docs/module-api-changelog.md +4 -0
- package/modules/discord/db.js +0 -3
- package/modules/discord/discord-bot.js +8 -1
- package/modules/discord/discord-bugs.js +133 -74
- package/modules/discord/module.json +1 -1
- package/modules/hall-ui/public/atlas.css +41 -32
- package/modules/hall-ui/public/atlas.html +8 -0
- package/modules/hall-ui/public/atlas.states.json +60 -0
- package/modules/hall-ui/public/collab.css +2 -2
- package/modules/hall-ui/public/collab.html +7 -1
- package/modules/hall-ui/public/collab.states.json +60 -0
- package/modules/hall-ui/public/copy-desk.css +21 -16
- package/modules/hall-ui/public/copy-desk.html +9 -1
- package/modules/hall-ui/public/copy-desk.states.json +59 -0
- package/modules/hall-ui/public/drachmae.html +38 -5
- package/modules/hall-ui/public/drachmae.js +20 -2
- package/modules/hall-ui/public/drachmae.states.json +64 -0
- package/modules/hall-ui/public/gate.css +20 -25
- package/modules/hall-ui/public/gate.html +9 -1
- package/modules/hall-ui/public/gate.states.json +60 -0
- package/modules/hall-ui/public/goals-lib.js +22 -5
- package/modules/hall-ui/public/goals-render.js +27 -5
- package/modules/hall-ui/public/goals.css +141 -60
- package/modules/hall-ui/public/goals.html +8 -1
- package/modules/hall-ui/public/goals.states.json +74 -0
- package/modules/hall-ui/public/government.css +35 -36
- package/modules/hall-ui/public/government.html +9 -1
- package/modules/hall-ui/public/government.states.json +59 -0
- package/modules/hall-ui/public/harbor.css +23 -26
- package/modules/hall-ui/public/harbor.html +9 -1
- package/modules/hall-ui/public/harbor.states.json +59 -0
- package/modules/hall-ui/public/modules.css +22 -21
- package/modules/hall-ui/public/modules.html +9 -1
- package/modules/hall-ui/public/modules.states.json +73 -0
- package/modules/hall-ui/public/people.html +7 -1
- package/modules/hall-ui/public/people.states.json +59 -0
- package/modules/hall-ui/public/scouting.html +7 -1
- package/modules/hall-ui/public/scouting.states.json +54 -0
- package/modules/hall-ui/public/sessions.css +1 -1
- package/modules/hall-ui/public/sessions.html +9 -1
- package/modules/hall-ui/public/sessions.states.json +58 -0
- package/modules/hall-ui/public/style.css +125 -5
- package/modules/hall-ui/public/watch.css +36 -39
- package/modules/hall-ui/public/watch.html +9 -1
- package/modules/hall-ui/public/watch.states.json +60 -0
- package/modules/lifecycle/goal-suggest.js +70 -2
- package/modules/lifecycle/lifecycle.js +7 -0
- package/package-lock.json +2 -2
- package/package.json +1 -1
- package/src/module-api.js +1 -1
- package/tests/discord_bugs.mjs +110 -31
- package/tests/filing_abuse_matrix.mjs +59 -20
- package/tests/goal_subtitle.mjs +14 -8
- package/tests/goal_suggest.mjs +107 -1
package/tests/goal_suggest.mjs
CHANGED
|
@@ -24,7 +24,7 @@ import { makeRunner } from './helpers.mjs';
|
|
|
24
24
|
|
|
25
25
|
process.env.NODE_ENV = 'test';
|
|
26
26
|
const require = createRequire(import.meta.url);
|
|
27
|
-
const { suggestGoals, goalSuggestHandler, SUGGEST_LIMIT } = require('../modules/lifecycle/goal-suggest.js');
|
|
27
|
+
const { suggestGoals, suggestGoalForCapture, goalSuggestHandler, SUGGEST_LIMIT } = require('../modules/lifecycle/goal-suggest.js');
|
|
28
28
|
const { test, summary } = makeRunner();
|
|
29
29
|
|
|
30
30
|
const V = 'BONGOS-V1';
|
|
@@ -192,4 +192,110 @@ await test('the handler clamps limit into a sane range', async () => {
|
|
|
192
192
|
}
|
|
193
193
|
});
|
|
194
194
|
|
|
195
|
+
// =========================================================================
|
|
196
|
+
// suggestGoalForCapture — ONE goal, or none, for a filing with nobody to choose
|
|
197
|
+
// (task 1003067 / BV1.R11). The HTTP suggester offers a human five options; a
|
|
198
|
+
// Discord message has no human in the loop, so this collapses to a single
|
|
199
|
+
// confident answer and declines whenever "confident" is not available.
|
|
200
|
+
// =========================================================================
|
|
201
|
+
|
|
202
|
+
const fakeDb = ({ versions = [], goals = [], throws = null, calls = null } = {}) => ({
|
|
203
|
+
listVersions: async () => { if (throws === 'versions') throw new Error('boom'); return versions; },
|
|
204
|
+
listGoals: async (args) => {
|
|
205
|
+
if (calls) calls.push(args);
|
|
206
|
+
if (throws === 'goals') throw new Error('boom');
|
|
207
|
+
return goals;
|
|
208
|
+
},
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
const BUILDING = { id: 'BONGOS-V1', status: 'building' };
|
|
212
|
+
const SHIPPED = { id: 'GDS-V3', status: 'shipped' };
|
|
213
|
+
const HALL_GOAL = { id: 81, title: 'Builders hall in the world', scope_modules: ['hall-ui'], version_id: 'BONGOS-V1' };
|
|
214
|
+
const ECON_GOAL = { id: 78, title: 'Project money out', scope_modules: ['economy'], version_id: 'BONGOS-V1' };
|
|
215
|
+
|
|
216
|
+
await test('suggestGoalForCapture: the one building version, and the goal the words match', async () => {
|
|
217
|
+
const got = await suggestGoalForCapture(
|
|
218
|
+
{ title: 'the hall sidebar collapses on mobile', body: '' },
|
|
219
|
+
{ db: fakeDb({ versions: [BUILDING, SHIPPED], goals: [ECON_GOAL, HALL_GOAL] }) }
|
|
220
|
+
);
|
|
221
|
+
assert.equal(got.id, 81, 'the hall goal, not the economy one');
|
|
222
|
+
assert.equal(got.version_id, 'BONGOS-V1', 'and the version comes from the version row, never a hardcode');
|
|
223
|
+
assert.ok(got.score > 0);
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
await test('suggestGoalForCapture: a SHIPPED version is never the home (idea 1000771)', async () => {
|
|
227
|
+
const got = await suggestGoalForCapture(
|
|
228
|
+
{ title: 'the hall sidebar collapses', body: '' },
|
|
229
|
+
{ db: fakeDb({ versions: [SHIPPED], goals: [HALL_GOAL] }) }
|
|
230
|
+
);
|
|
231
|
+
assert.equal(got, null, 'nothing is open to work, so there is no home — the filing goes to the inbox');
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
// This instance runs BONGOS-V1 and CB-V1 concurrently. An earlier cut declined
|
|
235
|
+
// whenever more than one version was open, which would have returned null for
|
|
236
|
+
// every report ever filed — a dead feature that looked like prudence. The goal
|
|
237
|
+
// carries the version, so rank across all of them and let the winner say.
|
|
238
|
+
await test('suggestGoalForCapture: TWO open versions ⇒ rank across BOTH, winner names its version', async () => {
|
|
239
|
+
const CB_GOAL = { id: 99, title: 'The front door', scope_modules: ['public-landing'], version_id: 'CB-V1' };
|
|
240
|
+
const got = await suggestGoalForCapture(
|
|
241
|
+
{ title: 'the front door hero is broken', body: '' },
|
|
242
|
+
{ db: fakeDb({ versions: [BUILDING, { id: 'CB-V1', status: 'building' }], goals: [HALL_GOAL, CB_GOAL] }) }
|
|
243
|
+
);
|
|
244
|
+
assert.equal(got.id, 99, 'the goal on the OTHER open version can win');
|
|
245
|
+
assert.equal(got.version_id, 'CB-V1', 'and it reports its own version, not the first one open');
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
await test('suggestGoalForCapture: a goal on a CLOSED version is never a home, even if it matches best', async () => {
|
|
249
|
+
const DEAD_GOAL = { id: 12, title: 'the hall sidebar and hall chrome', scope_modules: ['hall-ui'], version_id: 'GDS-V3' };
|
|
250
|
+
const got = await suggestGoalForCapture(
|
|
251
|
+
{ title: 'the hall sidebar collapses', body: '' },
|
|
252
|
+
{ db: fakeDb({ versions: [BUILDING, SHIPPED], goals: [DEAD_GOAL, ECON_GOAL] }) }
|
|
253
|
+
);
|
|
254
|
+
assert.equal(got, null, 'the better-matching goal sits on a shipped version — idea 1000771 exactly');
|
|
255
|
+
});
|
|
256
|
+
|
|
257
|
+
await test('suggestGoalForCapture: asks for open goals across ALL versions, not one', async () => {
|
|
258
|
+
const calls = [];
|
|
259
|
+
await suggestGoalForCapture(
|
|
260
|
+
{ title: 'the hall sidebar collapses', body: '' },
|
|
261
|
+
{ db: fakeDb({ versions: [BUILDING], goals: [HALL_GOAL], calls }) }
|
|
262
|
+
);
|
|
263
|
+
assert.equal(calls.length, 1, 'one query, not one per version');
|
|
264
|
+
assert.equal(calls[0].status, 'open');
|
|
265
|
+
assert.equal(calls[0].versionId, undefined, 'unscoped — the open-version filter is applied in JS');
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
await test('suggestGoalForCapture: no confident match ⇒ null, not the first goal dressed up', async () => {
|
|
269
|
+
const got = await suggestGoalForCapture(
|
|
270
|
+
{ title: 'zzzz qqqq nothing matches this', body: '' },
|
|
271
|
+
{ db: fakeDb({ versions: [BUILDING], goals: [HALL_GOAL, ECON_GOAL] }) }
|
|
272
|
+
);
|
|
273
|
+
assert.equal(got, null);
|
|
274
|
+
});
|
|
275
|
+
|
|
276
|
+
await test('suggestGoalForCapture: empty draft ⇒ null without touching the db', async () => {
|
|
277
|
+
let touched = false;
|
|
278
|
+
const db = { listVersions: async () => { touched = true; return [BUILDING]; }, listGoals: async () => [] };
|
|
279
|
+
assert.equal(await suggestGoalForCapture({ title: ' ', body: '' }, { db }), null);
|
|
280
|
+
assert.equal(touched, false, 'nothing to rank against ⇒ no query');
|
|
281
|
+
});
|
|
282
|
+
|
|
283
|
+
await test('suggestGoalForCapture: a db failure SHRUGS — it never throws at a bug report', async () => {
|
|
284
|
+
for (const throws of ['versions', 'goals']) {
|
|
285
|
+
const got = await suggestGoalForCapture(
|
|
286
|
+
{ title: 'the hall sidebar collapses', body: '' },
|
|
287
|
+
{ db: fakeDb({ versions: [BUILDING], goals: [HALL_GOAL], throws }) }
|
|
288
|
+
);
|
|
289
|
+
assert.equal(got, null, `a ${throws} failure degrades to "no home", never to a lost report`);
|
|
290
|
+
}
|
|
291
|
+
});
|
|
292
|
+
|
|
293
|
+
await test('suggestGoalForCapture: the catch-all is never offered as a home', async () => {
|
|
294
|
+
const got = await suggestGoalForCapture(
|
|
295
|
+
{ title: 'general problem in BONGOS', body: '' },
|
|
296
|
+
{ db: fakeDb({ versions: [BUILDING], goals: [{ id: 3, title: 'BONGOS-V1 — general', scope_modules: [], version_id: 'BONGOS-V1' }] }) }
|
|
297
|
+
);
|
|
298
|
+
assert.equal(got, null, 'a bucket is not a workspace — dropped for EVERY open version, not just one');
|
|
299
|
+
});
|
|
300
|
+
|
|
195
301
|
summary();
|