From fe759fbfbf6ba06a1bf38e6552d2a57d30b3384e Mon Sep 17 00:00:00 2001 From: Mick Cooney Date: Sun, 25 Oct 2026 11:13:05 +0000 Subject: [PATCH] test(r): split the R rename fixtures across two files and run eleven platform shards The 110 R rename fixtures run as one file that projects to about 1665 s on Windows at 15 s per test, past the 1200 s shard watchdog. Run them as two files of 55 fixtures (about 825 s each) so each fits a shard. The helper keeps defineRenameFixtureTests(language) unchanged for every language, except that it skips fixtures listed in renameOverflowIds (R only). defineRenameOverflowFixtureTests(language) registers just those, from the new rename-provider-r-part2.test.ts. The matrix test is untouched. Each file pins its partition count, and the first file proves no overflow id names a missing fixture. Shard weights, the cross-platform file list and the coverage hints now include the second file. Charging the second half adds 695 s to the Windows table, which no longer fits ten shards under the two-minute headroom the shard unit test requires (busiest shard 1133 s against a 1080 s ceiling). TOTAL in ci-tests.yml goes from 10 to 11, giving a busiest shard of 1029 s. --- .github/workflows/ci-tests.yml | 4 +- gitnexus/scripts/cross-platform-shard.ts | 3 + gitnexus/scripts/cross-platform-tests.ts | 1 + .../test/helpers/rename-integration-cases.ts | 79 ++++++++++++++++++- gitnexus/test/helpers/shard-balance.ts | 2 + .../rename-provider-r-part2.test.ts | 19 +++++ .../integration/rename-provider-r.test.ts | 19 ++++- .../test/unit/cross-platform-shard.test.ts | 27 ++++--- 8 files changed, 141 insertions(+), 13 deletions(-) create mode 100644 gitnexus/test/integration/rename-provider-r-part2.test.ts diff --git a/.github/workflows/ci-tests.yml b/.github/workflows/ci-tests.yml index f79b674ee3..7726ed6342 100644 --- a/.github/workflows/ci-tests.yml +++ b/.github/workflows/ci-tests.yml @@ -196,8 +196,8 @@ jobs: - id: gen run: | # Refreshed Windows timings leave eight shards too close to the - # 20-minute watchdog. Ten preserve headroom for runner variation. - TOTAL=10 # cross-platform (windows/macOS) shards per OS + # 20-minute watchdog. Eleven preserve headroom for runner variation. + TOTAL=11 # cross-platform (windows/macOS) shards per OS # Four coverage shards exceeded the 25-minute job limit while tests # were still passing. Split the full suite further; keep the timeout # and merged coverage thresholds unchanged. diff --git a/gitnexus/scripts/cross-platform-shard.ts b/gitnexus/scripts/cross-platform-shard.ts index 9ab042350d..bbe7745c5b 100644 --- a/gitnexus/scripts/cross-platform-shard.ts +++ b/gitnexus/scripts/cross-platform-shard.ts @@ -73,7 +73,10 @@ export const WINDOWS_WEIGHTS_SEC: Readonly> = { // old 100 s entry let this file share shard 5/10 with go and dml-gate and // exhaust the 20-minute watchdog. Weighted at the faster measurement, scaled by // 55 fixtures + the pin test over the 49 + 1 measured (6 fixtures added since). + // 110 fixtures now run as two files of 55 (rename-provider-r and -r-part2), + // each weighted as that 55-fixture file: 695 s apiece, so the packer places them apart. 'test/integration/rename-provider-r.test.ts': 695, + 'test/integration/rename-provider-r-part2.test.ts': 695, 'test/integration/rename-provider-ruby.test.ts': 100, 'test/integration/rename-provider-rust.test.ts': 75, 'test/integration/rename-provider-swift.test.ts': 300, diff --git a/gitnexus/scripts/cross-platform-tests.ts b/gitnexus/scripts/cross-platform-tests.ts index 93b11c79a6..5195d48449 100644 --- a/gitnexus/scripts/cross-platform-tests.ts +++ b/gitnexus/scripts/cross-platform-tests.ts @@ -181,6 +181,7 @@ const LBUG_NATIVE = [ 'test/integration/rename-provider-php.test.ts', 'test/integration/rename-provider-python.test.ts', 'test/integration/rename-provider-r.test.ts', + 'test/integration/rename-provider-r-part2.test.ts', 'test/integration/rename-provider-ruby.test.ts', 'test/integration/rename-provider-rust.test.ts', 'test/integration/rename-provider-swift.test.ts', diff --git a/gitnexus/test/helpers/rename-integration-cases.ts b/gitnexus/test/helpers/rename-integration-cases.ts index 71a9aae71c..7e2dc4df81 100644 --- a/gitnexus/test/helpers/rename-integration-cases.ts +++ b/gitnexus/test/helpers/rename-integration-cases.ts @@ -36,10 +36,87 @@ for (const language of (await fs.readdir(fixtures, { withFileTypes: true })).fil renameCases.sort((left, right) => (left.id < right.id ? -1 : left.id > right.id ? 1 : 0)); +// A language whose fixtures outgrow one CI shard budget moves part of them into an overflow file. +// The ids listed here are skipped by `defineRenameFixtureTests` and run only through +// `defineRenameOverflowFixtureTests`, so every fixture is registered exactly once. Keyed by id, +// so a fixture added later stays in the primary file until it is listed. +export const renameOverflowIds: ReadonlySet = new Set([ + 'r/assign-local-conditional', + 'r/assign-local-constant-call', + 'r/assign-local-function-literal-no-call', + 'r/assign-local-nested-function', + 'r/assign-local-no-call', + 'r/backtick-definition', + 'r/chained-receiver-same-name', + 'r/collision-new-name-parameter-call', + 'r/collision-unrelated-uses', + 'r/collision-variable-before', + 'r/cross-file-qualified-call', + 'r/duplicate-definition-other-file', + 'r/duplicate-definition-test-stub', + 'r/export-name-null', + 'r/function-call-chain', + 'r/generated-cpp11-wrapper', + 'r/infix-operator', + 'r/invalid-name-invalid-start', + 'r/local-def-call-before', + 'r/local-def-first', + 'r/local-def-loop', + 'r/namespace-export', + 'r/namespace-export-new-name', + 'r/namespace-pattern-new-name-exported', + 'r/namespace-pattern-word-boundary', + 'r/namespace-private-external-call', + 'r/namespace-private-local-import', + 'r/newname-pretty-dot', + 'r/parameter-body-read', + 'r/parameter-constant-default-call-and-read', + 'r/parameter-no-default-call', + 'r/r6-class', + 'r/r6-member-shadow-private', + 'r/r6-method', + 'r/rawnamespace-attached', + 'r/rc-own-method-shadow', + 'r/refclass-parent-without-member', + 'r/replacement-getter', + 'r/replacement-setter', + 'r/rprofile-mention', + 'r/s3-method', + 'r/s3-new-method-dotted-generic', + 'r/s3-new-method-name', + 'r/s4-class', + 'r/self-method-same-name', + 'r/string-built-name', + 'r/string-glue-call', + 'r/string-lookup-escaped', + 'r/string-parse-text', + 'r/superassign-in-function', + 'r/toplevel-call-before-definition-attached', + 'r/unindexed-no-mention', + 'r/unparseable-other-file', + 'r/value-reference-default', + 'r/value-reference-function-argument', +]); + // Separate files let CI distribute these real indexing runs across its shards. export function defineRenameFixtureTests(language: string): void { + defineRenameFixtureCases( + (fixture) => fixture.language === language && !renameOverflowIds.has(fixture.id), + ); +} + +// Registers only the overflow fixtures of `language`, for its second test file. +export function defineRenameOverflowFixtureTests(language: string): void { + defineRenameFixtureCases( + (fixture) => fixture.language === language && renameOverflowIds.has(fixture.id), + ); +} + +function defineRenameFixtureCases( + include: (fixture: (typeof renameCases)[number]) => boolean, +): void { describe('persisted semantic rename across providers (no mocks)', () => { - it.each(renameCases.filter((fixture) => fixture.language === language))( + it.each(renameCases.filter(include))( '$id', async ({ directory }) => { const temporary = await fs.mkdtemp(path.join(os.tmpdir(), 'rename-integration-')); diff --git a/gitnexus/test/helpers/shard-balance.ts b/gitnexus/test/helpers/shard-balance.ts index 79cd6b066e..75be8dab33 100644 --- a/gitnexus/test/helpers/shard-balance.ts +++ b/gitnexus/test/helpers/shard-balance.ts @@ -24,6 +24,8 @@ const SEQUENTIAL_COVERAGE_SECONDS: Readonly> = { 'test/integration/rename-provider-kotlin.test.ts': 93, 'test/integration/rename-provider-objective-c.test.ts': 82, 'test/integration/rename-provider-python.test.ts': 91, + 'test/integration/rename-provider-r-part2.test.ts': 122, + 'test/integration/rename-provider-r.test.ts': 120, 'test/integration/rename-provider-swift.test.ts': 72, 'test/integration/rename-provider-typescript.test.ts': 173, 'test/integration/rename-provider-vue.test.ts': 48, diff --git a/gitnexus/test/integration/rename-provider-r-part2.test.ts b/gitnexus/test/integration/rename-provider-r-part2.test.ts new file mode 100644 index 0000000000..250318d76f --- /dev/null +++ b/gitnexus/test/integration/rename-provider-r-part2.test.ts @@ -0,0 +1,19 @@ +import { describe, expect, it } from 'vitest'; +import { + defineRenameOverflowFixtureTests, + renameCases, + renameOverflowIds, +} from '../helpers/rename-integration-cases.js'; + +// Second half of the R rename fixtures, split out to fit the Windows shard budget; the first half +// and the partition pins live in rename-provider-r.test.ts. +describe('R rename overflow fixtures', () => { + it('are all discovered', () => { + const overflow = renameCases.filter( + (fixture) => fixture.language === 'r' && renameOverflowIds.has(fixture.id), + ); + expect(overflow).toHaveLength(55); + }); +}); + +defineRenameOverflowFixtureTests('r'); diff --git a/gitnexus/test/integration/rename-provider-r.test.ts b/gitnexus/test/integration/rename-provider-r.test.ts index e2a9f03fc1..66fc1b3f17 100644 --- a/gitnexus/test/integration/rename-provider-r.test.ts +++ b/gitnexus/test/integration/rename-provider-r.test.ts @@ -1,12 +1,29 @@ import { describe, expect, it } from 'vitest'; -import { defineRenameFixtureTests, renameCases } from '../helpers/rename-integration-cases.js'; +import { + defineRenameFixtureTests, + renameCases, + renameOverflowIds, +} from '../helpers/rename-integration-cases.js'; // The fixture runner builds its test list from the directory, so an empty or renamed directory // would define no test and stay green. Pin the number of R cases: adding one means raising it. +// The Windows shard budget holds about half of them, so the overflow ids run from +// rename-provider-r-part2.test.ts; the two counts below must add up to the pin. describe('R rename fixtures', () => { it('are all discovered', () => { expect(renameCases.filter((fixture) => fixture.language === 'r')).toHaveLength(110); }); + + it('split exactly between this file and the overflow file', () => { + const ids = renameCases.filter((fixture) => fixture.language === 'r').map((f) => f.id); + const overflow = ids.filter((id) => renameOverflowIds.has(id)); + expect(overflow).toHaveLength(55); + expect(ids.length - overflow.length).toBe(55); + // An overflow id naming no R fixture would silently shrink the second file. + expect([...renameOverflowIds].filter((id) => id.startsWith('r/') && !ids.includes(id))).toEqual( + [], + ); + }); }); defineRenameFixtureTests('r'); diff --git a/gitnexus/test/unit/cross-platform-shard.test.ts b/gitnexus/test/unit/cross-platform-shard.test.ts index 48650459f3..95c5153465 100644 --- a/gitnexus/test/unit/cross-platform-shard.test.ts +++ b/gitnexus/test/unit/cross-platform-shard.test.ts @@ -100,18 +100,26 @@ describe('cross-platform shard partition', () => { ).toEqual([]); }); - it('keeps the R rename suite off the shards that hold the go and dml-gate suites', () => { + it('keeps the R rename suites off the shards that hold the go and dml-gate suites', () => { // Windows CI run, 2026-10-17: rename-provider-r (599-750 s measured, 49 // persisted fixtures) was charged 100 s, so the packer put it with go and - // dml-gate and the shard exhausted the 20-minute watchdog. - const rWeight = weightOf('test/integration/rename-provider-r.test.ts'); - expect(rWeight).toBeGreaterThanOrEqual(600); + // dml-gate and the shard exhausted the 20-minute watchdog. The 110 R fixtures + // now run as two files of 55, each charged like that 55-fixture file. + const halves = [ + 'test/integration/rename-provider-r.test.ts', + 'test/integration/rename-provider-r-part2.test.ts', + ]; const shards = allShards(ALL_CROSS_PLATFORM, SHARD_TOTAL); const shardOf = (file: string) => shards.findIndex((files) => files.includes(file)); - const r = shardOf('test/integration/rename-provider-r.test.ts'); - expect(r).not.toBe(-1); - expect(shardOf('test/integration/rename-provider-go.test.ts')).not.toBe(r); - expect(shardOf('test/unit/incremental-index-extension-dml-gate.test.ts')).not.toBe(r); + for (const half of halves) { + expect(weightOf(half)).toBeGreaterThanOrEqual(600); + const r = shardOf(half); + expect(r).not.toBe(-1); + expect(shardOf('test/integration/rename-provider-go.test.ts')).not.toBe(r); + expect(shardOf('test/unit/incremental-index-extension-dml-gate.test.ts')).not.toBe(r); + } + // Both halves on one shard would project past the 1200 s watchdog at 15 s/test. + expect(shardOf(halves[0])).not.toBe(shardOf(halves[1])); }); it('covers every file exactly once, with no overlap between shards', () => { @@ -147,7 +155,8 @@ describe('cross-platform shard partition', () => { // fitting under 20 minutes left the previous partition prone to timeout. // The ceiling was 17 minutes until the R rename provider suite (measured // ~600 s on Windows) was charged its real weight: the table total grew by - // ~520 s, so even a perfect ten-way split averages ~1047 s per shard. + // ~520 s, so even a perfect ten-way split averages ~1047 s per shard; the 695 s added by splitting the R + // suite into two files made it eleven shards. expect(Math.max(...loads)).toBeLessThanOrEqual(18 * 60); });