Skip to content

feat(mergechecker): adding mergechecker interface with Check#69

Merged
behinddwalls merged 6 commits into
mainfrom
kevin.new/merge-checker
Feb 25, 2026
Merged

feat(mergechecker): adding mergechecker interface with Check#69
behinddwalls merged 6 commits into
mainfrom
kevin.new/merge-checker

Conversation

@kevinlnew
Copy link
Copy Markdown
Contributor

Summary

feat(mergechecker): adding mergechecker interface with Check
What?

  • basic interface with Check: explains how this is not a mergeability guarantee but a heuristic to advance the request or fail it fast.

Test Plan

Issues

@kevinlnew kevinlnew force-pushed the kevin.new/merge-checker branch from 2e76584 to a146ad4 Compare February 25, 2026 01:04
@kevinlnew kevinlnew marked this pull request as ready for review February 25, 2026 01:22
Comment thread extension/mergechecker/mergechecker.go Outdated
Comment thread extension/mergechecker/mergechecker.go Outdated
// mergeability of the request. A nil result does not guarantee
// that the changes will apply cleanly at merge finalization time.
// Returns ErrUnmergeable if the changes are not mergeable.
Check(ctx context.Context, request entity.Request) error
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.

let's have it return true/false + error
using errors to control code flow should in general be avoided (even though Go sdk is guilty of it sometimes).

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.

Most likely in the future we'll have to enhance the result with some metadata anyways. For example, return back to user with the additional info what files are conflicting against what hash/request. The return object is probably justified to be a structure of some sort.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@kevinlnew can you leave an edit for CLAUDE.md to check for future changes on this

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yep I'll do that in this diff

@sbalabanov
Copy link
Copy Markdown
Contributor

I see now that I am contradicting earlier Preetam's comment.
I am pretty opinionated about this one though. The primary result of such a function is a boolean value, and so it should be modeled as such. Merge conflict is not an error in the system, but an expected state.

@kevinlnew
Copy link
Copy Markdown
Contributor Author

Sounds good, bring the bool back

Comment thread extension/mergechecker/mergechecker.go Outdated
// mergeability of the request. A nil result does not guarantee
// that the changes will apply cleanly at merge finalization time.
// Returns ErrUnmergeable if the changes are not mergeable.
Check(ctx context.Context, request entity.Request) error
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.

Most likely in the future we'll have to enhance the result with some metadata anyways. For example, return back to user with the additional info what files are conflicting against what hash/request. The return object is probably justified to be a structure of some sort.

@kevinlnew kevinlnew requested a review from sbalabanov February 25, 2026 02:12
Comment thread extension/mergechecker/mergechecker.go Outdated
)

// ErrUnmergeable is returned by Check when the request's changes are not mergeable.
var ErrUnmergeable = errors.New("request is not mergeable")
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.

I think this error is not needed now

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yep, removed

Comment thread extension/mergechecker/mergechecker.go Outdated
// Check is a fail-fast validation that optimistically assesses the
// mergeability of the request. A positive result does not guarantee
// that the changes will apply cleanly at merge finalization time.
// Returns ErrUnmergeable if the changes are not mergeable.
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.

also not relevant, error should indicate that the merge checkimplementation can't do the check at all.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm fine to leave this to the implementation to return a relevant error message. Do we need typed err here?

@kevinlnew kevinlnew requested a review from sbalabanov February 25, 2026 02:38
…l; Updated merge checker to use a result struct with bool nested
@behinddwalls behinddwalls merged commit e8bc206 into main Feb 25, 2026
8 checks passed
@behinddwalls behinddwalls deleted the kevin.new/merge-checker branch June 2, 2026 18:40
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.

3 participants