MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / parseCiShardRequest

Function parseCiShardRequest

e2e/scripts/ci-shard.ts:103–133  ·  view source on GitHub ↗
(args: readonly string[])

Source from the content-addressed store, hash-verified

101 * Invalid input is returned as a typed value and never reaches the planner.
102 */
103export 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

Callers 2

run-ci-shard.tsFile · 0.90
ci-shard.test.tsFile · 0.90

Calls 2

parseTargetFunction · 0.85
parseIndexFunction · 0.85

Tested by

no test coverage detected