@bongos/core 1.19.214 → 1.19.215
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 +11 -11
- package/docs/api/openapi.json +1 -1
- package/modules/lifecycle/routes/goals.js +52 -9
- package/package-lock.json +2 -2
- package/package.json +1 -1
- package/src/module-api.js +3 -1
- package/tests/goal_membership_requests.mjs +52 -0
package/.bongos-core.json
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
"artifact": "bongos-core",
|
|
3
3
|
"manifest_schema": 1,
|
|
4
4
|
"generator": "scripts/gds/package-core.js",
|
|
5
|
-
"core_version": "1.19.
|
|
6
|
-
"core_contract": "1.19.
|
|
7
|
-
"source_commit": "
|
|
5
|
+
"core_version": "1.19.215",
|
|
6
|
+
"core_contract": "1.19.215",
|
|
7
|
+
"source_commit": "697713806bfbd222ba0423c021aee84f56218f10",
|
|
8
8
|
"source_ref": "HEAD",
|
|
9
|
-
"built_at": "2026-08-
|
|
9
|
+
"built_at": "2026-08-18T00:22:11.691Z",
|
|
10
10
|
"redaction": {
|
|
11
11
|
"model": "docs-redacted+functional-verbatim",
|
|
12
12
|
"docs_redacted": 310,
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"gate": "passed"
|
|
18
18
|
},
|
|
19
19
|
"file_count": 1633,
|
|
20
|
-
"tree_sha256": "
|
|
20
|
+
"tree_sha256": "61d4b6bf40452f45053fe94cf02b44d682b2aed0e9684b0799a0d33eda1f675d",
|
|
21
21
|
"files": [
|
|
22
22
|
{
|
|
23
23
|
"path": ".claude/skills/blocker-review/SKILL.md",
|
|
@@ -1372,7 +1372,7 @@
|
|
|
1372
1372
|
{
|
|
1373
1373
|
"path": "docs/api/openapi.json",
|
|
1374
1374
|
"mode": "0000644",
|
|
1375
|
-
"sha256": "
|
|
1375
|
+
"sha256": "675d873f35c886145c80d954b885692ef0608b4e5b1b843943611f59260eceed"
|
|
1376
1376
|
},
|
|
1377
1377
|
{
|
|
1378
1378
|
"path": "docs/architecture.md",
|
|
@@ -3652,7 +3652,7 @@
|
|
|
3652
3652
|
{
|
|
3653
3653
|
"path": "modules/lifecycle/routes/goals.js",
|
|
3654
3654
|
"mode": "0000644",
|
|
3655
|
-
"sha256": "
|
|
3655
|
+
"sha256": "8763c40223e27e9d6fc65ea76442e479301407ba70e77b9582c5ffcd09f17a11"
|
|
3656
3656
|
},
|
|
3657
3657
|
{
|
|
3658
3658
|
"path": "modules/lifecycle/routes/lifecycle.js",
|
|
@@ -4282,12 +4282,12 @@
|
|
|
4282
4282
|
{
|
|
4283
4283
|
"path": "package-lock.json",
|
|
4284
4284
|
"mode": "0000644",
|
|
4285
|
-
"sha256": "
|
|
4285
|
+
"sha256": "5a687e1b2df8e52068aaa27dfa92dd50ed65164905c74f9fe121750d023e95d9"
|
|
4286
4286
|
},
|
|
4287
4287
|
{
|
|
4288
4288
|
"path": "package.json",
|
|
4289
4289
|
"mode": "0000644",
|
|
4290
|
-
"sha256": "
|
|
4290
|
+
"sha256": "6b2203d8fa449d80e6ff225fd5f8dbe4969b4a72ca94ff61e478635fb754d445"
|
|
4291
4291
|
},
|
|
4292
4292
|
{
|
|
4293
4293
|
"path": "public-docs/index.html",
|
|
@@ -5902,7 +5902,7 @@
|
|
|
5902
5902
|
{
|
|
5903
5903
|
"path": "src/module-api.js",
|
|
5904
5904
|
"mode": "0000644",
|
|
5905
|
-
"sha256": "
|
|
5905
|
+
"sha256": "e2884e30e53fd3fe3c121df94ce9738bde706f3ddb414c023e6fd546ec1777ab"
|
|
5906
5906
|
},
|
|
5907
5907
|
{
|
|
5908
5908
|
"path": "src/module-loader/catalog.js",
|
|
@@ -6797,7 +6797,7 @@
|
|
|
6797
6797
|
{
|
|
6798
6798
|
"path": "tests/goal_membership_requests.mjs",
|
|
6799
6799
|
"mode": "0000644",
|
|
6800
|
-
"sha256": "
|
|
6800
|
+
"sha256": "59253dac0064ae1a9c7dd67ef87c1d32ff924d3c3dadf7cdb9553dbc76f88eb0"
|
|
6801
6801
|
},
|
|
6802
6802
|
{
|
|
6803
6803
|
"path": "tests/goal_routes.mjs",
|
package/docs/api/openapi.json
CHANGED
|
@@ -4276,7 +4276,7 @@
|
|
|
4276
4276
|
"goals"
|
|
4277
4277
|
],
|
|
4278
4278
|
"summary": "POST /goals/:id/invitations/:reqId/respond",
|
|
4279
|
-
"description": "POST /goals/:id/invitations/:reqId/respond { action: accept|decline } — ONLY the invited builder resolves their OWN pending invite (task 1952). accept → they're added as a member
|
|
4279
|
+
"description": "POST /goals/:id/invitations/:reqId/respond { action: accept|decline } — ONLY the invited builder resolves their OWN pending invite (task 1952). accept → they're added as a member (only while the goal is still OPEN, and a protected-scope goal still requires a Metic+ member — both re-checked against the CURRENT goal row by authorizeInvitationAccept, task 1002887); decline → the row is rejected, allowed whatever the goal's state, since that is inbox cleanup rather than admission. rank: any-builder (requireBuilder) + the in-handler authorizeInvitationResponse.\n\n**Rank:** `any-builder` — Any authenticated builder (row-level ownership enforced in-handler).",
|
|
4280
4280
|
"x-rank": "any-builder",
|
|
4281
4281
|
"x-source": "modules/lifecycle/routes/goals.js",
|
|
4282
4282
|
"parameters": [
|
|
@@ -324,6 +324,44 @@ function authorizeInvitationResponse({ request, goalId, actorId }) {
|
|
|
324
324
|
return { ok: true };
|
|
325
325
|
}
|
|
326
326
|
|
|
327
|
+
// authorizeInvitationAccept — the ORDERED, FAIL-CLOSED gate for the ACCEPT half of
|
|
328
|
+
// POST /goals/:id/invitations/:reqId/respond, run against the GOAL after
|
|
329
|
+
// authorizeInvitationResponse has cleared the request row (task 1002887).
|
|
330
|
+
//
|
|
331
|
+
// Accepting is an ADMISSION, so it needs the same goal-state floor every other
|
|
332
|
+
// admission path already has: the create side requires an open goal
|
|
333
|
+
// (authorizeGoalManagement) and the join-request approve side inherits that check
|
|
334
|
+
// verbatim — only invitation-accept was missing it, so an invite issued while a
|
|
335
|
+
// goal was open could still add a member AFTER the goal was achieved or archived.
|
|
336
|
+
// DECLINE is deliberately NOT gated here: clearing a stale invitation out of your
|
|
337
|
+
// inbox is cleanup, not admission (the route returns before calling this).
|
|
338
|
+
// Ordering mirrors the sibling routes: goal_not_found → goal_not_open →
|
|
339
|
+
// metic_required_for_protected_scope (the pre-existing protected-scope membership
|
|
340
|
+
// floor, re-asserted against the ACCEPTING builder's current rank because the goal
|
|
341
|
+
// may have been re-scoped since the invite; the actor-is-Archon half of
|
|
342
|
+
// protectedScopeAdmissionBlock does not apply — the invitee is consenting).
|
|
343
|
+
//
|
|
344
|
+
// Unlike its {status, body} siblings this returns a res.fail SPEC ({ code, status,
|
|
345
|
+
// message, details }) because the accept branch already answers through res.fail —
|
|
346
|
+
// routing it through the envelope keeps the existing metic_required_for_protected_scope
|
|
347
|
+
// response byte-identical while still being PURE + exported for DB-free tests.
|
|
348
|
+
function authorizeInvitationAccept({ goal, scopeProtected, actorRank }) {
|
|
349
|
+
if (!goal) {
|
|
350
|
+
return { ok: false, code: 'goal_not_found', status: 404,
|
|
351
|
+
message: 'The goal behind this invitation no longer exists.' };
|
|
352
|
+
}
|
|
353
|
+
if (goal.status !== 'open') {
|
|
354
|
+
return { ok: false, code: 'goal_not_open', status: 409,
|
|
355
|
+
message: 'This goal is no longer open — an invitation can only be accepted while it is. You can still decline it.',
|
|
356
|
+
details: { status: goal.status } };
|
|
357
|
+
}
|
|
358
|
+
if (scopeProtected && !METIC_PLUS.includes(actorRank)) {
|
|
359
|
+
return { ok: false, code: 'metic_required_for_protected_scope', status: 403,
|
|
360
|
+
message: 'This goal is scoped to a protected module and requires a Metic+ member.' };
|
|
361
|
+
}
|
|
362
|
+
return { ok: true };
|
|
363
|
+
}
|
|
364
|
+
|
|
327
365
|
// authorizeJoinRequestResponse — the gate for POST /goals/:id/requests/:reqId/respond
|
|
328
366
|
// (task 1952): an owner|manager|Archon approves/denies a pending join-request. The
|
|
329
367
|
// authority prefix is authorizeGoalManagement VERBATIM (goal exists/open + owner|
|
|
@@ -789,9 +827,10 @@ module.exports = function buildGoalsRouter() {
|
|
|
789
827
|
|
|
790
828
|
// POST /goals/:id/invitations/:reqId/respond { action: accept|decline } — ONLY the
|
|
791
829
|
// invited builder resolves their OWN pending invite (task 1952). accept → they're
|
|
792
|
-
// added as a member
|
|
793
|
-
// requires a Metic+ member
|
|
794
|
-
//
|
|
830
|
+
// added as a member (only while the goal is still OPEN, and a protected-scope goal
|
|
831
|
+
// still requires a Metic+ member — both re-checked against the CURRENT goal row by
|
|
832
|
+
// authorizeInvitationAccept, task 1002887); decline → the row is rejected, allowed
|
|
833
|
+
// whatever the goal's state, since that is inbox cleanup rather than admission.
|
|
795
834
|
// rank: any-builder (requireBuilder) + the in-handler authorizeInvitationResponse.
|
|
796
835
|
router.post('/goals/:id/invitations/:reqId/respond', auth.requireBuilder, async (req, res) => {
|
|
797
836
|
const id = parseId(req, res, { code: 'bad_goal_id' });
|
|
@@ -814,13 +853,14 @@ module.exports = function buildGoalsRouter() {
|
|
|
814
853
|
return res.json({ ok: true, action, request: resolved });
|
|
815
854
|
}
|
|
816
855
|
|
|
817
|
-
// accept —
|
|
818
|
-
//
|
|
819
|
-
// the invite). The invitee is consenting, so the actor-is-Archon half of the
|
|
820
|
-
// admission rule does NOT apply here — only the Metic+ membership floor does.
|
|
856
|
+
// accept — the goal-state + protected-scope floor, read against the goal's
|
|
857
|
+
// CURRENT row (fail-closed if it is gone). See authorizeInvitationAccept.
|
|
821
858
|
const goal = await db.getGoal(id);
|
|
822
|
-
|
|
823
|
-
|
|
859
|
+
const admit = authorizeInvitationAccept({
|
|
860
|
+
goal, scopeProtected: !!goal && scopeIncludesProtected(goal.scope_modules), actorRank: req.builder.rank,
|
|
861
|
+
});
|
|
862
|
+
if (!admit.ok) {
|
|
863
|
+
return res.fail(admit.code, { status: admit.status, message: admit.message, details: admit.details });
|
|
824
864
|
}
|
|
825
865
|
// Resolve + add atomically (one statement) — never an 'accepted' invite
|
|
826
866
|
// with no membership (the task-1952 review fix).
|
|
@@ -1505,6 +1545,9 @@ module.exports.RESOLVE_ACTIONS = RESOLVE_ACTIONS;
|
|
|
1505
1545
|
module.exports.protectedScopeAdmissionBlock = protectedScopeAdmissionBlock;
|
|
1506
1546
|
module.exports.authorizeCreateJoinRequest = authorizeCreateJoinRequest;
|
|
1507
1547
|
module.exports.authorizeInvitationResponse = authorizeInvitationResponse;
|
|
1548
|
+
// task 1002887: the goal-state floor on the ACCEPT half of the invitation-respond
|
|
1549
|
+
// route — exported for tests/goal_membership_requests.mjs, same precedent.
|
|
1550
|
+
module.exports.authorizeInvitationAccept = authorizeInvitationAccept;
|
|
1508
1551
|
module.exports.authorizeJoinRequestResponse = authorizeJoinRequestResponse;
|
|
1509
1552
|
// task 1953: the withdraw gate — exported for tests/goal_membership_requests.mjs,
|
|
1510
1553
|
// same precedent as its siblings above.
|
package/package-lock.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bongos/core",
|
|
3
|
-
"version": "1.19.
|
|
3
|
+
"version": "1.19.215",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@bongos/core",
|
|
9
|
-
"version": "1.19.
|
|
9
|
+
"version": "1.19.215",
|
|
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.
|
|
3
|
+
"version": "1.19.215",
|
|
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",
|
package/src/module-api.js
CHANGED
|
@@ -855,8 +855,10 @@ const { validateOrRespond, LIMITS, parseId, asyncHandler, corsPublicGet, parsePa
|
|
|
855
855
|
// landed since 1.19.212 with no explicit bump. run 32081051255. (task 1002620)
|
|
856
856
|
// 1.19.214 — CI auto-patch (publish-on-merge, ADR 0161): carrier for merges
|
|
857
857
|
// landed since 1.19.213 with no explicit bump. run 32081917908. (task 1002620)
|
|
858
|
+
// 1.19.215 — CI auto-patch (publish-on-merge, ADR 0161): carrier for merges
|
|
859
|
+
// landed since 1.19.214 with no explicit bump. run 32084187695. (task 1002620)
|
|
858
860
|
// ---------------------------------------------------------------------------
|
|
859
|
-
const CORE_VERSION = '1.19.
|
|
861
|
+
const CORE_VERSION = '1.19.215'; // CI auto-patch carrier (ADR 0161); see changelog above
|
|
860
862
|
|
|
861
863
|
// A namespaced logger so a module's log lines are attributable + consistent.
|
|
862
864
|
// Usage: const log = api.logger('dev-box'); log.info('mounted');
|
|
@@ -15,6 +15,9 @@
|
|
|
15
15
|
// • listPendingRequestsForGoal — pending both-kinds for one goal.
|
|
16
16
|
// • addGoalMember (task 1002888) — arriving as a member by ANY route cancels
|
|
17
17
|
// that builder's still-pending ask, atomically and kind-agnostically.
|
|
18
|
+
// • authorizeInvitationAccept (task 1002887) — accepting an invite re-checks the
|
|
19
|
+
// goal is still OPEN (a stale invite can't admit to an achieved/archived goal);
|
|
20
|
+
// declining stays allowed, so the route declines before ever reading the goal.
|
|
18
21
|
// • the migration is additive + private-safe (default 'public', partial unique).
|
|
19
22
|
|
|
20
23
|
import { strict as assert } from 'node:assert';
|
|
@@ -42,6 +45,7 @@ const {
|
|
|
42
45
|
protectedScopeAdmissionBlock,
|
|
43
46
|
authorizeCreateJoinRequest,
|
|
44
47
|
authorizeInvitationResponse,
|
|
48
|
+
authorizeInvitationAccept,
|
|
45
49
|
authorizeJoinRequestResponse,
|
|
46
50
|
authorizeWithdrawJoinRequest,
|
|
47
51
|
decorateGoalScope,
|
|
@@ -370,6 +374,54 @@ await test('authorizeInvitationResponse: the invitee (string vs number id) → A
|
|
|
370
374
|
assert.deepEqual(authorizeInvitationResponse({ request: INVITE, goalId: '5', actorId: 2 }), { ok: true });
|
|
371
375
|
});
|
|
372
376
|
|
|
377
|
+
// authorizeInvitationAccept (task 1002887) — the goal-state floor on ACCEPT only.
|
|
378
|
+
const OPEN_GOAL = { id: 5, status: 'open', scope_modules: null };
|
|
379
|
+
await test('authorizeInvitationAccept: open, unprotected goal → ALLOW', () => {
|
|
380
|
+
assert.deepEqual(authorizeInvitationAccept({ goal: OPEN_GOAL, scopeProtected: false, actorRank: 'thetes' }), { ok: true });
|
|
381
|
+
});
|
|
382
|
+
await test('authorizeInvitationAccept: the goal is gone → 404 (fail-closed, never a member of nothing)', () => {
|
|
383
|
+
const d = authorizeInvitationAccept({ goal: null, scopeProtected: false, actorRank: 'archon' });
|
|
384
|
+
assert.equal(d.ok, false); assert.equal(d.status, 404); assert.equal(d.code, 'goal_not_found');
|
|
385
|
+
});
|
|
386
|
+
for (const status of ['achieved', 'archived']) {
|
|
387
|
+
await test(`authorizeInvitationAccept: ${status} goal → 409 goal_not_open (a stale invite can't admit)`, () => {
|
|
388
|
+
const d = authorizeInvitationAccept({ goal: { ...OPEN_GOAL, status }, scopeProtected: false, actorRank: 'archon' });
|
|
389
|
+
assert.equal(d.ok, false); assert.equal(d.status, 409); assert.equal(d.code, 'goal_not_open');
|
|
390
|
+
assert.deepEqual(d.details, { status }, 'carries the blocking status, like every sibling goal_not_open');
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
await test('authorizeInvitationAccept: goal-state is checked BEFORE scope (ordering, like the join route)', () => {
|
|
394
|
+
const d = authorizeInvitationAccept({ goal: { ...OPEN_GOAL, status: 'archived' }, scopeProtected: true, actorRank: 'thetes' });
|
|
395
|
+
assert.equal(d.code, 'goal_not_open', 'a closed goal refuses on state, not on the scope floor');
|
|
396
|
+
});
|
|
397
|
+
await test('authorizeInvitationAccept: open + protected + sub-Metic invitee → 403 metic_required (unchanged)', () => {
|
|
398
|
+
const d = authorizeInvitationAccept({ goal: OPEN_GOAL, scopeProtected: true, actorRank: 'thetes' });
|
|
399
|
+
assert.equal(d.status, 403); assert.equal(d.code, 'metic_required_for_protected_scope');
|
|
400
|
+
assert.equal(d.message, 'This goal is scoped to a protected module and requires a Metic+ member.');
|
|
401
|
+
assert.equal(d.details, undefined, 'no details — the res.fail envelope stays byte-identical to the pre-1002887 response');
|
|
402
|
+
});
|
|
403
|
+
await test('authorizeInvitationAccept: open + protected + Metic invitee → ALLOW (consent, no Archon actor needed)', () => {
|
|
404
|
+
assert.deepEqual(authorizeInvitationAccept({ goal: OPEN_GOAL, scopeProtected: true, actorRank: 'metic' }), { ok: true });
|
|
405
|
+
});
|
|
406
|
+
|
|
407
|
+
// DECLINE stays allowed on a closed goal — clearing a stale invitation out of your
|
|
408
|
+
// inbox is cleanup, not admission. The route's decline branch must therefore return
|
|
409
|
+
// BEFORE the goal is ever fetched; pinned at the source level (the addGoalMember
|
|
410
|
+
// resolvedBy precedent above), since the live route is exercised in goal_routes.mjs.
|
|
411
|
+
await test('routes: invitation-respond declines before the goal-state gate', () => {
|
|
412
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
413
|
+
const src = readFileSync(join(here, '..', 'modules', 'lifecycle', 'routes', 'goals.js'), 'utf8');
|
|
414
|
+
const handler = src.slice(src.indexOf("router.post('/goals/:id/invitations/:reqId/respond'"));
|
|
415
|
+
const body = handler.slice(0, handler.indexOf('\n });'));
|
|
416
|
+
const declineAt = body.indexOf("if (action === 'decline')");
|
|
417
|
+
const gateAt = body.indexOf('authorizeInvitationAccept({');
|
|
418
|
+
assert.ok(declineAt > 0 && gateAt > 0, 'both branches present in the respond handler');
|
|
419
|
+
assert.ok(declineAt < gateAt, 'decline resolves and returns before the accept-only goal gate');
|
|
420
|
+
assert.ok(body.indexOf('db.getGoal(') > declineAt, 'decline never even reads the goal');
|
|
421
|
+
assert.ok(gateAt < body.indexOf('db.acceptMembershipRequestAndAddMember('),
|
|
422
|
+
'the gate runs before the membership add');
|
|
423
|
+
});
|
|
424
|
+
|
|
373
425
|
// authorizeJoinRequestResponse — owner|manager|Archon resolves a join-request.
|
|
374
426
|
const OWNER_GOAL = { id: 5, status: 'open', created_by: '1', visibility: 'private' };
|
|
375
427
|
const REQUEST = { id: 8, goal_id: '5', builder_id: '2', kind: 'request', status: 'pending' };
|