Skip to content

Conversation

@ktechmidas
Copy link
Collaborator

@ktechmidas ktechmidas commented Jan 2, 2026

Issue being fixed or feature implemented

When we attempt to reset in order to redeploy, dashmate will check the config despite us sending --force

What was done?

Bypass config checks when sending a reset --hard --force

How Has This Been Tested?

Tested on devnet-tadi

Breaking Changes

None

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have added "!" to the title and described breaking changes in the corresponding section if my code contains any
  • I have made corresponding changes to the documentation if needed

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

Summary by CodeRabbit

  • New Features
    • Added a --force flag to skip configuration validation when necessary, providing flexibility for advanced users to bypass validation checks in specific scenarios.

✏️ Tip: You can customize this high-level summary in your review settings.

@github-actions github-actions bot added this to the v3.0.0 milestone Jan 2, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 2, 2026

📝 Walkthrough

Walkthrough

A skipValidation flag has been threaded through the configuration system, allowing validation to be bypassed when the --force option is provided. The flag is propagated from the command interface through the configuration repository to individual Config instances, where conditional logic gates the schema validation.

Changes

Cohort / File(s) Summary
Config Class Enhancement
packages/dashmate/src/config/Config.js
Added optional skipValidation parameter (default false) to both constructor(name, options = {}, skipValidation = false) and setOptions(options, skipValidation = false). Wrapped AJV schema validation in a conditional that skips validation when flag is true. Updated JSDoc documentation.
Configuration Repository
packages/dashmate/src/config/configFile/ConfigFileJsonRepository.js
Updated read() method signature to accept options object: read(options = {}). Extracts skipValidation from options and passes it as third argument to Config constructor.
Command-Line Interface
packages/dashmate/src/oclif/command/BaseCommand.js
Modified config file read call to pass skipValidation option derived from --force flag: configFileRepository.read({ skipValidation: Boolean(this.parsedFlags.force) }).

Sequence Diagram

sequenceDiagram
    participant User
    participant BaseCommand
    participant ConfigFileJsonRepository
    participant Config

    User->>BaseCommand: Execute command with --force flag
    BaseCommand->>ConfigFileJsonRepository: read({ skipValidation: true })
    
    rect rgba(144, 238, 144, 0.3)
    Note over ConfigFileJsonRepository: skipValidation extracted from options
    end
    
    ConfigFileJsonRepository->>Config: constructor(name, options, skipValidation: true)
    
    rect rgba(255, 182, 193, 0.3)
    Note over Config: Validation conditional check
    alt skipValidation = true
        Config->>Config: Skip AJV schema validation
    else skipValidation = false
        Config->>Config: Perform AJV validation<br/>(throw on invalid)
    end
    end
    
    Config-->>ConfigFileJsonRepository: Config instance
    ConfigFileJsonRepository-->>BaseCommand: Loaded config
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

A rabbit hops through configs with glee,
With --force to skip validation's decree,
No schemas to fuss, no errors to slow,
Just rapid-fire configs to make spirits glow! 🐰✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: adding the ability to bypass validation for a total reset operation via the --force flag.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@ktechmidas ktechmidas changed the title feat: Bypass validation for total reset feat: bypass validation for total reset Jan 2, 2026
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
packages/dashmate/src/config/Config.js (1)

130-145: Validation bypass is correctly implemented with appropriate scope limitations.

The conditional validation logic correctly allows bypassing schema checks when skipValidation is true. Importantly, the set() method (lines 78-111) still validates individual property changes, which limits the security impact to bulk loading scenarios only.

The trade-off is acceptable for the reset use case, though there's a risk that invalid configurations could cause runtime errors later.

💡 Optional: Consider logging when validation is skipped

For observability and debugging, you might want to log when validation is bypassed:

 setOptions(options, skipValidation = false) {
   const clonedOptions = lodashCloneDeep(options);

   if (!skipValidation) {
     const isValid = Config.ajv.validate(configJsonSchema, clonedOptions);

     if (!isValid) {
       const message = Config.ajv.errorsText(undefined, { dataVar: 'config' });

       throw new InvalidOptionsError(
         clonedOptions,
         Config.ajv.errors,
         message,
       );
     }
+  } else {
+    // Log or warn that validation is being skipped
+    console.warn(`Skipping validation for config '${this.name}' (--force mode)`);
   }

   this.options = clonedOptions;

This would make it more visible when configs are loaded without validation, which could help with debugging if issues arise later.

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f7ea7e6 and 53b11b7.

📒 Files selected for processing (3)
  • packages/dashmate/src/config/Config.js
  • packages/dashmate/src/config/configFile/ConfigFileJsonRepository.js
  • packages/dashmate/src/oclif/command/BaseCommand.js
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{js,jsx,ts,tsx}: Use 2-space indent for JS/TS files
Use camelCase for variables and functions in JS/TS
Use PascalCase for class names in JS/TS
Use ESLint with Airbnb/TypeScript rules for JS/TS files

Files:

  • packages/dashmate/src/config/Config.js
  • packages/dashmate/src/oclif/command/BaseCommand.js
  • packages/dashmate/src/config/configFile/ConfigFileJsonRepository.js
packages/**/!(node_modules)/**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use kebab-case for filenames within JS packages

Files:

  • packages/dashmate/src/config/Config.js
  • packages/dashmate/src/oclif/command/BaseCommand.js
  • packages/dashmate/src/config/configFile/ConfigFileJsonRepository.js
🧬 Code graph analysis (2)
packages/dashmate/src/config/Config.js (1)
packages/dashmate/src/config/obfuscateConfig.js (1)
  • clonedOptions (15-15)
packages/dashmate/src/config/configFile/ConfigFileJsonRepository.js (1)
packages/dashmate/src/config/Config.js (1)
  • Config (16-186)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Build Docker images (RS-DAPI, rs-dapi, rs-dapi) / Build RS-DAPI image
  • GitHub Check: Build Docker images (Dashmate helper, dashmate-helper, dashmate-helper) / Build Dashmate helper image
  • GitHub Check: Build JS packages / Build JS
  • GitHub Check: Rust crates security audit
🔇 Additional comments (3)
packages/dashmate/src/config/configFile/ConfigFileJsonRepository.js (1)

25-30: LGTM! Clean implementation of skipValidation parameter.

The skipValidation flag is properly threaded through the read method to Config instantiation with appropriate defaults and documentation.

Also applies to: 65-65

packages/dashmate/src/config/Config.js (1)

20-26: LGTM! Constructor properly threads skipValidation parameter.

The constructor signature is updated cleanly with appropriate defaults and documentation. The skipValidation flag is correctly passed to setOptions.

packages/dashmate/src/oclif/command/BaseCommand.js (1)

44-47: This concern is incorrect. The force flag is properly defined in command subclasses.

The force flag is correctly defined in specific command classes that use it (e.g., packages/dashmate/src/commands/reset.js line 13, packages/dashmate/src/commands/restart.js line 14, etc.). This is the correct oclif pattern—command-specific flags are defined in the command classes themselves, not in base classes. When these commands extend ConfigBaseCommand or GroupBaseCommand and define their own flags, oclif merges all parent flags, making this.parsedFlags.force available in the context where it's used. The code at lines 44-47 works as intended.

Likely an incorrect or invalid review comment.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants