fablo icon indicating copy to clipboard operation
fablo copied to clipboard

Fix: remove duplicate Fabric version validation (_verifyFabricVersion is dead code)

Open zyzzmohit opened this issue 6 months ago • 1 comments

Summary

Removes the redundant _verifyFabricVersion() method and its call in src/commands/validate/index.ts.

Problem

Two separate methods check the exact same condition — whether fabricVersion >= 2.0.0:

  1. _validateFabricVersion() (line 153) — emits a CRITICAL error → calls process.exit(1) immediately
  2. _verifyFabricVersion() (line 562) — emits a regular ERROR → just adds to error list

Since _validateFabricVersion is called first (line 118) and exits the process on failure, _verifyFabricVersion (called at line 150) is unreachable dead code when the version check fails.

Fix

Remove the redundant _verifyFabricVersion method (lines 562-567) and its call (line 150). The existing _validateFabricVersion already handles this correctly with a CRITICAL exit.

Testing

  • ✅ npm run test:unit — 34/34 tests pass
  • ✅ npm run lint — 0 errors, 23 warnings (same as baseline minus 1 removed warning from dead code)
  • ✅ npm run build — compiles successfully

Fixes #763

zyzzmohit avatar May 29 '26 09:05 zyzzmohit

CI Note: The 2 failing checks (test-02-raft, test-04-snapshot) appear to be pre-existing flaky E2E tests unrelated to this PR they also fail on other recent PRs (e.g. #762, #761, #760)

This PR only removes 8 lines of dead code from a validation file (src/commands/validate/index.ts) and has no impact on Docker/chaincode/network configurations. All other checks (including DCO, test-main, and 5 other E2E suites) pass cleanly ✅ :)

zyzzmohit avatar May 29 '26 16:05 zyzzmohit