Reject unknown top-level qm.config.jsonc fields - #157
Closed
salluexez wants to merge 1 commit into
Closed
Conversation
There was a problem hiding this comment.
Pull request overview
This PR tightens CLI configuration validation by rejecting any unrecognized top-level keys in qm.config.jsonc, helping catch typos (e.g. org_id) early with a clear CliError.
Changes:
- Add a
VALID_TOP_LEVEL_KEYSallowlist and validateObject.keys(config)against it duringloadConfigAt()validation. - Emit a specific error message for unknown top-level fields (including the offending key).
- Add unit tests asserting unknown top-level keys are rejected.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
cli/src/config.ts |
Adds an allowlist of permitted top-level config keys and fails validation on any unknown key. |
cli/test/config.test.ts |
Adds tests ensuring configs with unknown top-level fields throw with the expected error message. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Collaborator
|
Fixed on our side, going out shortly with you as co-author on the commit 🙏 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Validate top-level keys in
qm.config.jsoncagainstVALID_TOP_LEVEL_KEYSduring CLI configuration validation, failing early with aCliErrorwhen an unrecognized field (e.g. typos like"org_id") is present. Includes unit tests incli/test/config.test.ts.Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.