mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-11-30 23:47:58 +00:00
* fix(python): track attribute accesses Index constructor fields in both structure and class scope. Report known cross-language omissions consistently in context and upstream impact. Fixes #3794 * refactor(python): share field classification rules * fix(python): ignore replaced constructors * fix(python): extract fields from binding targets * fix: preserve Python field evidence (#3795) * ci: fix Windows launch and Python baselines Launch Vitest directly through Node so the native test subset avoids cmd.exe's command-length limit and preserves argument boundaries. Cover long lists, shell metacharacters, and child failures. Refresh the Python capture fingerprint for attribute reads and constructor fields. Receiver read drops increase from 31 to 34: two Path.parent reads and admin.site.urls in existing Django fixtures. Call drops remain 141; receiver-shape states and scaling budgets stay unchanged. Validation: 425 tests, typecheck, lint, and all three benchmark checks pass. Refs #3795 * test: disambiguate Python field cases Vitest truncates interpolated case names, making distinct import and pattern cases collide in the execution audit. Include the case index so each receipt has a unique identity. Validation: 420 tests passed. Reconciled all 31,481 CI test receipts after replacing the affected suite with its fresh result. --------- Co-authored-by: Gergo Magyar <gergomagyar0@gmail.com>
111 lines
3.9 KiB
TypeScript
111 lines
3.9 KiB
TypeScript
/**
|
|
* Cross-platform test runner.
|
|
*
|
|
* Runs the platform-sensitive test subset defined in cross-platform-tests.ts
|
|
* via vitest. Used by `npm run test:cross-platform` and by the CI cross-
|
|
* platform matrix (ci-tests.yml).
|
|
*
|
|
* The main vitest.config.ts is used, so lbug-db project files get
|
|
* sequential execution and other safety constraints are preserved.
|
|
*/
|
|
|
|
import { execFileSync } from 'child_process';
|
|
import fs from 'fs';
|
|
import path from 'path';
|
|
import { fileURLToPath } from 'url';
|
|
import { ALL_CROSS_PLATFORM } from './cross-platform-tests.js';
|
|
import { parseShardArg } from './shard-arg.js';
|
|
|
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
const ROOT = path.resolve(__dirname, '..');
|
|
|
|
// Verify all files exist
|
|
const missing = ALL_CROSS_PLATFORM.filter((f) => !fs.existsSync(path.resolve(ROOT, f)));
|
|
if (missing.length > 0) {
|
|
console.error(`Cross-platform test files not found (${missing.length}):`);
|
|
for (const f of missing) console.error(` ${f}`);
|
|
console.error('\nUpdate scripts/cross-platform-tests.ts if files were moved or removed.');
|
|
process.exit(1);
|
|
}
|
|
|
|
// Pass the complete subset and --shard to the configured timing sequencer.
|
|
// Every runner reads the same snapshot, selected once by CI's shard-plan job.
|
|
// Fail loud on a malformed --shard arg (mirrors the missing-files check above):
|
|
// a silently-dropped shard flag would run the full unsharded suite and re-trip
|
|
// the watchdog. Kept outside the execFileSync try/catch below so the message
|
|
// isn't swallowed by that catch's watchdog-only branch.
|
|
let shardArg: string | undefined;
|
|
try {
|
|
shardArg = parseShardArg(process.argv.slice(2));
|
|
} catch (err) {
|
|
console.error(err instanceof Error ? err.message : String(err));
|
|
process.exit(1);
|
|
}
|
|
|
|
// Preserve the 15-minute local watchdog and the 20-minute CI override.
|
|
const DEFAULT_TIMEOUT_MIN = 15;
|
|
const timeoutMinutes = Number.parseInt(
|
|
process.env.GITNEXUS_CROSS_PLATFORM_TIMEOUT_MINUTES ?? String(DEFAULT_TIMEOUT_MIN),
|
|
10,
|
|
);
|
|
const timeoutMs =
|
|
Number.isFinite(timeoutMinutes) && timeoutMinutes > 0
|
|
? timeoutMinutes * 60 * 1000
|
|
: DEFAULT_TIMEOUT_MIN * 60 * 1000;
|
|
|
|
console.log(
|
|
`Running platform-sensitive test suite (${ALL_CROSS_PLATFORM.length} files total)` +
|
|
`${shardArg ? ` (${shardArg}, balanced by timing history)` : ''}...\n`,
|
|
);
|
|
|
|
const startedAt = Date.now();
|
|
const reportName = process.env.GITNEXUS_TEST_REPORT;
|
|
if (reportName && !/^[a-zA-Z0-9_-]+\.json$/.test(reportName)) {
|
|
throw new Error('GITNEXUS_TEST_REPORT must be a JSON basename');
|
|
}
|
|
const reportArgs = reportName
|
|
? [
|
|
'--reporter=default',
|
|
'--reporter=./scripts/execution-reporter.ts',
|
|
'--reporter=blob',
|
|
`--outputFile.json=${reportName}`,
|
|
`--outputFile.blob=.vitest/blob/${reportName}`,
|
|
]
|
|
: [];
|
|
try {
|
|
execFileSync(
|
|
process.execPath,
|
|
[
|
|
fileURLToPath(new URL('../node_modules/vitest/vitest.mjs', import.meta.url)),
|
|
'run',
|
|
...ALL_CROSS_PLATFORM,
|
|
...(shardArg ? [shardArg] : []),
|
|
...reportArgs,
|
|
],
|
|
{
|
|
cwd: ROOT,
|
|
stdio: 'inherit',
|
|
timeout: timeoutMs,
|
|
},
|
|
);
|
|
} catch (err) {
|
|
// execFileSync sets `killed`/`signal` when the watchdog above kills vitest.
|
|
const e = err as {
|
|
killed?: boolean;
|
|
signal?: NodeJS.Signals | null;
|
|
status?: number | null;
|
|
code?: string;
|
|
};
|
|
if (e.killed || e.signal) {
|
|
console.error(`vitest timed out after ${Math.round(timeoutMs / 60_000)} minutes`);
|
|
}
|
|
// #2449: Windows shards have died with a bare `status: null`, empty stderr
|
|
// and nothing to triage from. Always leave the child's exit facts behind.
|
|
const elapsedSec = Math.round((Date.now() - startedAt) / 1000);
|
|
console.error(
|
|
`vitest exited abnormally: status=${e.status ?? 'null'} signal=${e.signal ?? 'none'} ` +
|
|
`killed=${e.killed === true} spawnCode=${e.code ?? 'none'} elapsed=${elapsedSec}s ` +
|
|
`budget=${Math.round(timeoutMs / 60_000)}min`,
|
|
);
|
|
process.exit(1);
|
|
}
|