Skip to content

fix: reject unknown YAML config keys - #22

Merged
Luqueee merged 2 commits into
mainfrom
codex/reject-unknown-config
Sep 4, 2026
Merged

Luqueee merged 2 commits into
mainfrom
codex/reject-unknown-config

Conversation

@Luqueee

@Luqueee Luqueee commented Sep 4, 2026

Copy link
Copy Markdown
Owner

Summary\n\n- decode configuration with strict YAML known-field validation\n- report the unknown key together with the config path\n- preserve defaults for partial and empty configuration files\n- add regression coverage for unknown keys and empty YAML\n\nCloses #15\n\n## Validation\n\n- 165 Go tests passed\n- race tests passed\n- go vet passed\n- gofmt and diff checks passed

@coderabbitai

coderabbitai Bot commented Sep 4, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Team

Run ID: b864c6f2-3501-4db3-bc42-5ed0232e7b10

📥 Commits

Reviewing files that changed from the base of the PR and between a407f35 and ad91729.

📒 Files selected for processing (2)
  • internal/config/config.go
  • internal/config/config_test.go

Included review availability: Your plan provides up to 8 included reviews per hour; 1 remains after this review.


📝 Summary

Summary by CodeRabbit

  • Bug Fixes

    • Configuration files now reject unrecognized top-level YAML settings and multiple YAML documents.
    • Malformed YAML errors include the configuration file path for easier troubleshooting.
    • Empty configuration files continue to load successfully while retaining default values.
  • Tests

    • Added coverage for unknown settings, multiple documents, malformed trailing content, error paths, and empty configuration behavior.

Walkthrough

Changes

Load now uses strict YAML decoding. Unknown keys, multiple documents, and malformed trailing documents return errors that include the configuration path. Empty YAML input remains valid and preserves default log level and SSH port values.

Configuration loading

Layer / File(s) Summary
Strict YAML decoding and validation
internal/config/config.go, internal/config/config_test.go
Load uses yaml.Decoder with KnownFields(true), accepts empty input, and rejects additional YAML documents. Tests cover unknown keys, empty input, multiple documents, and malformed trailing documents.

Merge Risk: ⚪ Minimal · up to ad917

Configuration loading now rejects unknown fields and trailing YAML documents while preserving defaults for empty or partial configuration. The covered behavior is ready to merge.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title uses the required Conventional Commit format and clearly states the main change: rejecting unknown YAML configuration keys.
Description check ✅ Passed The description accurately summarizes strict YAML validation, default preservation, regression tests, and validation results. It directly relates to the changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/reject-unknown-config

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

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Team

Run ID: 9e0bc350-c0a6-44cb-9fa0-d334c3769755

📥 Commits

Reviewing files that changed from the base of the PR and between 3995291 and a407f35.

📒 Files selected for processing (2)
  • internal/config/config.go
  • internal/config/config_test.go

Included review availability: Your plan provides up to 8 included reviews per hour; 2 remain after this review.

Comment thread internal/config/config.go
@Luqueee

Luqueee commented Sep 4, 2026

Copy link
Copy Markdown
Owner Author

Fixes Applied Successfully\n\nApplied the approved CodeRabbit finding.\n\nChanges:\n- trailing YAML documents are now rejected\n- malformed trailing documents include the config path in the error\n- empty YAML files continue to load defaults\n\nCommit: ad91729\n\nValidation passed: 167 tests, race tests, go vet, format checks, and diff checks.

@Luqueee
Luqueee merged commit 234f284 into main Sep 4, 2026
4 checks passed
@Luqueee
Luqueee deleted the codex/reject-unknown-config branch September 4, 2026 10:58
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.

1 participant