Skip to content

Reject unknown top-level qm.config.jsonc fields - #157

Closed
salluexez wants to merge 1 commit into
yc-software:mainfrom
salluexez:reject-unknown-config-fields
Closed

Reject unknown top-level qm.config.jsonc fields#157
salluexez wants to merge 1 commit into
yc-software:mainfrom
salluexez:reject-unknown-config-fields

Conversation

@salluexez

@salluexez salluexez commented Aug 3, 2026

Copy link
Copy Markdown

Summary

Validate top-level keys in qm.config.jsonc against VALID_TOP_LEVEL_KEYS during CLI configuration validation, failing early with a CliError when an unrecognized field (e.g. typos like "org_id") is present. Includes unit tests in cli/test/config.test.ts.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Copilot AI review requested due to automatic review settings August 3, 2026 15:39

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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_KEYS allowlist and validate Object.keys(config) against it during loadConfigAt() 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.

@16francej 16francej added code-pr Code submitted instead of an ADR bug Something isn't working labels Aug 4, 2026
@ReganBell

Copy link
Copy Markdown
Collaborator

Fixed on our side, going out shortly with you as co-author on the commit 🙏

@ReganBell ReganBell closed this Aug 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working code-pr Code submitted instead of an ADR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants