MCPcopy Create free account
hub / github.com/RtlZeroMemory/Rezi / loadCiProfile

Function loadCiProfile

scripts/run-bench-ci.mjs:119–240  ·  view source on GitHub ↗
(profilePath)

Source from the content-addressed store, hash-verified

117}
118
119function loadCiProfile(profilePath) {
120 if (!existsSync(profilePath)) {
121 fail(`profile file not found: ${profilePath}`);
122 }
123
124 const profile = readJson(profilePath, "profile");
125 if (!isPlainObject(profile)) {
126 fail("profile root must be an object");
127 }
128
129 if (profile.name !== "ci") {
130 fail('profile.name must be "ci"');
131 }
132 if (profile.suite !== "terminal") {
133 fail('profile.suite must be "terminal"');
134 }
135 if (profile.io !== "stub") {
136 fail('profile.io must be "stub" for deterministic PR CI gating');
137 }
138
139 if (typeof profile.framework !== "string" || profile.framework.length === 0) {
140 fail("profile.framework must be a non-empty string");
141 }
142 if (!Number.isInteger(profile.warmup) || profile.warmup < 0) {
143 fail("profile.warmup must be an integer >= 0");
144 }
145 if (!Number.isInteger(profile.iterations) || profile.iterations <= 0) {
146 fail("profile.iterations must be an integer > 0");
147 }
148 if (typeof profile.outputDir !== "string" || profile.outputDir.length === 0) {
149 fail("profile.outputDir must be a non-empty string");
150 }
151
152 if (!Array.isArray(profile.requiredScenarios) || profile.requiredScenarios.length === 0) {
153 fail("profile.requiredScenarios must be a non-empty array");
154 }
155 const requiredScenarios = [];
156 const seenScenarios = new Set();
157 for (const scenario of profile.requiredScenarios) {
158 if (typeof scenario !== "string" || scenario.length === 0) {
159 fail("profile.requiredScenarios entries must be non-empty strings");
160 }
161 if (!scenario.startsWith("terminal-")) {
162 fail(`profile.requiredScenarios entry must be a terminal scenario: ${scenario}`);
163 }
164 if (seenScenarios.has(scenario)) {
165 fail(`profile.requiredScenarios contains duplicate entry: ${scenario}`);
166 }
167 seenScenarios.add(scenario);
168 requiredScenarios.push(scenario);
169 }
170
171 if (!isPlainObject(profile.requiredScenarioParams)) {
172 fail("profile.requiredScenarioParams must be an object");
173 }
174 const requiredScenarioParams = new Map();
175 for (const [scenario, rawParamSets] of Object.entries(profile.requiredScenarioParams)) {
176 if (!Array.isArray(rawParamSets) || rawParamSets.length === 0) {

Callers 1

mainFunction · 0.85

Calls 10

failFunction · 0.70
readJsonFunction · 0.70
isPlainObjectFunction · 0.70
normalizeParamsFunction · 0.70
keysMethod · 0.65
hasMethod · 0.45
addMethod · 0.45
pushMethod · 0.45
entriesMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected