Skip to content

test(cli-plugins): repair failing unit test suites across packages [DX-9770]#303

Merged
netrajpatel merged 6 commits into
developmentfrom
DX-9770
Jul 22, 2026
Merged

test(cli-plugins): repair failing unit test suites across packages [DX-9770]#303
netrajpatel merged 6 commits into
developmentfrom
DX-9770

Conversation

@netrajpatel

@netrajpatel netrajpatel commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

What & why

Repairs the cli-plugins test + lint tooling, which had drifted and broken under the current toolchain (Node 24, ESLint 10, modern ts-node/mocha). Failures were toolchain / config / stale-fixture drift, not product bugs. Also brings the test/lint script setup in line with cli-core (test and lint separated).

Jira: DX-9770 (epic DX-7539) · follow-up DX-9771

1. Unit-test suite repairs

Package Result
import ✅ 1726 passing (added missing test/tsconfig.json)
branches ✅ 123 passing (tsconfig, auth-stub helper, regenerated diff/merge fixtures, process.exit stub)
seed ✅ 33 passing (rewritten vs current SDK/HttpClient + resolveJsonModule)
external-migrate ✅ 42 passing + lint clean
variants ⚠️ 32/38 (0 → 32; toolchain + fancy/spy harness + auth stubs fixed; 6 integration cases remain)

Root cause themes: Node 24 native TS type-stripping (mocha loading specs as ESM), missing/misconfigured test/tsconfig.json, stale mocks after an axios→SDK/HttpClient migration, auth-dependent command tests not stubbing the auth check, and moved @oclif/test/fancy imports.

2. Dependency security fixes

Scoped pnpm.overrides + lockfile refresh to clear the high-severity Snyk SCA findings:

  • fast-uri 3.1.3 → 3.1.4 (SNYK-JS-FASTURI-18021349)
  • ws 8.21.0 → 8.21.1 (SNYK-JS-WS-17988732 / CVE-2026-62389)

3. ESLint 10 flat-config repair (10 packages)

The eslint.config.js files crashed under ESLint 10 (imported the deprecated eslint-config-oclif-typescript v3 / referenced removed @typescript-eslint rules / unloaded plugins), so lint never ran. Standardized on a valid flat config. Because lint had been crashing, this surfaced ~1000 pre-existing source lint issues (mostly prefer-const / no-unused-vars); those rules are set to 'warn' (visible, non-blocking) with cleanup tracked in DX-9771.

4. Lint consistency (align with cli-core)

  • Decoupled test/lint: removed the posttest lint hooks from all packages, so npm test runs tests only.
  • Uniform lint command eslint "src/**/*.ts" across all 18 TS packages (was three variants).
  • Added lint to the 5 TS packages that lacked one; dropped --fix from cli-tsgen's lint so it checks rather than mutates.
  • New .github/workflows/lint.yml (mirrors cli-core) — a dedicated Lint PR gate running pnpm run lint.

All 18 TS packages now lint with 0 errors.

Out of scope (follow-ups)

  • variants 6 remaining integration test failures.
  • ~1000 lint warnings cleanup + restoring error severity — DX-9771.
  • Test-runner fragmentation (mocha/jest/vitest) and the 2 JS-only packages (bulk-publish, migrate-rte) still lacking lint — deferred to a runner-normalization follow-up.

Notes

  • No product/runtime source changed (except 3 behavior-preserving catch bindings in external-migrate).
  • There is no lint gate in CI today; lint.yml adds one.

🤖 Generated with Claude Code

https://claude.ai/code/session_01NbgqgVDTDmh6c9LwDtMEf9

…X-9770]

Fix toolchain/config/stale-fixture drift (Node 24, ESLint 10, ts-node/mocha)
that broke unit suites across several packages -- these were tooling issues,
not product bugs:

- import: add missing test/tsconfig.json (pretest TS5057) -- 1726 passing
- branches: fix test/tsconfig (TS6059), auth-stub command tests, regenerate
  stale diff/merge fixtures, stub process.exit in collectMergeSettings -- 123 passing
- seed: rewrite suite against current SDK/HttpClient impl + resolveJsonModule -- 33 passing
- external-migrate: fix 16 lint errors (ignore lib/, idiomatic rule options,
  optional catch bindings) -- lint clean, 42 passing
- variants: fix ESM/JSON toolchain, fancy/spy test harness, auth stubs, mock
  config -- 32/38 passing (6 known-remaining, see ticket)
