[codex] Improve CI test coverage (#212)

* Improve CI test coverage

* Stabilize live E2E harness

* Shard live E2E CI

* Cache live E2E CI dependencies

* Stabilize live E2E smoke CI

* Update generated live browser bundles

* Tighten live E2E smoke runtime

* Prevent live E2E smoke hangs

* Stabilize live E2E CI coverage

* Fix stale accept DOM cleanup

* Regenerate live browser outputs
This commit is contained in:
Paul Bakaus
2026-06-08 10:39:12 -07:00
committed by GitHub
parent 1aedbcf538
commit 82801a4894
30 changed files with 2585 additions and 262 deletions
+102 -15
View File
@@ -3,10 +3,11 @@
*
* Creates real temp directories, runs the CLI, and verifies results.
*
* Pure blocks (already-installed detection, unprefix migration) run in the
* default `bun run test`. Network blocks that download the universal bundle use
* `describeNet` and run only under `bun run test:cli-e2e` (IMPECCABLE_CLI_E2E=1),
* skipping gracefully when impeccable.style is unreachable.
* Deterministic install/update coverage uses a local universal bundle override
* and runs in the default suite. Remote smoke blocks that download the
* production universal bundle use `describeRemote` and run only under
* `bun run test:cli-remote-e2e` (IMPECCABLE_CLI_REMOTE_E2E=1), skipping
* gracefully when impeccable.style is unreachable.
*/
import { describe, test, expect, beforeAll, afterAll } from 'bun:test';
import { execSync } from 'child_process';
@@ -57,6 +58,24 @@ function createFakeLinkSource(root, providers = ['.claude']) {
}
}
function createFakeUniversalBundle(root, providers = ['.claude', '.agents', '.cursor']) {
const bundleRoot = join(root, 'universal-bundle');
for (const provider of providers) {
const skillDir = join(bundleRoot, provider, 'skills', 'impeccable');
mkdirSync(join(skillDir, 'scripts'), { recursive: true });
writeFileSync(join(skillDir, 'SKILL.md'), [
'---',
'name: impeccable',
'version: 9.9.9-local',
'---',
'',
`Local deterministic bundle for ${provider}.`,
].join('\n'));
writeFileSync(join(skillDir, 'scripts', 'context.mjs'), 'console.log("local bundle context");\n');
}
return bundleRoot;
}
/**
* Simulate an install from the era when the CLI offered a command prefix: the
* skill lives at `<prefix>impeccable`. Optionally drop in a third-party skill
@@ -71,19 +90,19 @@ function createPrefixedInstall(root, { prefix = 'i-', providers = ['.claude'], f
// ─── Already-installed detection ─────────────────────────────────────────────
// Network e2e blocks (real bundle downloads from impeccable.style) run only
// under `bun run test:cli-e2e` (IMPECCABLE_CLI_E2E=1). The default `bun run test`
// skips them so it stays fast and works offline; when opted in they still skip
// gracefully if the bundle endpoint is unreachable.
const WANT_CLI_E2E = process.env.IMPECCABLE_CLI_E2E === '1';
// Remote e2e blocks (real bundle downloads from impeccable.style) run only
// under `bun run test:cli-remote-e2e` (IMPECCABLE_CLI_REMOTE_E2E=1). The default
// suite skips them so it stays offline and stable; when opted in they still
// skip gracefully if the bundle endpoint is unreachable.
const WANT_CLI_REMOTE_E2E = process.env.IMPECCABLE_CLI_REMOTE_E2E === '1';
let bundleReachable = false;
if (WANT_CLI_E2E) {
if (WANT_CLI_REMOTE_E2E) {
try {
execSync('curl -sfIL --max-time 10 https://impeccable.style/api/download/bundle/universal -o /dev/null', { stdio: 'pipe' });
bundleReachable = true;
} catch {}
}
const describeNet = (WANT_CLI_E2E && bundleReachable) ? describe : describe.skip;
const describeRemote = (WANT_CLI_REMOTE_E2E && bundleReachable) ? describe : describe.skip;
describe('skills install: already-installed detection', () => {
test('detects impeccable sentinel and bails', () => {
@@ -291,9 +310,77 @@ describe('skills: unprefix migration', () => {
});
});
// ─── Update fallback (direct download) ───────────────────────────────────────
// ─── Install/update from local universal bundle ──────────────────────────────
describeNet('skills update: refreshes from the universal bundle', () => {
describe('skills install/update: local universal bundle e2e', () => {
test('installs provider-specific skills into a fresh project', () => {
const tmp = mkdtempSync(join(tmpdir(), 'imp-test-local-install-'));
execSync('git init', { cwd: tmp });
const bundleRoot = createFakeUniversalBundle(tmp);
const output = run('skills install -y --providers=claude,codex,cursor', {
cwd: tmp,
env: { ...process.env, IMPECCABLE_BUNDLE_PATH: bundleRoot },
});
expect(output).toContain('Done!');
for (const provider of ['.claude', '.agents', '.cursor']) {
const skillDir = join(tmp, provider, 'skills', 'impeccable');
expect(existsSync(join(skillDir, 'SKILL.md'))).toBe(true);
expect(readFileSync(join(skillDir, 'SKILL.md'), 'utf8')).toContain(`Local deterministic bundle for ${provider}.`);
expect(existsSync(join(skillDir, 'scripts', 'context.mjs'))).toBe(true);
}
rmSync(tmp, { recursive: true, force: true });
}, 15000);
test('updates stale copied skills from the local bundle', () => {
const tmp = mkdtempSync(join(tmpdir(), 'imp-test-local-update-'));
execSync('git init', { cwd: tmp });
const bundleRoot = createFakeUniversalBundle(tmp, ['.claude']);
const skillDir = join(tmp, '.claude', 'skills', 'impeccable');
mkdirSync(skillDir, { recursive: true });
writeFileSync(join(skillDir, 'SKILL.md'), '---\nname: impeccable\nstale: true\n---\nOld content.\n');
const output = run('skills update -y', {
cwd: tmp,
env: { ...process.env, IMPECCABLE_BUNDLE_PATH: bundleRoot },
});
expect(output).toContain('Updated');
const content = readFileSync(join(skillDir, 'SKILL.md'), 'utf8');
expect(content).not.toContain('stale: true');
expect(content).toContain('version: 9.9.9-local');
expect(existsSync(join(skillDir, 'scripts', 'context.mjs'))).toBe(true);
rmSync(tmp, { recursive: true, force: true });
}, 15000);
test('--force reinstall over an old prefixed install lands on canonical impeccable', () => {
const tmp = mkdtempSync(join(tmpdir(), 'imp-test-local-force-'));
execSync('git init', { cwd: tmp });
const bundleRoot = createFakeUniversalBundle(tmp, ['.claude']);
const prefixed = join(tmp, '.claude', 'skills', 'i-impeccable');
mkdirSync(prefixed, { recursive: true });
writeFileSync(join(prefixed, 'SKILL.md'), '---\nname: i-impeccable\n---\n');
run('skills install -y --force --providers=claude', {
cwd: tmp,
env: { ...process.env, IMPECCABLE_BUNDLE_PATH: bundleRoot },
});
const skills = readdirSync(join(tmp, '.claude', 'skills'));
expect(skills).toContain('impeccable');
expect(skills).not.toContain('i-impeccable');
rmSync(tmp, { recursive: true, force: true });
}, 15000);
});
// ─── Update fallback (remote direct download smoke) ──────────────────────────
describeRemote('skills update: refreshes from the production universal bundle', () => {
let tmp;
beforeAll(() => {
@@ -328,9 +415,9 @@ describeNet('skills update: refreshes from the universal bundle', () => {
});
});
// ─── Full install e2e (downloads the universal bundle) ───────────────────────
// ─── Full install remote smoke (downloads the production universal bundle) ───
describeNet('skills install: full e2e (universal bundle download)', () => {
describeRemote('skills install: production universal bundle download', () => {
let tmp;
beforeAll(() => {