Hub 2.23.0: release requirements carry forward

A release needs what every earlier release of its product needed (the
highest version per product), so "requires accounts 1.7.0" is written
once in WHATS-NEW.md. Fixes New install -> Website 1.0.1 sending a
Website-only install job: its heading didn't repeat 1.0.0's requirement,
so Accounts wasn't installed first and the agent refused the job.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-26 15:08:48 +02:00
co-authored by Claude Opus 5.5
parent 5ed8cad6a1
commit d5fa11f50f
7 changed files with 84 additions and 10 deletions
+31 -1
View File
@@ -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' }]);
});
});