Skip to content

Handle missing origin/data when generating fixtures - #50

Open
HansonHe-UW wants to merge 1 commit into
WATonomous:masterfrom
HansonHe-UW:fix/49-shallow-clone-fixtures
Open

Handle missing origin/data when generating fixtures#50
HansonHe-UW wants to merge 1 commit into
WATonomous:masterfrom
HansonHe-UW:fix/49-shallow-clone-fixtures

Conversation

@HansonHe-UW

Copy link
Copy Markdown

Closes #49.

When running npm run generate-fixtures (invoked by npm run dev, npm run build, and npm test) in either a shallow clone (gh repo clone -- --depth 1) or any clone of the public mirror, the script previously failed with:

Generating fixtures...
fatal: invalid reference: origin/data

This PR makes scripts/generate-fixtures.sh check whether origin/data is available before calling git worktree add, attempt to fetch it on demand, and fall back to a clear, actionable error message that points the contributor at FETCH_FIXTURES_FROM when the ref isn't reachable.

Behavior after change

Environment Before After
Internal monorepo, full clone works works (no change)
Internal monorepo, shallow clone fatal: invalid reference: origin/data auto-fetches origin/data, then works
Public mirror, no env var fatal: invalid reference: origin/data clean actionable error pointing at FETCH_FIXTURES_FROM
Any clone, with FETCH_FIXTURES_FROM set works works (unrelated code path)

Testing

Verified locally on macOS:

  1. Public mirror, no FETCH_FIXTURES_FROM → exits 1 with the new error message and git's underlying fatal: couldn't find remote ref data is preserved for debuggability.
  2. Public mirror, FETCH_FIXTURES_FROM=https://cloud.watonomous.ca/fixtures → goes through the unchanged wget branch.
  3. bash -n scripts/generate-fixtures.sh clean.

I do not have access to the internal monorepo, so I could not directly exercise the shallow-internal-clone case end-to-end — happy to defer to maintainers on that scenario.

Scope notes

Intentionally kept the change focused. I did not touch .github/workflows/build.yml or make the data ref configurable via an env var — happy to extend if maintainers prefer.

Copilot AI review requested due to automatic review settings May 26, 2026 23:23
In shallow clones (e.g. `gh repo clone -- --depth 1`), or when cloning
the public mirror (which does not include the `data` branch), running
`./scripts/generate-fixtures.sh` without `FETCH_FIXTURES_FROM` fails
with a cryptic `fatal: invalid reference: origin/data` from
`git worktree`.

Before invoking `git worktree add`, check whether `origin/data` is
present locally and try to fetch it on demand. If the ref still cannot
be obtained — which is the case for the public mirror — exit with an
actionable error pointing the contributor at `FETCH_FIXTURES_FROM`.

Fixes WATonomous#49.
@HansonHe-UW
HansonHe-UW force-pushed the fix/49-shallow-clone-fixtures branch from bd8efb7 to cf580f6 Compare May 26, 2026 23:27
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.

Make fixture generation work in shallow CI/local clones

1 participant