Skip to content

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

Description

@zyzzmohit

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions