Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions frontend/src/create/NewAgentWorkbench.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -850,12 +850,16 @@ export function NewAgentWorkbench({
const min = Number(minInstance);
const max = Number(maxInstance);
if (
!minInstance.trim() ||
!maxInstance.trim() ||
!Number.isSafeInteger(min) ||
min < 1 ||
min < 0 ||
!Number.isSafeInteger(max) ||
max < 1
) {
setDeploymentValidationError("实例数必须为大于 0 的整数");
setDeploymentValidationError(
"最小实例数必须为大于等于 0 的整数,最大实例数必须为大于 0 的整数",
);
return;
}
if (min > max) {
Expand Down Expand Up @@ -1252,7 +1256,7 @@ export function NewAgentWorkbench({
</span>
<Input
type="number"
min={1}
min={0}
step={1}
value={minInstance}
size="xl"
Expand Down
9 changes: 6 additions & 3 deletions frontend/src/ui/ProjectPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -570,10 +570,13 @@ function validateRuntimeInstanceRange(
!maxValue.trim() ||
!Number.isSafeInteger(min) ||
!Number.isSafeInteger(max) ||
min < 1 ||
min < 0 ||
max < 1
) {
return { valid: false, error: "实例数必须为大于 0 的整数。" };
return {
valid: false,
error: "最小实例数必须为大于等于 0 的整数,最大实例数必须为大于 0 的整数。",
};
}
if (min > max) {
return { valid: false, error: "最小实例数不能大于最大实例数。" };
Expand Down Expand Up @@ -2609,7 +2612,7 @@ export function ProjectPreview({
<input
id="runtime-min-instance"
type="number"
min="1"
min="0"
step="1"
inputMode="numeric"
value={minInstance}
Expand Down
13 changes: 13 additions & 0 deletions frontend/tests/newAgentWorkbench.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,19 @@ test("final step exposes deployment progress and error feedback", () => {
workbenchSource,
/className="new-agent-workbench__instance-fields"[\s\S]*?className="new-agent-workbench__model-field-label">\s*最小实例数[\s\S]*?className="new-agent-workbench__model-field-label">\s*最大实例数/,
);
assert.match(
workbenchSource,
/最小实例数[\s\S]*?type="number"[\s\S]*?min=\{0\}[\s\S]*?value=\{minInstance\}/,
);
assert.match(workbenchSource, /min < 0/);
assert.match(
workbenchSource,
/!minInstance\.trim\(\)[\s\S]*?!maxInstance\.trim\(\)/,
);
assert.match(
workbenchSource,
/最小实例数必须为大于等于 0 的整数,最大实例数必须为大于 0 的整数/,
);
assert.match(
workbenchSource,
/role="table"[\s\S]*?aria-label="环境变量"[\s\S]*?role="columnheader">名称[\s\S]*?role="columnheader">值[\s\S]*?role="columnheader">操作/,
Expand Down
7 changes: 6 additions & 1 deletion frontend/tests/runtimeScalingDeploy.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ test("renders Runtime instance inputs with memory-aware and Sidecar-safe default
);
assert.match(
projectPreviewSource,
/id="runtime-min-instance"[\s\S]*?type="number"[\s\S]*?value=\{minInstance\}/,
/id="runtime-min-instance"[\s\S]*?type="number"[\s\S]*?min="0"[\s\S]*?value=\{minInstance\}/,
);
assert.match(
projectPreviewSource,
Expand All @@ -56,6 +56,11 @@ test("renders Runtime instance inputs with memory-aware and Sidecar-safe default
projectPreviewSource,
/disabled=\{deploying \|\| sidecarEnabled\}/,
);
assert.match(projectPreviewSource, /min < 0/);
assert.match(
projectPreviewSource,
/最小实例数必须为大于等于 0 的整数,最大实例数必须为大于 0 的整数。/,
);
assert.match(
projectPreviewSource,
/inMemorySession \|\| sidecarEnabled[\s\S]*?className="pp-instance-note"[\s\S]*?Harness Sidecar 首期仅支持单实例,Runtime 固定为 1~1[\s\S]*?为避免多实例间会话丢失,推荐将 Runtime 固定为 1~1/,
Expand Down
27 changes: 25 additions & 2 deletions tests/cli/test_studio_rbac.py
Original file line number Diff line number Diff line change
Expand Up @@ -5498,6 +5498,7 @@ async def _mark_validated_oauth_token(request: Request, call_next):
[
("in-memory", 1, 1, True, False),
("persistent", 1, 5, False, False),
("persistent", 0, 5, True, False),
("persistent", 2, 4, True, False),
("persistent", 1, 5, False, True),
],
Expand Down Expand Up @@ -5694,8 +5695,30 @@ def test_deployment_rejects_internal_runtime_environment(
@pytest.mark.parametrize(
("min_instance", "max_instance", "detail"),
[
(0, 1, "Runtime instance range must use positive integers"),
("1", 5, "Runtime instance range must use positive integers"),
(
-1,
1,
(
"Runtime minInstance must be a non-negative integer and "
"maxInstance must be a positive integer"
),
),
(
0,
0,
(
"Runtime minInstance must be a non-negative integer and "
"maxInstance must be a positive integer"
),
),
(
"1",
5,
(
"Runtime minInstance must be a non-negative integer and "
"maxInstance must be a positive integer"
),
),
(2, 1, "Runtime minInstance cannot exceed maxInstance"),
],
)
Expand Down
7 changes: 5 additions & 2 deletions veadk/cli/cli_frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -5771,12 +5771,15 @@ async def _deploy_to_agentkit(request: Request):
or isinstance(max_instance, bool)
or not isinstance(min_instance, int)
or not isinstance(max_instance, int)
or min_instance < 1
or min_instance < 0
or max_instance < 1
):
raise HTTPException(
status_code=400,
detail="Runtime instance range must use positive integers",
detail=(
"Runtime minInstance must be a non-negative integer and "
"maxInstance must be a positive integer"
),
)
if min_instance > max_instance:
raise HTTPException(
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1 +1 @@
import{U as a,C as n}from"../visualizations/mermaid/mermaid.core-BJxhX8WV.js";const t=(r,o)=>a.lang.round(n.parse(r)[o]);export{t as c};
import{U as a,C as n}from"../visualizations/mermaid/mermaid.core-BcqeQUkk.js";const t=(r,o)=>a.lang.round(n.parse(r)[o]);export{t as c};

Large diffs are not rendered by default.

Loading
Loading