Skip to content

Dependabot Snapshots has basic metadata about "status" and "reason"#13843

Merged
Ahmed3lmallah merged 4 commits intomainfrom
ae/snapshots-has-metadata
Jan 12, 2026
Merged

Dependabot Snapshots has basic metadata about "status" and "reason"#13843
Ahmed3lmallah merged 4 commits intomainfrom
ae/snapshots-has-metadata

Conversation

@Ahmed3lmallah
Copy link
Contributor

@Ahmed3lmallah Ahmed3lmallah commented Dec 19, 2025

What are you trying to accomplish?

A snapshot is submitted from update-graph jobs, even if fail scenarios, such as:

  • an empty snapshot when the manifest doesn't exist (deleted)
  • an empty snapshot when an error is encountered

When those snapshots are consumed, it is hard to determine the reason behind having an empty snapshot without any supporting metadata! This PR adds those needed metadata:

  • Failures: empty snapshot, status: failed, reason: #{error_type}
  • Deleted manifest: empty snapshot, status: skipped, reason: "missing-manifest-files"
  • Valid manifest with no dependencies: empty snapshot, status: ok
  • Valid manifest with dependencies: regular snapshot, status: ok

Prerequisites:

How will you know you've accomplished your goal?

Start received dependency submissions with metadata

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.

Copy link
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

This PR adds metadata fields (status and reason) to dependency snapshots submitted to the GitHub Dependency Submission API. This enables downstream consumers to understand why a snapshot is empty without examining job logs. The implementation handles three distinct scenarios: successful snapshots with dependencies (status: "ok"), failed snapshots due to errors (status: "failed" with error type), and skipped snapshots for deleted manifests (status: "skipped" with reason "missing-manifest-files").

Key Changes

  • Added status and reason metadata to all dependency snapshots with appropriate values based on submission context
  • Introduced new constants for status values ("ok", "failed", "skipped") and the missing manifests reason
  • Updated submission creation logic to populate metadata in error and missing file scenarios

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
updater/lib/github_api/dependency_submission.rb Added status/reason attributes with defaults, defined constants for status values, and included metadata in payload with .compact to omit nil reasons
updater/lib/dependabot/update_graph_processor.rb Updated empty_submission signature to accept status/reason parameters, passed appropriate metadata for skipped (missing files) and failed (error) scenarios
updater/spec/dependabot/update_graph_processor_spec.rb Added test assertions to verify metadata in all three scenarios: successful snapshots, failed snapshots, and skipped snapshots for non-existent files

jakecoffman
jakecoffman previously approved these changes Jan 6, 2026
@Ahmed3lmallah Ahmed3lmallah merged commit 039a54c into main Jan 12, 2026
165 of 166 checks passed
@Ahmed3lmallah Ahmed3lmallah deleted the ae/snapshots-has-metadata branch January 12, 2026 17:30
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.

4 participants