mirror of
https://github.com/garrytan/gstack.git
synced 2026-10-03 01:46:55 +02:00
fix(test): pin the package.json change kind in shared-input selection tests
computePaidCaseSelection read the version-only exemption from git even when changed files were injected, so the shared-input test failed on main and on version-only branches. The exemption is now an optional input; the test pins a real package.json change and covers the version-only case.
This commit is contained in:
1 parent
99058ee3cd
commit
a11b651827
2 files changed
+13
-2
No files matched your search
@@ -298,13 +298,16 @@ export function computePaidCaseSelection(options: {
|
||||
env?: NodeJS.ProcessEnv;
|
||||
rootDir?: string;
|
||||
changedFiles?: string[];
|
||||
/** Whether package.json differs from the base only in `version`; computed from git when omitted. */
|
||||
packageVersionOnly?: boolean;
|
||||
}): { selection: PaidCaseSelection; reason: string; coverage?: PrProfileSelection } {
|
||||
const env = options.env ?? process.env;
|
||||
const rootDir = options.rootDir ?? ROOT;
|
||||
const baseRef = env.EVALS_BASE || detectBaseBranch(rootDir) || 'main';
|
||||
const files = options.changedFiles ?? (env.EVALS_ALL ? [] : getChangedFiles(baseRef, rootDir));
|
||||
const all = !!env.EVALS_ALL || files.length === 0;
|
||||
const effectiveFiles = files.filter(file => options.profile !== 'pr' || file !== 'package.json' || !packageVersionOnlySinceBase(rootDir, baseRef));
|
||||
const effectiveFiles = files.filter(file => options.profile !== 'pr' || file !== 'package.json' ||
|
||||
!(options.packageVersionOnly ?? packageVersionOnlySinceBase(rootDir, baseRef)));
|
||||
const sourceAliases = options.profile === 'pr' ? existingPromptSourceAliases(effectiveFiles, rootDir) : {};
|
||||
const selectionFiles = [...new Set([...effectiveFiles, ...Object.values(sourceAliases)])];
|
||||
const select = (table: Record<string, string[]>) => all ? null
|
||||
|
||||
@@ -13,7 +13,9 @@ const periodicIds = Object.keys(E2E_TOUCHFILES).filter(id => E2E_TIERS[id] === '
|
||||
const judgeIds = Object.keys(LLM_JUDGE_TOUCHFILES).sort();
|
||||
|
||||
test.each(sharedInputs)('%s retains the full gate after native dependency registration', file => {
|
||||
const result = computePaidCaseSelection({ profile: 'pr', env: {}, changedFiles: [file] });
|
||||
// A package.json change beyond its version; the version-only exemption is
|
||||
// decided from git history and would otherwise depend on the checkout.
|
||||
const result = computePaidCaseSelection({ profile: 'pr', env: {}, changedFiles: [file], packageVersionOnly: false });
|
||||
expect(result.coverage?.mode).toBe('full-fallback');
|
||||
expect(result.selection.e2e).toEqual(gateIds);
|
||||
expect(result.selection.judges).toEqual(judgeIds);
|
||||
@@ -22,6 +24,12 @@ test.each(sharedInputs)('%s retains the full gate after native dependency regist
|
||||
expect(result.coverage?.needsFullValidation).toBe(false);
|
||||
});
|
||||
|
||||
test('a version-only package.json change does not restore the full gate', () => {
|
||||
const result = computePaidCaseSelection({ profile: 'pr', env: {}, changedFiles: ['package.json'], packageVersionOnly: true });
|
||||
expect(result.coverage?.mode).not.toBe('full-fallback');
|
||||
expect(result.coverage?.reasons.join('\n')).not.toContain('Shared runtime/build inputs restore every gate case and judge: package.json');
|
||||
});
|
||||
|
||||
test.each(sharedInputs)('%s broad policy is independent of native, judge and global maps', file => {
|
||||
for (const registration of ['none', 'broad', 'fast', 'judge', 'global']) {
|
||||
const maps: PrProfileMaps = {
|
||||
|
||||
Reference in new issue
Block a user