mirror of
https://github.com/pbakaus/impeccable.git
synced 2026-09-14 07:06:45 +03:00
The engine no longer lives in a separate repo. `crates/` is a snapshot of the
open crates (foundation, core, common, context, live, hook, skills, comp,
comp-verbs, html, browser, detect, cli) plus `Cargo.lock`, taken as a git
archive of the engine repo at the commit that finished the boundary split.
None of that repo's history comes with it, and none of it should: the closed
half stays private.
The closed half is the rule engine. It ships as a prebuilt native archive per
target, `libimpeccable_detector.a`, published as a `detector-v<X>` GitHub
Release on this repo. `crates/core/build.rs` resolves and links it three ways:
`IMPECCABLE_DETECTOR_LIB=<dir>` for a local detector build, else the
`~/.impeccable/detector/<version>/<target>/` cache, else a download verified
against its `.sha256` sidecar. `crates/core` is a thin shim over a three-symbol
C ABI; nothing above it knows the boundary exists.
What changed versus the engine repo copy:
- Every crate manifest moves from `license-file.workspace` to
`license.workspace` (this workspace declares Apache-2.0), and the workspace
gains the `postcard` dependency the boundary encoding needs.
- The launcher contract test reads `skill/scripts/impeccable{,.cmd}` instead of
a sibling `launcher/` dir, and `engine_binary` downloads from
`github.com/pbakaus/impeccable/releases/download/engine-v<version>/` instead
of the retired dist repo. No oracle golden carried the old URL, so no
re-recording was owed.
- The tests that hunted for a public repo through `IMPECCABLE_PUBLIC_REPO`,
`../impeccable-second` or a hardcoded home directory now resolve the root as
`CARGO_MANIFEST_DIR/../..`, because they are in it. The env var stays as an
override for an out-of-tree checkout.
- The in-page bundle (`detect-antipatterns-browser.js`, 2 MB of generated wasm
glue) is no longer tracked. `crates/core/build.rs` resolves it beside the
archive, hands the path to `impeccable_core::browser::IN_PAGE_BUNDLE_JS`, and
live mode serves that. `scripts/check-detector-release.mjs` now requires it
and its `.sha256` in a detector release.
- The live crate embeds `skill/scripts/live-browser*.js` and
`modern-screenshot.umd.js` directly rather than through vendored copies, so
the binary and the installed skill cannot drift.
- `crates/browser/assets/` (an unused second copy of the bundle) is gone.
- `tests/lib/engine-bin.mjs` also accepts `target/release/impeccable`, so a
plain `cargo build --release -p impeccable` is enough to run `bun run test`.
Verified with the archive from a local detector build: `cargo test --workspace`
267 pass, oracle 795 pass / 0 fail / 0 missing, `bun run build` clean, the
default suite green, and the launcher's `engine-probe` handshake answering
through `skill/scripts/impeccable`.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vau2X53xGTjjTCXWMVBoNY
61 lines
3.1 KiB
JavaScript
61 lines
3.1 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,
|
|
IN_PAGE_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 both bundles 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);
|
|
// Per target: archive + .sha256. Plus the extension bundle, the in-page
|
|
// bundle crates/core embeds, and that bundle's own .sha256.
|
|
assert.equal(seen.length, DETECTOR_TARGETS.length * 2 + 3);
|
|
assert.ok(seen.includes(`https://example.test/dl/detector-v0.1.0/${BROWSER_BUNDLE_ASSET}`));
|
|
assert.ok(seen.includes(`https://example.test/dl/detector-v0.1.0/${IN_PAGE_BUNDLE_ASSET}`));
|
|
assert.ok(seen.includes(`https://example.test/dl/detector-v0.1.0/${IN_PAGE_BUNDLE_ASSET}.sha256`));
|
|
});
|
|
|
|
it('lists every missing asset, sorted by target then archive/checksum/bundle', async () => {
|
|
const fetchImpl = async (url) => (url.includes('windows-x64') || url.includes(BROWSER_BUNDLE_ASSET) || url.includes(IN_PAGE_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,
|
|
IN_PAGE_BUNDLE_ASSET,
|
|
`${IN_PAGE_BUNDLE_ASSET}.sha256`,
|
|
]);
|
|
});
|
|
|
|
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 + 3);
|
|
});
|
|
});
|