Skip to content

feat(entity): add git:// ChangeID parser#242

Open
mnoah1 wants to merge 2 commits into
mainfrom
mnoah1/entity-change-git
Open

feat(entity): add git:// ChangeID parser#242
mnoah1 wants to merge 2 commits into
mainfrom
mnoah1/entity-change-git

Conversation

@mnoah1

@mnoah1 mnoah1 commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Adds entity/change/git, a git-scheme change URI parser that mirrors the github provider (similar field/structure naming), but is used to refer to a change based on ref + commit instead of by pull request.

The ref segment carries refs/heads/ or refs/tags/, percent- encoded in case of slashes in a branch name.

Move existing SHA check into a shared entity/change/changeutil.IsFullHex(s, length) helper now used by both the github and git providers, with the expected length passed in per provider.

Why?

Stovepipe validation will act on changes that are already merged, and referenced by branch + SHA instead of pull request or phabricator revision.

What?

git:// schema definition

Test Plan

  • Unit tests
  • Will use this in subsequent changes to build out stovepipe workflow

@mnoah1 mnoah1 marked this pull request as ready for review June 15, 2026 16:41
@mnoah1 mnoah1 requested review from a team, behinddwalls and sbalabanov as code owners June 15, 2026 16:41
@mnoah1 mnoah1 changed the title feat(entity): add git:// change provider and share hex SHA validation feat(entity): add git:// ChangeID support Jun 15, 2026
@mnoah1 mnoah1 changed the title feat(entity): add git:// ChangeID support feat(entity): add git:// ChangeID parser Jun 15, 2026
Comment thread entity/change/git/change_id.go Outdated
const refPrefix = "refs/"

// changeIDFormat is the expected format for change IDs, included in error messages.
const changeIDFormat = "git://{owner}/{repo}/{ref}/{head_commit_sha}"

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.

Suggested change
const changeIDFormat = "git://{owner}/{repo}/{ref}/{head_commit_sha}"
const changeIDFormat = "git://{remote}/{repo}/{refspec}/{commit_sha}"

basically something like git://git.remote.com/<repo>/<refspec>/<commit_sha>? how do we handle port? ideally all URLs support port usage

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.

With my latest update, port can be part of the remote URL.

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.

Any reason we would want refspec over ref? Ref feels less ambiguous.

Comment thread entity/change/git/change_id.go Outdated
Comment thread entity/change/git/change_id.go Outdated
Adds entity/change/git, a git-scheme change URI parser that mirrors the
github provider (same field/structure naming), differing only where the
schemes genuinely differ: a fixed git scheme and a fully-qualified,
percent-encoded git ref in place of pull/{pr_number}.

The ref segment carries refs/heads/<branch> or refs/tags/<tag>, percent-
encoded so branches, tags, and slash-containing ref names fit a single path
segment unambiguously.

Extracts the lowercase-hex-SHA check into a shared
entity/change/changeutil.IsFullHex(s, length) helper now used by both the
github and git providers, with the expected length passed in per provider.
@mnoah1 mnoah1 force-pushed the mnoah1/entity-change-git branch from fefbedb to f7ae090 Compare June 15, 2026 18:11
@mnoah1 mnoah1 force-pushed the mnoah1/entity-change-git branch from f7ae090 to 05bcab5 Compare June 15, 2026 18:14
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