(args: readonly string[])
| 101 | * Invalid input is returned as a typed value and never reaches the planner. |
| 102 | */ |
| 103 | export const parseCiShardRequest = (args: readonly string[]): ParseCiShardRequestResult => { |
| 104 | if (args.length !== 2) { |
| 105 | return { |
| 106 | ok: false, |
| 107 | error: new CiShardInputError( |
| 108 | "usage: bun scripts/run-ci-shard.ts <cloud|selfhost|local> <shard-index>", |
| 109 | ), |
| 110 | }; |
| 111 | } |
| 112 | |
| 113 | const target = parseTarget(args[0]); |
| 114 | if (target === undefined) { |
| 115 | return { |
| 116 | ok: false, |
| 117 | error: new CiShardInputError(`unsupported e2e target: ${args[0]}`), |
| 118 | }; |
| 119 | } |
| 120 | |
| 121 | const index = parseIndex(args[1]); |
| 122 | const count = CI_SHARD_COUNTS[target]; |
| 123 | if (index === undefined || index > count) { |
| 124 | return { |
| 125 | ok: false, |
| 126 | error: new CiShardInputError( |
| 127 | `shard index for ${target} must be an integer from 1 through ${count}`, |
| 128 | ), |
| 129 | }; |
| 130 | } |
| 131 | |
| 132 | return { ok: true, value: { target, index, count } }; |
| 133 | }; |
| 134 | |
| 135 | /** |
| 136 | * Discovers the complete set of test files owned by a target, relative to the |
no test coverage detected