IF Commons GitHub

AnyFS Git hosts tests

0003Active

0003-anyfs-githost-tests · owner if · domain commons

Requirements

FR-001checkpassing

The fake of GitHub's API MUST refuse a branch that is not moved forward, MUST cut a recursive tree short where told, MUST answer a protected branch and a throttle as GitHub does; the fake of GitLab's API MUST page a tree along the Link header, MUST check each file a commit changes (a create of a file that exists, an update or a delete of one that does not, an update or a delete whose last commit is not the file's) and MUST commit on the head the branch has when the request arrives; the same contract tests MUST run on both.

Enforced (check): .github: cd commons/anyfs-githost && bun run verify — host.test.ts: one contract on the fake of each host

Proved by: anyfs-githost/suite/host.test.ts

Tests: passed: suite/host.test.ts the store passes every case of the conformance suite of AnyFS on both hosts, including the

FR-002checkpartly run

Where the environment names a repository on a real GitHub or GitLab and a token that may push to it, the conformance suite of AnyFS MUST run on it, in a folder of its own, with the token read from the environment by a function and written nowhere.

Enforced (check): .github: cd commons/anyfs-githost && bun run verify — real.test.ts: the contract on a real Git host where one can be run

Proved by: anyfs-githost/suite/real.test.ts

Tests: skipped: suite/real.test.ts on a real host named by the environment the store passes every case of the conformance sui

FR-003checkpartly run

Where no real host is named, the test MUST say why it did not run (that GitHub and GitLab cannot be run in the sandbox and that Gitea, which can be, does not speak their write API), and MUST NOT pass silently for want of it.

Enforced (check): .github: cd commons/anyfs-githost && bun run verify — real.test.ts: a test says why it did not run a real host

Proved by: anyfs-githost/suite/real.test.ts

Tests: skipped: suite/real.test.ts on a real host named by the environment the store passes every case of the conformance sui

Acceptance scenarios

  1. Given the fake of GitHub's API and the fake of GitLab's, When the contract runs, Then it is the same code, per FR-001.
  2. Given no real host is named, When the real-host test runs, Then it says why it did not, per FR-003.

Out of scope

  • A real GitHub or GitLab in the checks of every run: a token for one comes from the environment and is not in a test. A real Git host that can be run in process (Gitea or Forgejo) speaks its own API for a commit, not GitHub's or GitLab's, so it would need a client of its own: a later library.

Edge cases

  • A fake that is more lenient than the host: held to the contract that the real host runs, per FR-002.

Assumptions

  • None.

Open questions

  • None.

Key entities

  • The fake - a host's API made in process as a transport.

Success criteria

SC-001success criterion

The tests pass on Bun and on Node 26.

Review & acceptance checklist

  • [x] Every requirement is testable and has a test.

Titles, headings, exports, tables, columns and requirements. Esc closes.