@bongos/core 1.19.278 → 1.19.279
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 +20 -15
- package/modules/lifecycle/claim-feed.js +142 -0
- package/modules/lifecycle/db.js +52 -53
- package/modules/lifecycle/goal-authz.js +56 -1
- package/modules/lifecycle/routes/claims.js +6 -0
- package/package-lock.json +2 -2
- package/package.json +1 -1
- package/src/module-api.js +3 -1
- package/tests/goal_abuse_matrix.mjs +72 -0
- package/tests/reward_gate.mjs +4 -3
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.
|
|
6
|
-
"core_contract": "1.19.
|
|
7
|
-
"source_commit": "
|
|
5
|
+
"core_version": "1.19.279",
|
|
6
|
+
"core_contract": "1.19.279",
|
|
7
|
+
"source_commit": "20fdd2b00fa489173ea330aeec453d56dcb6999a",
|
|
8
8
|
"source_ref": "HEAD",
|
|
9
|
-
"built_at": "2026-08-
|
|
9
|
+
"built_at": "2026-08-21T20:04:41.616Z",
|
|
10
10
|
"redaction": {
|
|
11
11
|
"model": "docs-redacted+functional-verbatim",
|
|
12
12
|
"docs_redacted": 319,
|
|
13
13
|
"agent_docs_stubbed": 22,
|
|
14
|
-
"functional_verbatim":
|
|
14
|
+
"functional_verbatim": 1377,
|
|
15
15
|
"rules": 3,
|
|
16
16
|
"gate_literals": 3,
|
|
17
17
|
"gate": "passed"
|
|
18
18
|
},
|
|
19
|
-
"file_count":
|
|
20
|
-
"tree_sha256": "
|
|
19
|
+
"file_count": 1718,
|
|
20
|
+
"tree_sha256": "98ca3398579326bf1dc3356202895e6911341413dbf4e0238347e3357888565f",
|
|
21
21
|
"files": [
|
|
22
22
|
{
|
|
23
23
|
"path": ".claude/skills/blocker-review/SKILL.md",
|
|
@@ -3744,6 +3744,11 @@
|
|
|
3744
3744
|
"mode": "0000644",
|
|
3745
3745
|
"sha256": "0c52ae165d304f0f08ca04c9a288ef7d8ffb07288282dcd7b2d503fced7cd744"
|
|
3746
3746
|
},
|
|
3747
|
+
{
|
|
3748
|
+
"path": "modules/lifecycle/claim-feed.js",
|
|
3749
|
+
"mode": "0000644",
|
|
3750
|
+
"sha256": "3586cc2aa07913870ad99073c534e70ef2e2c5ff6a5ef2ddeb141cfd397269cd"
|
|
3751
|
+
},
|
|
3747
3752
|
{
|
|
3748
3753
|
"path": "modules/lifecycle/conflict-resolve.js",
|
|
3749
3754
|
"mode": "0000644",
|
|
@@ -3757,7 +3762,7 @@
|
|
|
3757
3762
|
{
|
|
3758
3763
|
"path": "modules/lifecycle/db.js",
|
|
3759
3764
|
"mode": "0000644",
|
|
3760
|
-
"sha256": "
|
|
3765
|
+
"sha256": "74eedb9ee1c423c9ecdea6f09d8555fa3200ac9e3a86a194182774cb72f0cd0b"
|
|
3761
3766
|
},
|
|
3762
3767
|
{
|
|
3763
3768
|
"path": "modules/lifecycle/done-when.js",
|
|
@@ -3782,7 +3787,7 @@
|
|
|
3782
3787
|
{
|
|
3783
3788
|
"path": "modules/lifecycle/goal-authz.js",
|
|
3784
3789
|
"mode": "0000644",
|
|
3785
|
-
"sha256": "
|
|
3790
|
+
"sha256": "3eb9d818e0e0d45a896a5c0a515842b5f5a01e102d02f8a9a605c271088c8e5d"
|
|
3786
3791
|
},
|
|
3787
3792
|
{
|
|
3788
3793
|
"path": "modules/lifecycle/goal-conflicts.js",
|
|
@@ -3837,7 +3842,7 @@
|
|
|
3837
3842
|
{
|
|
3838
3843
|
"path": "modules/lifecycle/routes/claims.js",
|
|
3839
3844
|
"mode": "0000644",
|
|
3840
|
-
"sha256": "
|
|
3845
|
+
"sha256": "e02abac52a82fb02603dd92074d4ebd060ec03195803d704b021614806ef00fe"
|
|
3841
3846
|
},
|
|
3842
3847
|
{
|
|
3843
3848
|
"path": "modules/lifecycle/routes/dependencies.js",
|
|
@@ -4492,12 +4497,12 @@
|
|
|
4492
4497
|
{
|
|
4493
4498
|
"path": "package-lock.json",
|
|
4494
4499
|
"mode": "0000644",
|
|
4495
|
-
"sha256": "
|
|
4500
|
+
"sha256": "66c790ddb5f66b9c7e5961f8402a508bdb36d5dddf35215401eda673a115c003"
|
|
4496
4501
|
},
|
|
4497
4502
|
{
|
|
4498
4503
|
"path": "package.json",
|
|
4499
4504
|
"mode": "0000644",
|
|
4500
|
-
"sha256": "
|
|
4505
|
+
"sha256": "ea43d45c4c7ef30f10935c5ec6e967e9a1c707a6f9a69ed7f5f6b2e5771fef8e"
|
|
4501
4506
|
},
|
|
4502
4507
|
{
|
|
4503
4508
|
"path": "public-docs/index.html",
|
|
@@ -6142,7 +6147,7 @@
|
|
|
6142
6147
|
{
|
|
6143
6148
|
"path": "src/module-api.js",
|
|
6144
6149
|
"mode": "0000644",
|
|
6145
|
-
"sha256": "
|
|
6150
|
+
"sha256": "e58b6609edc9a144ab403e149a715aebdc324b598244833d1ef3a6aa3713f88a"
|
|
6146
6151
|
},
|
|
6147
6152
|
{
|
|
6148
6153
|
"path": "src/module-loader/catalog.js",
|
|
@@ -7042,7 +7047,7 @@
|
|
|
7042
7047
|
{
|
|
7043
7048
|
"path": "tests/goal_abuse_matrix.mjs",
|
|
7044
7049
|
"mode": "0000644",
|
|
7045
|
-
"sha256": "
|
|
7050
|
+
"sha256": "daf3a5942ce3f154d29618e4242557758db50d8c70046562995fc2c10d5ee954"
|
|
7046
7051
|
},
|
|
7047
7052
|
{
|
|
7048
7053
|
"path": "tests/goal_achievement.mjs",
|
|
@@ -8062,7 +8067,7 @@
|
|
|
8062
8067
|
{
|
|
8063
8068
|
"path": "tests/reward_gate.mjs",
|
|
8064
8069
|
"mode": "0000644",
|
|
8065
|
-
"sha256": "
|
|
8070
|
+
"sha256": "a21d9f4d3ff937d59b9361b330a2e5e93ded9c9a12d73434eb843cae9d1a3c74"
|
|
8066
8071
|
},
|
|
8067
8072
|
{
|
|
8068
8073
|
"path": "tests/reward_mode_cost_plus_only.mjs",
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// modules/lifecycle/claim-feed.js — shaping + gating helpers for the claimable
|
|
4
|
+
// feed and the two claim paths, carved out of the oversized db.js (task 1003137;
|
|
5
|
+
// the fitness excess-lines ratchet is why these live here and not inline).
|
|
6
|
+
//
|
|
7
|
+
// Three residents, two halves of one rule plus a feed cap:
|
|
8
|
+
//
|
|
9
|
+
// - goalMembershipFailures — the CLAIM-time goal-membership gate (task
|
|
10
|
+
// 1003137, owner ruling 2026-08-19: a task that lives in a goal is
|
|
11
|
+
// claimable only by that goal's members — every goal, catch-alls included).
|
|
12
|
+
// EXTRACTED so BOTH `INSERT INTO claims` sites (db.claimTask and
|
|
13
|
+
// db.claimTasksBatch — the batch path duplicates claimTask's gates one by
|
|
14
|
+
// one, so an inline-only gate would be trivially bypassable via
|
|
15
|
+
// /claims/batch) run the identical check. The DECISION itself is the pure
|
|
16
|
+
// goal-authz.goalMembershipClaimRefusal; this wrapper only fetches the
|
|
17
|
+
// goal + membership facts on the caller's open txn client.
|
|
18
|
+
// - decorateGoalMembership — the FEED half of the same rule (owner chose
|
|
19
|
+
// filter-plus-show-as-joinable): a ready task whose goal the builder has
|
|
20
|
+
// not joined is never silently advertised as claimable — the exact trap
|
|
21
|
+
// task 1002650 closed for open blockers. The row stays in the feed but
|
|
22
|
+
// carries goal_membership { required, goal_id, visibility, action } so the
|
|
23
|
+
// caller renders it joinable. Reuses the SAME pure refusal fn, so feed and
|
|
24
|
+
// gate cannot disagree on join-vs-apply or on the leak rule (a private
|
|
25
|
+
// goal's title/scope never leave the server).
|
|
26
|
+
// - capNewcomerTasks — the newcomer-chore display cap (task 1266), moved
|
|
27
|
+
// verbatim from db.js.
|
|
28
|
+
//
|
|
29
|
+
// db.js re-exports all three, so callers and tests keep their import site.
|
|
30
|
+
|
|
31
|
+
// Pure kernel-adjacent matcher via the doorway (never the core file); the pure
|
|
32
|
+
// membership decision from the authority-model sibling.
|
|
33
|
+
const api = require('../../src/module-api');
|
|
34
|
+
const { scopeIncludesProtected } = api.moduleScopeMap;
|
|
35
|
+
const { goalMembershipClaimRefusal } = require('./goal-authz.js');
|
|
36
|
+
|
|
37
|
+
// The claim-txn half. `tasks` rows need { id, goal_id }; goal_id NULL rows are
|
|
38
|
+
// skipped (nullable by migration 160 — a NULL goal has no membership to check;
|
|
39
|
+
// a dangling goal_id can't occur, tasks.goal_id is FK'd). An Archon passes as
|
|
40
|
+
// the implicit member (the isMemberOrArchon convention). Runs on the caller's
|
|
41
|
+
// open txn `client` so the read shares the claim transaction's snapshot.
|
|
42
|
+
// Returns [{ task_id, refusal }] — empty when every task is claimable.
|
|
43
|
+
async function goalMembershipFailures({ client, tasks, builderId, builderRank }) {
|
|
44
|
+
const gated = tasks.filter((t) => t.goal_id != null);
|
|
45
|
+
if (gated.length === 0 || builderRank === 'archon') return [];
|
|
46
|
+
const goalIds = Array.from(new Set(gated.map((t) => Number(t.goal_id))));
|
|
47
|
+
const { rows: goalRows } = await client.query(
|
|
48
|
+
`SELECT g.id, g.title, g.visibility, g.scope_modules,
|
|
49
|
+
EXISTS (SELECT 1 FROM goal_members gm
|
|
50
|
+
WHERE gm.goal_id = g.id AND gm.builder_id = $2) AS is_member
|
|
51
|
+
FROM goals g
|
|
52
|
+
WHERE g.id = ANY($1::bigint[])`,
|
|
53
|
+
[goalIds, builderId]
|
|
54
|
+
);
|
|
55
|
+
const byId = new Map(goalRows.map((r) => [Number(r.id), r]));
|
|
56
|
+
const failures = [];
|
|
57
|
+
for (const t of gated) {
|
|
58
|
+
const goal = byId.get(Number(t.goal_id)) ?? null;
|
|
59
|
+
const refusal = goalMembershipClaimRefusal({
|
|
60
|
+
goal,
|
|
61
|
+
isMember: goal ? goal.is_member === true : false,
|
|
62
|
+
actorRank: builderRank,
|
|
63
|
+
scopeProtected: goal ? scopeIncludesProtected(goal.scope_modules) : false,
|
|
64
|
+
});
|
|
65
|
+
if (refusal) failures.push({ task_id: Number(t.id), refusal });
|
|
66
|
+
}
|
|
67
|
+
return failures;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// The feed half. Consumes (and strips) the g_* scratch columns db.js's
|
|
71
|
+
// LEFT JOIN rides along; member / Archon / goal-less rows pass through shaped
|
|
72
|
+
// exactly as before task 1003137. The SQL folds "Archon" into g_is_member, so
|
|
73
|
+
// actorRank is passed null here — membership is the only remaining question.
|
|
74
|
+
function decorateGoalMembership(row) {
|
|
75
|
+
const { g_visibility, g_scope_modules, g_title, g_is_member, ...task } = row;
|
|
76
|
+
if (task.goal_id == null || g_visibility == null) return task; // no goal → not gated
|
|
77
|
+
const refusal = goalMembershipClaimRefusal({
|
|
78
|
+
goal: { id: task.goal_id, title: g_title, visibility: g_visibility },
|
|
79
|
+
isMember: g_is_member === true,
|
|
80
|
+
actorRank: null,
|
|
81
|
+
scopeProtected: scopeIncludesProtected(g_scope_modules),
|
|
82
|
+
});
|
|
83
|
+
if (!refusal) return task; // member/Archon → as today
|
|
84
|
+
return {
|
|
85
|
+
...task,
|
|
86
|
+
goal_membership: {
|
|
87
|
+
required: true,
|
|
88
|
+
goal_id: refusal.goal_id,
|
|
89
|
+
visibility: refusal.visibility,
|
|
90
|
+
action: refusal.action,
|
|
91
|
+
...('goal_title' in refusal ? { goal_title: refusal.goal_title } : {}),
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// Cap the number of newcomer_friendly rows in a claimable feed to `cap`
|
|
97
|
+
// (task 1266). Pure + exported for unit testing. Non-newcomer (real version)
|
|
98
|
+
// rows pass through untouched and unbounded. When newcomer rows exceed the cap
|
|
99
|
+
// they're selected round-robin across the disciplines PRESENT among them — so
|
|
100
|
+
// each of the builder's lanes is represented before a slot goes to a duplicate
|
|
101
|
+
// of an already-shown discipline. Input ordering (priority, est, created) is
|
|
102
|
+
// preserved: we compute a keep-set of ids and then filter the original array.
|
|
103
|
+
function capNewcomerTasks(rows, cap = 3) {
|
|
104
|
+
const all = Array.isArray(rows) ? rows : [];
|
|
105
|
+
const newcomer = all.filter((t) => t && t.newcomer_friendly === true);
|
|
106
|
+
if (newcomer.length <= cap) return all;
|
|
107
|
+
|
|
108
|
+
// Group newcomer rows by discipline, preserving (a) input order within each
|
|
109
|
+
// group and (b) first-appearance order of the groups themselves — so the
|
|
110
|
+
// highest-priority discipline's chore is picked first.
|
|
111
|
+
const groups = new Map(); // discipline -> [rows], insertion-ordered
|
|
112
|
+
for (const t of newcomer) {
|
|
113
|
+
const disc = t.discipline || 'unclassified';
|
|
114
|
+
if (!groups.has(disc)) groups.set(disc, []);
|
|
115
|
+
groups.get(disc).push(t);
|
|
116
|
+
}
|
|
117
|
+
const lists = Array.from(groups.values());
|
|
118
|
+
|
|
119
|
+
// Round-robin: take index 0 from each group, then index 1, etc., until we've
|
|
120
|
+
// kept `cap` rows. Duplicate disciplines fill later passes once each lane has
|
|
121
|
+
// been represented.
|
|
122
|
+
const keep = new Set();
|
|
123
|
+
let depth = 0;
|
|
124
|
+
let progressed = true;
|
|
125
|
+
while (keep.size < cap && progressed) {
|
|
126
|
+
progressed = false;
|
|
127
|
+
for (const list of lists) {
|
|
128
|
+
if (depth < list.length) {
|
|
129
|
+
keep.add(list[depth].id);
|
|
130
|
+
progressed = true;
|
|
131
|
+
if (keep.size >= cap) break;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
depth += 1;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// Filter the original (ordered) array: every non-newcomer row, plus the kept
|
|
138
|
+
// newcomer rows. Preserves the original feed ordering.
|
|
139
|
+
return all.filter((t) => t.newcomer_friendly !== true || keep.has(t.id));
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
module.exports = { goalMembershipFailures, decorateGoalMembership, capNewcomerTasks };
|
package/modules/lifecycle/db.js
CHANGED
|
@@ -46,6 +46,9 @@ const { claimEligibilityAllows, CLAIM_ANY, CLAIM_NEWCOMER } = require('./claim-e
|
|
|
46
46
|
// Pure kernel-adjacent matchers via the doorway (never the core file).
|
|
47
47
|
const { matchProtected } = api.permissionPathCheck;
|
|
48
48
|
const { touchesOverlap } = api.pathMatch;
|
|
49
|
+
// Claimable-feed shaping + the goal-membership claim gate (task 1003137; the
|
|
50
|
+
// newcomer cap of task 1266 moved there too) — see claim-feed.js.
|
|
51
|
+
const { goalMembershipFailures, decorateGoalMembership, capNewcomerTasks } = require('./claim-feed.js');
|
|
49
52
|
|
|
50
53
|
|
|
51
54
|
// ---------------------------------------------------------------------------
|
|
@@ -1923,6 +1926,8 @@ const SESSION_FIT_SQL = `
|
|
|
1923
1926
|
async function listClaimableTasks({ versionId = null, builderId = null, discipline = null, fit = null } = {}) {
|
|
1924
1927
|
const params = [];
|
|
1925
1928
|
const where = [];
|
|
1929
|
+
let goalJoin = '';
|
|
1930
|
+
let selectCols = 'v.*';
|
|
1926
1931
|
if (versionId) {
|
|
1927
1932
|
params.push(versionId);
|
|
1928
1933
|
where.push(`v.version_id = $${params.length}`);
|
|
@@ -1971,6 +1976,16 @@ async function listClaimableTasks({ versionId = null, builderId = null, discipli
|
|
|
1971
1976
|
WHEN 'archon' THEN 4 WHEN 'metic' THEN 3 WHEN 'thetes' THEN 2 WHEN 'xenos' THEN 1 ELSE 0
|
|
1972
1977
|
END
|
|
1973
1978
|
)`);
|
|
1979
|
+
// task 1003137: ride the goal + own-membership facts along so
|
|
1980
|
+
// decorateGoalMembership (claim-feed.js) can flag non-member rows joinable.
|
|
1981
|
+
// Same parameter index — all three reads are the same builderId. The
|
|
1982
|
+
// goal_members PK (goal_id, builder_id) means the LEFT JOIN never
|
|
1983
|
+
// multiplies rows; an Archon reads as member (isMemberOrArchon convention).
|
|
1984
|
+
goalJoin = ` LEFT JOIN goals g ON g.id = v.goal_id
|
|
1985
|
+
LEFT JOIN goal_members gm ON gm.goal_id = g.id AND gm.builder_id = $${params.length}`;
|
|
1986
|
+
selectCols = `v.*, g.visibility AS g_visibility, g.scope_modules AS g_scope_modules, g.title AS g_title,
|
|
1987
|
+
(gm.builder_id IS NOT NULL
|
|
1988
|
+
OR (SELECT rank FROM builders WHERE id = $${params.length}) = 'archon') AS g_is_member`;
|
|
1974
1989
|
}
|
|
1975
1990
|
// Autonomy / parallel-eligibility filter. Joining the session-fit relation
|
|
1976
1991
|
// (also a SELECT t.* shape) makes bare column names like priority/created_at
|
|
@@ -1988,12 +2003,14 @@ async function listClaimableTasks({ versionId = null, builderId = null, discipli
|
|
|
1988
2003
|
// recent actuals; ordering on the raw estimate puts oversized tasks at the
|
|
1989
2004
|
// bottom even when their actual time-to-ship is short. See migration 015.
|
|
1990
2005
|
const sql =
|
|
1991
|
-
`SELECT
|
|
2006
|
+
`SELECT ${selectCols} FROM (${CLAIMABLE_SQL}) v` + goalJoin + fitJoin +
|
|
1992
2007
|
(where.length ? ` WHERE ${where.join(' AND ')}` : '') +
|
|
1993
2008
|
` ORDER BY v.priority NULLS LAST,
|
|
1994
2009
|
COALESCE(v.est_minutes_calibrated, v.est_minutes) NULLS LAST,
|
|
1995
2010
|
v.created_at`;
|
|
1996
|
-
const { rows } = await pool.query(sql, params);
|
|
2011
|
+
const { rows: rawRows } = await pool.query(sql, params);
|
|
2012
|
+
// task 1003137: strip g_* scratch columns, flag non-member rows joinable.
|
|
2013
|
+
const rows = rawRows.map(decorateGoalMembership);
|
|
1997
2014
|
// SR-12 / G2 (task 994): when the autonomous/parallel runner is asking, drop
|
|
1998
2015
|
// any task whose declared touches[] reach the permission/methodology/deploy
|
|
1999
2016
|
// core. The runner ships as Archon straight to main, so these must never be
|
|
@@ -2002,7 +2019,12 @@ async function listClaimableTasks({ versionId = null, builderId = null, discipli
|
|
|
2002
2019
|
// with the grader pre-pass, pre-push hook, and main-audit — no second source
|
|
2003
2020
|
// of truth to drift.
|
|
2004
2021
|
if (fit === 'autonomous' || fit === 'parallel') {
|
|
2005
|
-
|
|
2022
|
+
// task 1003137: membership-required rows are DROPPED, not flagged — the
|
|
2023
|
+
// claim gate will refuse them and an autonomous runner can't answer a join
|
|
2024
|
+
// prompt. (No builderId → no membership facts; the claim gate stays the
|
|
2025
|
+
// hard control.)
|
|
2026
|
+
return rows.filter((t) => !taskTouchesProtectedPath(t)
|
|
2027
|
+
&& !(t.goal_membership && t.goal_membership.required === true));
|
|
2006
2028
|
}
|
|
2007
2029
|
// Newcomer-chore display cap (task 1266, owner decision 2026-06-19). The
|
|
2008
2030
|
// newcomer-floor keeps a deep supply pool (floor: 3 artist + 2 ideator) so
|
|
@@ -2017,53 +2039,6 @@ async function listClaimableTasks({ versionId = null, builderId = null, discipli
|
|
|
2017
2039
|
return capNewcomerTasks(rows);
|
|
2018
2040
|
}
|
|
2019
2041
|
|
|
2020
|
-
// Cap the number of newcomer_friendly rows in a claimable feed to `cap`
|
|
2021
|
-
// (task 1266). Pure + exported for unit testing. Non-newcomer (real version)
|
|
2022
|
-
// rows pass through untouched and unbounded. When newcomer rows exceed the cap
|
|
2023
|
-
// they're selected round-robin across the disciplines PRESENT among them — so
|
|
2024
|
-
// each of the builder's lanes is represented before a slot goes to a duplicate
|
|
2025
|
-
// of an already-shown discipline. Input ordering (priority, est, created) is
|
|
2026
|
-
// preserved: we compute a keep-set of ids and then filter the original array.
|
|
2027
|
-
|
|
2028
|
-
function capNewcomerTasks(rows, cap = 3) {
|
|
2029
|
-
const all = Array.isArray(rows) ? rows : [];
|
|
2030
|
-
const newcomer = all.filter((t) => t && t.newcomer_friendly === true);
|
|
2031
|
-
if (newcomer.length <= cap) return all;
|
|
2032
|
-
|
|
2033
|
-
// Group newcomer rows by discipline, preserving (a) input order within each
|
|
2034
|
-
// group and (b) first-appearance order of the groups themselves — so the
|
|
2035
|
-
// highest-priority discipline's chore is picked first.
|
|
2036
|
-
const groups = new Map(); // discipline -> [rows], insertion-ordered
|
|
2037
|
-
for (const t of newcomer) {
|
|
2038
|
-
const disc = t.discipline || 'unclassified';
|
|
2039
|
-
if (!groups.has(disc)) groups.set(disc, []);
|
|
2040
|
-
groups.get(disc).push(t);
|
|
2041
|
-
}
|
|
2042
|
-
const lists = Array.from(groups.values());
|
|
2043
|
-
|
|
2044
|
-
// Round-robin: take index 0 from each group, then index 1, etc., until we've
|
|
2045
|
-
// kept `cap` rows. Duplicate disciplines fill later passes once each lane has
|
|
2046
|
-
// been represented.
|
|
2047
|
-
const keep = new Set();
|
|
2048
|
-
let depth = 0;
|
|
2049
|
-
let progressed = true;
|
|
2050
|
-
while (keep.size < cap && progressed) {
|
|
2051
|
-
progressed = false;
|
|
2052
|
-
for (const list of lists) {
|
|
2053
|
-
if (depth < list.length) {
|
|
2054
|
-
keep.add(list[depth].id);
|
|
2055
|
-
progressed = true;
|
|
2056
|
-
if (keep.size >= cap) break;
|
|
2057
|
-
}
|
|
2058
|
-
}
|
|
2059
|
-
depth += 1;
|
|
2060
|
-
}
|
|
2061
|
-
|
|
2062
|
-
// Filter the original (ordered) array: every non-newcomer row, plus the kept
|
|
2063
|
-
// newcomer rows. Preserves the original feed ordering.
|
|
2064
|
-
return all.filter((t) => t.newcomer_friendly !== true || keep.has(t.id));
|
|
2065
|
-
}
|
|
2066
|
-
|
|
2067
2042
|
// SR-12 / G2 (task 994): does this task's declared touches[] overlap any
|
|
2068
2043
|
// permission-sensitive (ADR 0043) path? Pure + exported for unit testing.
|
|
2069
2044
|
// Returns true if ANY declared touch matches a protected glob — such a task is
|
|
@@ -2659,7 +2634,7 @@ async function claimTask({ taskId, builderId, worktreeName, headSha, creatorSess
|
|
|
2659
2634
|
}
|
|
2660
2635
|
|
|
2661
2636
|
const { rows: taskRows } = await client.query(
|
|
2662
|
-
`SELECT id, status, touches, newcomer_friendly, requires_rank, needs_migration, module_key, credits_reward, reward_gate_exempt, est_minutes, kind FROM tasks WHERE id = $1 FOR UPDATE`,
|
|
2637
|
+
`SELECT id, status, touches, newcomer_friendly, requires_rank, needs_migration, module_key, credits_reward, reward_gate_exempt, est_minutes, kind, goal_id FROM tasks WHERE id = $1 FOR UPDATE`,
|
|
2663
2638
|
[taskId]
|
|
2664
2639
|
);
|
|
2665
2640
|
if (taskRows.length === 0) {
|
|
@@ -2730,6 +2705,15 @@ async function claimTask({ taskId, builderId, worktreeName, headSha, creatorSess
|
|
|
2730
2705
|
};
|
|
2731
2706
|
}
|
|
2732
2707
|
|
|
2708
|
+
// task 1003137 (owner ruling 2026-08-19): a task's goal requires MEMBERSHIP —
|
|
2709
|
+
// every goal, catch-alls included; goal_id NULL is NOT gated. After the rank
|
|
2710
|
+
// gates (membership only narrows — it must never mask a rank refusal),
|
|
2711
|
+
// before deps. Decision + leak rule: goal-authz.goalMembershipClaimRefusal;
|
|
2712
|
+
// the SAME extracted check runs in claimTasksBatch (the only other INSERT
|
|
2713
|
+
// INTO claims site) — see claim-feed.js.
|
|
2714
|
+
const goalRefusals = await goalMembershipFailures({ client, tasks: [task], builderId, builderRank });
|
|
2715
|
+
if (goalRefusals.length > 0) throw goalRefusals[0].refusal;
|
|
2716
|
+
|
|
2733
2717
|
// The claim gate (ADR 0015, generalized in task 1516 / ADR 0086 §5): a task
|
|
2734
2718
|
// can't be claimed while any dependency is un-done — its OWN edges plus those
|
|
2735
2719
|
// inherited from its goal/criteria, where "done" = task shipped | criterion
|
|
@@ -2986,7 +2970,7 @@ async function claimTasksBatch({ taskIds, builderId, worktreePrefix, creatorSess
|
|
|
2986
2970
|
|
|
2987
2971
|
// Lock every requested task row up front (sorted to avoid deadlocks).
|
|
2988
2972
|
const { rows: taskRows } = await client.query(
|
|
2989
|
-
`SELECT id, status, touches, newcomer_friendly, requires_rank, needs_migration, module_key FROM tasks WHERE id = ANY($1::bigint[]) ORDER BY id FOR UPDATE`,
|
|
2973
|
+
`SELECT id, status, touches, newcomer_friendly, requires_rank, needs_migration, module_key, goal_id FROM tasks WHERE id = ANY($1::bigint[]) ORDER BY id FOR UPDATE`,
|
|
2990
2974
|
[uniqIds]
|
|
2991
2975
|
);
|
|
2992
2976
|
|
|
@@ -3069,6 +3053,14 @@ async function claimTasksBatch({ taskIds, builderId, worktreePrefix, creatorSess
|
|
|
3069
3053
|
}
|
|
3070
3054
|
}
|
|
3071
3055
|
|
|
3056
|
+
// task 1003137: the SAME extracted goal-membership gate as claimTask — this
|
|
3057
|
+
// path owns the repo's only other INSERT INTO claims, so an inline-only gate
|
|
3058
|
+
// would be bypassable via batch. Same ladder position: after rank, before deps.
|
|
3059
|
+
for (const f of await goalMembershipFailures({ client, tasks: taskRows, builderId, builderRank })) {
|
|
3060
|
+
const { code, ...rest } = f.refusal;
|
|
3061
|
+
failures.push({ task_id: f.task_id, reason: code, ...rest });
|
|
3062
|
+
}
|
|
3063
|
+
|
|
3072
3064
|
// Per-task dependency check (ADR 0015, generalized task 1516). An EXTERNAL dep
|
|
3073
3065
|
// (not in this batch) must already be done; a batch-internal dep isn't done yet
|
|
3074
3066
|
// at claim time but doesn't block — the batch is worked serially. "Internal"
|
|
@@ -3351,7 +3343,7 @@ async function validateClaimBatch({ taskIds, builderId }) {
|
|
|
3351
3343
|
const builderRank = builderRows[0] ? builderRows[0].rank : null;
|
|
3352
3344
|
|
|
3353
3345
|
const { rows: taskRows } = await pool.query(
|
|
3354
|
-
`SELECT id, status, touches, newcomer_friendly, requires_rank, module_key
|
|
3346
|
+
`SELECT id, status, touches, newcomer_friendly, requires_rank, module_key, goal_id
|
|
3355
3347
|
FROM tasks WHERE id = ANY($1::bigint[])`,
|
|
3356
3348
|
[uniqIds]
|
|
3357
3349
|
);
|
|
@@ -3393,6 +3385,12 @@ async function validateClaimBatch({ taskIds, builderId }) {
|
|
|
3393
3385
|
}
|
|
3394
3386
|
}
|
|
3395
3387
|
|
|
3388
|
+
// task 1003137: goal-membership, kept in sync with claimTasksBatch (see claim-feed.js).
|
|
3389
|
+
for (const f of await goalMembershipFailures({ client: pool, tasks: taskRows, builderId, builderRank })) {
|
|
3390
|
+
const { code, ...rest } = f.refusal;
|
|
3391
|
+
push(f.task_id, { reason: code, ...rest });
|
|
3392
|
+
}
|
|
3393
|
+
|
|
3396
3394
|
// Dependencies — external to the batch only (a batch-internal dep is fine;
|
|
3397
3395
|
// the batch is worked serially, same rule as claimTasksBatch).
|
|
3398
3396
|
const batchIdSet = new Set(uniqIds);
|
|
@@ -5688,6 +5686,7 @@ module.exports = {
|
|
|
5688
5686
|
listClaimableTasks,
|
|
5689
5687
|
capNewcomerTasks,
|
|
5690
5688
|
taskTouchesProtectedPath, // SR-12 / G2 (task 994): autonomous-fit protected-path exclusion (pure, testable)
|
|
5689
|
+
decorateGoalMembership, // task 1003137: feed-side joinable flag (pure, testable)
|
|
5691
5690
|
rankCrossDisciplineRecommendations,
|
|
5692
5691
|
listActiveClaims,
|
|
5693
5692
|
updateTaskStatus,
|
|
@@ -62,4 +62,59 @@ function authorizeGoalManagement({ goal, actorId, actorRank, actorMembership })
|
|
|
62
62
|
return { ok: true };
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
// goalMembershipClaimRefusal — the CLAIM-time membership gate (task 1003137).
|
|
66
|
+
// Owner ruling 2026-08-19: a task that lives in a goal is claimable only by that
|
|
67
|
+
// goal's members — EVERY goal, the '<version> — general' catch-alls included.
|
|
68
|
+
// Safe precisely because the refusal is actionable in-session: joining a public
|
|
69
|
+
// goal costs one 'yes' (POST /goals/:id/join), a private/protected one an
|
|
70
|
+
// application (POST /goals/:id/requests).
|
|
71
|
+
//
|
|
72
|
+
// Returns null when the claim may proceed, else the refusal payload the claim
|
|
73
|
+
// paths throw (code GOAL_MEMBERSHIP_REQUIRED, HTTP 403 at the route). PURE —
|
|
74
|
+
// both INSERT INTO claims sites (claimTask + claimTasksBatch, db.js) feed it
|
|
75
|
+
// through db.goalMembershipFailures so the batch path cannot drift from the
|
|
76
|
+
// single-claim path.
|
|
77
|
+
//
|
|
78
|
+
// The decision, in order (fail-closed on the membership question itself):
|
|
79
|
+
// - no goal → not gated. tasks.goal_id is NULLABLE (migration 160) and every
|
|
80
|
+
// version created after it gets no catch-all, so goal_id IS NULL is COMMON —
|
|
81
|
+
// a NULL goal has no membership to check. (A dangling goal_id can't occur:
|
|
82
|
+
// tasks.goal_id is FK'd to goals(id).)
|
|
83
|
+
// - Archon → pass. An Archon is an implicit member everywhere in the goal
|
|
84
|
+
// surface (isMemberOrArchon, POST /goals/:id/join, isGoalOwnerOrManager);
|
|
85
|
+
// the claim gate follows that single convention rather than minting a
|
|
86
|
+
// second membership model. Membership only NARROWS what the rank gates
|
|
87
|
+
// (which run before this in claimTask's ladder) already allow — it never
|
|
88
|
+
// widens what a Xenos reaches.
|
|
89
|
+
// - member → pass.
|
|
90
|
+
// - else refuse, naming the action: 'join' for a public unprotected goal,
|
|
91
|
+
// 'apply' for a private one OR a protected-scope one (self-join on
|
|
92
|
+
// protected scope is Archon-mediated — routes/goals.js POST /:id/join).
|
|
93
|
+
//
|
|
94
|
+
// LEAK RULE (the goal_abuse_matrix ordering discipline, gotcha d): a PRIVATE
|
|
95
|
+
// goal's refusal carries goal_id, visibility and the action ONLY — never the
|
|
96
|
+
// title, never scope. A public goal's title is public; it rides along so the
|
|
97
|
+
// CLI can name what to join.
|
|
98
|
+
function goalMembershipClaimRefusal({ goal, isMember, actorRank, scopeProtected }) {
|
|
99
|
+
if (!goal) return null; // goal_id NULL — no membership to check, NOT gated
|
|
100
|
+
if (actorRank === 'archon') return null;
|
|
101
|
+
if (isMember) return null;
|
|
102
|
+
const isPrivate = goal.visibility === 'private';
|
|
103
|
+
const action = (isPrivate || scopeProtected === true) ? 'apply' : 'join';
|
|
104
|
+
const goalId = Number(goal.id);
|
|
105
|
+
return {
|
|
106
|
+
code: 'GOAL_MEMBERSHIP_REQUIRED',
|
|
107
|
+
goal_id: goalId,
|
|
108
|
+
visibility: goal.visibility,
|
|
109
|
+
action,
|
|
110
|
+
...(isPrivate ? {} : { goal_title: goal.title }),
|
|
111
|
+
what_to_do: action === 'join'
|
|
112
|
+
? `Join the goal (POST /api/bongos/goals/${goalId}/join), then retry the claim.`
|
|
113
|
+
: `Apply to join (POST /api/bongos/goals/${goalId}/requests); nothing can be claimed until an owner approves.`,
|
|
114
|
+
message: isPrivate
|
|
115
|
+
? `This task lives in goal ${goalId}, which is private — you are not a member.`
|
|
116
|
+
: `This task lives in goal ${goalId} ("${goal.title}") — you are not a member.`,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
module.exports = { isGoalOwner, isGoalOwnerOrManager, authorizeGoalManagement, goalMembershipClaimRefusal };
|
|
@@ -301,6 +301,12 @@ module.exports = function buildClaimsRouter() {
|
|
|
301
301
|
// builder's. Same 403 semantics as the Xenos gate; the body carries
|
|
302
302
|
// { required, actual } so the CLI can render a clean message.
|
|
303
303
|
err.code === 'INSUFFICIENT_RANK' ? 403 :
|
|
304
|
+
// task 1003137: the task's goal requires membership. The body carries
|
|
305
|
+
// goal_id, visibility, and the action (join|apply) + what_to_do —
|
|
306
|
+
// enough for the CLI to offer the join inline (task 1003138). A
|
|
307
|
+
// private goal's body deliberately omits its title/scope (leak rule
|
|
308
|
+
// in goal-authz.goalMembershipClaimRefusal).
|
|
309
|
+
err.code === 'GOAL_MEMBERSHIP_REQUIRED' ? 403 :
|
|
304
310
|
500;
|
|
305
311
|
// V4.R14 (#952): a TASK_NOT_READY 409 names the way forward instead of
|
|
306
312
|
// leaving the caller to discover the promote route by spelunking (#506).
|
package/package-lock.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bongos/core",
|
|
3
|
-
"version": "1.19.
|
|
3
|
+
"version": "1.19.279",
|
|
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.279",
|
|
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.279",
|
|
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
|
@@ -983,8 +983,10 @@ const { validateOrRespond, LIMITS, parseId, asyncHandler, corsPublicGet, parsePa
|
|
|
983
983
|
// landed since 1.19.276 with no explicit bump. run 32503053532. (task 1002620)
|
|
984
984
|
// 1.19.278 — CI auto-patch (publish-on-merge, ADR 0161): carrier for merges
|
|
985
985
|
// landed since 1.19.277 with no explicit bump. run 32508270995. (task 1002620)
|
|
986
|
+
// 1.19.279 — CI auto-patch (publish-on-merge, ADR 0161): carrier for merges
|
|
987
|
+
// landed since 1.19.278 with no explicit bump. run 32521664476. (task 1002620)
|
|
986
988
|
// ---------------------------------------------------------------------------
|
|
987
|
-
const CORE_VERSION = '1.19.
|
|
989
|
+
const CORE_VERSION = '1.19.279'; // CI auto-patch carrier (ADR 0161); see changelog above
|
|
988
990
|
|
|
989
991
|
// A namespaced logger so a module's log lines are attributable + consistent.
|
|
990
992
|
// Usage: const log = api.logger('dev-box'); log.info('mounted');
|
|
@@ -29,6 +29,10 @@
|
|
|
29
29
|
// O1 ordering: non-member + out-of-scope → not_a_member (no scope hint leaks)
|
|
30
30
|
// O2 ordering: a closed goal short-circuits first → goal_not_open
|
|
31
31
|
// P Metic+ on an in-scope protected path → ALLOW (rank clears the floor)
|
|
32
|
+
// Q* CLAIM a task in a goal you never joined (task 1003137)→ 403 GOAL_MEMBERSHIP_REQUIRED
|
|
33
|
+
// (join for public, apply for private/protected; a private goal's refusal
|
|
34
|
+
// leaks no title and no scope; goal_id NULL is not gated; both INSERT
|
|
35
|
+
// INTO claims sites run the same extracted gate)
|
|
32
36
|
//
|
|
33
37
|
// Ordering is fail-closed (a missing/ambiguous input denies), and membership is
|
|
34
38
|
// checked BEFORE scope so a non-member never learns the scope (O1 vs B). Per-branch
|
|
@@ -155,6 +159,74 @@ await test('[K] a protected-scope goal is recognized as protected; a normal goal
|
|
|
155
159
|
assert.equal(scopeIncludesProtected(G_IDEAS.scope_modules), false, 'ideas is a normal, open-join module');
|
|
156
160
|
});
|
|
157
161
|
|
|
162
|
+
// ---- [Q] the CLAIM-time membership wall (task 1003137) ----
|
|
163
|
+
// A task that lives in a goal is claimable only by that goal's members — every
|
|
164
|
+
// goal, the '<version> — general' catch-alls included (owner ruling 2026-08-19).
|
|
165
|
+
// The decision is the pure goalMembershipClaimRefusal (goal-authz.js); db.js
|
|
166
|
+
// feeds BOTH claim paths through the one extracted db.goalMembershipFailures.
|
|
167
|
+
const { goalMembershipClaimRefusal } = require('../modules/lifecycle/goal-authz.js');
|
|
168
|
+
const G_PUBLIC = { id: 21, title: 'Public builder profiles', visibility: 'public' };
|
|
169
|
+
const G_PRIVATE = { id: 22, title: 'SECRET-TITLE-MUST-NOT-LEAK', visibility: 'private', scope_modules: ['lifecycle'] };
|
|
170
|
+
|
|
171
|
+
await test('[Q1] goal_id NULL is NOT gated — a NULL goal has no membership to check (migration 160 nullable)', () => {
|
|
172
|
+
assert.equal(goalMembershipClaimRefusal({ goal: null, isMember: false, actorRank: 'xenos', scopeProtected: false }), null);
|
|
173
|
+
});
|
|
174
|
+
await test('[Q2] a member claims freely', () => {
|
|
175
|
+
assert.equal(goalMembershipClaimRefusal({ goal: G_PUBLIC, isMember: true, actorRank: 'xenos', scopeProtected: false }), null);
|
|
176
|
+
});
|
|
177
|
+
await test('[Q3] an Archon is an implicit member (the isMemberOrArchon convention)', () => {
|
|
178
|
+
assert.equal(goalMembershipClaimRefusal({ goal: G_PRIVATE, isMember: false, actorRank: 'archon', scopeProtected: true }), null);
|
|
179
|
+
});
|
|
180
|
+
await test('[Q4] non-member on a public unprotected goal → GOAL_MEMBERSHIP_REQUIRED, action=join, title rides along', () => {
|
|
181
|
+
const r = goalMembershipClaimRefusal({ goal: G_PUBLIC, isMember: false, actorRank: 'metic', scopeProtected: false });
|
|
182
|
+
assert.equal(r.code, 'GOAL_MEMBERSHIP_REQUIRED');
|
|
183
|
+
assert.equal(r.action, 'join');
|
|
184
|
+
assert.equal(r.goal_id, 21);
|
|
185
|
+
assert.equal(r.visibility, 'public');
|
|
186
|
+
assert.equal(r.goal_title, 'Public builder profiles');
|
|
187
|
+
assert.ok(/join/i.test(r.what_to_do), 'the way forward names the join route');
|
|
188
|
+
});
|
|
189
|
+
await test('[Q5] non-member on a PRIVATE goal → action=apply, and the refusal leaks NO title and NO scope', () => {
|
|
190
|
+
const r = goalMembershipClaimRefusal({ goal: G_PRIVATE, isMember: false, actorRank: 'metic', scopeProtected: true });
|
|
191
|
+
assert.equal(r.code, 'GOAL_MEMBERSHIP_REQUIRED');
|
|
192
|
+
assert.equal(r.action, 'apply');
|
|
193
|
+
assert.equal(r.visibility, 'private');
|
|
194
|
+
assert.ok(!('goal_title' in r), 'a private goal\'s title must not leak to a non-member');
|
|
195
|
+
const flat = JSON.stringify(r);
|
|
196
|
+
assert.ok(!flat.includes('SECRET-TITLE-MUST-NOT-LEAK'), 'no field may carry the private title');
|
|
197
|
+
assert.ok(!flat.includes('scope_modules') && !flat.includes('lifecycle'), 'no field may carry the private scope');
|
|
198
|
+
});
|
|
199
|
+
await test('[Q6] non-member on a public PROTECTED-scope goal → action=apply (self-join is Archon-mediated)', () => {
|
|
200
|
+
const r = goalMembershipClaimRefusal({ goal: G_PUBLIC, isMember: false, actorRank: 'metic', scopeProtected: true });
|
|
201
|
+
assert.equal(r.action, 'apply', 'a protected-scope goal is never offered as open-join');
|
|
202
|
+
});
|
|
203
|
+
await test('[Q7] source contract: BOTH INSERT INTO claims sites run the extracted gate (batch cannot bypass)', () => {
|
|
204
|
+
const dbSrc = readFileSync(new URL('../modules/lifecycle/db.js', import.meta.url), 'utf8');
|
|
205
|
+
const insertSites = dbSrc.match(/INSERT INTO claims \(/g) || [];
|
|
206
|
+
assert.equal(insertSites.length, 2, 'exactly two claim-insert sites (claimTask + claimTasksBatch) — a third needs the gate too');
|
|
207
|
+
const gateCalls = dbSrc.match(/await goalMembershipFailures\(/g) || [];
|
|
208
|
+
assert.equal(gateCalls.length, 3, 'the membership gate must run on both claim paths + validateClaimBatch (the dry-run twin that must stay in sync)');
|
|
209
|
+
});
|
|
210
|
+
await test('[Q8] feed contract: a non-member row is flagged joinable, never silently claimable (leak rule holds)', () => {
|
|
211
|
+
const { decorateGoalMembership } = require('../modules/lifecycle/db.js');
|
|
212
|
+
// member / goal-less rows pass through shaped as today
|
|
213
|
+
assert.deepEqual(decorateGoalMembership({ id: 1, goal_id: null }), { id: 1, goal_id: null });
|
|
214
|
+
assert.deepEqual(
|
|
215
|
+
decorateGoalMembership({ id: 2, goal_id: 21, g_visibility: 'public', g_scope_modules: ['ideas'], g_title: 'T', g_is_member: true }),
|
|
216
|
+
{ id: 2, goal_id: 21 }
|
|
217
|
+
);
|
|
218
|
+
// non-member public → flagged join, title carried, scope stripped
|
|
219
|
+
const pub = decorateGoalMembership({ id: 3, goal_id: 21, g_visibility: 'public', g_scope_modules: ['ideas'], g_title: 'T', g_is_member: false });
|
|
220
|
+
assert.deepEqual(pub.goal_membership, { required: true, goal_id: 21, visibility: 'public', action: 'join', goal_title: 'T' });
|
|
221
|
+
assert.ok(!('g_scope_modules' in pub) && !('g_title' in pub), 'scratch columns must not leave the feed');
|
|
222
|
+
// non-member private → flagged apply, NO title
|
|
223
|
+
const priv = decorateGoalMembership({ id: 4, goal_id: 22, g_visibility: 'private', g_scope_modules: ['ideas'], g_title: 'SECRET', g_is_member: false });
|
|
224
|
+
assert.deepEqual(priv.goal_membership, { required: true, goal_id: 22, visibility: 'private', action: 'apply' });
|
|
225
|
+
// non-member public but protected-scope → apply (matches the join route's Archon-mediation)
|
|
226
|
+
const prot = decorateGoalMembership({ id: 5, goal_id: 23, g_visibility: 'public', g_scope_modules: ['lifecycle'], g_title: 'L', g_is_member: false });
|
|
227
|
+
assert.equal(prot.goal_membership.action, 'apply');
|
|
228
|
+
});
|
|
229
|
+
|
|
158
230
|
// ---- the pins that make a rank drift on a goal route a red build (BV1.R61) ----
|
|
159
231
|
// The wall is only drift-proof if the goal routes are PINNED and the LIVE routes
|
|
160
232
|
// classify to those pins. The catch-violation (a downgrade → blocker) is proven in
|
package/tests/reward_gate.mjs
CHANGED
|
@@ -163,9 +163,10 @@ t('claim path AUTO-ASSIGNS inside the FOR UPDATE transaction (never refuses)', (
|
|
|
163
163
|
// pre-flight half of claimTask (which spans ~13k chars). Widened 5000 -> 6000 in
|
|
164
164
|
// BV1.R106, when the permission-expressed claim gate pushed the reward-gate block
|
|
165
165
|
// past the old edge; 6000 -> 7000 in task 1002613, when the enriched
|
|
166
|
-
// rank_too_low_for_task denial did the same
|
|
167
|
-
//
|
|
168
|
-
|
|
166
|
+
// rank_too_low_for_task denial did the same; 7000 -> 8500 in task 1003137, when
|
|
167
|
+
// the goal-membership gate landed between the rank gates and deps. Keep it
|
|
168
|
+
// comfortably below the claimTasksBatch boundary (~16.5k chars in).
|
|
169
|
+
const body = dbSrc.slice(start, start + 8500);
|
|
169
170
|
assert.match(body, /rewardGateAssignment\(task\)/, 'claimTask must consult the auto-assign decision');
|
|
170
171
|
assert.match(body, /UPDATE tasks SET credits_reward/, 'claimTask must persist the assigned reward in-tx');
|
|
171
172
|
// it must SELECT the columns the gate needs.
|