Skip to content

Add end-to-end tests for hg repo operations - #2751

Draft
hahn-kev-bot wants to merge 1 commit into
developfrom
claude/hgresume-managed-apis-migration-bc907f
Draft

hahn-kev-bot wants to merge 1 commit into
developfrom
claude/hgresume-managed-apis-migration-bc907f

Conversation

@hahn-kev-bot

Copy link
Copy Markdown
Collaborator

AI summary

This adds end-to-end tests for every operation where LexBox API reads or writes the hg repos directly on the shared volume. It's stage one of moving that work to hgresume's new /api/manage/* endpoints (#2718). The follow-up PR swaps the implementation, and these tests show it still behaves the same. Only test code changes.

The tests only check results through the public API: GraphQL, REST, the TUS upload, and the hgweb and resumable proxies. They never look at disk paths, because disk access is what's being removed.

New tests (ProjectRepoTests, DeleteProjectTests):

  • Create: a new project gets an empty repo that hgweb serves, for codes starting with a letter and with a digit.
  • Copy to new project: the copy has the same tip as the source.
  • Hard delete: the repo stops being served, and recreating the same code gives a fresh empty repo.
  • Soft delete: the old code stops being served and can be reused with an empty repo.
  • Backup zip: downloading a backup and re-uploading it gives the same tip. This works for an empty repo too, and an unknown project code returns 404.
  • Reset, leave empty: the repo is empty, and the old tip can no longer be fetched.
  • Reset error cases: finishing a reset that was never started fails, and so does starting a second reset while one is running. In both cases the repo stays usable.
  • Reset + upload: covers a zip with .hg at the root, one with .hg nested in a folder plus extra files, and one with no .hg. The no-.hg upload fails with ZIP_MISSING_HG_FOLDER and a later upload still works. After each successful upload, a backup is downloaded to check that only .hg/ was kept.
  • Reset backup cleanup (dry run): the endpoint responds, and every name it returns is a valid reset backup older than 5 days.

Extended: SendReceiveServiceTests.ModifyProjectData now checks that after a push over hgweb or resumable, the background metadata job sets the repo size and entry count and leaves hasAbandonedTransactions false.

Not covered:

  • hasAbandonedTransactions being true, because the public API can't leave an interrupted transaction behind.
  • Actually deleting an old reset backup, because the API can't make a backup old enough.
  • Soft-deleting a project whose repo is already gone, because the API can't reach that state.

Current behaviour these tests pin:

  • A failed zip upload returns 500 with an app-error-code. The frontend relies on this.
  • The other reset errors are only asserted as ≥ 400, so fixing their status codes later won't fail these tests.

Test plan

  • dotnet build backend/Testing and dotnet format whitespace are clean
  • The new tests pass in CI's integration run against the kind cluster. They need the LexBox stack, so they weren't run locally.

🤖 Generated with Claude Code

Pin the current observable behaviour of HgService's on-disk repo
operations (create, copy, delete, soft delete, backup, reset, upload
zip, reset backup cleanup, post-push metadata) through the public API,
so the follow-up switch to hgresume's /api/manage endpoints can be
verified against it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added the 📦 Lexbox issues related to any server side code, fw-headless included label Oct 14, 2026
@coderabbitai

coderabbitai Bot commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

📦 Lexbox issues related to any server side code, fw-headless included

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants