Skip to content

Improve logging and metrics around NoChange Errors#15169

Open
robaiken wants to merge 1 commit into
mainfrom
robaiken/quiet-no-change-summary
Open

Improve logging and metrics around NoChange Errors#15169
robaiken wants to merge 1 commit into
mainfrom
robaiken/quiet-no-change-summary

Conversation

@robaiken
Copy link
Copy Markdown
Contributor

@robaiken robaiken commented May 28, 2026

What are you trying to accomplish?

Improve the logging and metrics signal around NoChangeErrors from npm/yarn/pnpm lockfile updates by ensuring the end-of-run "Dependencies failed to update" summary table renders a compact one-liner for no_change_error instead of pretty-printing the entire error_details payload (which includes the full command_traces array with stdout per command).

This builds on #15068, which converts what is today an opaque unknown_error (with a giant Sorbet stack trace and null details) into a structured no_change_error carrying useful diagnostic context. Without this change, that new structured payload drowns the summary in a multi-screen wall of text per failing dependency, hiding the very logging and metrics #15068 is adding.

Before this work (on main today) — meaningless unknown_error / null row preceded by ~40 lines of Sorbet stack trace:

2026/05/28 17:32:27 ERROR /home/dependabot/npm_and_yarn/lib/dependabot/npm_and_yarn/file_updater.rb:52:in 'Dependabot::NpmAndYarn::FileUpdater#updated_dependency_files'
2026/05/28 17:32:27 ERROR /home/dependabot/dependabot-updater/vendor/ruby/3.4.0/gems/sorbet-runtime-0.6.13208/lib/types/private/methods/call_validation.rb:294:in 'UnboundMethod#bind_call'
... (~40 more lines of Sorbet frames) ...
2026/05/28 17:32:27 ERROR bin/update_files.rb:48:in '<main>'

Dependabot encountered '1' error(s) during execution, please check the logs for more details.
+--------------------------------------------+
|       Dependencies failed to update        |
+------------+---------------+---------------+
| Dependency | Error Type    | Error Details |
+------------+---------------+---------------+
| qs         | unknown_error | null          |
+------------+---------------+---------------+

After #15068 alone — useful structured payload, but the summary table dumps it all:

updater | 2026/05/28 16:45:54 INFO Handled error whilst updating qs: no_change_error {dependencies: [{"name" => "qs", "version" => "6.15.2", ...}], updated_files: [], dependency_files: ["package.json", "pnpm-lock.yaml"], package_manager: "pnpm", reason: "no_files_updated", commands_succeeded: true, fallback_attempted: false, fallback_succeeded: nil, command_traces: [{package_manager: "pnpm", command: "update qs@6.15.2  --lockfile-only --no-save -r", ..., stdout: "(node:5109) [DEP0169] DeprecationWarning: `url.parse()` ... (multi-screen stdout) ... Done in 3.1s"}, {package_manager: "pnpm", command: "install --lockfile-only", ..., stdout: "... Done in 460ms", content_changed_after: false}]}

(plus the same payload pretty-printed inside the summary table)

After this PR — compact, scannable summary; full payload still flows to backend, logs, and metrics:

updater | +-----------------------------------------------------------------------------------------------------------------------------+
updater | |                                                Dependencies failed to update                                                |
updater | +------------+-----------------+----------------------------------------------------------------------------------------------+
updater | | Dependency | Error Type      | Error Details                                                                                |
updater | +------------+-----------------+----------------------------------------------------------------------------------------------+
updater | | qs         | no_change_error | package_manager=pnpm reason=no_files_updated command_traces=2 (full details sent to service) |
updater | +------------+-----------------+----------------------------------------------------------------------------------------------+

