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

推荐订阅源

Google DeepMind News
Google DeepMind News
G
Google Developers Blog
博客园 - 三生石上(FineUI控件)
B
Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Hugging Face - Blog
Hugging Face - Blog
C
Check Point Blog
V
V2EX
Vercel News
Vercel News
U
Unit 42
Recent Announcements
Recent Announcements
Last Week in AI
Last Week in AI
J
Java Code Geeks
WordPress大学
WordPress大学
罗磊的独立博客
I
InfoQ
阮一峰的网络日志
阮一峰的网络日志
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
小众软件
小众软件
M
MIT News - Artificial intelligence
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Apple Machine Learning Research
Apple Machine Learning Research
Martin Fowler
Martin Fowler
云风的 BLOG
云风的 BLOG

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: bypass npm freshness filters during updates · opencl...
steipete · 2026-05-17 · via Recent Commits to openclaw:main
11

import fsSync from "node:fs";

2+

import os from "node:os";

3+

import path from "node:path";

24

import { describe, expect, it, vi } from "vitest";

35

import { createNpmProjectInstallEnv } from "./npm-install-env.js";

467+

const EXPECTED_MIN_FRESHNESS_ENV = {

8+

NPM_CONFIG_BEFORE: "",

9+

NPM_CONFIG_MIN_RELEASE_AGE: "",

10+

"NPM_CONFIG_MIN-RELEASE-AGE": "",

11+

npm_config_before: "",

12+

"npm_config_min-release-age": "0",

13+

npm_config_min_release_age: "",

14+

};

15+516

describe("npm project install env", () => {

617

it("uses an absolute POSIX script shell for npm lifecycle scripts", () => {

718

const platformSpy = vi.spyOn(process, "platform", "get").mockReturnValue("linux");

@@ -14,6 +25,7 @@ describe("npm project install env", () => {

1425

PATH: "/tmp/openclaw-npm-global/bin",

1526

}),

1627

).toEqual({

28+

...EXPECTED_MIN_FRESHNESS_ENV,

1729

NPM_CONFIG_SCRIPT_SHELL: "/bin/sh",

1830

PATH: "/tmp/openclaw-npm-global/bin",

1931

npm_config_dry_run: "false",

@@ -40,6 +52,7 @@ describe("npm project install env", () => {

4052

NPM_CONFIG_SCRIPT_SHELL: "/custom/sh",

4153

}),

4254

).toEqual({

55+

...EXPECTED_MIN_FRESHNESS_ENV,

4356

NPM_CONFIG_SCRIPT_SHELL: "/custom/sh",

4457

npm_config_dry_run: "false",

4558

npm_config_fetch_retries: "5",

@@ -56,6 +69,7 @@ describe("npm project install env", () => {

5669

npm_config_script_shell: "/custom/lower-sh",

5770

}),

5871

).toEqual({

72+

...EXPECTED_MIN_FRESHNESS_ENV,

5973

npm_config_dry_run: "false",

6074

npm_config_fetch_retries: "5",

6175

npm_config_fetch_retry_maxtimeout: "120000",

@@ -71,4 +85,55 @@ describe("npm project install env", () => {

7185

platformSpy.mockRestore();

7286

}

7387

});

88+89+

it("bypasses npm release-age filters for OpenClaw-managed installs", () => {

90+

const env = createNpmProjectInstallEnv({

91+

NPM_CONFIG_BEFORE: "2026-01-01T00:00:00.000Z",

92+

NPM_CONFIG_MIN_RELEASE_AGE: "7",

93+

"npm_config_min-release-age": "7",

94+

npm_config_before: "2026-01-01T00:00:00.000Z",

95+

npm_config_min_release_age: "7",

96+

});

97+98+

expect(env.NPM_CONFIG_BEFORE).toBe("");

99+

expect(env.npm_config_before).toBe("");

100+

expect(env.NPM_CONFIG_MIN_RELEASE_AGE).toBe("");

101+

expect(env["npm_config_min-release-age"]).toBe("0");

102+

expect(env.npm_config_min_release_age).toBe("");

103+

});

104+105+

it("does not leak parent npm freshness env into explicit child envs", () => {

106+

const previousBefore = process.env.NPM_CONFIG_BEFORE;

107+

process.env.NPM_CONFIG_BEFORE = "2026-01-01T00:00:00.000Z";

108+

try {

109+

const env = createNpmProjectInstallEnv({});

110+111+

expect(env.NPM_CONFIG_BEFORE).toBe("");

112+

expect(env.npm_config_before).toBe("");

113+

expect(env["npm_config_min-release-age"]).toBe("0");

114+

} finally {

115+

if (previousBefore == null) {

116+

delete process.env.NPM_CONFIG_BEFORE;

117+

} else {

118+

process.env.NPM_CONFIG_BEFORE = previousBefore;

119+

}

120+

}

121+

});

122+123+

it("uses a current before override for explicit npm before policy", () => {

124+

const dir = fsSync.mkdtempSync(path.join(os.tmpdir(), "openclaw-npmrc-"));

125+

try {

126+

const npmrc = path.join(dir, "npmrc");

127+

fsSync.writeFileSync(npmrc, "before=2026-01-01T00:00:00.000Z\n", "utf-8");

128+

const env = createNpmProjectInstallEnv({

129+

NPM_CONFIG_USERCONFIG: npmrc,

130+

});

131+132+

expect(env["npm_config_min-release-age"]).toBe("");

133+

expect(env.npm_config_before).toMatch(/^\d{4}-\d{2}-\d{2}T/);

134+

expect(env.npm_config_before).not.toBe("2026-01-01T00:00:00.000Z");

135+

} finally {

136+

fsSync.rmSync(dir, { recursive: true, force: true });

137+

}

138+

});

74139

});