fix(updates): scan release channels across pages
Share a bounded release scan across channels and compare tag versions across pages. Report uncertainty when the scan hits its limit without confirming a newer release. Verified with local release responses covering cross-page versions, truncation, and missing feeds.
This commit is contained in:
1 parent
5a78b1fdf8
commit
31f4fedafe
11 files changed
+173
-101
No files matched your search
@@ -1,6 +1,6 @@
|
||||
/** Why an adaptation pack cannot be built, read or used. */
|
||||
export type PatchPackProblem =
|
||||
/** tuning/patch-pack.jsonc is invalid. */
|
||||
/** tuning/release-channels.jsonc is invalid. */
|
||||
| 'tuning'
|
||||
/** No signing key, or a key of the wrong kind. */
|
||||
| 'key'
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
/**
|
||||
* The adaptation pack settings in packages/patcher/tuning/patch-pack.jsonc.
|
||||
*/
|
||||
/** Settings shared by the launcher and adaptation pack release checks. */
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { parseJsonc } from '@wto/jsonc';
|
||||
import { PatchPackError } from './patch-pack-error.ts';
|
||||
@@ -8,13 +6,14 @@ import { PatchPackError } from './patch-pack-error.ts';
|
||||
export interface PatchPackTuning {
|
||||
/** `owner/repo` on GitHub. */
|
||||
readonly repository: string;
|
||||
readonly releasesPerCheck: number;
|
||||
readonly releasePageSize: number;
|
||||
readonly maxReleasePages: number;
|
||||
readonly maxPackBytes: number;
|
||||
readonly maxUnpackedBytes: number;
|
||||
readonly requestTimeoutMs: number;
|
||||
}
|
||||
|
||||
const TUNING_FILE = new URL('../../tuning/patch-pack.jsonc', import.meta.url);
|
||||
const TUNING_FILE = new URL('../../tuning/release-channels.jsonc', import.meta.url);
|
||||
|
||||
let cached: PatchPackTuning | null = null;
|
||||
|
||||
@@ -27,9 +26,12 @@ export function patchPackTuning(): PatchPackTuning {
|
||||
if (typeof repository !== 'string' || !/^[A-Za-z0-9._-]+\/[A-Za-z0-9._-]+$/.test(repository)) {
|
||||
throw tuningError('"repository" must be "owner/repo"');
|
||||
}
|
||||
const releasePageSize = positiveInteger(fields, 'release_page_size');
|
||||
if (releasePageSize > 100) throw tuningError('"release_page_size" must be at most 100');
|
||||
cached = {
|
||||
repository,
|
||||
releasesPerCheck: positiveInteger(fields, 'releases_per_check'),
|
||||
releasePageSize,
|
||||
maxReleasePages: positiveInteger(fields, 'max_release_pages'),
|
||||
maxPackBytes: positiveInteger(fields, 'max_pack_bytes'),
|
||||
maxUnpackedBytes: positiveInteger(fields, 'max_unpacked_bytes'),
|
||||
requestTimeoutMs: positiveInteger(fields, 'request_timeout_ms'),
|
||||
@@ -39,10 +41,10 @@ export function patchPackTuning(): PatchPackTuning {
|
||||
|
||||
function positiveInteger(fields: Record<string, unknown>, key: string): number {
|
||||
const value = fields[key];
|
||||
if (typeof value !== 'number' || !Number.isInteger(value) || value <= 0) throw tuningError(`"${key}" must be a positive integer`);
|
||||
if (typeof value !== 'number' || !Number.isSafeInteger(value) || value <= 0) throw tuningError(`"${key}" must be a positive integer`);
|
||||
return value;
|
||||
}
|
||||
|
||||
function tuningError(detail: string): PatchPackError {
|
||||
return new PatchPackError('tuning', `tuning/patch-pack.jsonc: ${detail}`);
|
||||
return new PatchPackError('tuning', `tuning/release-channels.jsonc: ${detail}`);
|
||||
}
|
||||
Reference in new issue
Block a user