Anything you want to highlight for special attention from reviewers?

  • The change is scoped strictly to local console rendering. Every downstream signal is preserved:
    • client.record_update_job_error(error_type:, error_details:) still sends the full structured payload to the backend.
    • log_no_change_diagnostics (per-trace info log lines from error_handler.rb) still runs unchanged.
    • service.increment_metric("updater.no_change", ...) still fires with all tags.
    • Sentry behavior is unchanged (and no_change_error was never sent to Sentry).
  • The no_change_error branch in summarize_error_details is forward-compatible: it's dormant until Add no-change diagnostics for npm/yarn/pnpm lockfile updates #15068 lands, then activates automatically. This PR can be reviewed and merged independently.
  • Alternative considered: dropping no_change_error rows from the table entirely (since the data is in logs/backend). Kept the row for at-a-glance visibility — open to dropping it if reviewers prefer.
  • Drive-by fix: added require "github_api/dependency_submission" to updater/spec/dependabot/service_spec.rb to fix a pre-existing failure (uninitialized constant GithubApi) in the create_dependency_submission test.

How will you know you've accomplished your goal?

  • All service_spec tests pass, including the two dependency_error_summary tests directly exercising the modified code path:
    $ bin/test --workdir updater bundler bundle exec rspec spec/dependabot/service_spec.rb
    Finished in 0.12 seconds (files took 1.71 seconds to load)
    43 examples, 0 failures
    
  • Manual verification via script/dependabot update -f tmp/nc.yaml against a pnpm fixture that produces a no-change result — observed the compact summary row shown above instead of the verbose payload.

Checklist

  • I have run the complete test suite to ensure all tests and linters pass.
  • I have thoroughly tested my code changes to ensure they work as expected, including adding additional tests for new functionality.
  • I have written clear and descriptive commit messages.
  • I have provided a detailed description of the changes in the pull request, including the problem it addresses, how it fixes the problem, and any relevant details about the implementation.
  • I have ensured that the code is well-documented and easy to understand.

The end-of-run "Dependencies failed to update" table pretty-prints
the full error_details payload for every error. For no_change_error,
that payload includes the entire command_traces array (with full
stdout for each command), producing a multi-screen wall of text per
failing dependency.

Render no_change_error rows as a compact one-liner instead. The full
structured payload is still sent to the backend via
client.record_update_job_error and to logs via
log_no_change_diagnostics — this only affects local console output.

Also fix a pre-existing service_spec failure by requiring
github_api/dependency_submission, which was not being loaded
transitively and caused 'uninitialized constant GithubApi' in the
create_dependency_submission test.
Copilot AI review requested due to automatic review settings May 28, 2026 17:25
@robaiken robaiken requested a review from a team as a code owner May 28, 2026 17:25
@robaiken robaiken changed the title updater: condense no_change_error rows in end-of-run summary table Improve logging and metrics around NoChange Errors May 28, 2026
Copy link
Copy Markdown
Contributor

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

Condenses the no_change_error rendering in the updater's end-of-run "Dependencies failed to update" summary table. Previously each row pretty-printed the full error_details payload (including all command_traces stdout), producing a wall of text. The PR delegates the Error Details cell to a new summarize_error_details helper that renders a compact one-liner for no_change_error, while preserving existing behavior (and full payload telemetry) for all other error types.

Changes:

  • Add summarize_error_details helper in Dependabot::Service and use it in dependency_error_summary for enhanced error details.
  • Add missing require "github_api/dependency_submission" in service spec to fix pre-existing load failure.
Show a summary per file
File Description
updater/lib/dependabot/service.rb New private summarize_error_details helper renders one-line summary for no_change_error; falls back to JSON.pretty_generate for other error types.
updater/spec/dependabot/service_spec.rb Adds require "github_api/dependency_submission" to fix uninitialized constant GithubApi in existing test.

Copilot's findings

  • Files reviewed: 2/2 changed files
  • Comments generated: 0

Copy link
Copy Markdown
Contributor

@yeikel yeikel left a comment

Choose a reason for hiding this comment

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

A small change that helps a lot. Thank you!

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