diff --git a/CHANGELOG.md b/CHANGELOG.md index c189d61..28af9ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,26 @@ versions follow [Semantic Versioning](https://semver.org/). ## [Unreleased] +## [2.23.0] - 2026-11-26 + +Release requirements carry forward. No migration; no API is removed. + +### Changed + +- **A release needs what every earlier release of its product needed** (release sync, + `inheritRequirements`): "— requires accounts 1.7.0" is written once in WHATS-NEW.md, on the + release that first needs it, and each later release keeps it (the highest version per product; a + later heading can raise it but never lower or drop it). The stored requirements are the inherited + ones, so New install, update requests and the Releases page all see them. The next sync fixes + existing releases. + +### Fixed + +- **New install → Website 1.0.1 no longer sends a Website-only install job.** Its heading didn't + repeat 1.0.0's "requires accounts 1.7.0", so the Hub didn't install Accounts first. It sent + `install` with `products: ["website"]`, which the agent refuses ("This agent installs one product at + a time: Events or Accounts.") and `crosscode` can't do. A Website can only be added next to Accounts. + ## [2.22.0] - 2026-11-25 "Get more storage" for the Church Website (crosscode-platform docs/WEBSITE-1.0-PLAN.md §10, decision diff --git a/backend/package-lock.json b/backend/package-lock.json index 2fab907..ecc2e73 100644 --- a/backend/package-lock.json +++ b/backend/package-lock.json @@ -1,12 +1,12 @@ { "name": "events-hub-backend", - "version": "2.22.0", + "version": "2.23.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "events-hub-backend", - "version": "2.22.0", + "version": "2.23.0", "hasInstallScript": true, "dependencies": { "@anthropic-ai/sdk": "^1.3.0", diff --git a/backend/package.json b/backend/package.json index 7240b14..9b485de 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "events-hub-backend", - "version": "2.22.0", + "version": "2.23.0", "private": true, "description": "Cross Events Hub — API for managing Cross Events installs, licences and heartbeats", "main": "src/index.js", diff --git a/backend/src/utils/releaseSync.js b/backend/src/utils/releaseSync.js index e786443..8b78a08 100644 --- a/backend/src/utils/releaseSync.js +++ b/backend/src/utils/releaseSync.js @@ -3,7 +3,7 @@ * (Releases page): a repository, a tag prefix and a notes file. Every tag `1.2.3` is a * release of that product, dated by its commit; the notes come from the notes file on the * repository's default branch ("## 1.2.3" sections; "urgent" or "security" in the heading marks an - * urgent release, "requires accounts 1.2.0" a requirement). Notes only attach to tagged versions, + * urgent release, "requires accounts 1.2.0" a requirement, which every later release keeps). Notes only attach to tagged versions, * so a section written ahead of a release stays hidden until it's tagged, and a note can be * corrected after release without a new version. Runs every 15 minutes and from "Sync now". * @@ -18,6 +18,7 @@ const prisma = require('../config/db'); const { getSettings, setSettings, releaseRepoToken } = require('./settings'); const { syncLatestVersion } = require('./releases'); +const { compareVersions } = require('./alerts'); const { PRODUCTS, PRODUCT_NAMES, isProduct } = require('./products'); const TIMEOUT_MS = 20000; @@ -188,6 +189,27 @@ async function fetchTags(repo, token) { return tags; } +/** + * Hub 2.23.0: requirements carry forward. A release needs what every earlier release of the product + * needed (the highest version per product), as well as what its own heading says, so "— requires + * accounts 1.7.0" is written once, on the release that first needs it. A later heading can raise a + * requirement but never lower or drop one. `tagged` is Map(version → { requires }); returns + * Map(version → requires) in the same order as `tagged`. + */ +function inheritRequirements(tagged) { + const byVersion = [...tagged.keys()].sort(compareVersions); + const carried = new Map(); + const out = new Map(); + for (const version of byVersion) { + for (const r of tagged.get(version).requires || []) { + const had = carried.get(r.product); + if (!had || compareVersions(r.version, had) > 0) carried.set(r.product, r.version); + } + out.set(version, [...carried].map(([product, v]) => ({ product, version: v }))); + } + return new Map([...tagged.keys()].map(v => [v, out.get(v)])); +} + const sameRequires = (a, b) => JSON.stringify(a || []) === JSON.stringify(b || []); const sourceLabel = s => `${targetName(s.product)} (${parseRepoUrl(s.repo)?.repo || s.repo}, ${s.tagPrefix || 'no prefix'}1.2.3)`; @@ -259,7 +281,9 @@ async function syncReleases() { const table = agentOnly ? prisma.agentRelease : prisma.release; const tagged = found[product] || new Map(); const existing = new Map((await table.findMany(agentOnly ? {} : { where: { product } })).map(r => [r.version, r])); - for (const [version, t] of tagged) { + const inherited = agentOnly ? null : inheritRequirements(tagged); + for (const [version, tag] of tagged) { + const t = agentOnly ? tag : { ...tag, requires: inherited.get(version) }; const had = existing.get(version); const requires = agentOnly ? {} : { requires: t.requires }; if (!had) { @@ -290,4 +314,4 @@ async function syncReleases() { return { sources: counts, added, updated, removed, latest, problems }; } -module.exports = { PLATFORM_REPO, AGENT, agentSource, targetName, gitGet: get, parseRepoUrl, parseNotes, parseRequirements, plainNotes, tagPattern, defaultSources, cleanSources, releaseSources, syncReleases }; +module.exports = { PLATFORM_REPO, AGENT, agentSource, targetName, gitGet: get, parseRepoUrl, parseNotes, parseRequirements, inheritRequirements, plainNotes, tagPattern, defaultSources, cleanSources, releaseSources, syncReleases }; diff --git a/backend/tests/releaseSync.test.js b/backend/tests/releaseSync.test.js index fffaf21..7ad820d 100644 --- a/backend/tests/releaseSync.test.js +++ b/backend/tests/releaseSync.test.js @@ -1,7 +1,7 @@ // Releases from git: reading the repo address and WHATS-NEW.md. jest.mock('../src/config/db', () => ({})); -const { parseRepoUrl, parseNotes } = require('../src/utils/releaseSync'); +const { parseRepoUrl, parseNotes, inheritRequirements } = require('../src/utils/releaseSync'); test('the repository address becomes the Gitea API', () => { expect(parseRepoUrl('https://c-git.crosscode.co.za/joshua/hope-events')).toEqual({ api: 'https://c-git.crosscode.co.za/api/v1/repos/joshua/hope-events', owner: 'joshua', repo: 'hope-events' }); @@ -61,3 +61,33 @@ Nothing changes for you. expect(parseNotes(null)).toEqual({}); }); }); + +describe('requirements carry forward (Hub 2.23.0)', () => { + const tagged = (entries) => new Map(entries.map(([v, requires]) => [v, { requires }])); + + test('a later release needs what an earlier one needed, without repeating it', () => { + const out = inheritRequirements(tagged([ + ['1.0.1', []], + ['1.0.0', [{ product: 'accounts', version: '1.7.0' }]], + ['1.1.0', []], + ])); + expect(out.get('1.0.0')).toEqual([{ product: 'accounts', version: '1.7.0' }]); + expect(out.get('1.0.1')).toEqual([{ product: 'accounts', version: '1.7.0' }]); + expect(out.get('1.1.0')).toEqual([{ product: 'accounts', version: '1.7.0' }]); + }); + + test('releases before the first requirement need nothing; a later heading raises it, never lowers it', () => { + const out = inheritRequirements(tagged([ + ['2.9.0', []], + ['3.0.0', [{ product: 'accounts', version: '1.1.0' }]], + ['3.1.0', [{ product: 'accounts', version: '1.2.0' }]], + ['3.2.0', [{ product: 'accounts', version: '1.0.0' }, { product: 'website', version: '1.0.0' }]], + ['3.10.0', []], + ])); + expect(out.get('2.9.0')).toEqual([]); + expect(out.get('3.0.0')).toEqual([{ product: 'accounts', version: '1.1.0' }]); + expect(out.get('3.2.0')).toEqual([{ product: 'accounts', version: '1.2.0' }, { product: 'website', version: '1.0.0' }]); + // 3.10.0 sorts after 3.2.0 as a version, not as text. + expect(out.get('3.10.0')).toEqual([{ product: 'accounts', version: '1.2.0' }, { product: 'website', version: '1.0.0' }]); + }); +}); diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 69cecf9..a77e967 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -1,12 +1,12 @@ { "name": "events-hub-frontend", - "version": "2.22.0", + "version": "2.23.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "events-hub-frontend", - "version": "2.22.0", + "version": "2.23.0", "dependencies": { "lucide-react": "^0.536.0", "next": "^15.5.24", diff --git a/frontend/package.json b/frontend/package.json index 5b28595..6edbc5e 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,6 @@ { "name": "events-hub-frontend", - "version": "2.22.0", + "version": "2.23.0", "private": true, "scripts": { "dev": "next dev -p 3200",