Skip to content

Run the tests that need no Elasticsearch host in GitHub Actions - #52

Draft
gaurav wants to merge 1 commit into
biothings:mainfrom
TranslatorSRI:run-tests-in-github-actions
Draft

gaurav wants to merge 1 commit into
biothings:mainfrom
TranslatorSRI:run-tests-in-github-actions

Conversation

@gaurav

@gaurav gaurav commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

Nothing runs the test suite on pull requests, so tests drift unnoticed: before #42, the POST set-ID test posted a body the handler rejects and had evidently not been run in some time. This PR adds a GitHub Actions workflow that runs every test that needs no Elasticsearch host on pull requests, pushes to main and manual dispatch. Closes #44.

It is based on main and independent of #42 and #48, so it can merge in any order. Once #42 merges, the workflow also runs tests/test_openapi.py without changes here.

Calls worth overruling

  • It skips the two cluster test files rather than listing the files to run. tests/test_normalized_nodes.py and tests/test_set_identifiers.py query su10:9200, which GitHub can't reach; everything else uses fake or unreachable clients. A new test file therefore runs in CI by default, and one that needs the cluster has to be added to the skip list. A comment in the workflow says so.
  • uv pip install -e ".[tests]", not uv sync/uv run, which fail to resolve the project until requires-python is raised (Raise requires-python to >=3.10 so uv run can resolve the project #43). Once that's fixed, the workflow can switch to uv sync, ideally with a committed lockfile.
  • One Python version, 3.12, the version the Docker image runs, rather than a matrix.
  • The explanation lives in the workflow, not the README, since Rewrite the OpenAPI document to describe the Elasticsearch service, and make the endpoints match it #42 also adds a README section and the comment sits next to the skip list it explains.

What it deliberately does not do

Running the cluster tests in CI needs a fixture index in a service container or a reachable test cluster; see #19.

Verification

On 770aaa5, actionlint passes on the workflow, and its steps run in a fresh Python 3.12 venv (uv pip install -e ".[tests]", then the same pytest command) pass all of the 50-odd host-free tests on main. The workflow's own run on this PR is the real check.

🤖 Generated with Claude Code

Nothing ran the test suite on pull requests. The workflow runs on pull
requests, pushes to main and manual dispatch, with Python 3.12 as the
Docker image uses.

It skips the two test files that query the su10:9200 cluster rather
than listing the files to run, so new host-free tests (such as
tests/test_openapi.py from biothings#42) are picked up without editing it.

It installs with `uv pip install`, not `uv sync`, because `uv sync` and
`uv run` can't resolve the project until requires-python is raised
(biothings#43).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gaurav added a commit to gaurav/prcoder that referenced this pull request Oct 15, 2026
…itch between them when it has several (#144)

A branch pushed to a fork by URL, with no tracking config, had a pull
request prcoder could not see: nodenorm-es's
`run-tests-in-github-actions` has biothings/NodeNormalizationAPI#52 open
from `TranslatorSRI:run-tests-in-github-actions`, and the pane said
there was none. `gh pr view` finds a pull request by a head label built
from the branch's push config, and a cross-repository one's label is
`fork:branch`, which a bare branch name never matches. This PR looks for
the branch's pull request in every repository it could be in, shows it
with each side of `head → base` labelled by where it lives, and, when a
branch has more than one, lets the switcher pick between them without a
checkout. It also re-measures every figure in `docs/Verifying.md`, which
the lookup moved. Closes #129.

## The calls worth overruling

- **Where to look.** `repoInfo` lists the repositories once at startup:
gh's base repo, its parent when it is a fork, and the repository behind
each GitHub remote. The poll runs one `gh pr list --head <branch>` per
repository in place of `gh pr view`.
- **Strangers.** `--head main` in a parent matches every fork's `main`.
A row is this branch's when its head repository is one of those, or this
clone has its head commit, which alone vouches for a fork no remote
names. When a plain `git push` of the branch goes to a same-named branch
(`pushRepo`, from `%(push)`), only that repository's head counts, so a
fork's `main` is not given the parent's `main → release`.
- **What a crowded name costs.** The first page is five deep, with the
checks, so the common case is one call. One all strangers (vscode has 63
open from a `main`) is asked again 100 deep without them; the branch's
found only there gets its checks from `gh pr view`. Unvouched heads go
to git as one `cat-file --batch-check` per page. Nothing is remembered
between polls; #147 is the proposal to remember the answer instead.
- **Which to show** (`pickPr`): the one picked in the switcher; else
open over merged, at this clone's HEAD, the one shown last poll (so a
comment on the other of two does not swap the pane), gh's base
repository first, newest.
- **Labels.** A side in origin's repository is bare, as it always was;
one another remote names is `upstream:main`; one no remote names is
`TranslatorSRI:branch`, as GitHub writes it. `origin:` on every side was
the alternative: noise in the common case.
- **The URL is a pull request's identity**, not its number, which a fork
and its parent can share: `keepPr`, the switcher's options and
`/api/pr/switch`, which runs `gh pr checkout <url>`: gh resolves a bare
number in its base repository. The route takes only the whole of a
`https://github.com/owner/repo/pull/N` in one of the repositories above,
and `/api/pr/choose` only a URL the last poll listed
([Security.md](https://github.com/gaurav/prcoder/blob/a96dc21/docs/Security.md#checking-new-work)).
- **`scope`** is `current` when the lookup found the pull request,
whichever repository it is in, so a fork's pull request into its parent
keeps its sync light. The Stack tab and a local patch's base remote go
by the pull request's own repository.

## What's here

- The lookup, `branchPrs` in `github.js`, its gh and git facts dated in
its docstrings.
- The head's state row and the terminal's status block label both sides
([Panes.md](https://github.com/gaurav/prcoder/blob/a96dc21/docs/Panes.md#the-head)).
- The switcher leads with **On this branch** when the branch has two or
more pull requests, each with its stack; a pick there (`POST
/api/pr/choose`) shows it without a checkout until the branch changes,
even on a dirty tree
([Panes.md](https://github.com/gaurav/prcoder/blob/a96dc21/docs/Panes.md#moving-between-pull-requests)).
The pane with no pull request names the repositories it looked in when
there was more than one.
- `g` in the terminal runs the same lookup as the poll.
- Two more git calls per poll on every branch: where it pushes, and HEAD
read again beside `git status`, so a commit during the lookup's gh calls
cannot pair an old head with a new tree
([figures](https://github.com/gaurav/prcoder/blob/a96dc21/docs/Verifying.md#figures-worth-re-measuring)).

## What it deliberately does not do

The git side still asks everything of `origin`: Create PR's push, the
sync light's fallback on a branch with no pull request, the stack walk,
the compare page's owner. That is #143. The repositories looked in are
read once at startup, so a remote added mid-session needs a restart
(#145). The switcher's and Stack tab's list is still gh's base
repository's alone. A branch with no open pull request still pays a
second pass per repository on every poll.

## Verification

All 500-odd tests pass on a96dc21, locally and in CI, the browser suite
in Chromium and Firefox included; `PRCODER_PR=1 node tools/browser.mjs`
in Firefox gives every line its expected value on the same commit.
Against nodenorm-es, this tree's server with `cwd` there shows
biothings#52 as current and synced. The two-pull-request case and the
push-target rule are covered by fixtures only: no branch of this repo
has two pull requests.

Nothing is blocking.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
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.

Run the tests that need no Elasticsearch host in GitHub Actions

1 participant