fix(mkrep): stop the test suite creating real repos, and confirm implicit ones #152
No Reviewers
Labels
Clear labels
Area/CI
Area/Completions
Area/Components
Area/Config
Area/Docs
Area/Functions
Area/Integrations
Area/Prompt & Theme
Area/Scripts
Area/Tests
Compat/Breaking
Kind/Bug
Kind/Chore
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Performance
Kind/Refactor
Kind/Security
Kind/Testing
good first issue
help wanted
.github/workflows and repository automation
completions/ - tab-completion scripts
The opinionated-component system (C1-C6)
config.fish and conf.d/ - startup and environment
docs/manual/ and the generated manual, man page, and site
functions/ - user-facing functions and helpers
integrations/ - third-party tool wiring
themes/ and prompt appearance
scripts/ - standalone helper scripts
tests/ - the syntax lint and functional suite
Breaking change that won't be backward compatible
Something is not working
Tooling, dependencies, and housekeeping
Documentation changes
Improve existing functionality
New functionality
Makes existing behavior faster or lighter
Restructures code without changing behavior
This is security issue
Issue or pull request related to testing
Well-scoped and self-contained; a good place to start
Maintainer is looking for someone to pick this up
Priority
Critical
1
The priority is critical
Priority
High
2
The priority is high
Priority
Medium
3
The priority is medium
Priority
Low
4
The priority is low
Reviewed
Confirmed
1
Issue has been confirmed
Reviewed
Duplicate
2
This issue or pull request already exists
Reviewed
Invalid
3
Invalid issue
Reviewed
Won't Fix
3
This issue won't be fixed
Status
Blocked
1
Something is blocking this issue or pull request
Status
Need More Info
2
Feedback is required to reproduce issue or to continue work
Status
Abandoned
3
Somebody has started to work on this but abandoned work
Milestone
No items
No Milestone
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: rootiest/fish-config#152
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
The visible symptom
tests/run-tests.fishreported 6 failingmkrepassertions —default run exits 0,cwd entered,--no-cd exits 0,--clean exits 0,--clean --strict together succeeds,-s exits 0— each failing withError: no available loginfromtea.Running the suite on its own reported something different: 63/64, with a single unrelated failure (
bare $GITEA_URL creates no remote). That split is what made it look flaky.What was actually happening
mkrep resolves a server from
$GIT_SERVERplus$GITEA_URL/$GITEA_HOST, and this repository doubles as a real~/.config/fishwhere all of them are exported for day-to-day use. Left ambient, the six sections that call a baremkrep <dir>with no remote flag took the auto-create branch and contacted the live forge.It succeeded at least once. An empty
rootiest/repoexisted ongit.rootiest.dev,created_at 2026-09-14T23:49:50Z— created by a test run during #150's development. It has been deleted.That also explains the two different results:
XDG_CONFIG_HOMEtearun-tests.fishError: no available loginThe standalone run was green because an earlier run had already created the repo. A test that passes for that reason is worse than one that fails.
Fix 1 — test isolation
Five variables neutralized once at suite setup, using the same shadow-to-empty pattern the suite already applied per-section for
--check-existing— whose comment flagged this exact hazard ("these are real exported vars in this dev environment"). Empty reads as unset to mkrep, so real globals are untouched, and each isolated suite is its ownfish --no-configprocess, so nothing leaks between suites.Nothing depended on the ambient value: every section that wants a server sets its own
set -lx GIT_SERVER gitea, and one section asserts the opposite outright ($GITEA_URL alone (no $GIT_SERVER) does not trigger anything— the standalone failure).Also corrected a stale header comment claiming the suite "runs autoloaded straight in the driver's own process".
run-tests.fish:113runs it asfish --no-config $suite. That claim is what one consults to judge whether a suite-wideset -gxis safe, so it mattered here.Fix 2 — confirm an implicit remote-create
The test bug was a symptom of a sharp edge in mkrep. Creating a repository on a forge is the only outward-facing thing mkrep does, and on the
$GIT_SERVERpath an exported variable is all it takes to reach it — somkrep foo, which reads as purely local, would make a repo on a server without ever saying so.It now asks first, defaulting to no:
Provenance gates the prompt, not the resolved value.
--server,--remoteand--new-remoteeach state outright what they are going to do, so none of them prompts; only an ambient$GIT_SERVERdoes.--yes/-yskips the question.-s: declining something the caller may expect is a diagnostic, and mkrep already writes its errors to stderr regardless of-s.Linking an already-existing repo is unaffected, as is
--check-existing.Testing
750/750 assertions pass (
mkrep73/73, up from 64), 249/249 syntax, 249/249 indent, docs 84/84.Nine new assertions cover the non-interactive skip, its stderr note,
--yes, and--servernot prompting. The non-interactive case is itself one of the behaviors under test, since the suite runs underfish --no-config.The interactive
readis not in the suite — that needs a pseudo-terminal, and the answer parsing it guards is a singlestring match. It was verified by hand underscript(1), both answers, against a stubbed$MKREP_REMOTE_CMD:Behavior change
mkrep <dir>with$GIT_SERVERset no longer creates a remote unprompted. Scripts relying on that need--yes(or--server <type>). The path is one day old, so the blast radius is small, but it is a real change and not just a new flag.