Skip to content

Conversation

@StephenButtolph
Copy link
Contributor

@StephenButtolph StephenButtolph commented Nov 5, 2025

Why this should be merged

  1. Removes an interface
  2. Replaces an error with a bool
  3. Generally simplifies some code
  4. Removes Semantic
  5. Removes duplicate function Before

How this works

A cleanup that I factored out of my wip of the version logging work.

How this was tested

CI

Need to be documented in RELEASES.md?

No

Copilot AI review requested due to automatic review settings November 5, 2025 17:03
@StephenButtolph StephenButtolph self-assigned this Nov 5, 2025
@StephenButtolph StephenButtolph moved this to In Progress 🏗️ in avalanchego Nov 5, 2025
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 simplifies the version package by removing unnecessary abstractions and improving code clarity. The changes replace error-based compatibility checking with boolean returns, eliminate the Compatibility interface in favor of a concrete type, and modernize version comparison using the cmp package.

Key changes:

  • Replaced error returns with bool in compatibility checking
  • Removed the Compatibility interface, using *Compatibility concrete type instead
  • Updated version comparison to use cmp.Compare for clearer semantics

Reviewed Changes

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

Show a summary per file
File Description
version/version.go Switched from atomic.Value to sync.Once for string caching; updated Compare to use cmp.Compare and changed parameter type from *Semantic to *Application
version/constants.go Changed GetCompatibility return type from Compatibility to *Compatibility and reordered parameters
version/compatibility_test.go Updated test expectations from error assertions to boolean checks; renamed variables for clarity
version/compatibility.go Removed Compatibility interface and error constants; simplified compatibility logic to return bool instead of error
version/application_test.go Removed compatibility-related test cases following deletion of Compatible method
version/application.go Removed Compatible method and error constants; updated Compare to use cmp.Compare
network/peer/peer.go Updated compatibility checks to use boolean returns and added version logging
network/peer/config.go Changed VersionCompatibility field type from version.Compatibility to *version.Compatibility

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

StephenButtolph and others added 3 commits November 5, 2025 12:04
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Stephen Buttolph <stephen@avalabs.org>
@blacksmith-sh

This comment has been minimized.

@joshua-kim joshua-kim enabled auto-merge November 5, 2025 21:54
@joshua-kim joshua-kim added this pull request to the merge queue Nov 5, 2025
Merged via the queue into master with commit 3d3a594 Nov 5, 2025
35 checks passed
@joshua-kim joshua-kim deleted the cleanup-version-package branch November 5, 2025 22:22
@github-project-automation github-project-automation bot moved this from In Progress 🏗️ to Done 🎉 in avalanchego Nov 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants