Merge branch 'fix/sibling-version-from-heartbeat'
This commit is contained in:
@@ -5,6 +5,19 @@ versions follow [Semantic Versioning](https://semver.org/).
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [2.23.1] - 2026-11-26
|
||||
|
||||
No migration; no API is removed.
|
||||
|
||||
### Fixed
|
||||
|
||||
- **New install read a church's Accounts version from the install record, not from its
|
||||
heartbeat.** The record only changed with the Hub's own install and deploy jobs for that product.
|
||||
An Accounts updated alongside another product (`crosscode deploy` updates Accounts first) kept its
|
||||
old version there. So New install → Website refused cross-demo2 ("needs Accounts 1.7.0 or later;
|
||||
this church has 1.6.0") while the installs list showed 1.7.0. It now uses the heartbeat's version.
|
||||
- **Each heartbeat now updates the install record's version**, so the two can't drift apart again.
|
||||
|
||||
## [2.23.0] - 2026-11-26
|
||||
|
||||
Release requirements carry forward. No migration; no API is removed.
|
||||
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "events-hub-backend",
|
||||
"version": "2.23.0",
|
||||
"version": "2.23.1",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "events-hub-backend",
|
||||
"version": "2.23.0",
|
||||
"version": "2.23.1",
|
||||
"hasInstallScript": true,
|
||||
"dependencies": {
|
||||
"@anthropic-ai/sdk": "^1.3.0",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "events-hub-backend",
|
||||
"version": "2.23.0",
|
||||
"version": "2.23.1",
|
||||
"private": true,
|
||||
"description": "Cross Events Hub — API for managing Cross Events installs, licences and heartbeats",
|
||||
"main": "src/index.js",
|
||||
|
||||
@@ -239,6 +239,9 @@ router.post('/installs/heartbeat', heartbeatLimiter, async (req, res) => {
|
||||
try {
|
||||
const tied = await prisma.deployment.updateMany({ where: { licenceId: install.licenceId, installId: null, status: { notIn: ['removed', 'failed'] } }, data: { installId: install.id } });
|
||||
if (!tied.count) await require('../utils/jobs').lookForUnlinked(install, now);
|
||||
// Hub 2.23.1: the install record's version follows the heartbeat (it only followed the Hub's
|
||||
// own jobs, so a product updated alongside another kept its old version there).
|
||||
if (version) await prisma.deployment.updateMany({ where: { installId: install.id, OR: [{ version: null }, { version: { not: version } }] }, data: { version } });
|
||||
} catch (e) {
|
||||
console.warn('[hub] tying the install record to its site failed:', e?.message || e);
|
||||
}
|
||||
|
||||
@@ -672,7 +672,7 @@ async function newInstall(input, admin, now = new Date()) {
|
||||
const release = await releaseFor(product, input.version || null);
|
||||
await preflight(server, product, release.version, now);
|
||||
// The church's other products: the same short name means the same church folder on one server.
|
||||
const siblings = await prisma.deployment.findMany({ where: { shortName, status: { notIn: ['removed', 'failed'] } } });
|
||||
const siblings = await prisma.deployment.findMany({ where: { shortName, status: { notIn: ['removed', 'failed'] } }, include: { install: true } });
|
||||
if (siblings.some(s => s.product === product)) throw fail(409, 'SHORT_NAME_TAKEN', `${shortName} already has ${PRODUCT_NAMES[product]}.`);
|
||||
if (siblings.some(s => s.customerId !== customer.id)) throw fail(409, 'SHORT_NAME_TAKEN', `The short name ${shortName} is already used by another customer.`);
|
||||
if (siblings.some(s => s.serverId !== server.id)) throw fail(409, 'OTHER_SERVER', `${shortName}'s other products are on another server; a church's products go on one server.`);
|
||||
@@ -942,8 +942,12 @@ async function requiredFirst({ release, product, siblings, input, domain, server
|
||||
if (!need) return null;
|
||||
const have = siblings.find(s => s.product === 'accounts');
|
||||
if (have) {
|
||||
if (have.version && compareVersions(have.version, need.version) < 0) {
|
||||
throw fail(409, 'REQUIREMENT_NOT_MET', `${PRODUCT_NAMES[product]} ${release.version} needs Accounts ${need.version} or later; this church has ${have.version}. Update its Accounts first.`);
|
||||
// Hub 2.23.1: what it runs now, from its heartbeat. The record's version only changes with the
|
||||
// Hub's own jobs, so an Accounts updated alongside another product (crosscode deploy updates
|
||||
// Accounts first) still showed the old one.
|
||||
const running = have.install?.version || have.version;
|
||||
if (running && compareVersions(running, need.version) < 0) {
|
||||
throw fail(409, 'REQUIREMENT_NOT_MET', `${PRODUCT_NAMES[product]} ${release.version} needs Accounts ${need.version} or later; this church has ${running}. Update its Accounts first.`);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -530,6 +530,20 @@ describe('Cross Events 3.0 brings its Accounts (2.5.0)', () => {
|
||||
expect(job).toMatchObject({ type: 'add-product', args: { product: 'events', version: 'events@3.0.0' } });
|
||||
});
|
||||
|
||||
test("the church's Accounts version is what its heartbeat says, not the install record's (Hub 2.23.1)", async () => {
|
||||
const { server } = await joinServer();
|
||||
await servers.setServerConfig(server.id, { TRUST_PROXY: 'loopback' });
|
||||
const a = await jobs.newInstall({ product: 'accounts', customerId: 'cust-1', serverId: server.id, shortName: 'hope', domain: 'accounts.hope.co.za', version: '1.0.0' }, admin, NOW);
|
||||
await db.job.updateMany({ where: { deploymentId: a.deployment.id }, data: { status: 'succeeded' } });
|
||||
// Updated on the server to 1.1.0 by a job for another product: the record still says 1.0.0.
|
||||
const install = await db.install.create({ data: { id: 'inst-acc', product: 'accounts', version: '1.1.0' } });
|
||||
await db.deployment.update({ where: { id: a.deployment.id }, data: { status: 'live', version: '1.0.0', installId: install.id } });
|
||||
const out = await jobs.newInstall({ customerId: 'cust-1', serverId: server.id, shortName: 'hope', domain: 'events.hope.co.za' }, admin, NOW);
|
||||
expect(out.alsoInstalling).toBeUndefined();
|
||||
const [job] = (await poll(server)).jobs;
|
||||
expect(job).toMatchObject({ type: 'add-product', args: { product: 'events', version: 'events@3.0.0' } });
|
||||
});
|
||||
|
||||
test('Events 2.x installs as before, without Accounts', async () => {
|
||||
const { server } = await joinServer();
|
||||
await servers.setServerConfig(server.id, { TRUST_PROXY: 'loopback' });
|
||||
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "events-hub-frontend",
|
||||
"version": "2.23.0",
|
||||
"version": "2.23.1",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "events-hub-frontend",
|
||||
"version": "2.23.0",
|
||||
"version": "2.23.1",
|
||||
"dependencies": {
|
||||
"lucide-react": "^0.536.0",
|
||||
"next": "^15.5.24",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "events-hub-frontend",
|
||||
"version": "2.23.0",
|
||||
"version": "2.23.1",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev -p 3200",
|
||||
|
||||
Reference in New Issue
Block a user