Skip to content

fix: reject unknown structured collection keys#55

Merged
Azhovan merged 3 commits into
mainfrom
fix/strict-collection-unknown-keys
May 11, 2026
Merged

fix: reject unknown structured collection keys#55
Azhovan merged 3 commits into
mainfrom
fix/strict-collection-unknown-keys

Conversation

@asadijabar
Copy link
Copy Markdown
Collaborator

Summary

  • reject unknown nested keys inside direct structured map values in strict mode
  • reject unknown nested keys inside structured slice elements in strict mode
  • add regression coverage for both strict-mode bypasses

Validation

  • go test ./... -run TestLoad_NestedCollections -count=1
  • make ci (format, vet, and tests passed; lint failed because local golangci-lint was built with Go 1.25 while the active Go toolchain includes Go 1.26 files requiring a newer linter build)

Copilot AI review requested due to automatic review settings May 11, 2026 12:18
Copy link
Copy Markdown

Copilot AI left a comment

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 strict-mode validation to reject unknown keys that appear inside directly provided structured collection values (e.g., map[string]Struct values provided as nested maps, and []Struct elements provided as nested objects), and adds regression tests to prevent strict-mode bypasses for these cases.

Changes:

  • Extend strict-mode unknown-key detection to recursively validate nested keys inside structured struct, []struct, and map[string]struct values provided directly in source data.
  • Add helper functions to collect valid key→type mappings and to recursively validate nested structured values.
  • Add regression tests covering unknown nested keys in direct map values and slice elements under strict mode.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
loader.go Adds strict-mode recursion to detect unknown nested keys inside structured collection values.
loader_test.go Adds regression tests ensuring strict mode rejects unknown nested keys in direct map values and slice elements.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread loader.go Outdated
Comment thread loader.go
@Azhovan
Copy link
Copy Markdown
Owner

Azhovan commented May 11, 2026

@codex

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0fafc07413

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread binding.go Outdated
@Azhovan Azhovan merged commit 442e857 into main May 11, 2026
5 checks passed
@github-actions github-actions Bot deleted the fix/strict-collection-unknown-keys branch May 11, 2026 14: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.

3 participants