Vendor OpenClaw source as Adolf fork baseline
Some checks failed
ClawSweeper Dispatch / dispatch (push) Has been cancelled
CodeQL / Security High (actions) (push) Has been cancelled
CodeQL / Security High (channel-runtime-boundary) (push) Has been cancelled
CodeQL / Security High (core-auth-secrets) (push) Has been cancelled
CodeQL / Security High (mcp-process-tool-boundary) (push) Has been cancelled
CodeQL / Security High (network-ssrf-boundary) (push) Has been cancelled
CodeQL / Security High (plugin-trust-boundary) (push) Has been cancelled
CodeQL / Security High (process-exec-boundary) (push) Has been cancelled
Docs Sync Publish Repo / sync-publish-repo (push) Has been cancelled
Docs / docs (push) Has been cancelled
OpenClaw Stable Main Closeout / Resolve stable release closeout inputs (push) Has been cancelled
OpenClaw Stable Main Closeout / Verify stable main closeout (push) Has been cancelled
Workflow Sanity / no-tabs (push) Has been cancelled
Workflow Sanity / actionlint (push) Has been cancelled
Workflow Sanity / generated-doc-baselines (push) Has been cancelled
CI / runner-admission (push) Has been cancelled
CI / preflight (push) Has been cancelled
CI / security-fast (push) Has been cancelled
CI / pnpm-store-warmup (push) Has been cancelled
CI / build-artifacts (push) Has been cancelled
CI / native-i18n (push) Has been cancelled
CI / ${{ matrix.check_name }} (push) Has been cancelled
CI / ${{ matrix.checkName }} (push) Has been cancelled
CI / checks-node-compat-node22 (push) Has been cancelled
CI / check-bundled-channel-config-metadata (push) Has been cancelled
CI / check-dependencies (push) Has been cancelled
CI / check-guards (push) Has been cancelled
CI / check-lint (push) Has been cancelled
CI / check-prod-types (push) Has been cancelled
CI / check-shrinkwrap (push) Has been cancelled
CI / check-test-types (push) Has been cancelled
CI / check-additional-boundaries-a (push) Has been cancelled
CI / check-additional-boundaries-bcd (push) Has been cancelled
CI / check-additional-extension-bundled (push) Has been cancelled
CI / check-additional-extension-channels (push) Has been cancelled
CI / check-additional-extension-package-boundary (push) Has been cancelled
CI / check-additional-runtime-topology-architecture (push) Has been cancelled
CI / check-session-accessor-boundary (push) Has been cancelled
CI / check-session-transcript-reader-boundary (push) Has been cancelled
CI / check-docs (push) Has been cancelled
CI / skills-python (push) Has been cancelled
CI / macos-swift (push) Has been cancelled
CI / ios-build (push) Has been cancelled
CI / ci-timings-summary (push) Has been cancelled
Native App Locale Refresh / Refresh native fa (push) Has been cancelled
Native App Locale Refresh / Refresh native fr (push) Has been cancelled
Native App Locale Refresh / Refresh native hi (push) Has been cancelled
Native App Locale Refresh / Refresh native id (push) Has been cancelled
Native App Locale Refresh / Refresh native it (push) Has been cancelled
Native App Locale Refresh / Refresh native ja-JP (push) Has been cancelled
Control UI Locale Refresh / plan (push) Has been cancelled
Control UI Locale Refresh / Refresh ${{ matrix.locale }} (push) Has been cancelled
Control UI Locale Refresh / Commit control UI locale refresh (push) Has been cancelled
Live Media Runner Image / Build live media runner image (push) Has been cancelled
Native App Locale Refresh / Refresh native ar (push) Has been cancelled
Native App Locale Refresh / Refresh native de (push) Has been cancelled
Native App Locale Refresh / Refresh native es (push) Has been cancelled
Native App Locale Refresh / Refresh native ko (push) Has been cancelled
Native App Locale Refresh / Refresh native nl (push) Has been cancelled
Native App Locale Refresh / Refresh native pl (push) Has been cancelled
Native App Locale Refresh / Refresh native pt-BR (push) Has been cancelled
Native App Locale Refresh / Refresh native ru (push) Has been cancelled
Native App Locale Refresh / Refresh native sv (push) Has been cancelled
Native App Locale Refresh / Refresh native th (push) Has been cancelled
Native App Locale Refresh / Refresh native tr (push) Has been cancelled
Native App Locale Refresh / Refresh native uk (push) Has been cancelled
Native App Locale Refresh / Refresh native vi (push) Has been cancelled
Native App Locale Refresh / Refresh native zh-CN (push) Has been cancelled
Native App Locale Refresh / Refresh native zh-TW (push) Has been cancelled
Native App Locale Refresh / Commit native locale refresh (push) Has been cancelled
Plugin Init Scaffold Validation / Validate provider scaffold (push) Has been cancelled
Plugin NPM Release / preview_plugins_npm (push) Has been cancelled
Plugin NPM Release / Validate release publish approval (push) Has been cancelled
Plugin NPM Release / preview_plugin_pack (push) Has been cancelled
Plugin NPM Release / publish_plugins_npm (push) Has been cancelled
Sandbox Common Smoke / sandbox-common-smoke (push) Has been cancelled
Website Installer Sync / static (push) Has been cancelled
Website Installer Sync / linux-docker (push) Has been cancelled
Website Installer Sync / macos-installer (push) Has been cancelled
Website Installer Sync / windows-installer (push) Has been cancelled
Website Installer Sync / sync-website (push) Has been cancelled

