Skip to content

Plugin SDK import scanner treats property methods and test titles as module imports #5326

Closed

Description

@koenvg

Summary

experimental_scanPublicSdkOnly reports module-import violations for property methods, property calls, and words inside test-title strings. These constructs do not import modules. This makes valid regression tests fail the public SDK dependency gate and requires unrelated naming workarounds.

Current scanner
  source text → regex matches → dependency checks
                    ↑
          Also matches method names
          and words inside strings

Expected scanner
  source syntax → actual imports → same dependency checks

Versions and environment

  • @get-bb/plugin-sdk 0.6.37, installed from npm. This was npm's latest release when reproduced. Originally observed with 0.6.15.
  • macOS 26.6.2, Node 24.15.0, npm 11.12.1.
  • BB CLI 0.45.0 on the investigation host. The reproduction runs in a clean standalone npm directory and does not use BB, an agent provider, or plugin loading.
  • Source comparison and local regression tests used commit fdd3de3b19b97e6cd1ef7300cbb54711431249d3.

Steps to reproduce

  1. Create a scratch project and install the published test entrypoint's dependencies:
mkdir sdk-scan-repro
cd sdk-scan-repro
npm init -y
npm install @get-bb/[email protected] [email protected] [email protected] [email protected]
  1. Save this as repro.mjs. The scanner only reads each planted fixture; it does not execute it.
import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { experimental_scanPublicSdkOnly as scan } from "@get-bb/plugin-sdk/testing";

const root = mkdtempSync(join(tmpdir(), "sdk-scan-fixture-"));
const cases = {
  method: "const f = { import(includeUncertain = false) { return includeUncertain; } };",
  propertyCall: "f.import(estimate);",
  propertyLiteralCall: 'f.import("@bb/db");',
  testTitle: 'it("after a confirmed import", () => {});\nit("next test", () => {});',
  renamedControl:
    'const f = { completeImport(includeUncertain = false) { return includeUncertain; } };\nf.completeImport(estimate);\nit("after a confirmed generation", () => {});\nit("next test", () => {});',
  realImports: 'import "@bb/db";\nimport "unapproved-package";',
};
try {
  writeFileSync(join(root, "package.json"), '{"name":"scanner-repro"}');
  for (const [name, source] of Object.entries(cases)) {
    writeFileSync(join(root, "example.test.ts"), source);
    console.log(name + ": " + JSON.stringify(scan(root).violations));
  }
} finally {
  rmSync(root, { recursive: true, force: true });
}
  1. Run node repro.mjs.

Expected vs actual

Expected: the first four cases and renamedControl return empty violation lists. realImports must still report both violations. No property-name, test-title, or arbitrary-string allowances should be necessary.

Actual output, reproduced on 0.6.37:

method: [{"file":"example.test.ts","specifier":"includeUncertain = false","reason":"dynamic-specifier"}]
propertyCall: [{"file":"example.test.ts","specifier":"estimate","reason":"dynamic-specifier"}]
propertyLiteralCall: [{"file":"example.test.ts","specifier":"@bb/db","reason":"private-package"}]
testTitle: [{"file":"example.test.ts","specifier":", () => {});\nit(","reason":"outside-allowlist"}]
renamedControl: []
realImports: [{"file":"example.test.ts","specifier":"@bb/db","reason":"private-package"},{"file":"example.test.ts","specifier":"unapproved-package","reason":"outside-allowlist"}]

Evidence

Observed: the clean reproduction above uses the unmodified published package. The planted package declares no dependencies and contains no module imports in the first four cases.

The source explains these matches: the specifier regexes scan raw source text, without distinguishing syntax from strings or property names. The published 0.6.37 scanner contains the same regexes.

A local, unpushed syntax-aware fix passes scanner regressions for these cases and preserves rejection of real private, outside-allowlist, outside-package, and dynamic imports. Its SDK suite passed 361 tests. An isolated quota copy with only the installed scanner replaced passed 765 tests with the original method/title names restored and no allowances for them. These are local validation results, not a released SDK adoption claim. No PR was opened.

Investigation: BBP-181, originating from BBP-177. Investigation thread.

What was ruled out

  • Not fixed by the latest published SDK, 0.6.37.
  • Not caused by plugin runtime behavior, import resolution, or the quota allowlist: it reproduces in an isolated package with default scan options.
  • Not a real private import in the property-call case: changing the method to completeImport removes the violation without changing dependencies.
  • No matching open or closed issue found for scanPublicSdkOnly, dynamic-specifier, or import false positives.

Suggested priority and effort

Medium. Plugin authors can work around this by renaming methods and test titles, but doing so hides an incorrect dependency-gate result. No data loss observed. Effort is for maintainers to assess.

Checks

  • Reproduced on the latest release.
  • Searched open and closed issues for the same problem.
  • Agent-generated report links its investigation thread.

AGENT GENERATED

Activity

  1. added theissue type on Oct 10, 2026
  2. added
    plugins
    confirmed-repro
    on Oct 10, 2026
  3. bb-slop-cop commented on Oct 10, 2026

    @bb-slop-cop
    Contributor

    🚨 SLOP COP 🚨 · new-issue-autopilot

    • Classification: Bug · Priority: Medium · Effort: Medium · Labels: plugins, confirmed-repro.
    • Report: https://get-bb.github.io/reports/issues/5326.html
    • Verdict: REPRODUCED · Confidence: high. Seven regression cases fail in two clean checkouts of trusted main; six existing scanner tests pass.
    • Root cause: Raw-source regexes mistake property methods, property calls, comments, and string contents for module imports.
    • No safe PR: A syntax-aware candidate passes all 13 scanner tests but fails the SDK's existing ESM runtime contract; its built testing entrypoint throws Dynamic require of "fs" is not supported. Resolving this requires a parser dependency or packaging decision outside the simple-fix limits. The candidate was not pushed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-reproplugins

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions