Skip to content

Conversation

@scunningham
Copy link
Contributor

No description provided.

@scunningham scunningham requested review from Copilot and tonymeehan May 28, 2025 20:35
Copy link

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 splits the existing HashRule behavior into two distinct functions—HashRule (for general identity hashing) and StableHash (for version-agnostic hashing)—and centralizes the actual SHA-256 + base58 logic in a new helper _hashRule.

  • Introduce StableHash to exclude version/gen metadata when hashing.
  • Refactor HashRule to delegate to _hashRule after clearing previous hash.
  • Add _hashRule as a private helper for consistent JSON marshaling and hashing.
Comments suppressed due to low confidence (1)

pkg/parser/tree.go:720

  • [nitpick] In Go, leading underscores in function names are uncommon. Consider renaming _hashRule to hashRule to follow Go naming conventions for unexported functions.
func _hashRule(rule ParseRuleT) (string, error) {

// HashRule to provide a unique stable identity for the rule. It can be used for dupe detection.
// The hash is based on the rule's content, excluding metadata that is not semantically important.
// HashRule to provide a unique identity for the rule.
// The hash is based on the rule's content, excluding previous hash calculations.
Copy link

Copilot AI May 28, 2025

Choose a reason for hiding this comment

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

[nitpick] The phrase "excluding previous hash calculations" can be clearer; consider specifying "excluding the existing rule.Metadata.Hash field" so readers understand exactly which metadata is omitted.

Copilot uses AI. Check for mistakes.
@scunningham scunningham merged commit dca8600 into prequel-dev:main May 28, 2025
1 check passed
@scunningham scunningham deleted the stablehash branch May 28, 2025 20:37
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.

2 participants