Files
openhuman/scripts/ci/check-feature-forwarding.mjs
T
+16 2e5b5e7b23 Promote main → release (#5203)
Co-authored-by: YellowSnnowmann <167776381+YellowSnnowmann@users.noreply.github.com>
Co-authored-by: Steven Enamakel <31011319+senamakel@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Cyrus Gray <144336577+graycyrus@users.noreply.github.com>
Co-authored-by: Horst1993 <horst.w@gmicloud.ai>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: James Gentes <jgentes@users.noreply.github.com>
Co-authored-by: Sam <samrusani@users.noreply.github.com>
Co-authored-by: Sami Rusani <14844597+samrusani@users.noreply.github.com>
Co-authored-by: oxoxDev <164490987+oxoxDev@users.noreply.github.com>
Co-authored-by: Muhammad Ismail <78064250+myi1@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: nb213 <binyangzhu000@gmail.com>
Co-authored-by: binyangzhu000-sudo <224954946+binyangzhu000-sudo@users.noreply.github.com>
Co-authored-by: Steven Enamakel <enamakel@tinyhumans.ai>
Co-authored-by: CodeGhost21 <164498022+CodeGhost21@users.noreply.github.com>
Co-authored-by: sanil-23 <sanil@tinyhumans.ai>
Co-authored-by: M3gA-Mind <elvin@mahadao.com>
Co-authored-by: oxoxDev <oxoxdev@users.noreply.github.com>
Co-authored-by: mysma-9403 <64923976+mysma-9403@users.noreply.github.com>
Co-authored-by: mwakidenis <mwakidenice@gmail.com>
Co-authored-by: NgoQuocViet2001 <123613986+NgoQuocViet2001@users.noreply.github.com>
Co-authored-by: viet.ngo <viet.ngo@sotatek.com>
Co-authored-by: Maciej Myszkiewicz <mmyszkiewicz@bwcoders.com>
2026-07-27 11:49:45 +05:30

69 lines
2.4 KiB
JavaScript

#!/usr/bin/env node
// Fails when the desktop shell does not forward a default-ON core Cargo gate.
//
// See scripts/lib/feature-forwarding.mjs for why this exists (#4919). Short
// version: the shell sets `default-features = false` on `openhuman_core`, so
// every default-ON gate must be forwarded by hand. When someone forgets, the
// domain vanishes from the shipped app with no build error — that is how #4901
// (voice, 56 users) and #4918 (tokenjuice-treesitter) shipped.
//
// Usage: check-feature-forwarding.mjs [core-manifest] [shell-manifest]
import { readFileSync } from 'node:fs';
import { dirname, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
import {
diffForwarding,
formatReport,
INTENTIONALLY_NOT_FORWARDED,
parseCoreDefaultFeatures,
parseShellForwardedFeatures,
} from '../lib/feature-forwarding.mjs';
const REPO_ROOT = resolve(dirname(fileURLToPath(import.meta.url)), '../..');
function usage() {
return 'Usage: check-feature-forwarding.mjs [core-manifest] [shell-manifest]';
}
const [coreArg, shellArg, extra] = process.argv.slice(2);
if (coreArg === '--help' || coreArg === '-h') {
console.log(usage());
process.exit(0);
}
if (extra) {
console.error(usage());
process.exit(2);
}
const corePath = coreArg ? resolve(coreArg) : resolve(REPO_ROOT, 'Cargo.toml');
const shellPath = shellArg ? resolve(shellArg) : resolve(REPO_ROOT, 'app/src-tauri/Cargo.toml');
let coreToml;
let shellToml;
try {
coreToml = readFileSync(corePath, 'utf8');
shellToml = readFileSync(shellPath, 'utf8');
} catch (err) {
console.error(`Could not read manifests: ${err.message}`);
process.exit(2);
}
const coreDefaults = parseCoreDefaultFeatures(coreToml);
const shell = parseShellForwardedFeatures(shellToml);
// A parser that silently finds nothing would turn this guard into a rubber
// stamp, which is worse than not having it. Treat "no defaults found" as a
// failure of the check itself rather than a pass.
if (coreDefaults.length === 0) {
console.error(
`FAIL: parsed zero default features from ${corePath}.\n` +
'Either the manifest changed shape or the parser is broken — refusing to pass vacuously.'
);
process.exit(2);
}
const result = diffForwarding({ coreDefaults, shell, allowlist: INTENTIONALLY_NOT_FORWARDED });
console.log(formatReport(result, { coreDefaults, shell, allowlist: INTENTIONALLY_NOT_FORWARDED }));
process.exit(result.ok ? 0 : 1);