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
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:
240
test/scripts/dependency-ownership-surface-report.test.ts
Normal file
240
test/scripts/dependency-ownership-surface-report.test.ts
Normal file
@@ -0,0 +1,240 @@
|
||||
// Dependency Ownership Surface Report tests cover dependency ownership surface report script behavior.
|
||||
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
||||
import { tmpdir } from "node:os";
|
||||
import path from "node:path";
|
||||
import { afterEach, describe, expect, it } from "vitest";
|
||||
import {
|
||||
collectDependencyOwnershipSurfaceCheckErrors,
|
||||
collectDependencyOwnershipSurfaceReport,
|
||||
packageNameFromLockKey,
|
||||
parseArgs,
|
||||
renderDependencyOwnershipSurfaceMarkdownReport,
|
||||
} from "../../scripts/dependency-ownership-surface-report.mjs";
|
||||
|
||||
const tempDirs: string[] = [];
|
||||
|
||||
afterEach(() => {
|
||||
for (const dir of tempDirs.splice(0)) {
|
||||
rmSync(dir, { force: true, recursive: true });
|
||||
}
|
||||
});
|
||||
|
||||
function makeTempRepo() {
|
||||
const dir = mkdtempSync(path.join(tmpdir(), "openclaw-ownership-surface-"));
|
||||
tempDirs.push(dir);
|
||||
return dir;
|
||||
}
|
||||
|
||||
function writeRepoFile(repoRoot: string, relativePath: string, value: string) {
|
||||
const filePath = path.join(repoRoot, relativePath);
|
||||
mkdirSync(path.dirname(filePath), { recursive: true });
|
||||
writeFileSync(filePath, value, "utf8");
|
||||
}
|
||||
|
||||
describe("packageNameFromLockKey", () => {
|
||||
it("extracts scoped and unscoped names from pnpm snapshot keys", () => {
|
||||
expect(packageNameFromLockKey("@scope/pkg@1.2.3(peer@1.0.0)")).toBe("@scope/pkg");
|
||||
expect(packageNameFromLockKey("left-pad@1.3.0")).toBe("left-pad");
|
||||
});
|
||||
});
|
||||
|
||||
describe("parseArgs", () => {
|
||||
it("rejects missing markdown artifact paths", () => {
|
||||
expect(() => parseArgs(["--markdown"])).toThrow("--markdown requires a value");
|
||||
expect(() => parseArgs(["--markdown", "--json"])).toThrow("--markdown requires a value");
|
||||
expect(() => parseArgs(["--markdown", "-h"])).toThrow("--markdown requires a value");
|
||||
expect(() => parseArgs(["--markdown", ""])).toThrow("--markdown requires a value");
|
||||
});
|
||||
|
||||
it("keeps json as a boolean or optional artifact path", () => {
|
||||
expect(parseArgs(["--json"])).toMatchObject({
|
||||
asJson: true,
|
||||
jsonPath: null,
|
||||
});
|
||||
expect(parseArgs(["--json", "report.json"])).toMatchObject({
|
||||
asJson: true,
|
||||
jsonPath: "report.json",
|
||||
});
|
||||
expect(() => parseArgs(["--json", "-h"])).toThrow("Unsupported argument: -h");
|
||||
});
|
||||
|
||||
it("rejects duplicate report artifact options", () => {
|
||||
expect(() => parseArgs(["--json", "first.json", "--json", "second.json"])).toThrow(
|
||||
"--json was provided more than once.",
|
||||
);
|
||||
expect(() =>
|
||||
parseArgs(["--markdown", "first.md", "--markdown", "second.md"]),
|
||||
).toThrow("--markdown was provided more than once.");
|
||||
});
|
||||
});
|
||||
|
||||
describe("collectDependencyOwnershipSurfaceReport", () => {
|
||||
it("reports root dependency reachability, install-surface packages, and ownership metadata gaps", () => {
|
||||
const repoRoot = makeTempRepo();
|
||||
writeRepoFile(
|
||||
repoRoot,
|
||||
"package.json",
|
||||
JSON.stringify({
|
||||
dependencies: {
|
||||
"core-lib": "1.0.0",
|
||||
"missing-owner": "2.0.0",
|
||||
},
|
||||
}),
|
||||
);
|
||||
writeRepoFile(
|
||||
repoRoot,
|
||||
"pnpm-lock.yaml",
|
||||
`
|
||||
lockfileVersion: '9.0'
|
||||
importers:
|
||||
.:
|
||||
dependencies:
|
||||
core-lib:
|
||||
specifier: 1.0.0
|
||||
version: 1.0.0
|
||||
missing-owner:
|
||||
specifier: 2.0.0
|
||||
version: 2.0.0
|
||||
alias-domexception:
|
||||
specifier: npm:@nolyfill/domexception@1.0.0
|
||||
version: npm:@nolyfill/domexception@1.0.0
|
||||
packages:
|
||||
core-lib@1.0.0: {}
|
||||
transitive-native@1.0.0:
|
||||
requiresBuild: true
|
||||
missing-owner@2.0.0: {}
|
||||
'@nolyfill/domexception@1.0.0': {}
|
||||
snapshots:
|
||||
core-lib@1.0.0:
|
||||
dependencies:
|
||||
transitive-native: 1.0.0
|
||||
alias-domexception: '@nolyfill/domexception@1.0.0'
|
||||
transitive-native@1.0.0: {}
|
||||
missing-owner@2.0.0: {}
|
||||
'@nolyfill/domexception@1.0.0': {}
|
||||
`,
|
||||
);
|
||||
writeRepoFile(
|
||||
repoRoot,
|
||||
"scripts/lib/dependency-ownership.json",
|
||||
JSON.stringify({
|
||||
schemaVersion: 1,
|
||||
dependencies: {
|
||||
"alias-domexception": {
|
||||
owner: "core:test",
|
||||
class: "core-runtime",
|
||||
risk: ["compat"],
|
||||
},
|
||||
"core-lib": { owner: "core:test", class: "core-runtime", risk: ["network"] },
|
||||
},
|
||||
}),
|
||||
);
|
||||
writeRepoFile(repoRoot, "src/index.ts", 'import "core-lib";\n');
|
||||
|
||||
const report = collectDependencyOwnershipSurfaceReport({ repoRoot });
|
||||
|
||||
expect(report.summary).toEqual({
|
||||
buildRiskPackageCount: 1,
|
||||
importerCount: 1,
|
||||
lockfilePackageCount: 4,
|
||||
rootClosurePackageCount: 4,
|
||||
rootDirectDependencyCount: 3,
|
||||
rootOwnershipRecordCount: 2,
|
||||
});
|
||||
expect(report.ownershipGaps).toEqual(["missing-owner"]);
|
||||
expect(report.topRootDependencyCones[0]).toEqual({
|
||||
class: "core-runtime",
|
||||
closureSize: 3,
|
||||
missingSnapshotKeys: [],
|
||||
name: "core-lib",
|
||||
owner: "core:test",
|
||||
resolved: "1.0.0",
|
||||
risk: ["network"],
|
||||
section: "dependencies",
|
||||
sourceCategory: "unreferenced",
|
||||
sourceFileCount: 0,
|
||||
sourceSections: [],
|
||||
specifier: "1.0.0",
|
||||
});
|
||||
expect(collectDependencyOwnershipSurfaceCheckErrors(report)).toEqual([
|
||||
"root dependency 'missing-owner' is missing from scripts/lib/dependency-ownership.json",
|
||||
]);
|
||||
|
||||
const markdown = renderDependencyOwnershipSurfaceMarkdownReport(report);
|
||||
expect(markdown).toContain("# Dependency Ownership and Install Surface Report");
|
||||
expect(markdown).toContain("## Target");
|
||||
expect(markdown).toContain("## Scope");
|
||||
expect(markdown).toContain("It does not query npm advisories");
|
||||
expect(markdown).toContain("## Root Dependencies Missing Ownership Metadata");
|
||||
expect(markdown).toContain("`missing-owner`");
|
||||
expect(markdown).toContain("## Root Dependencies By Resolved Transitive Package Count");
|
||||
expect(markdown).toContain("`core-lib`: 3 resolved transitive packages");
|
||||
expect(markdown).toContain("## Workspace Packages With The Most Dependencies");
|
||||
expect(markdown).toContain("3 direct dependencies");
|
||||
expect(markdown).not.toContain("dependencys");
|
||||
expect(markdown).toContain("## Packages With Install-Time Or Platform-Specific Behavior");
|
||||
expect(markdown).toContain("`transitive-native@1.0.0`: requires build");
|
||||
expect(markdown).not.toContain("# Dependency Risk Report");
|
||||
expect(markdown).not.toContain("Ownership gaps");
|
||||
expect(markdown).not.toContain("Largest root dependency cones");
|
||||
expect(markdown).not.toContain("## Root Dependencies With The Most Transitive Packages");
|
||||
});
|
||||
|
||||
it("does not mark plugin importer dependencies as stale ownership records", () => {
|
||||
const repoRoot = makeTempRepo();
|
||||
writeRepoFile(
|
||||
repoRoot,
|
||||
"package.json",
|
||||
JSON.stringify({
|
||||
dependencies: {
|
||||
"core-lib": "1.0.0",
|
||||
},
|
||||
}),
|
||||
);
|
||||
writeRepoFile(
|
||||
repoRoot,
|
||||
"pnpm-lock.yaml",
|
||||
`
|
||||
lockfileVersion: '9.0'
|
||||
importers:
|
||||
.:
|
||||
dependencies:
|
||||
core-lib:
|
||||
specifier: 1.0.0
|
||||
version: 1.0.0
|
||||
extensions/web-readability:
|
||||
dependencies:
|
||||
plugin-readable:
|
||||
specifier: 2.0.0
|
||||
version: 2.0.0
|
||||
packages:
|
||||
core-lib@1.0.0: {}
|
||||
plugin-readable@2.0.0: {}
|
||||
snapshots:
|
||||
core-lib@1.0.0: {}
|
||||
plugin-readable@2.0.0: {}
|
||||
`,
|
||||
);
|
||||
writeRepoFile(
|
||||
repoRoot,
|
||||
"scripts/lib/dependency-ownership.json",
|
||||
JSON.stringify({
|
||||
schemaVersion: 1,
|
||||
dependencies: {
|
||||
"core-lib": { owner: "core:test", class: "core-runtime", risk: ["network"] },
|
||||
"plugin-readable": {
|
||||
owner: "plugin:web-readability",
|
||||
class: "plugin-runtime",
|
||||
risk: ["html"],
|
||||
},
|
||||
"removed-lib": { owner: "core:test", class: "core-runtime", risk: ["unused"] },
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
||||
const report = collectDependencyOwnershipSurfaceReport({ repoRoot });
|
||||
|
||||
expect(report.ownershipGaps).toStrictEqual([]);
|
||||
expect(report.staleOwnershipRecords).toEqual(["removed-lib"]);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user