openclaw - 💡(How to fix) Fix Exported utility functions in check-cli-bootstrap-imports.mjs have no unit tests [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#83919Fetched 2026-05-20 03:46:42
View on GitHub
Comments
1
Participants
2
Timeline
6
Reactions
1
Timeline (top)
closed ×1commented ×1labeled ×1mentioned ×1

Error Message

Unit test using an in-memory fs stub: assert that a source string 'import foo from "some-package"' triggers an external-import error, while 'import foo from "./local.js"' does not; assert that a chunk file above DEFAULT_GATEWAY_RUN_CHUNK_MAX_BYTES triggers a budget error.

Fix Action

Fix / Workaround

Severity: medium / Confidence: high / Category: test-gap Triage: test-gap Detected against: openclaw v2026.5.18 (latest stable at time of scan, 2026-05-18) Tooling: clawpatch 0.3.0 + acpx/claude-sonnet-4-5 via Brad Mills protocol


Standardized clawpatch finding. Persistent in v2026.5.18 (not resolved by upgrading from v2026.5.12). Finding ID: fnd_sig-feat-cli-command-23edfe2554-_0d5304ee94.

Code Example

export function listStaticImportSpecifiers(source) {
  return [...source.matchAll(STATIC_IMPORT_RE)].map((match) => match.groups?.specifier ?? "");
}

---

export function collectCliBootstrapExternalImportErrors(params = {}) {

---

export function collectGatewayRunChunkBudgetErrors(params = {}) {
RAW_BUFFERClick to expand / collapse

Severity: medium / Confidence: high / Category: test-gap Triage: test-gap Detected against: openclaw v2026.5.18 (latest stable at time of scan, 2026-05-18) Tooling: clawpatch 0.3.0 + acpx/claude-sonnet-4-5 via Brad Mills protocol

Evidence

  • scripts/check-cli-bootstrap-imports.mjs:60-65 (listStaticImportSpecifiers)
export function listStaticImportSpecifiers(source) {
  return [...source.matchAll(STATIC_IMPORT_RE)].map((match) => match.groups?.specifier ?? "");
}
  • scripts/check-cli-bootstrap-imports.mjs:96-120 (collectCliBootstrapExternalImportErrors)
export function collectCliBootstrapExternalImportErrors(params = {}) {
  • scripts/check-cli-bootstrap-imports.mjs:140-210 (collectGatewayRunChunkBudgetErrors)
export function collectGatewayRunChunkBudgetErrors(params = {}) {

Reasoning

The three exported functions (listStaticImportSpecifiers, collectCliBootstrapExternalImportErrors, collectGatewayRunChunkBudgetErrors) guard against cold-path imports entering the CLI bootstrap bundle and enforce a byte budget on the gateway-run chunk — both are build-correctness invariants. They accept injectable fs and params overrides, making them straightforward to unit-test in isolation. Yet no test files exist for them. A regression in STATIC_IMPORT_RE, the forbidden-import list, or the chunk budget constant would go undetected until CI catches it post-build.

Recommendation

Add a colocated scripts/check-cli-bootstrap-imports.test.mjs (or .test.ts) covering: (1) listStaticImportSpecifiers with representative import/export forms, (2) collectCliBootstrapExternalImportErrors with an fs mock returning a source file containing both relative and external specifiers, (3) collectGatewayRunChunkBudgetErrors with synthetic chunk content that hits and misses the marker sets and byte budget.

Why existing tests miss this

The feature JSON confirms tests: [] for this feature group. The script is only exercised as part of a full pnpm build run, which does not feed back into the unit-test suite.

Suggested regression test

Unit test using an in-memory fs stub: assert that a source string 'import foo from "some-package"' triggers an external-import error, while 'import foo from "./local.js"' does not; assert that a chunk file above DEFAULT_GATEWAY_RUN_CHUNK_MAX_BYTES triggers a budget error.

Minimum fix scope

Add scripts/check-cli-bootstrap-imports.test.mjs covering the three exported functions with fs-mocked inputs for both passing and failing cases.


Standardized clawpatch finding. Persistent in v2026.5.18 (not resolved by upgrading from v2026.5.12). Finding ID: fnd_sig-feat-cli-command-23edfe2554-_0d5304ee94.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix Exported utility functions in check-cli-bootstrap-imports.mjs have no unit tests [1 comments, 2 participants]