mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-08-28 19:11:03 +08:00
perf(test): start heavy batches first; make artifact upload non-fatal
The worker queue sorted by raw file weight, which is 0 for batch pseudo-files (not real paths) — batches started last, leaving one worker running a full batch after the rest of the shard drained. Sorting by shard weight starts the heaviest items first and shortens the tail. The batch-safety guard now reads member sources in parallel, and the diagnostics-only artifact upload no longer fails a green job on a runner-side network blip (seen as ECONNREFUSED on Blacksmith).
This commit is contained in:
@@ -203,6 +203,9 @@ jobs:
|
||||
|
||||
- name: Upload unit artifacts
|
||||
if: always() && matrix.settings.run
|
||||
# kilocode_change - diagnostics only: a runner-side network blip here must not
|
||||
# fail a job whose tests already passed (seen as ECONNREFUSED on Blacksmith).
|
||||
continue-on-error: true
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: unit-${{ matrix.settings.os }}-${{ matrix.settings.index }}-${{ github.run_attempt }}
|
||||
|
||||
@@ -388,13 +388,14 @@ if (patterns.length === 0 && !profile) {
|
||||
// later: bun's mock.module is process-wide and permanent, AppRuntime.dispose() kills the
|
||||
// shared runtime, and global-fetch spies observe batch-mates' traffic.
|
||||
const unsafe = [/\bmock\.module\s*\(/, /\bAppRuntime\.dispose\s*\(/, /\bspyOn\s*\(\s*globalThis\b/]
|
||||
const violations: string[] = []
|
||||
for (const members of batches.values()) {
|
||||
for (const member of members) {
|
||||
const source = await Bun.file(path.join(root, "test", member)).text()
|
||||
if (unsafe.some((pattern) => pattern.test(source))) violations.push(member)
|
||||
}
|
||||
}
|
||||
const violations = (
|
||||
await Promise.all(
|
||||
[...batches.values()].flat().map(async (member) => {
|
||||
const source = await Bun.file(path.join(root, "test", member)).text()
|
||||
return unsafe.some((pattern) => pattern.test(source)) ? member : undefined
|
||||
}),
|
||||
)
|
||||
).filter((member): member is string => member !== undefined)
|
||||
if (violations.length > 0) {
|
||||
console.error(
|
||||
[
|
||||
@@ -696,7 +697,10 @@ console.log()
|
||||
|
||||
const start = performance.now()
|
||||
const results: Result[] = []
|
||||
const queue = TestShard.order(files, weight)
|
||||
// Order by shardWeight, not weight: batch pseudo-files are not real paths, so weight()
|
||||
// gives them 0 and they would start LAST — leaving one worker running a whole batch
|
||||
// after everything else finished. Heaviest-first keeps the tail short. kilocode_change
|
||||
const queue = TestShard.order(files, shardWeight)
|
||||
|
||||
const workers = Array.from({ length: Math.min(concurrency, files.length) }, async () => {
|
||||
while (queue.length > 0 && !stopped.value) {
|
||||
|
||||
Reference in New Issue
Block a user