feat(FN-1754): raise global max concurrent ceiling to 10000
- Enforce 10000 upper bound in CentralCore for globalMaxConcurrent setting - Add 10000 upper bound validation in the project settings API route - Raise max ceiling in SettingsModal from previous limit to 10000 - Add route test verifying the 10000 upper bound is enforced
This commit is contained in:
@@ -1748,6 +1748,13 @@ export class CentralCore extends EventEmitter<CentralCoreEvents> {
|
||||
): Promise<GlobalConcurrencyState> {
|
||||
this.ensureInitialized();
|
||||
|
||||
if (
|
||||
updates.globalMaxConcurrent !== undefined &&
|
||||
(!Number.isFinite(updates.globalMaxConcurrent) || updates.globalMaxConcurrent < 1 || updates.globalMaxConcurrent > 10000)
|
||||
) {
|
||||
throw new Error("globalMaxConcurrent must be between 1 and 10000");
|
||||
}
|
||||
|
||||
const current = await this.getGlobalConcurrencyState();
|
||||
const updated = {
|
||||
...current,
|
||||
|
||||
@@ -1545,7 +1545,7 @@ export function SettingsModal({
|
||||
id="globalMaxConcurrent"
|
||||
type="number"
|
||||
min={1}
|
||||
max={50}
|
||||
max={10000}
|
||||
value={globalMaxConcurrent ?? ""}
|
||||
onChange={(e) => {
|
||||
const val = e.target.value;
|
||||
|
||||
@@ -669,6 +669,22 @@ describe("PUT /api/global-concurrency route handler", () => {
|
||||
expect(mockUpdateGlobalConcurrency).toHaveBeenCalledWith({ globalMaxConcurrent: 10 });
|
||||
expect((res.body as any).globalMaxConcurrent).toBe(10);
|
||||
});
|
||||
|
||||
it("rejects globalMaxConcurrent above 10000", async () => {
|
||||
const store = new MockStoreForRoutes();
|
||||
const app = createServer(store as any);
|
||||
|
||||
const res = await request(
|
||||
app,
|
||||
"PUT",
|
||||
"/api/global-concurrency",
|
||||
JSON.stringify({ globalMaxConcurrent: 10001 }),
|
||||
{ "Content-Type": "application/json" },
|
||||
);
|
||||
|
||||
expect(res.status).toBe(400);
|
||||
expect(mockUpdateGlobalConcurrency).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
// ── GET /api/projects/:id/health Route Tests ─────────────────────────────────
|
||||
|
||||
@@ -14199,8 +14199,8 @@ export function createApiRoutes(store: TaskStore, options?: ServerOptions): Rout
|
||||
*/
|
||||
router.put("/global-concurrency", async (req, res) => {
|
||||
const { globalMaxConcurrent } = req.body ?? {};
|
||||
if (!Number.isInteger(globalMaxConcurrent) || globalMaxConcurrent < 1) {
|
||||
throw badRequest("globalMaxConcurrent must be an integer >= 1");
|
||||
if (!Number.isInteger(globalMaxConcurrent) || globalMaxConcurrent < 1 || globalMaxConcurrent > 10000) {
|
||||
throw badRequest("globalMaxConcurrent must be an integer between 1 and 10000");
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user