Skip to content

feat: add predecessors package logic ported from create-proposal-pr composite action#474

Merged
ecPablo merged 20 commits intomainfrom
ecpablo/dx-1876-opcount-sorting-port
Oct 7, 2025
Merged

feat: add predecessors package logic ported from create-proposal-pr composite action#474
ecPablo merged 20 commits intomainfrom
ecpablo/dx-1876-opcount-sorting-port

Conversation

@ecPablo
Copy link
Contributor

@ecPablo ecPablo commented Oct 1, 2025

We are moving the files related to opcounts and predecessor calculation to this package to allow better reusability across all the GH workflows as this is something that might be used in different mcms related pipelines.

Main API's Exposed

Opcount computation related

ComputeHighestOpCountsFromPredecessors: Returns the newly computed opcounts for the given PR and list of predecessors.

func ComputeHighestOpCountsFromPredecessors(
	lggr logger.Logger,
	newProposalData ProposalsOpData,
	predecessors []PRView,
) map[mcmstypes.ChainSelector]uint64

ApplyHighestOpCountsToProposal: Applies the new opcounts provided to the proposal and saves the proposal to the filesystem

func ApplyHighestOpCountsToProposal(
	lggr logger.Logger,
	proposalPath string,
	newOpCounts map[mcmstypes.ChainSelector]uint64,
) 

ParseProposalOpsData: small helper to extract just the opcount related information into an easier to access struct.

func ParseProposalOpsData(ctx context.Context, filePath string) (ProposalsOpData, error)

@changeset-bot
Copy link

changeset-bot bot commented Oct 1, 2025

🦋 Changeset detected

Latest commit: c91ddcc

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
chainlink-deployments-framework Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@ecPablo ecPablo marked this pull request as ready for review October 1, 2025 15:01
@ecPablo ecPablo requested review from a team as code owners October 1, 2025 15:01
Copilot AI review requested due to automatic review settings October 1, 2025 15:01
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 predecessor and operation count calculation logic to the proposalutils package, porting functionality from a composite GitHub action to improve reusability across MCMS-related pipelines. The implementation provides tools for finding proposal PR dependencies, computing operation counts, and managing proposal metadata.

Key changes:

  • GitHub API integration for searching and analyzing proposal PRs with dependency resolution
  • Operation count computation logic that calculates highest opcounts from predecessor PRs
  • Proposal graph building using topological sorting to establish PR dependencies based on shared MCM addresses

Reviewed Changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
go.mod Adds github.com/google/go-github/v71 dependency for GitHub API integration
experimental/proposalutils/predecessors/types.go Defines core data structures for PR views, MCM operation data, and context
experimental/proposalutils/predecessors/types_test.go Unit tests for the EndingOpCount calculation method
experimental/proposalutils/predecessors/proposal_graph.go Implements dependency graph building and topological sorting for PR relationships
experimental/proposalutils/predecessors/proposal_graph_test.go Comprehensive tests for graph construction and MCM relationship detection
experimental/proposalutils/predecessors/predecessor.go Core logic for computing opcounts and applying them to proposals
experimental/proposalutils/predecessors/predecessor_test.go Tests for opcount computation, proposal parsing, and file operations
experimental/proposalutils/predecessors/github_ops.go GitHub API client implementation for PR searching and content retrieval
experimental/proposalutils/predecessors/github_ops_test.go Tests for GitHub API integration with mock HTTP servers
.changeset/mighty-ways-kick.md Changeset documentation for the minor version bump

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

ChrisAmora
ChrisAmora previously approved these changes Oct 1, 2025
Copy link
Contributor

@ChrisAmora ChrisAmora left a comment

Choose a reason for hiding this comment

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

LGTM

Copilot AI review requested due to automatic review settings October 3, 2025 13:47
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

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


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copilot AI review requested due to automatic review settings October 3, 2025 13:55
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

Copilot reviewed 10 out of 11 changed files in this pull request and generated 3 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

ecPablo and others added 2 commits October 3, 2025 07:57
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings October 3, 2025 14:32
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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

Copilot reviewed 10 out of 11 changed files in this pull request and generated 3 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings October 3, 2025 14:34
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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

Copilot reviewed 10 out of 11 changed files in this pull request and generated 2 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copilot AI review requested due to automatic review settings October 3, 2025 18:38
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

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


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copilot AI review requested due to automatic review settings October 6, 2025 14:21
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

Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@cl-sonarqube-production
Copy link

@ecPablo ecPablo enabled auto-merge October 6, 2025 20:38
@ecPablo ecPablo added this pull request to the merge queue Oct 7, 2025
Merged via the queue into main with commit fdcf28d Oct 7, 2025
18 of 19 checks passed
@ecPablo ecPablo deleted the ecpablo/dx-1876-opcount-sorting-port branch October 7, 2025 13:36
github-merge-queue bot pushed a commit that referenced this pull request Oct 7, 2025
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## chainlink-deployments-framework@0.55.0

### Minor Changes

-
[#492](#492)
[`7243af8`](7243af8)
Thanks [@jkongie](https://github.com/jkongie)! - update aptos dep to
v1.9.1

-
[#474](#474)
[`fdcf28d`](fdcf28d)
Thanks [@ecPablo](https://github.com/ecPablo)! - add predecessors and
opcount calculation logic to proposalutils package.

### Patch Changes

-
[#496](#496)
[`fea372c`](fea372c)
Thanks [@graham-chainlink](https://github.com/graham-chainlink)! - fix:
update db controller to accept context

-
[#498](#498)
[`ce51cbe`](ce51cbe)
Thanks [@gustavogama-cll](https://github.com/gustavogama-cll)! - fix:
anvil env should check for addresses from DataStore as well

-
[#495](#495)
[`126609e`](126609e)
Thanks [@ecPablo](https://github.com/ecPablo)! - get delay for advancing
time from the proposal instead of constant value

-
[#497](#497)
[`976d232`](976d232)
Thanks [@graham-chainlink](https://github.com/graham-chainlink)! -
fix(catalog/memory): remove dependency on testing.T

---------

Co-authored-by: app-token-issuer-engops[bot] <144731339+app-token-issuer-engops[bot]@users.noreply.github.com>
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.

6 participants