mirror of
https://github.com/pbakaus/impeccable.git
synced 2026-09-12 14:16:28 +03:00
The engine binaries move from the impeccable-dist channel to this repo's own GitHub Releases (tag engine-v<ENGINE_VERSION>), and the closed detector the engine links arrives as detector-v<DETECTOR_VERSION> releases on the same repo. This commit wires the public side for that; the crates themselves land in the next commit. - Launcher (sh + cmd), npm shim, fetch-engine and check-engine-release now download from github.com/pbakaus/impeccable/releases/download/engine-v<X>/. - release.mjs gains `engine`: verifies ENGINE_VERSION against the platform package pins and the detector release, tags, pushes; release-engine.yml builds the five targets and publishes. check-detector-release.mjs is the matching release-order guard (with tests). - Root Cargo.toml (workspace, lto = false with the reason), rust-toolchain.toml (exact pin), DETECTOR_VERSION, /target ignored. - CI: rust + rust-windows jobs and an oracle job that replays the goldens against a source build, warn-only until the first detector release exists; ci-test-plan exposes a `rust` output. - docs/ENGINE.md (the crate map and the closed-detector mechanism) and the CLAUDE.md engine, release-order and rules sections. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vau2X53xGTjjTCXWMVBoNY
54 lines
2.6 KiB
JavaScript
54 lines
2.6 KiB
JavaScript
/**
|
|
* scripts/check-detector-release.mjs: the release-order guard for the closed
|
|
* detector archives that crates/core/build.rs downloads. Probes are injected
|
|
* so the test never touches the network.
|
|
*/
|
|
import { describe, it } from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import {
|
|
archiveAsset, assetUrl, checkDetectorRelease, DETECTOR_TARGETS, BROWSER_BUNDLE_ASSET, DEFAULT_DETECTOR_BASE,
|
|
} from '../scripts/check-detector-release.mjs';
|
|
|
|
const okResponse = { status: 206, body: { cancel: async () => {} } };
|
|
const missingResponse = { status: 404, body: null };
|
|
|
|
describe('check-detector-release', () => {
|
|
it('names one archive per target, .lib on Windows, and the detector-v tag in the URL', () => {
|
|
assert.equal(archiveAsset('darwin-arm64'), 'libimpeccable_detector-darwin-arm64.a');
|
|
assert.equal(archiveAsset('windows-x64'), 'impeccable_detector-windows-x64.lib');
|
|
assert.equal(
|
|
assetUrl('0.1.0', archiveAsset('linux-x64'), 'https://example.test/dl/'),
|
|
'https://example.test/dl/detector-v0.1.0/libimpeccable_detector-linux-x64.a',
|
|
);
|
|
assert.equal(DEFAULT_DETECTOR_BASE, 'https://github.com/pbakaus/impeccable/releases/download');
|
|
});
|
|
|
|
it('passes when every archive, checksum and the browser bundle answer', async () => {
|
|
const seen = [];
|
|
const fetchImpl = async (url) => { seen.push(url); return okResponse; };
|
|
const result = await checkDetectorRelease({ version: '0.1.0', base: 'https://example.test/dl', fetchImpl });
|
|
assert.equal(result.ok, true);
|
|
assert.equal(result.missing.length, 0);
|
|
assert.equal(seen.length, DETECTOR_TARGETS.length * 2 + 1);
|
|
assert.ok(seen.includes(`https://example.test/dl/detector-v0.1.0/${BROWSER_BUNDLE_ASSET}`));
|
|
});
|
|
|
|
it('lists every missing asset, sorted by target then archive/checksum/bundle', async () => {
|
|
const fetchImpl = async (url) => (url.includes('windows-x64') || url.endsWith(BROWSER_BUNDLE_ASSET) ? missingResponse : okResponse);
|
|
const result = await checkDetectorRelease({ version: '0.1.0', base: 'https://example.test/dl', fetchImpl });
|
|
assert.equal(result.ok, false);
|
|
assert.deepEqual(result.missing.map((m) => m.what), [
|
|
'impeccable_detector-windows-x64.lib',
|
|
'impeccable_detector-windows-x64.lib.sha256',
|
|
BROWSER_BUNDLE_ASSET,
|
|
]);
|
|
});
|
|
|
|
it('treats a network error as a missing asset instead of throwing', async () => {
|
|
const fetchImpl = async () => { throw new Error('offline'); };
|
|
const result = await checkDetectorRelease({ version: '0.1.0', base: 'https://example.test/dl', fetchImpl });
|
|
assert.equal(result.ok, false);
|
|
assert.equal(result.missing.length, DETECTOR_TARGETS.length * 2 + 1);
|
|
});
|
|
});
|