* fix(doltremote): treat s3:// as a native Dolt remote scheme
s3:// URLs previously survived Normalize only by falling through, and the
SCP heuristic treated any "@" in a URL as an SCP-style git remote, so an
s3 URL with "@" in its path or query string would be rewritten into a
bogus git+ssh remote. Add s3:// to NativeSchemes and anchor SCP detection
to inputs without a "://" scheme that match a user@host:path grammar.
* test(doltremote): pin the s3:// entry and the dotless host:pa@th case
Follow-up to the #5948 review. Deleting "s3://" from NativeSchemes made
no test fail, so TestNativeSchemesContainsEachNativeScheme now asserts
every entry the list holds; removing the s3:// line fails its s3://
subtest.
The base change also flipped a fourth behavior its description did not
list: a dotless pre-colon token whose only "@" sits after the colon
("host:pa@th", "alias:repo@v1") used to classify as SCP-style on the
bare strings.Contains(url, "@") check and normalize to
git+ssh://host/pa@th. It now classifies false and passes through
Normalize unchanged. Both inputs are pinned as rows in
TestIsSCPStyleGitURLRejectsNonSCPInputs; against origin/main's
remote.go they fail.
Normalize's doc comment now lists s3:// with the other native schemes.
* build(bazel): add go_test target for internal/doltremote
The PR adds remote_test.go and remote_invariant_test.go to a package whose
BUILD.bazel (added on main by #6798) declares only a go_library. Generated by
bazel run //:gazelle; no hand-written lines.
* fix(doltremote): guard FromGitURL's SCP split, cross-reference the SCP grammars
Maintainer review fixes for the four non-gating findings in the iteration-1
synthesis (0 blockers, 0 majors; quality scorecard 986/approve). The PR's own
fix is unchanged.
Contract fidelity, the one gate-impact-minor finding: FromGitURL is exported and
cmd/bd's gitURLToDoltRemote calls it directly, bypassing Normalize's
classification. Its first-colon split still rebuilt s3://bucket/team@prod/db
into git+ssh://s3///bucket/team@prod/db, the exact string this PR removes from
Normalize. That split now obeys the same "://" rule as isSCPStyleGitURL.
This takes the finding's second offered arm over its first. Gating on
isSCPStyleGitURL(url) instead changes 17 of 31 inputs across the package's own
corpus, against 9 for the "://" guard; the 8 extra are the SCP hosts that
predicate deliberately declines to classify - IDN hosts, non-ASCII userinfo and
dotless aliases - which FromGitURL converts correctly today.
TestFromGitURLStillConvertsSCPForms pins them, and mutating to the rejected arm
reds exactly those three rows while the new regression pin still passes.
NativeSchemes: the finding's "add az:// and oci:// for consistency" arm is
declined and the documentation arm taken instead. The PR body scopes this change
to s3:// and defers az:// to #6227 explicitly; #6227 is open, and it pairs
NativeSchemes with dolt.IsBackupURL - the site where the gap actually changes
behavior - so adding the entry here would have overridden a tracked contributor
decision while closing only half the bug. oci:// is in neither authority's
native list. The list's doc comment now records that narrowing, points at
remotecache.remoteSchemes as the fuller authority, and states that membership is
inert: every entry contains "://", so isSCPStyleGitURL rejects it and
Normalize's closing "return url" returns the same bytes listed or not. Dropping
gs:// reds one census leaf and no behavioral test, which measures that claim
rather than asserting it. The new FromGitURL table covers az:// and oci://
precisely because the guard is keyed on "://" and not on list membership.
Duplicate SCP grammar: scpStyleGitURLPattern's first alternative is
byte-identical to remotecache.gitSSHPattern, and the whole pattern is a superset
by exactly the user-less dotted-host form - the form on which the two already
disagree in production. Both regexes now cross-reference each other and the
divergence is pinned from each side. Exporting a shared matcher was the other
offered arm; it would have widened remotecache.IsRemoteURL's accept set, a
behavior change in a second package for a non-gating finding.
normalizeRemoteURL's doc comment restated Normalize's rules and had drifted
twice: it never gained s3://, and it named gitURLToDoltRemote as the converter
when the body calls doltremote.Normalize directly. Collapsed it to a reference
so the surface cannot drift again.
Codex's prescribed remedy for the hollow NativeSchemes census subtest is
declined, as the synthesis directs: asserting Normalize(scheme+"bucket/x") per
scheme passes against an empty list, for the same inertness reason above. The
subtest's comment, which claimed to protect a fast path it cannot observe, is
corrected instead.
go test ./internal/doltremote/ ./internal/remotecache/ green; cmd/bd named
selector 56 pass, 0 fail, 0 skip; go build ./..., go vet and gofmt clean; bazel
test passes on both packages; gazelle and go_srcs.py --check report no BUILD
drift.
---------
Co-authored-by: Julian Knutsen <julian@gastownhall.com>
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>