Skip to content

feat(logging): add info-level logging for applied configuration changes#1021

Open
tdabasinskas wants to merge 1 commit into
github-community-projects:main-enterprisefrom
datolabs-io:feat/log-applied-changes
Open

feat(logging): add info-level logging for applied configuration changes#1021
tdabasinskas wants to merge 1 commit into
github-community-projects:main-enterprisefrom
datolabs-io:feat/log-applied-changes

Conversation

@tdabasinskas

@tdabasinskas tdabasinskas commented Jul 11, 2026

Copy link
Copy Markdown

Fixes #451.

When safe-settings applies changes (non-dry-run), nothing is visible above debug level: the diff computation, the "there are changes" decision, and the API call results are all log.debug. At the default log level a sync that rewrites branch protection across an org produces no trace of what it changed. HagegeR and tylerohlsen asked for exactly this in #451.

This PR adds one info-level line per applied change, in the three places changes are actually applied:

  • lib/plugins/diffable.js (covers labels, teams, collaborators, autolinks, variables, rulesets, and the other diffable plugins): Applying <Plugin> changes to <owner>/<repo>
  • lib/plugins/branches.js: Applying branch protection changes to <branch> branch of <owner>/<repo>
  • lib/plugins/repository.js: separate lines for repository settings and topic changes

Each line points at the debug level for the full diff rather than embedding it. That's deliberate: diffs can contain config values (e.g. Actions variables), and per the review discussion on #1018 those shouldn't land in info-level logs. The full diffs were already logged at debug; that behavior is unchanged. Dry-run (nop) output is also unchanged.

Also fixes two debug statements in repository.js that interpolated objects into template strings and printed Result of comparing repo for changes = [object Object] (the bug @HagegeR pointed out in the issue comments, in its current location).

When safe-settings applies changes to repositories, users need visibility into what actions are being taken without enabling debug logging. This change adds informational log messages when changes are applied, while keeping detailed diffs at debug level.

The info messages indicate:
- Which plugin is applying changes (branches, repository settings, topics, labels, etc.)
- Which repository is being modified
- That detailed diffs are available at debug level

This improves operational visibility and makes it easier to track configuration changes in production environments without overwhelming logs with detailed diffs.
Copilot AI review requested due to automatic review settings July 11, 2026 10:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds user-visible (info-level) logging when safe-settings actually applies configuration changes, improving traceability at default log levels while keeping potentially sensitive diffs at debug level. This addresses the lack of visibility called out in #451.

Changes:

  • Emit one info-level log line when Diffable plugins apply changes (non-nop), pointing to debug logs for the full diff.
  • Emit an info-level log line when branch protection changes are applied (non-nop).
  • Emit separate info-level log lines when repository settings and topic updates are applied (non-nop), and fix two debug logs that previously printed [object Object].

Reviewed changes

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

Show a summary per file
File Description
lib/plugins/diffable.js Adds info-level “Applying changes…” log for non-nop runs when changes are detected.
lib/plugins/branches.js Adds info-level log when branch protection changes are about to be applied (non-nop).
lib/plugins/repository.js Adds info-level logs for repository settings/topics apply; fixes debug logs to stringify objects properly.
test/unit/lib/plugins/labels.test.js Updates logger stub; asserts info log is emitted when applying label changes.
test/unit/lib/plugins/branches.test.js Updates logger stub; adds assertion that branch-protection apply is logged at info.
test/unit/lib/plugins/repository.test.js Updates logger stub; asserts info logs for repository settings and topics; removes it.only.
test/unit/lib/plugins/rulesets.test.js Updates logger stub to include info.
test/unit/lib/plugins/environments.test.js Updates logger stub(s) to include info.
test/unit/lib/plugins/variables.test.js Updates logger stub to include info.
test/unit/lib/plugins/teams.test.js Updates logger stub to include info.
test/unit/lib/plugins/custom_properties.test.js Updates logger stub to include info.
test/unit/lib/plugins/collaborators.test.js Updates logger stub to include info.
test/unit/lib/plugins/autolinks.test.js Updates logger stub to include info.

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

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.

Better logging

2 participants