- root: add lint script consistent with cli

No product/runtime source changed except 3 behavior-preserving catch bindings
in external-migrate. The ESLint flat-config migration (~10 packages) and the 6
remaining variants integration failures are tracked as out-of-scope follow-ups.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NbgqgVDTDmh6c9LwDtMEf9
@netrajpatel
netrajpatel requested a review from a team as a code owner July 21, 2026 10:18
@github-actions

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 56 0 25 ❌ Failed
🟡 Medium Severity 0 1 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

⚠️ Warning: The following vulnerabilities have exceeded their SLA thresholds (days since publication).

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 1 90 / 365 days ⚠️ Warning
🔵 Low 0 0 180 / 365 days ✅ Passed

ℹ️ Vulnerabilities Without Available Fixes (Informational Only)

The following vulnerabilities were detected but do not have fixes available (no upgrade or patch). These are excluded from failure thresholds:

  • Critical without fixes: 0
  • High without fixes: 0
  • Medium without fixes: 1
  • Low without fixes: 0

❌ BUILD FAILED - Security checks failed

Please review and fix the security vulnerabilities before merging.

Resolve the high-severity Snyk SCA findings blocking CI (security-sca):

- fast-uri 3.1.3 -> 3.1.4  (SNYK-JS-FASTURI-18021349, Interpretation Conflict)
- ws       8.21.0 -> 8.21.1 (SNYK-JS-WS-17988732, resource allocation / CVE-2026-62389)

Added scoped pnpm.overrides (range-limited so the unrelated ws@1.0.2 resolution
is untouched) and refreshed the lockfile. Both are patch bumps of transitive deps.

Note: inflight@1.0.6 (medium, SNYK-JS-INFLIGHT-6095116) has no published fix
(package is abandoned); left as-is.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NbgqgVDTDmh6c9LwDtMEf9
@github-actions

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 0 105 25 ✅ Passed
🟡 Medium Severity 2 58 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

⚠️ Warning: The following vulnerabilities have exceeded their SLA thresholds (days since publication).

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 1 90 / 365 days ⚠️ Warning
🔵 Low 0 0 180 / 365 days ✅ Passed

ℹ️ Vulnerabilities Without Available Fixes (Informational Only)

The following vulnerabilities were detected but do not have fixes available (no upgrade or patch). These are excluded from failure thresholds:

  • Critical without fixes: 0
  • High without fixes: 105
  • Medium without fixes: 58
  • Low without fixes: 0

⚠️ BUILD PASSED WITH WARNINGS - SLA breaches detected for issues without available fixes

Consider reviewing these vulnerabilities when fixes become available.

