Skip to content

feat(change): require host[:port] authority in change URIs#329

Merged
behinddwalls merged 2 commits into
mainfrom
preetam/change-uri-impl
Jul 10, 2026
Merged

feat(change): require host[:port] authority in change URIs#329
behinddwalls merged 2 commits into
mainfrom
preetam/change-uri-impl

Conversation

@behinddwalls

@behinddwalls behinddwalls commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

Why?

The Change URIs RFC (doc/rfc/change-uri.md, previous PR in this stack) makes every change URI carry the provider instance's host[:port] as its RFC 3986 authority, so a URI is globally unambiguous on its own: GitHub and Phabricator URIs previously carried no host (the same URI could name two different changes on two provider instances), and the ghe/ghes schemes stood in for an instance discriminator without actually being one.

What?

  • platform/base/change/github: parser rewritten on net/url; format is now github://{host[:port]}/{org}/{repo}/pull/{pr}/{sha}; single github scheme — ghe/ghes are rejected; parsed form gains a Host field.
  • platform/base/change/phabricator: same treatment; format is now phab://{host[:port]}/D{revision}/{diff}; the host moves in-band from queue config into the URI authority.
  • platform/base/change/git: unchanged format (it already carried the authority); gains only the new lowercase-host validation.
  • platform/base/change/changeutil: new IsLowercaseASCII predicate — canonical form is validated, never normalized (uppercase hosts are rejected, not folded), matching the existing full-40-hex SHA rule.
  • Contract docs updated in api/base/change proto (comment-only, regenerated via make proto), platform/base/change, and entity comments; all test fixtures across gateway, orchestrator, extensions, runway, integration, and e2e suites moved to authority-bearing URIs (github.example.com / phab.example.com).

No wire change: Change.uris stays a repeated string; only the accepted grammar of its contents changes. Pre-production, so this is a hard cutover with no dual-format window (per the RFC's rejected alternatives).

Test Plan

make test (65/65), ✅ make build, ✅ make proto / make fmt / make gazelle idempotent. Parser suites cover the new grammar: host and host:port round-trips, nested orgs, and rejections for missing host, uppercase host, host-less legacy URIs, and ghe:///ghes:// schemes.

Stack

  1. docs(rfc): add change URI design #328
  2. @ feat(change): require host[:port] authority in change URIs #329

@behinddwalls behinddwalls marked this pull request as ready for review July 9, 2026 22:32
@behinddwalls behinddwalls requested review from a team and sbalabanov as code owners July 9, 2026 22:32
Comment thread platform/base/change/git/change_id.go
@behinddwalls behinddwalls force-pushed the preetam/change-uri-authority branch from 17dbcc1 to d4c28d4 Compare July 10, 2026 15:53
@behinddwalls behinddwalls force-pushed the preetam/change-uri-impl branch from 24c270f to fad6b9e Compare July 10, 2026 15:54
behinddwalls added a commit that referenced this pull request Jul 10, 2026
## Summary
### Why?

Change URIs are the system-wide identity of a code change — stored as a
primary-key column, correlated by strict string equality, and shared
across SubmitQueue, Stovepipe, and Runway via the `api/base/change`
contract. Today only `git://` URIs name the provider instance; GitHub
and Phabricator URIs carry no host, so the same URI can name two
different changes on two provider instances, and the host lives
out-of-band in queue config — coupling change identity to queue
topology.

### What?

Adds `doc/rfc/change-uri.md`, a spec for change URIs: every URI is
`scheme://{host[:port]}/{path}` where the scheme names the provider
model, the mandatory authority names the instance, and the path pins the
change to an exact code state. Defines the per-provider formats (GitHub
PR, Phabricator Diff, git ref/commit), canonical-form rules (validated,
never normalized: lowercase host, verbatim optional port, full 40-hex
SHAs, byte-for-byte round-trip), and rejected alternatives (out-of-band
host, per-flavor `ghe`/`ghes` schemes, web URLs as identity).

Also links the RFC from `doc/rfc/index.md` under Shared, and drops a
pre-existing duplicated "Build Runner" entry from the index.

## Test Plan


## Issues


## Stack
1. @ #328
1. #329
@behinddwalls behinddwalls requested a review from JamyDev July 10, 2026 16:19
## Summary

### Why?

The Change URIs RFC (doc/rfc/change-uri.md, previous PR in this stack) makes every change URI carry the provider instance's `host[:port]` as its RFC 3986 authority, so a URI is globally unambiguous on its own: GitHub and Phabricator URIs previously carried no host (the same URI could name two different changes on two provider instances), and the `ghe`/`ghes` schemes stood in for an instance discriminator without actually being one.

### What?

- `platform/base/change/github`: parser rewritten on `net/url`; format is now `github://{host[:port]}/{org}/{repo}/pull/{pr}/{sha}`; single `github` scheme — `ghe`/`ghes` are rejected; parsed form gains a `Host` field.
- `platform/base/change/phabricator`: same treatment; format is now `phab://{host[:port]}/D{revision}/{diff}`; the host moves in-band from queue config into the URI authority.
- `platform/base/change/git`: unchanged format (it already carried the authority); gains only the new lowercase-host validation.
- `platform/base/change/changeutil`: new `IsLowercaseASCII` predicate — canonical form is validated, never normalized (uppercase hosts are rejected, not folded), matching the existing full-40-hex SHA rule.
- Contract docs updated in `api/base/change` proto (comment-only, regenerated via `make proto`), `platform/base/change`, and entity comments; all test fixtures across gateway, orchestrator, extensions, runway, integration, and e2e suites moved to authority-bearing URIs (`github.example.com` / `phab.example.com`).

No wire change: `Change.uris` stays a repeated string; only the accepted grammar of its contents changes. Pre-production, so this is a hard cutover with no dual-format window (per the RFC's rejected alternatives).

## Test Plan

✅ `make test` (65/65), ✅ `make build`, ✅ `make proto` / `make fmt` / `make gazelle` idempotent. Parser suites cover the new grammar: host and host:port round-trips, nested orgs, and rejections for missing host, uppercase host, host-less legacy URIs, and `ghe://`/`ghes://` schemes.
@behinddwalls behinddwalls force-pushed the preetam/change-uri-impl branch from 3771850 to 42c89c8 Compare July 10, 2026 17:59
@behinddwalls behinddwalls changed the base branch from preetam/change-uri-authority to main July 10, 2026 17:59
@behinddwalls behinddwalls merged commit 50475cf into main Jul 10, 2026
14 checks passed
@behinddwalls behinddwalls deleted the preetam/change-uri-impl branch July 10, 2026 18:05
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