惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

J
Java Code Geeks
月光博客
月光博客
D
DataBreaches.Net
云风的 BLOG
云风的 BLOG
F
Fortinet All Blogs
T
The Blog of Author Tim Ferriss
Stack Overflow Blog
Stack Overflow Blog
Blog — PlanetScale
Blog — PlanetScale
aimingoo的专栏
aimingoo的专栏
U
Unit 42
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
MyScale Blog
MyScale Blog
T
Tailwind CSS Blog
N
Netflix TechBlog - Medium
B
Blog
博客园_首页
G
Google Developers Blog
Recent Announcements
Recent Announcements
博客园 - 【当耐特】
P
Proofpoint News Feed
博客园 - 司徒正美
Hugging Face - Blog
Hugging Face - Blog
MongoDB | Blog
MongoDB | Blog
Last Week in AI
Last Week in AI

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix(qa): reject loose docker stats ceilings · openclaw/op...
vincentkoc · 2026-06-17 · via Recent Commits to openclaw:main

File tree

  • scripts/e2e/lib/docker-stats

Original file line numberDiff line numberDiff line change

@@ -3,15 +3,27 @@ import fs from "node:fs";

33

import { createInterface } from "node:readline";

44
55

const [statsFile, maxMemoryRaw, maxCpuRaw, label = "docker"] = process.argv.slice(2);

6-

const maxMemoryMiB = Number(maxMemoryRaw);

7-

const maxCpuPercent = Number(maxCpuRaw);

6+

const NON_NEGATIVE_DECIMAL_PATTERN = /^(?:0|[1-9]\d*)(?:\.\d+)?$/u;

87
9-

function assertFiniteLimit(value, raw, name) {

10-

if (!Number.isFinite(value) || value < 0) {

11-

throw new Error(`${name} must be a finite non-negative number. Got: ${JSON.stringify(raw)}`);

8+

function parseFiniteLimit(raw, name) {

9+

const text = String(raw ?? "").trim();

10+

if (!NON_NEGATIVE_DECIMAL_PATTERN.test(text)) {

11+

throw new Error(

12+

`${name} must be a finite non-negative number in decimal notation. Got: ${JSON.stringify(raw)}`,

13+

);

1214

}

15+

const parsed = Number(text);

16+

if (!Number.isFinite(parsed)) {

17+

throw new Error(

18+

`${name} must be a finite non-negative number in decimal notation. Got: ${JSON.stringify(raw)}`,

19+

);

20+

}

21+

return parsed;

1322

}

1423
24+

const maxMemoryMiB = parseFiniteLimit(maxMemoryRaw, "max memory MiB");

25+

const maxCpuPercent = parseFiniteLimit(maxCpuRaw, "max CPU percent");

26+
1527

function parseMemoryMiB(raw) {

1628

const value =

1729

String(raw || "")

@@ -87,9 +99,6 @@ let maxObservedMemoryMiB = 0;

8799

let maxObservedCpuPercent = 0;

88100

let parsedSamples = 0;

89101
90-

assertFiniteLimit(maxMemoryMiB, maxMemoryRaw, "max memory MiB");

91-

assertFiniteLimit(maxCpuPercent, maxCpuRaw, "max CPU percent");

92-
93102

await scanStatsFileLines(statsFile, (line) => {

94103

let parsed;

95104

try {

Original file line numberDiff line numberDiff line change

@@ -48,6 +48,23 @@ describe("scripts/e2e/lib/docker-stats/assert-resource-ceiling.mjs", () => {

4848
4949

expect(result.status).not.toBe(0);

5050

expect(result.stderr).toContain("max memory MiB must be a finite non-negative number");

51+
52+

const exponent = runAssert(

53+

writeStats('{"MemUsage":"128MiB / 2GiB","CPUPerc":"25.0%"}\n'),

54+

"1e3",

55+

);

56+
57+

expect(exponent.status).not.toBe(0);

58+

expect(exponent.stderr).toContain("max memory MiB must be a finite non-negative number");

59+
60+

const cpuExponent = runAssert(

61+

writeStats('{"MemUsage":"128MiB / 2GiB","CPUPerc":"25.0%"}\n'),

62+

"512",

63+

"1e3",

64+

);

65+
66+

expect(cpuExponent.status).not.toBe(0);

67+

expect(cpuExponent.stderr).toContain("max CPU percent must be a finite non-negative number");

5168

});

5269
5370

it("rejects JSON samples without parseable Docker resource fields", () => {

@@ -65,8 +82,8 @@ describe("scripts/e2e/lib/docker-stats/assert-resource-ceiling.mjs", () => {

6582

it("reports and enforces parsed Docker resource peaks", () => {

6683

const result = runAssert(

6784

writeStats('{"MemUsage":"128MiB / 2GiB","CPUPerc":"25.0%"}\n'),

68-

"256",

69-

"50",

85+

"256.5",

86+

"50.5",

7087

);

7188
7289

expect(result.status).toBe(0);