The eslint.config.js files in these packages crashed under ESLint 10 (flat
config): they imported the deprecated eslint-config-oclif-typescript (v3,
eslintrc-style) or referenced removed @typescript-eslint rules
(quotes/type-annotation-spacing/ban-ts-ignore) and unloaded plugins
(node/*, unicorn/*), so `lint` never actually ran.

Standardised all 10 on a valid flat config (typescript-eslint recommended +
package rules; unicorn/node registered so pre-existing inline eslint-disable
directives resolve). Packages: apps-cli, audit, branches, cli-tsgen,
content-type, export, export-to-csv, import, import-setup, query-export.

Because lint had been crashing, fixing the configs surfaced ~1000 pre-existing
source lint issues (mostly prefer-const + no-unused-vars). These were never
enforced before, so the debt-revealing rules are set to 'warn' (kept visible,
non-blocking); a follow-up ticket tracks cleaning them. There is no lint gate
in CI, so this changes no CI outcome. No product source changed.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NbgqgVDTDmh6c9LwDtMEf9
@github-actions

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 0 105 25 ✅ Passed
🟡 Medium Severity 2 58 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

⚠️ Warning: The following vulnerabilities have exceeded their SLA thresholds (days since publication).

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 1 90 / 365 days ⚠️ Warning
🔵 Low 0 0 180 / 365 days ✅ Passed

ℹ️ Vulnerabilities Without Available Fixes (Informational Only)

The following vulnerabilities were detected but do not have fixes available (no upgrade or patch). These are excluded from failure thresholds:

  • Critical without fixes: 0
  • High without fixes: 105
  • Medium without fixes: 58
  • Low without fixes: 0

⚠️ BUILD PASSED WITH WARNINGS - SLA breaches detected for issues without available fixes

Consider reviewing these vulnerabilities when fixes become available.

…orkflow [DX-9770]

Make cli-plugins consistent with cli-core (separate test and lint):

- Decouple: remove the `posttest` lint hooks from all packages so `npm test`
  runs tests only (npm's posttest was auto-running lint after every test).
- Uniform lint command `eslint "src/**/*.ts"` across all 18 TS packages
  (was three variants: `eslint .`, `eslint . --ext .ts`, `eslint src/**/*.ts`).
- Add a `lint` script to the 5 TS packages that lacked one (bootstrap,
  cli-cm-regex-validate, migration, seed, variants) + a flat config for variants.
- Drop `--fix` from cli-tsgen's lint script so lint checks rather than mutates.
- Add .github/workflows/lint.yml (mirrors cli-core's) as a dedicated PR gate
  running `pnpm run lint`.

All 18 TS packages now lint with 0 errors (warnings only; cleanup tracked in
DX-9771). No product source changed. The two JS-only packages (bulk-publish,
migrate-rte) still need a JS lint setup and are left for the test-runner
normalization follow-up.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NbgqgVDTDmh6c9LwDtMEf9
@github-actions

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 0 105 25 ✅ Passed
🟡 Medium Severity 2 58 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

⚠️ Warning: The following vulnerabilities have exceeded their SLA thresholds (days since publication).

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 1 90 / 365 days ⚠️ Warning
🔵 Low 0 0 180 / 365 days ✅ Passed

ℹ️ Vulnerabilities Without Available Fixes (Informational Only)

The following vulnerabilities were detected but do not have fixes available (no upgrade or patch). These are excluded from failure thresholds:

  • Critical without fixes: 0
  • High without fixes: 105
  • Medium without fixes: 58
  • Low without fixes: 0

⚠️ BUILD PASSED WITH WARNINGS - SLA breaches detected for issues without available fixes

Consider reviewing these vulnerabilities when fixes become available.

@netrajpatel
netrajpatel changed the base branch from main to development July 21, 2026 13:48
@github-actions

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 0 105 25 ✅ Passed
🟡 Medium Severity 2 58 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

⚠️ Warning: The following vulnerabilities have exceeded their SLA thresholds (days since publication).

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 1 90 / 365 days ⚠️ Warning
🔵 Low 0 0 180 / 365 days ✅ Passed

ℹ️ Vulnerabilities Without Available Fixes (Informational Only)

The following vulnerabilities were detected but do not have fixes available (no upgrade or patch). These are excluded from failure thresholds:

  • Critical without fixes: 0
  • High without fixes: 105
  • Medium without fixes: 58
  • Low without fixes: 0

⚠️ BUILD PASSED WITH WARNINGS - SLA breaches detected for issues without available fixes

Consider reviewing these vulnerabilities when fixes become available.

Comment thread package.json Outdated
…l [DX-9770]

Address review feedback: keep all overrides in pnpm-workspace.yaml for
consistency, instead of package.json `pnpm.overrides`.

- Move the fast-uri and ws overrides into pnpm-workspace.yaml.
- Bump the existing `fast-uri` override 3.1.3 -> 3.1.4: 3.1.3 is the
  vulnerable version (SNYK-JS-FASTURI-18021349) this PR is fixing, so the
  workspace pin is updated to the patched release.
- Add `ws: 8.21.1` (SNYK-JS-WS-17988732).
- Remove the now-redundant `pnpm.overrides` block from package.json.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NbgqgVDTDmh6c9LwDtMEf9
@github-actions

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 0 0 25 ✅ Passed
🟡 Medium Severity 0 1 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

⚠️ Warning: The following vulnerabilities have exceeded their SLA thresholds (days since publication).

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 1 90 / 365 days ⚠️ Warning
🔵 Low 0 0 180 / 365 days ✅ Passed

ℹ️ Vulnerabilities Without Available Fixes (Informational Only)

The following vulnerabilities were detected but do not have fixes available (no upgrade or patch). These are excluded from failure thresholds:

  • Critical without fixes: 0
  • High without fixes: 0
  • Medium without fixes: 1
  • Low without fixes: 0

⚠️ BUILD PASSED WITH WARNINGS - SLA breaches detected for issues without available fixes

Consider reviewing these vulnerabilities when fixes become available.

@netrajpatel
netrajpatel merged commit c8f7fe4 into development Jul 22, 2026
11 checks passed
@netrajpatel
netrajpatel deleted the DX-9770 branch July 22, 2026 08:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants