Skip to content

Import large repositories in the software-project pack - #18

Merged
Yan Xia (sd983527) merged 1 commit into
microsoft:mainfrom
sd983527:large-repo-import
Nov 3, 2026
Merged

Yan Xia (sd983527) merged 1 commit into
microsoft:mainfrom
sd983527:large-repo-import

Conversation

@sd983527

Copy link
Copy Markdown
Collaborator

Running the software-project pack on a large private repository (about 40k files, 485 MB of packed history, Git LFS pointers) needed three host-side workarounds. This PR removes the need for each one.

Changes

  • Seed push failed with HTTP 413. The team driver pushes the imported history through the edge proxy, whose client_max_body_size is 100 MiB. docker/nginx-edge/conf.d/gitea.conf now lifts the limit for Git pushes only (location ~ /git-receive-pack$). Other requests keep the 100 MiB limit, and Gitea still requires a login to push.
  • Git LFS pointers broke the import. With git-lfs installed on the host, cloning an upstream whose LFS objects are unavailable fails at checkout. GIT_LFS_SKIP_SMUDGE=1 alone is not enough: git-lfs still installs a pre-push hook, so the next push fails. The prepare, sync and export hooks now clone with the LFS filter turned off (NO_LFS in hooks/common.py, saved in each clone's config). git-lfs never runs, LFS files stay pointer files, and the seed push, sync merge and delivery push carry them unchanged.
  • git failed in acceptance checks with "detected dubious ownership". evaluate.py mounts the delivered checkout, owned by the host user, into a container that runs as root. The container now runs git config --global --add safe.directory "*" before each check, as the worker's own git config does. This works on older git versions too, which ignore -c and GIT_CONFIG_COUNT for this setting.

Docs: docker/README.md, tasks/software-project/README.md, docs/acceptance_testing.md (known limitation: LFS content is never fetched, so checks that need it fail) and tests/smoke/README.md.

Tests

  • tests/unit/test_software_project.py:
    • LfsTest runs prepare, sync and export with a failing LFS filter (GIT_CONFIG_GLOBAL).
    • EvaluateTest runs evaluate in a fake container that does not own the checkout (GIT_TEST_ASSUME_DIFFERENT_OWNER=1).
    • Both fail without the fix.
  • tests/smoke/run_smoke.sh (software-project):
    • The upstream's history is over 100 MiB (a 110 MiB fixture is added and then removed).
    • acceptance.main runs git log -1 --format=%H, and the run checks its output against the delivered head.
  • Manual checks:
    • nginx 1.27 with the edge config and a stand-in Gitea: a 150 MiB push got 413 before and 200 after, both with Content-Length and chunked. A 150 MiB API request still gets 413.
    • git-lfs 3.6.1: a plain clone fails, and a GIT_LFS_SKIP_SMUDGE=1 clone fails on push. The NO_LFS clone pushes cleanly.
  • Same tree on a Linux host with Docker and git-lfs: python3 -m unittest discover -s tests/unit passed (78 tests), and SMOKE_PACK=software-project bash tests/smoke/run_smoke.sh passed.

🤖 Generated with Claude Code

Running the software-project pack on a large private repository (about
40k files, 485 MB of packed history, Git LFS pointers) needed three manual
workarounds; the pack now handles each case:

- Edge proxy: Git pushes (git-receive-pack) have no body-size limit, so the
  driver's push of the imported history no longer fails with HTTP 413.
  Other requests keep the 100 MiB limit; Gitea authenticates pushes.
- Git LFS: the prepare, sync and export hooks clone with the LFS filter
  off (kept in each clone's config), so pointers whose objects are missing
  pass through, git-lfs installs no pre-push hook, and the seed push, sync
  merge and delivery push carry pointers as they are
  (GIT_LFS_SKIP_SMUDGE=1 alone still installs the hook, and the push fails).
- Evaluation: the acceptance container trusts the delivered checkout
  (safe.directory) before running a check, so git in acceptance.main no
  longer fails with "detected dubious ownership".

Tests: unit tests run the hooks under a failing LFS filter and evaluate
under a fake container that does not own the checkout; the
software-project smoke run imports an upstream whose history is over
100 MiB and runs git in acceptance.main.

Co-Authored-By: Claude <noreply@anthropic.com>
@sd983527
Yan Xia (sd983527) merged commit 62793dc into microsoft:main Nov 3, 2026
5 checks passed
@sd983527
Yan Xia (sd983527) deleted the large-repo-import branch November 3, 2026 05:52
Yan Xia (sd983527) added a commit to sd983527/Agensh that referenced this pull request Nov 3, 2026
Conflicts kept both sides:
- evaluate.py: microsoft#18's safe.directory wrapper (TRUSTED_RUN) with the private
  data mount, now after the checkout mount; the team network's profile name
  falls back to the profile file, so the hook also runs without
  AGENSH_PROFILE (as microsoft#18's unit test calls it)
- prepare.py: the snapshot-aware import message with microsoft#18's NO_LFS clone
- run_smoke.sh: microsoft#18's git check in the evaluation now also runs in
  [acceptance] final, which the evaluate hook uses when it is set
- export.py: the snapshot replay's upstream clone turns off LFS too

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Yan Xia (sd983527) added a commit to sd983527/Agensh that referenced this pull request Nov 3, 2026
The merge added microsoft#18's git check to [acceptance] final, so the evaluation now
runs four commands; the git check finds its result by command, not position.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant