hyperledger-labs / hyperledger-labs/fablo
Bug: duplicate Fabric version validation - _verifyFabricVersion is unreachable dead code
- Dominant language
- Shell
- Stars
- 238
- Forks
- 113
- Avg merge
- 3d 20h
- Merged PRs (30d)
- 10
Description
## 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
2. 2. **`_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`
2. 2. Run `fablo validate`
3. 3. Observe that `_validateFabricVersion` fires first and exits with `process.exit(1)`
4. 4. `_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.
Contributor guide
Assessment
This issue has not been assessed yet.