fablo icon indicating copy to clipboard operation
fablo copied to clipboard

Bug: duplicate Fabric version validation - _verifyFabricVersion is unreachable dead code

Open zyzzmohit opened this issue 6 months ago • 1 comments

Summary

In src/commands/validate/index.ts, two separate methods validate the exact same condition - whether fabricVersion >= 2.0.0:

  1. _validateFabricVersion() (line 153) - emits a CRITICAL error -> calls process.exit(1) immediately
    1. _verifyFabricVersion() (line 562) - emits a regular ERROR -> just adds to error list Since _validateFabricVersion is called first (line 118 in validate()) and exits the process on failure, _verifyFabricVersion (called at line 150) is unreachable dead code when the version check fails.

Steps to Reproduce

  1. Set fabricVersion to "1.4.0" in a fablo-config.json
    1. Run fablo validate
    1. Observe that _validateFabricVersion fires first and exits with process.exit(1)
    1. _verifyFabricVersion never executes

Expected Behavior

There should be a single, clear Fabric version validation - not two methods checking the same thing with different severity levels.

Proposed 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.

Happy to open a PR for this fix.

zyzzmohit avatar May 29 '26 09:05 zyzzmohit

i've opened PR #764 with a fix for this issue :)

zyzzmohit avatar May 29 '26 10:05 zyzzmohit