Skip to content

Add UpdateTypes field to Allowed struct - #605

Merged
v-kbukum1 merged 3 commits into
mainfrom
kbukum1/allow-update-types
Mar 31, 2026
Merged

v-kbukum1 merged 3 commits into
mainfrom
kbukum1/allow-update-types

Conversation

@v-kbukum1

Copy link
Copy Markdown
Contributor

Summary

Add UpdateTypes []string field to the Allowed struct, enabling update-types support in the allow block of dependabot.yml.

This matches the existing pattern in the Condition (ignore) struct which already has UpdateTypes []string at line 221.

Changes

  • internal/model/job.go: Add UpdateTypes []string field to Allowed struct with json:"update-types,omitempty" yaml:"update-types,omitempty" tags
  • internal/model/job_test.go: Add update-types to exampleJob fixture, add TestAllowedUpdateTypes (YAML unmarshal) and TestAllowedUpdateTypesJSON (JSON round-trip) tests

Related PRs

Relates to dependabot/dependabot-core#12668.

Copilot AI 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.

Pull request overview

Adds update-types support to the allow block of dependabot.yml by extending the CLI job model, aligning it with the existing ignore-conditions (Condition.UpdateTypes) pattern used elsewhere in the Dependabot CLI.

Changes:

  • Add UpdateTypes []string to model.Allowed with json/yaml:"update-types,omitempty" tags.
  • Extend the exampleJob YAML fixture with an allowed-updates entry that uses update-types.
  • Add YAML unmarshal and JSON-focused tests for Allowed.UpdateTypes.

Reviewed changes

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

File Description
internal/model/job.go Extends the job model (Allowed) to carry update-types through to the updater payload.
internal/model/job_test.go Updates fixtures and adds tests to cover YAML parsing and JSON handling for the new field.

Comment thread internal/model/job_test.go
@v-kbukum1
v-kbukum1 force-pushed the kbukum1/allow-update-types branch from 9111723 to ebe3572 Compare March 27, 2026 16:44
truggeri
truggeri previously approved these changes Mar 27, 2026

@truggeri truggeri 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.

Good by me, but I do think the marshal test could be slightly better.

Comment thread internal/model/job_test.go
v-kbukum1 and others added 3 commits March 27, 2026 13:37
Add update-types support to the Allowed struct, matching the existing
pattern in the Condition (ignore) struct. This enables semver-level
filtering (major/minor/patch) in allow blocks of dependabot.yml.

Changes:
- Add UpdateTypes []string field to Allowed struct in model/job.go
- Add update-types entry to exampleJob YAML fixture
- Add TestAllowedUpdateTypes: verifies YAML unmarshal of update-types
- Add TestAllowedUpdateTypesJSON: verifies JSON round-trip serialization

Relates to dependabot/dependabot-core#12668.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Unmarshal into map[string]any to verify correct JSON tag names
("update-types", "dependency-name") rather than round-tripping
through the same struct. Also verify omitempty behavior.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Compare marshaled JSON string directly to verify correct key names
and omitempty behavior, per reviewer feedback.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@v-kbukum1
v-kbukum1 force-pushed the kbukum1/allow-update-types branch from a7054d9 to 1050006 Compare March 27, 2026 18:37
@v-kbukum1

v-kbukum1 commented Mar 27, 2026 •

Copy link
Copy Markdown
Contributor Author

Good by me, but I do think the marshal test could be slightly better.

@truggeri
I just changed assertion to check without unmarshalling. Can you check if it is make sense?

Copilot AI 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.

Pull request overview

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

@v-abhishekbhaskar v-abhishekbhaskar 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.

LGTM

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