Skip to content

Pass repoName to validators for repository-specific validation - #25

Closed
qin-guan wants to merge 2 commits into
main-enterprisefrom
claude/peaceful-shannon-6mh4gd
Closed

qin-guan wants to merge 2 commits into
main-enterprisefrom
claude/peaceful-shannon-6mh4gd

Conversation

@qin-guan

Copy link
Copy Markdown

Summary

This PR adds repository name context to configuration validators, enabling validators to make decisions based on which repository is being configured. This allows for repository-specific validation rules and overrides.

Key Changes

  • Validator Function Signatures: Updated all validator function constructors to include repoName as a parameter:

    • configvalidators: Changed from (baseconfig, githubContext) to (baseconfig, githubContext, repoName)
    • overridevalidators: Changed from (baseconfig, overrideconfig, githubContext) to (baseconfig, overrideconfig, githubContext, repoName)
  • MergeDeep Class:

    • Added repoName parameter to constructor
    • Stored repoName as instance variable
    • Updated all validator calls to pass repoName
  • Settings Class:

    • Updated validate() method to accept and pass repoName parameter
    • Modified getRepoConfig() to instantiate MergeDeep with repoName
    • Updated all validator invocations to include repoName
  • Array Merge Logic (mergeArrayBy.js):

    • Updated mergeBy() function signature to accept repoName
    • Passed repoName to all validator calls during array merging
  • Deployment Config (deploymentConfig.js):

    • Updated validator function constructors to include repoName parameter
  • Example Use Case (.github/repos/AllMight.yml):

    • Added repository-specific configuration for AllMight
    • Updated branch protection validator to allow only AllMight to remove branch protection entirely
    • Removed AllMight from the global exclusion list

Implementation Details

The repoName is now threaded through the entire validation pipeline, from the initial getRepoConfig() call through MergeDeep and into individual validator functions. This enables validators to implement repository-specific logic, such as allowing certain repositories to override restrictions that apply to others.

https://claude.ai/code/session_01GjGrPVikcfioKHkrBzbhxu

Stop excluding AllMight and add .github/repos/AllMight.yml with
`protection: null` on the default branch, so safe-settings deletes it.

The branches override validator dereferenced overrideconfig.protection and
had no way to tell which repo it was validating. Validators now receive the
repo name as a fourth argument, and the branches validator allows
`protection: null` only for AllMight. Every other repo still has the
review-count guardrail.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GjGrPVikcfioKHkrBzbhxu
@hacktron-safe-settings

Copy link
Copy Markdown

🤖 Safe-Settings config changes detected:

Msg Plugin Repo Additions Deletions Modifications

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-20T08:16:47.844740Z e81a669 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e81a66968f

ℹ️ 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".

Comment thread helm/safe-settings/values.yaml Outdated
Comment on lines +133 to +134
if (overrideconfig.protection === null) {
return repoName === 'AllMight'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Validate protection removal on added branches

When a non-AllMight repository overrides a branch that is absent from the global branches array, this check is never reached: mergeArrayBy invokes the override validator only when matchingIndex > -1, and Settings.childPluginsList later validates only entries from the base array. Consequently, an override such as {name: "staging", protection: null} is passed to the branches plugin, which deletes that branch's protection, despite the stated restriction that only AllMight may do so. Apply the repository restriction to added branch entries as well as matched overrides.

Useful? React with 👍 / 👎.

AllMight stays excluded from safe-settings so its branch protection can be
managed directly in GitHub.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GjGrPVikcfioKHkrBzbhxu
@qin-guan qin-guan closed this Oct 24, 2026
@qin-guan
qin-guan deleted the claude/peaceful-shannon-6mh4gd branch October 24, 2026 08:40
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