Skip to content

[Bug] config reset contains dead code - delete operation never persisted to disk #305

Description

@zakaziko86

Bug Description

reset in src/commands/config/getSetReset.ts (lines 38-50)
contains a completely useless delete config[key] statement
that modifies a local object which is never written back to disk.

Root Cause

reset(key: string): void{constconfig=this.getConfig();// reads fresh config from diskif(!(keyinconfig)){this.failSpinner(`Configuration key '${key}' does not exist.`);return;}deleteconfig[key];// modifies LOCAL object — NEVER persistedthis.writeConfig(key,undefined);// reads ANOTHER fresh config from diskthis.succeedSpinner(`Configuration successfully reset`);}

Impact

The delete config[key] on line 47 is dead code — it modifies
a local variable that is immediately discarded. writeConfig
then reads a completely fresh copy from disk anyway. This suggests
a logic misunderstanding that could cause real bugs if someone
refactors this code expecting the delete to have been persisted.

Suggested Fix

reset(key: string): void{constconfig=this.getConfig();if(!(keyinconfig)){this.failSpinner(`Configuration key '${key}' does not exist.`);return;}// Remove dead code - writeConfig handles persistencethis.writeConfig(key,undefined);this.succeedSpinner(`Configuration successfully reset`);}

File

src/commands/config/getSetReset.ts lines 38-50
Severity: Medium

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions