-
Notifications
You must be signed in to change notification settings - Fork 198
Description
Problem Description
What is actually happening
When Safe-Settings processes repository settings, the repository.name field incorrectly appears in dry-run diffs even though it's not configured in settings.yml.
(No other configuration at all, its a fresh install of safe-settings and our first usage in this org)
repository:
# Common defaults; adjust if your org differs
allow_merge_commit: true
allow_squash_merge: true
allow_rebase_merge: true
In concurrent processing scenarios (multiple repos via Promise.all), the wrong repo name can leak into other repos' diffs due to a race condition.
Root cause: In settings.js lines (https://github.com/github/safe-settings/pull/806/changes#diff-cb055c8e3497e3772fc444a77c4aed8483453e7580ffe7ddb223bdffaff43c57L299), Object.assign(repoConfig, {...}) mutates the shared this.config.repository object instead of creating a new object. When multiple repos are processed concurrently:
updateRepos(repoA)setsthis.config.repository.name = "repoA"then yields at anawaitupdateRepos(repoB)setsthis.config.repository.name = "repoB"then yieldsupdateRepos(repoA)resumes but now seesname: "repoB"in itsrepoConfig
Additionally, name is not in ignorableFields in repository.js, so it always appears in diffs even though Safe-Settings injects it internally.
What is the expected behavior
repository.nameshould NOT appear in dry-run diffs unless the user explicitly configures it for renaming- Each repo's config should be isolated - processing repo A should never affect repo B's settings
Error output, if available
🤖 Safe-Settings config changes detected:
Msg Plugin Repo Additions Deletions Modifications
✋ Repository "fleetlock" {} {} {
"allow_squash_merge": true,
"name": "safe-settings-admin", <-- WRONG: there should be nothing like this at all
"allow_rebase_merge": true
}
With workaround (restrictedRepos.exclude: [safe-settings-admin]), the race condition is avoided but name still appears:
"name": "fleetlock", <-- Correct repo but shouldn't appear at all
Context
Are you using the hosted instance of probot/settings or running your own?
Running our own instance via container image ghcr.io/github/safe-settings:2.1.18
If running your own instance, are you using it with github.com or GitHub Enterprise?
Version of probot/settings
safe-settings 2.1.18