Adolf is a fork/vendored clone of github.com/openclaw/openclaw (v2026.6.11),
free to diverge. Tree copied sans upstream .git; upstream remote added for
future syncs. Node pinned to 24 (.nvmrc); engines already require >=22.19.
Preserves docs/ARCHITECTURE.md.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LeqyaxJF2nbRXJtae2kNB2
This commit is contained in:
2026-07-05 09:36:54 +00:00
parent 3216769225
commit bedb527145
21108 changed files with 6010766 additions and 0 deletions

View File

@@ -0,0 +1,261 @@
// Check Changelog Attributions tests cover check changelog attributions script behavior.
import { execFileSync } from "node:child_process";
import { mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
import os from "node:os";
import path from "node:path";
import { describe, expect, it } from "vitest";
import {
findForbiddenChangelogThanks,
isForbiddenChangelogThanksHandle,
requiresExplicitHumanChangelogThanks,
} from "../../scripts/check-changelog-attributions.mjs";
const changelogScriptPath = path.join(process.cwd(), "scripts", "pr-lib", "changelog.sh");
const commonScriptPath = path.join(process.cwd(), "scripts", "pr-lib", "common.sh");
const gatesScriptPath = path.join(process.cwd(), "scripts", "pr-lib", "gates.sh");
function run(cwd: string, command: string, args: string[], env?: NodeJS.ProcessEnv): string {
return execFileSync(command, args, {
cwd,
encoding: "utf8",
env: env ? { ...process.env, ...env } : process.env,
stdio: ["ignore", "pipe", "pipe"],
}).trim();
}
function createRepoWithPrChangelogDiff(entry: string): string {
const repo = mkdtempSync(path.join(os.tmpdir(), "openclaw-changelog-credit-"));
run(repo, "git", ["init", "-q", "--initial-branch=main"]);
run(repo, "git", ["config", "user.email", "test@example.com"]);
run(repo, "git", ["config", "user.name", "Test User"]);
writeFileSync(repo + "/CHANGELOG.md", "# Changelog\n\n## Unreleased\n\n### Fixes\n\n", "utf8");
run(repo, "git", ["add", "CHANGELOG.md"]);
run(repo, "git", ["commit", "-qm", "seed"]);
const baseSha = run(repo, "git", ["rev-parse", "HEAD"]);
// validate_changelog_entry_for_pr reads origin/main...HEAD, so the test
// fixture needs a real base ref plus a feature-branch changelog diff.
run(repo, "git", ["update-ref", "refs/remotes/origin/main", baseSha]);
run(repo, "git", ["checkout", "-qb", "feature"]);
writeFileSync(
repo + "/CHANGELOG.md",
`# Changelog\n\n## Unreleased\n\n### Fixes\n\n${entry}\n`,
"utf8",
);
run(repo, "git", ["add", "CHANGELOG.md"]);
run(repo, "git", ["commit", "-qm", "add changelog entry"]);
return repo;
}
function createRepoWithChangelog(content: string): string {
const repo = mkdtempSync(path.join(os.tmpdir(), "openclaw-changelog-policy-"));
writeFileSync(repo + "/CHANGELOG.md", content, "utf8");
return repo;
}
function validateChangelogEntry(repo: string, contrib: string): string {
return run(
repo,
"bash",
[
"-c",
'source "$OPENCLAW_PR_CHANGELOG_SH"; validate_changelog_entry_for_pr 123 "$OPENCLAW_TEST_CONTRIB"',
],
{
OPENCLAW_PR_CHANGELOG_SH: changelogScriptPath,
OPENCLAW_TEST_CONTRIB: contrib,
},
);
}
function validateChangelogAttributionPolicy(repo: string): string {
return run(
repo,
"bash",
["-c", 'source "$OPENCLAW_PR_CHANGELOG_SH"; validate_changelog_attribution_policy'],
{
OPENCLAW_PR_CHANGELOG_SH: changelogScriptPath,
},
);
}
describe("check-changelog-attributions", () => {
it("flags forbidden bot, org, and maintainer thanks attributions", () => {
const content = [
"- Internal cleanup. Thanks @codex.",
"- Org-owned fix. Thanks @openclaw.",
"- Maintainer-owned fix. Thanks @steipete.",
"- Mixed credit. Thanks @contributor and @OpenClaw.",
"- Bot repair. Thanks @clawsweeper[bot].",
"- Dependency bump. Thanks @dependabot[bot].",
"- App repair. Thanks @app/clawsweeper.",
].join("\n");
expect(findForbiddenChangelogThanks(content)).toEqual([
{ line: 1, handle: "codex", text: "- Internal cleanup. Thanks @codex." },
{ line: 2, handle: "openclaw", text: "- Org-owned fix. Thanks @openclaw." },
{ line: 3, handle: "steipete", text: "- Maintainer-owned fix. Thanks @steipete." },
{ line: 4, handle: "openclaw", text: "- Mixed credit. Thanks @contributor and @OpenClaw." },
{ line: 5, handle: "clawsweeper[bot]", text: "- Bot repair. Thanks @clawsweeper[bot]." },
{ line: 6, handle: "dependabot[bot]", text: "- Dependency bump. Thanks @dependabot[bot]." },
{ line: 7, handle: "app/clawsweeper", text: "- App repair. Thanks @app/clawsweeper." },
]);
});
it("allows external contributor thanks attributions", () => {
expect(
findForbiddenChangelogThanks(
"- User-facing fix. Fixes #123. Thanks @external-contributor and @other-user.",
),
).toStrictEqual([]);
});
it("checks every thanked handle on a changelog line", () => {
expect(
findForbiddenChangelogThanks("- Mixed credit (#123). Thanks @openclaw and @alice."),
).toEqual([
{
line: 1,
handle: "openclaw",
text: "- Mixed credit (#123). Thanks @openclaw and @alice.",
},
]);
});
it("uses one attribution predicate for scanner and shell checks", () => {
expect(isForbiddenChangelogThanksHandle("")).toBe(true);
expect(isForbiddenChangelogThanksHandle("null")).toBe(true);
expect(isForbiddenChangelogThanksHandle("app/any-bot")).toBe(true);
expect(isForbiddenChangelogThanksHandle("codex")).toBe(true);
expect(isForbiddenChangelogThanksHandle("openclaw")).toBe(true);
expect(isForbiddenChangelogThanksHandle("steipete")).toBe(true);
expect(isForbiddenChangelogThanksHandle("app/clawsweeper")).toBe(true);
expect(isForbiddenChangelogThanksHandle("clawsweeper")).toBe(true);
expect(isForbiddenChangelogThanksHandle("clawsweeper[bot]")).toBe(true);
expect(isForbiddenChangelogThanksHandle("openclaw-clawsweeper")).toBe(true);
expect(isForbiddenChangelogThanksHandle("openclaw-clawsweeper[bot]")).toBe(true);
expect(isForbiddenChangelogThanksHandle("dependabot[bot]")).toBe(true);
expect(isForbiddenChangelogThanksHandle("dependabot[bot]", { strictBotHandle: true })).toBe(
true,
);
expect(isForbiddenChangelogThanksHandle("alice")).toBe(false);
expect(isForbiddenChangelogThanksHandle("human-clawsweeper-fan")).toBe(false);
expect(
isForbiddenChangelogThanksHandle("human-clawsweeper-fan", { strictBotHandle: true }),
).toBe(false);
expect(requiresExplicitHumanChangelogThanks("clawsweeper")).toBe(true);
expect(requiresExplicitHumanChangelogThanks("clawsweeper[bot]")).toBe(true);
expect(requiresExplicitHumanChangelogThanks("dependabot[bot]")).toBe(true);
expect(requiresExplicitHumanChangelogThanks("app/clawsweeper")).toBe(true);
expect(requiresExplicitHumanChangelogThanks("human-clawsweeper-fan")).toBe(false);
expect(requiresExplicitHumanChangelogThanks("steipete")).toBe(false);
expect(requiresExplicitHumanChangelogThanks("")).toBe(false);
});
it("requires explicit human thanks for bot PR changelog entries", () => {
const repo = createRepoWithPrChangelogDiff("- Bot repair (#123).");
try {
let output = "";
try {
validateChangelogEntry(repo, "dependabot[bot]");
} catch (error) {
output = String((error as { stdout?: unknown }).stdout ?? error);
}
expect(output).toContain("must include an explicit human Thanks @handle");
} finally {
rmSync(repo, { recursive: true, force: true });
}
});
it("accepts explicit human thanks for bot PR changelog entries", () => {
const repo = createRepoWithPrChangelogDiff("- Bot repair (#123). Thanks @alice.");
try {
expect(validateChangelogEntry(repo, "dependabot[bot]")).toContain("explicit thanks");
} finally {
rmSync(repo, { recursive: true, force: true });
}
});
it("keeps non-bot forbidden contributors on the no-thanks fallback", () => {
const repo = createRepoWithPrChangelogDiff("- Maintainer repair (#123).");
try {
expect(validateChangelogEntry(repo, "steipete")).toContain("skipping thanks check");
} finally {
rmSync(repo, { recursive: true, force: true });
}
});
it("runs the shell attribution policy over real changelog content", () => {
const forbiddenRepo = createRepoWithChangelog(
"# Changelog\n\n## Unreleased\n\n### Fixes\n\n- Bot repair. Thanks @dependabot[bot].\n",
);
try {
let output = "";
try {
validateChangelogAttributionPolicy(forbiddenRepo);
} catch (error) {
output = String((error as { stderr?: unknown }).stderr ?? error);
}
expect(output).toContain("Forbidden changelog thanks attribution");
expect(output).toContain("CHANGELOG.md:7 uses Thanks @dependabot[bot]");
} finally {
rmSync(forbiddenRepo, { recursive: true, force: true });
}
const allowedRepo = createRepoWithChangelog(
"# Changelog\n\n## Unreleased\n\n### Fixes\n\n- User fix. Thanks @alice.\n",
);
try {
expect(validateChangelogAttributionPolicy(allowedRepo)).toBe("");
} finally {
rmSync(allowedRepo, { recursive: true, force: true });
}
});
it("runs changelog attribution policy from prepare gates when CHANGELOG changes", () => {
const repo = createRepoWithPrChangelogDiff("- User fix (#123). Thanks @alice.");
const callsPath = path.join(repo, "calls.log");
mkdirSync(path.join(repo, ".local"));
writeFileSync(path.join(repo, ".local", "pr-meta.env"), "PR_AUTHOR=alice\n", "utf8");
try {
const output = run(
repo,
"bash",
[
"-c",
`
set -euo pipefail
source "$OPENCLAW_PR_COMMON_SH"
source "$OPENCLAW_PR_CHANGELOG_SH"
source "$OPENCLAW_PR_GATES_SH"
enter_worktree() { :; }
checkout_prep_branch() { :; }
bootstrap_deps_if_needed() { :; }
require_artifact() { [ -s "$1" ]; }
normalize_pr_changelog_entries() { printf 'normalize\\n' >>"$OPENCLAW_TEST_CALLS"; }
validate_changelog_attribution_policy() { printf 'policy\\n' >>"$OPENCLAW_TEST_CALLS"; }
validate_changelog_merge_hygiene() { printf 'merge-hygiene\\n' >>"$OPENCLAW_TEST_CALLS"; }
validate_changelog_entry_for_pr() { printf 'entry:%s:%s\\n' "$1" "$2" >>"$OPENCLAW_TEST_CALLS"; }
run_quiet_logged() { printf 'gate:%s\\n' "$1" >>"$OPENCLAW_TEST_CALLS"; }
prepare_gates 123
`,
],
{
OPENCLAW_PR_COMMON_SH: commonScriptPath,
OPENCLAW_PR_CHANGELOG_SH: changelogScriptPath,
OPENCLAW_PR_GATES_SH: gatesScriptPath,
OPENCLAW_TEST_CALLS: callsPath,
OPENCLAW_TESTBOX: "0",
},
);
const calls = readFileSync(callsPath, "utf8");
expect(output).toContain("docs_only=true");
expect(calls).toContain("normalize\npolicy\n");
} finally {
rmSync(repo, { recursive: true, force: true });
}
});
});