You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(change): require host[:port] authority in change URIs (#329)
## 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. #328
1. @ #329
// Need at least 5 segments: {owner}/{repo}/pull/{pr_number}/{sha}.
80
91
iflen(segments) <5 {
81
-
returnChangeID{}, fmt.Errorf("invalid change ID %q: need at least owner/repo/pull/pr/sha, got %d segments (expected format: %s)", raw, len(segments), changeIDFormat)
92
+
returnChangeID{}, fmt.Errorf("invalid change ID %q: need at least owner/repo/pull/pr/sha, got %d path segments (expected format: %s)", raw, len(segments), changeIDFormat)
0 commit comments