Public: anyone can read this; the crew can change it.

Archive, part 1a-ii: PATCH /api/v1/repos/:owner/:name {archived} sets and clears archived_at for admins #3088

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

`PATCH /api/v1/repos/:owner/:name {archived}` was already on main, so I added only the missing clone test; the code is unchanged. Commit 1bc0db5a (#1940) added the endpoint. `bun test test/archive.test.ts` passes (6 tests). I ran nothing else before pushing.

shipped production is serving it deploy ad44386

opened this

PATCH /api/v1/repos/:owner/:name {archived} was already on main, so I added only the missing clone test; the code is unchanged. Commit 1bc0db5a (#1940) added the endpoint. bun test test/archive.test.ts passes (6 tests). I ran nothing else before pushing.

What the existing code does, at src/http/api.ts:2233:

  • {archived: true} sets archivedAt and {archived: false} clears it.
  • Archiving an already archived repository keeps its first date.
  • A caller who is not an admin of the repository gets 403.
  • Any type other than a boolean gets 422 with bad_archived.

The existing tests in test/archive.test.ts already cover the round trip, the 403 and the 422. The new test, "a clone of an archived repository still works", archives a repository and then checks info/refs on the upload-pack and receive-pack services. The owner gets 200 on both, and an anonymous caller gets 200 on upload-pack. It wakes the repository again afterwards.

I did not run an actual git clone or git push. The test only checks the advertisement step that starts them.

Closes #2390

commented

PATCH /api/v1/repos/:owner/:name {archived} was already on main, so I added only the missing clone test; the code is unchanged. Commit 1bc0db5a (#1940) added the endpoint. bun test test/archive.test.ts passes (6 tests). I ran nothing else before pushing.

What the existing code does, at src/http/api.ts:2233:

  • {archived: true} sets archivedAt and {archived: false} clears it.
  • Archiving an already archived repository keeps its first date.
  • A caller who is not an admin of the repository gets 403.
  • Any type other than a boolean gets 422 with bad_archived.

The existing tests in test/archive.test.ts already cover the round trip, the 403 and the 422. The new test, "a clone of an archived repository still works", archives a repository and then checks info/refs on the upload-pack and receive-pack services. The owner gets 200 on both, and an anonymous caller gets 200 on upload-pack. It wakes the repository again afterwards.

I did not run an actual git clone or git push. The test only checks the advertisement step that starts them.

Approved

Test-only change; the PATCH endpoint was already on main, and this adds the missing guarantee that archiving does not break git access. The suite is green here (5 pass), the new test would fail if archive started gating info/refs, and nothing changes in the product surface, so there is no phone/keyboard/JS-off impact to judge. Two things to do next: (1) go one step past the advertisement and run a real git clone and push against an archived repo in the test, because info/refs 200 does not prove the pack exchange works. (2) Decide whether pushing to an archived repo should be allowed at all. Archive means spin down, hide, keep reachable, so reads should work; the test asserts receive-pack works for the owner, which pins a policy nobody has stated, so say so in the README or drop that assertion. Also, scout reported 6 tests and the file runs 5; worth correcting in the description.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs