@bongos/core 1.19.1035 → 1.19.1036
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 +72 -57
- package/clients/bongos-client/index.d.ts +1 -1
- package/docs/adr/0339-a-projects-owner-upgrades-it-and-a-hosted-project-hands-off-to-the-hub-door.md +84 -0
- package/docs/adr/README.md +1 -0
- package/docs/api/openapi.json +7 -5
- package/docs/copy-inventory.md +10 -10
- package/docs/copy-registry.json +13 -13
- package/docs/module-api-changelog.md +2 -0
- package/modules/hall-ui/public/atlas.html +1 -1
- package/modules/hall-ui/public/blockers.html +1 -1
- package/modules/hall-ui/public/board-room.html +1 -1
- package/modules/hall-ui/public/collab.html +1 -1
- package/modules/hall-ui/public/copy-desk.html +1 -1
- package/modules/hall-ui/public/deploy.html +1 -1
- package/modules/hall-ui/public/diagrams.html +1 -1
- package/modules/hall-ui/public/drachmae.html +1 -1
- package/modules/hall-ui/public/fleet.html +1 -1
- package/modules/hall-ui/public/gate.html +1 -1
- package/modules/hall-ui/public/goals.html +1 -1
- package/modules/hall-ui/public/government.html +1 -1
- package/modules/hall-ui/public/idea.html +1 -1
- package/modules/hall-ui/public/ideas.html +1 -1
- package/modules/hall-ui/public/index.html +1 -1
- package/modules/hall-ui/public/modules.html +1 -1
- package/modules/hall-ui/public/people.html +1 -1
- package/modules/hall-ui/public/primer.html +1 -1
- package/modules/hall-ui/public/profile.html +1 -1
- package/modules/hall-ui/public/project-settings.html +1 -1
- package/modules/hall-ui/public/ranks.html +1 -1
- package/modules/hall-ui/public/roadmap.html +1 -1
- package/modules/hall-ui/public/roster.html +1 -1
- package/modules/hall-ui/public/sessions.html +1 -1
- package/modules/hall-ui/public/settings.html +1 -1
- package/modules/hall-ui/public/shell.js +36 -5
- package/modules/hall-ui/public/studio.html +1 -1
- package/modules/hall-ui/public/task.html +1 -1
- package/modules/hall-ui/public/watch.html +1 -1
- package/modules/hall-ui/public/work.html +1 -1
- package/modules/provisioning/core-upgrade-authz.js +85 -0
- package/modules/provisioning/core-upgrade.js +2 -1
- package/modules/provisioning/provisioning.js +4 -4
- package/modules/provisioning/routes/core-upgrade.js +12 -6
- package/package-lock.json +2 -2
- package/package.json +1 -1
- package/release-notes.json +10 -0
- package/scripts/gds/provision-core-upgrade.js +12 -4
- package/src/bongos/auth.js +8 -2
- package/src/bongos/routes/core-update.js +25 -3
- package/src/module-api.js +1 -1
- package/tests/core_upgrade_owner_door.mjs +444 -0
- package/tests/nav_permission_atoms.mjs +1 -1
- package/tests/provisioning_teardown_intent.mjs +28 -2
- package/tests/scouting_page_gate.mjs +11 -3
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// modules/provisioning/core-upgrade-authz.js — who may move ONE hosted project's core
|
|
4
|
+
// pin: its owner, or a holder of `core.pin.move` (task 1004174, ADR 0339).
|
|
5
|
+
//
|
|
6
|
+
// THE OWNER'S RULING, 2026-09-26: only a project's owner upgrades it — "owners and
|
|
7
|
+
// archons are the same" for the platform operator, because the operator owns the
|
|
8
|
+
// platform. Until this file the deploy door was `core.pin.move` alone: archon-floor
|
|
9
|
+
// and system:true, so the owner of a hosted project below Archon could see that they
|
|
10
|
+
// were behind and could never act on it. The door stays on the control plane (ADR
|
|
11
|
+
// 0293 D1): a hosted project hands its owner off to this hub's /deploy?project=<slug>
|
|
12
|
+
// and gains no capability of its own.
|
|
13
|
+
//
|
|
14
|
+
// THE SHAPE IS THE ONE THE MODULE ALREADY USES FOR "OWNER OR OPERATOR" (ADR 0328
|
|
15
|
+
// Decision 2, and platform-identity's requireScoutingReader, ADR 0210). Ownership is
|
|
16
|
+
// asked FIRST; on any "no" — not the owner, no such row, an unreadable id, a database
|
|
17
|
+
// blip — the request falls through to the UNMODIFIED permission gate. So a caller who
|
|
18
|
+
// is neither gets byte-for-byte the refusal the door has always given, whether or not
|
|
19
|
+
// the id exists, and the widening can only ever admit. The atom is still spelled in
|
|
20
|
+
// the route's middleware list, where route-rank-check.js and gen-api-docs.js read it.
|
|
21
|
+
//
|
|
22
|
+
// THE PLATFORM'S OWN ROW IS NOT A PROJECT AN OWNER MAY MOVE HERE. Moving the control
|
|
23
|
+
// plane changes the code every hosted project is driven by, so it stays on the atom:
|
|
24
|
+
// OWNER_SHAPES admits the two tenant shapes and nothing else, and a shape added later
|
|
25
|
+
// is excluded by omission.
|
|
26
|
+
|
|
27
|
+
// The tenant shapes the runner can actually reach (UPGRADE_SHAPES minus the platform).
|
|
28
|
+
const OWNER_SHAPES = Object.freeze(new Set(['co-tenant', 'cloud-host']));
|
|
29
|
+
|
|
30
|
+
// An id as the route names it: a positive integer and nothing else. Anything else is
|
|
31
|
+
// not looked up at all — it falls to the permission gate, and the handler's own
|
|
32
|
+
// parseId gives the 400 an admitted caller would get.
|
|
33
|
+
const ID_RE = /^[1-9][0-9]{0,15}$/;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Does this builder own this instance in a way that lets them move its core? PURE.
|
|
37
|
+
* Fail-closed on every missing piece: no row, no builder, no recorded owner, or a
|
|
38
|
+
* shape that is not a tenant.
|
|
39
|
+
*/
|
|
40
|
+
function ownsUpgradableProject(inst, builder) {
|
|
41
|
+
return !!inst && !!builder && builder.id != null
|
|
42
|
+
&& OWNER_SHAPES.has(inst.hosting_shape)
|
|
43
|
+
&& inst.owner_builder_id != null
|
|
44
|
+
&& String(inst.owner_builder_id) === String(builder.id);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* The OR gate, as one middleware mounted after requireBuilder. `pinGate` is the
|
|
49
|
+
* ALREADY-BUILT `requirePermission('core.pin.move')` middleware.
|
|
50
|
+
*
|
|
51
|
+
* It records WHICH door admitted the caller on `req.coreUpgradeAuthority`, because
|
|
52
|
+
* the intent's actor has to say so truthfully (coreUpgradeActor below).
|
|
53
|
+
*/
|
|
54
|
+
function requireOwnProjectOrPin({ pinGate, provisioning, pool, log }) {
|
|
55
|
+
return async function ownProjectOrPinGate(req, res, next) {
|
|
56
|
+
const raw = req.params ? req.params.id : undefined;
|
|
57
|
+
if (typeof raw === 'string' && ID_RE.test(raw)) {
|
|
58
|
+
try {
|
|
59
|
+
const inst = await provisioning.getInstanceById(pool, Number(raw));
|
|
60
|
+
if (ownsUpgradableProject(inst, req.builder)) {
|
|
61
|
+
req.coreUpgradeAuthority = 'owner';
|
|
62
|
+
return next();
|
|
63
|
+
}
|
|
64
|
+
} catch (err) {
|
|
65
|
+
// Message only: a query error can carry row data. The permission gate below
|
|
66
|
+
// then decides, so a blip here can deny an owner but never admit anyone.
|
|
67
|
+
if (log && log.error) log.error(`core-upgrade owner check failed, falling back to core.pin.move: ${err && err.message}`);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
req.coreUpgradeAuthority = 'pin';
|
|
71
|
+
return pinGate(req, res, next);
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* The actor recorded on the intent and the event. Both forms carry the builder id,
|
|
77
|
+
* because the runner hands it to the core_upgrades ledger as `--requested-by` and
|
|
78
|
+
* ADR 0293 D5 refuses an unattributed row for a move an HTTP request started.
|
|
79
|
+
*/
|
|
80
|
+
function coreUpgradeActor(req) {
|
|
81
|
+
const door = req.coreUpgradeAuthority === 'owner' ? 'owner' : 'archon';
|
|
82
|
+
return `api:${door}:${req.builder.id}`;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
module.exports = { OWNER_SHAPES, ownsUpgradableProject, requireOwnProjectOrPin, coreUpgradeActor };
|
|
@@ -177,7 +177,8 @@ function makeCoreUpgradeHandler({ provisioning, pool, parseId, validateOrRespond
|
|
|
177
177
|
// The actor rides the intent, and the runner carries it through to the
|
|
178
178
|
// core_upgrades ledger (ADR 0293 D5): a privileged action with an
|
|
179
179
|
// unattributed row is not acceptable here.
|
|
180
|
-
|
|
180
|
+
// `api:owner:<id>` when the project's owner pressed it (task 1004174), else `api:archon:<id>`.
|
|
181
|
+
const actor = require('./core-upgrade-authz').coreUpgradeActor(req);
|
|
181
182
|
// `dry_run: true` asks what the move WOULD do and moves nothing (task 1004121).
|
|
182
183
|
// Queued the same way as the move, through the same single-open-intent slot, so a
|
|
183
184
|
// preview cannot be requested on top of a move that is already running — and, just
|
|
@@ -1158,9 +1158,9 @@ async function enqueueIntent(db, instanceId, action, requestedBy, targetVersion
|
|
|
1158
1158
|
// delete hostage would repeat 1002691. A pending 'restart' or 'repo-private' (task 1004193) joins them for the same
|
|
1159
1159
|
// reason (task 1003238) — and more sharply, since the owner reaches for Restart
|
|
1160
1160
|
// precisely when a project looks broken, which is also when they give up and delete
|
|
1161
|
-
// it. A RUNNING intent is mid-flight and never yanked —
|
|
1162
|
-
//
|
|
1163
|
-
//
|
|
1161
|
+
// it. A RUNNING intent is mid-flight and never yanked — the caller gets { conflict: 'open_intent' } with the blocking intent so the route
|
|
1162
|
+
// can answer truthfully. The control-plane row is never superseded, in the same statement (task 1004286): enqueueIntent's guard refuses its
|
|
1163
|
+
// teardown, and a refused teardown must cancel nothing (it used to cancel a pending restart). Each statement is atomic, the index the arbiter:
|
|
1164
1164
|
// any interleaving with the runner or a concurrent enqueue lands on one of these
|
|
1165
1165
|
// truthful outcomes.
|
|
1166
1166
|
async function enqueueTeardown(db, instanceId, requestedBy) {
|
|
@@ -1169,7 +1169,7 @@ async function enqueueTeardown(db, instanceId, requestedBy) {
|
|
|
1169
1169
|
SET state = 'error', last_error = 'superseded: teardown requested',
|
|
1170
1170
|
updated_at = now(), resolved_at = now()
|
|
1171
1171
|
WHERE instance_id = $1 AND action IN ('provision', 'settings-apply', 'restart', 'repo-private') AND state = 'pending'
|
|
1172
|
-
|
|
1172
|
+
AND NOT EXISTS (SELECT 1 FROM provisioning_instances WHERE id = $1 AND hosting_shape = 'control-plane') RETURNING id`,
|
|
1173
1173
|
[instanceId]
|
|
1174
1174
|
);
|
|
1175
1175
|
const { intent, created } = await enqueueIntent(db, instanceId, 'teardown', requestedBy);
|
|
@@ -26,6 +26,7 @@ const express = require('express');
|
|
|
26
26
|
const api = require('../../../src/module-api');
|
|
27
27
|
const provisioning = require('../provisioning');
|
|
28
28
|
const { makeCoreUpgradeHandler, makeCoreUpgradePreviewHandler, makeControlPlaneHandler } = require('../core-upgrade');
|
|
29
|
+
const { requireOwnProjectOrPin } = require('../core-upgrade-authz');
|
|
29
30
|
|
|
30
31
|
const log = api.logger('provisioning');
|
|
31
32
|
|
|
@@ -40,6 +41,11 @@ module.exports = function buildCoreUpgradeRouter() {
|
|
|
40
41
|
// and not `requireRank`: tests/government_require_permission.mjs fails the build
|
|
41
42
|
// on a new requireRank in a modules/*/routes gate.
|
|
42
43
|
//
|
|
44
|
+
// OR THE PROJECT'S OWN OWNER (task 1004174, ADR 0339 — the owner's ruling that only
|
|
45
|
+
// a project's owner upgrades it). Ownership of a TENANT row is asked first; any other
|
|
46
|
+
// caller meets the unmodified `core.pin.move` gate and its unchanged refusal. The
|
|
47
|
+
// platform's own row is not an owner's to move here — it stays on the atom.
|
|
48
|
+
//
|
|
43
49
|
// Body: { to: "1.19.757" } — and requiring it IS the second step of the two-step
|
|
44
50
|
// the owner asked for (ADR 0293 D4). A request that cannot fire without naming
|
|
45
51
|
// its target cannot fire from a stray click, and "move to whatever is newest",
|
|
@@ -55,7 +61,7 @@ module.exports = function buildCoreUpgradeRouter() {
|
|
|
55
61
|
router.post(
|
|
56
62
|
'/provisioning/instances/:id/core-upgrade',
|
|
57
63
|
api.requireBuilder,
|
|
58
|
-
api.requirePermission('core.pin.move'),
|
|
64
|
+
requireOwnProjectOrPin({ pinGate: api.requirePermission('core.pin.move'), provisioning, pool: api.pool, log }),
|
|
59
65
|
makeCoreUpgradeHandler({
|
|
60
66
|
provisioning,
|
|
61
67
|
pool: api.pool,
|
|
@@ -71,19 +77,19 @@ module.exports = function buildCoreUpgradeRouter() {
|
|
|
71
77
|
// core version and how far behind it is, which is a vulnerability-window disclosure —
|
|
72
78
|
// precisely the sort of thing ADR 0043 keeps off unauthenticated surfaces. A preview
|
|
73
79
|
// anyone could read would also let an attacker time a request against a known-stale
|
|
74
|
-
// window. The read being no cheaper than the write costs the owner nothing:
|
|
75
|
-
// the
|
|
80
|
+
// window. The read being no cheaper than the write costs the owner nothing: whoever
|
|
81
|
+
// may press the button may read what it would do — the same two doors as the POST.
|
|
76
82
|
router.get(
|
|
77
83
|
'/provisioning/instances/:id/core-upgrade',
|
|
78
84
|
api.requireBuilder,
|
|
79
|
-
api.requirePermission('core.pin.move'),
|
|
85
|
+
requireOwnProjectOrPin({ pinGate: api.requirePermission('core.pin.move'), provisioning, pool: api.pool, log }),
|
|
80
86
|
makeCoreUpgradePreviewHandler({ provisioning, pool: api.pool, parseId: api.parseId, log }),
|
|
81
87
|
);
|
|
82
88
|
|
|
83
89
|
// GET /provisioning/control-plane — "which row is this platform, and where does it
|
|
84
90
|
// stand?" The deploy page's first call: the self row is created once by hand at
|
|
85
|
-
// install time, so its id is per-install and nobody's to memorise.
|
|
86
|
-
//
|
|
91
|
+
// install time, so its id is per-install and nobody's to memorise. The atom ALONE
|
|
92
|
+
// here, with no owner door: this is the platform's own row (ADR 0339).
|
|
87
93
|
router.get(
|
|
88
94
|
'/provisioning/control-plane',
|
|
89
95
|
api.requireBuilder,
|
package/package-lock.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bongos/core",
|
|
3
|
-
"version": "1.19.
|
|
3
|
+
"version": "1.19.1036",
|
|
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.1036",
|
|
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.1036",
|
|
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/release-notes.json
CHANGED
|
@@ -7487,5 +7487,15 @@
|
|
|
7487
7487
|
"id": "1002669",
|
|
7488
7488
|
"text": "The owner can now check from their own laptop what the automatic background jobs decided and when the project's core software was last upgraded, instead of logging into the server to find out."
|
|
7489
7489
|
}
|
|
7490
|
+
],
|
|
7491
|
+
"1.19.1036": [
|
|
7492
|
+
{
|
|
7493
|
+
"id": "1004286",
|
|
7494
|
+
"text": "Pressing delete on the platform's own server is still refused, and now it no longer quietly cancels a restart you had already asked for."
|
|
7495
|
+
},
|
|
7496
|
+
{
|
|
7497
|
+
"id": "1004174",
|
|
7498
|
+
"text": "The owner of a hosted project can now upgrade it themselves: the \"you're behind\" banner on their project links to the Deploy page on the hub, which lets a project's owner move their own project, and only their own."
|
|
7499
|
+
}
|
|
7490
7500
|
]
|
|
7491
7501
|
}
|
|
@@ -140,6 +140,16 @@ function targetFault(to, available, installed, channel, channelAllows) {
|
|
|
140
140
|
return null;
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
+
// The builder id a queued move is attributed to, from the actor the web tier recorded.
|
|
144
|
+
// PURE. Two doors reach the move (ADR 0339): an Archon (`api:archon:<id>`) and, since
|
|
145
|
+
// task 1004174, the project's own owner (`api:owner:<id>`). Both carry the id, because
|
|
146
|
+
// it becomes `--requested-by` on the core_upgrades ledger (ADR 0293 D5). Anything else
|
|
147
|
+
// yields '' — the id is interpolated into a shell command, so only digits ever pass.
|
|
148
|
+
function requestedByOf(intent) {
|
|
149
|
+
const m = intent && typeof intent.requested_by === 'string' && /^api:(?:archon|owner):(\d+)$/.exec(intent.requested_by);
|
|
150
|
+
return m ? m[1] : '';
|
|
151
|
+
}
|
|
152
|
+
|
|
143
153
|
/**
|
|
144
154
|
* Perform a queued core-pin move. Returns { ok } — NEVER throws for an expected refusal.
|
|
145
155
|
*
|
|
@@ -224,9 +234,7 @@ async function coreUpgradeInstance(inst, deps, intent) {
|
|
|
224
234
|
// it the pin lives only in the working tree, and the next pull-deploy resets it away —
|
|
225
235
|
// the silent thirteen-release revert upgrade.js's own header records.
|
|
226
236
|
const versionUrl = `http://127.0.0.1:${inst.port}/version`;
|
|
227
|
-
const requestedBy =
|
|
228
|
-
? intent.requested_by.replace(/^api:archon:/, '')
|
|
229
|
-
: '';
|
|
237
|
+
const requestedBy = requestedByOf(intent);
|
|
230
238
|
// Built by the SAME function the preview uses, so "what you were shown" and "what runs"
|
|
231
239
|
// cannot drift apart into two hand-maintained flag lists (task 1004121).
|
|
232
240
|
// The preview probes; the move must probe identically or the two commands diverge on
|
|
@@ -982,4 +990,4 @@ async function snapshotAllCoreVersions(deps) {
|
|
|
982
990
|
return { seen };
|
|
983
991
|
}
|
|
984
992
|
|
|
985
|
-
module.exports = { UPGRADE_SHAPES, CHANGE_CAP, REPO_NOTES, repoNote, parseChangeRecords, readInstalledNotes, readPackagedNotes, changesBetween, coreCheckoutCandidates, findCoreCheckout, gitFault, resolveRunAs, versionCmd, parseServedVersion, parseSchemaPending, targetFault, parsePreflight, upgradeInvocation, preflightUpgrade, preflightCoreUpgrade, coreUpgradeInstance, snapshotCoreVersions, snapshotAllCoreVersions };
|
|
993
|
+
module.exports = { UPGRADE_SHAPES, CHANGE_CAP, REPO_NOTES, repoNote, requestedByOf, parseChangeRecords, readInstalledNotes, readPackagedNotes, changesBetween, coreCheckoutCandidates, findCoreCheckout, gitFault, resolveRunAs, versionCmd, parseServedVersion, parseSchemaPending, targetFault, parsePreflight, upgradeInvocation, preflightUpgrade, preflightCoreUpgrade, coreUpgradeInstance, snapshotCoreVersions, snapshotAllCoreVersions };
|
package/src/bongos/auth.js
CHANGED
|
@@ -461,7 +461,13 @@ const PAGE_GATES = Object.freeze({
|
|
|
461
461
|
// preview discloses the exact core version the box serves and how far behind it is
|
|
462
462
|
// — a vulnerability window, and exactly the kind of topology ADR 0043 keeps off
|
|
463
463
|
// unauthenticated surfaces.
|
|
464
|
-
|
|
464
|
+
//
|
|
465
|
+
// SINCE ADR 0339 (task 1004174) its routes admit a SECOND audience — a hosted
|
|
466
|
+
// project's own owner, for that project only — so the shell follows through the same
|
|
467
|
+
// `alsoAdmits` door /people uses (ADR 0210). It admits the SHELL for an owner of any
|
|
468
|
+
// live project; which project they may read or move is still the routes' question,
|
|
469
|
+
// asked per request against that project's row.
|
|
470
|
+
requireCorePinPage: Object.freeze({ permission: 'core.pin.move', deniedTo: '/builders', alsoAdmits: 'isProjectOwner' }),
|
|
465
471
|
// The /fleet cost page (task 1001949) — on `provisioning.fleet.manage`, the SAME atom
|
|
466
472
|
// its one read (GET /provisioning/fleet/cost-ledger) checks: every owner's projects
|
|
467
473
|
// and what they cost, so the page reaches exactly as far as the data does.
|
|
@@ -469,7 +475,7 @@ const PAGE_GATES = Object.freeze({
|
|
|
469
475
|
});
|
|
470
476
|
|
|
471
477
|
// The `alsoAdmits` door — "is this visitor the page's OTHER audience?", asked of
|
|
472
|
-
// the module that owns the answer, only for
|
|
478
|
+
// the module that owns the answer, only for a gate that declares one.
|
|
473
479
|
//
|
|
474
480
|
// FAIL-CLOSED, EVERY WAY IT CAN FAIL: a gate with no `alsoAdmits`, a hub module
|
|
475
481
|
// that is off (every non-hub instance), a port that never grew the function, or a
|
|
@@ -22,6 +22,25 @@ const express = require('express');
|
|
|
22
22
|
const { asyncHandler } = require('./_helpers');
|
|
23
23
|
const auth = require('../auth');
|
|
24
24
|
const { readCoreUpdate, readCoreUpgrades } = require('../core-update');
|
|
25
|
+
const { loadIdpConfig } = require('../auth-config');
|
|
26
|
+
|
|
27
|
+
// WHERE A HOSTED PROJECT'S OWNER TAKES THE UPGRADE (task 1004174, ADR 0339): the hub's
|
|
28
|
+
// own deploy door, scoped to this project — `<hub>/deploy?project=<slug>`. The act stays
|
|
29
|
+
// on the control plane (ADR 0293 D1); this instance only names the address, so it gains
|
|
30
|
+
// no capability. Both halves are already here on a federated project: provisioning
|
|
31
|
+
// writes the hub origin and this project's hub client id, which IS its slug (ADR 0246),
|
|
32
|
+
// into web.env. null when this instance is not federated with a hub — a self-hosted
|
|
33
|
+
// instance, or the hub itself — so the hall offers no link rather than a wrong one.
|
|
34
|
+
// Only the origin and the client id are read; the client secret never leaves auth-config.
|
|
35
|
+
function hubDeployUrl(config) {
|
|
36
|
+
if (!config || typeof config.origin !== 'string' || !config.clientId) return null;
|
|
37
|
+
if (!/^https?:\/\/[^\s"'<>]+$/i.test(config.origin)) return null;
|
|
38
|
+
return `${config.origin.replace(/\/+$/, '')}/deploy?project=${encodeURIComponent(String(config.clientId))}`;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function safeIdpConfig() {
|
|
42
|
+
try { return loadIdpConfig(); } catch { return null; }
|
|
43
|
+
}
|
|
25
44
|
|
|
26
45
|
// ?limit for GET /core-upgrades: an integer 1..100, else 20.
|
|
27
46
|
function upgradesLimit(raw) {
|
|
@@ -30,7 +49,7 @@ function upgradesLimit(raw) {
|
|
|
30
49
|
return Math.min(100, Math.max(1, n));
|
|
31
50
|
}
|
|
32
51
|
|
|
33
|
-
|
|
52
|
+
function buildCoreUpdateRouter({ upgrades = readCoreUpgrades } = {}) {
|
|
34
53
|
const router = express.Router();
|
|
35
54
|
|
|
36
55
|
router.get(
|
|
@@ -48,7 +67,7 @@ module.exports = function buildCoreUpdateRouter({ upgrades = readCoreUpgrades }
|
|
|
48
67
|
// that cannot name its own core reports `no_answer` and renders no banner.
|
|
49
68
|
let running = null;
|
|
50
69
|
try { running = require('../../module-api').CORE_VERSION; } catch { /* version unknown */ }
|
|
51
|
-
res.json({ ok: true, update: await readCoreUpdate({ running }) });
|
|
70
|
+
res.json({ ok: true, update: await readCoreUpdate({ running }), deploy_url: hubDeployUrl(safeIdpConfig()) });
|
|
52
71
|
}, { errorCode: 'core_update_failed', message: false }),
|
|
53
72
|
);
|
|
54
73
|
|
|
@@ -71,4 +90,7 @@ module.exports = function buildCoreUpdateRouter({ upgrades = readCoreUpgrades }
|
|
|
71
90
|
);
|
|
72
91
|
|
|
73
92
|
return router;
|
|
74
|
-
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
module.exports = buildCoreUpdateRouter;
|
|
96
|
+
module.exports.hubDeployUrl = hubDeployUrl;
|
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.
|
|
74
|
+
const CORE_VERSION = '1.19.1036'; // 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');
|