Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions docs/DESIGN.md
Original file line number Diff line number Diff line change
Expand Up @@ -940,9 +940,10 @@ committed maps list them, so no GEO files are needed) and, if any id or symbol u
the expression output changed, opens an issue with the counts and the commands to run
(`update_gene_ids.py` → `build_expression.py` → `build_rdf.py`). No change → the
release is recorded without an issue; Chado unreachable from CI → the issue is opened
without counts. `checks/flybase_release_check.json` makes each release reported once.
without counts. Maps already at the current release → the release is recorded (nothing to
check). `checks/flybase_release_check.json` makes each release handled once.
The full rebuild is not automated (it needs the GEO matrices / h5ad files and ROBOT).
(`checks/flybase_release_check.json` is created on the first FlyBase release check.) Not run on PRs: it needs OLS, which is
Not run on PRs: it needs OLS, which is
sometimes unavailable.

### 2026-10 regeneration under the general curation rules
Expand Down
31 changes: 21 additions & 10 deletions scripts/check_flybase_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
by the expression output has changed, it opens an issue in this repo with the counts
and the commands to run (`update_gene_ids.py`, `build_expression.py`, `build_rdf.py`); if nothing
changed, it records the release without an issue. If Chado can't be reached, the
issue is still opened, without counts.
issue is still opened, without counts. If the maps are already at the current release,
it records the release (nothing to check).

Each release is handled once: `checks/flybase_release_check.json` records the last
release checked.
Expand Down Expand Up @@ -81,10 +82,14 @@ def main() -> int:
maps = sorted(REPO_ROOT.glob("projects/*/gene_id_map.tsv"))
behind = {p.parent.name: ug.map_release(p) for p in maps if ug.map_release(p) != release}
record = json.loads(RECORD.read_text()) if RECORD.exists() else {}
if not behind or record.get("release") == release:
print(f"FlyBase {full}: gene id maps {'current' if not behind else 'already reported'}; nothing to do")
if record.get("release") == release:
print(f"FlyBase {full}: already checked on {record.get('checked_at')}; nothing to do")
_output(changed=False)
return 0
if not behind:
print(f"FlyBase {full}: gene id maps current; nothing to check")
_record(release, full, args.dry_run, maps_current=True)
return 0

print(f"FlyBase {full}; gene id maps at: {behind}")
results, chado_ok = {}, True
Expand Down Expand Up @@ -128,15 +133,21 @@ def main() -> int:
else:
print(" no gene id or symbol used by the expression output changed; no issue")

if not args.dry_run:
RECORD.parent.mkdir(exist_ok=True)
RECORD.write_text(json.dumps({"release": release, "release_text": full,
"checked_at": dt.date.today().isoformat(),
"chado_queried": chado_ok, "changes": results,
"issue": issue}, indent=2) + "\n")
_output(changed=True)
_record(release, full, args.dry_run, maps_current=False, chado_queried=chado_ok,
changes=results, issue=issue)
return 0


def _record(release: str, full: str, dry_run: bool, **fields) -> None:
"""Write the release record (so the release is handled once), unless a dry run."""
if dry_run:
_output(changed=False)
return
RECORD.parent.mkdir(exist_ok=True)
RECORD.write_text(json.dumps({"release": release, "release_text": full,
"checked_at": dt.date.today().isoformat(), **fields}, indent=2) + "\n")
_output(changed=True)


if __name__ == "__main__":
sys.exit(main())
16 changes: 15 additions & 1 deletion tests/test_ci_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,23 @@ def lookup(ids):
assert mod.main() == 0 and len(opened) == 1 and "could not be queried" in opened[0][1]


def test_flybase_same_release_does_nothing(tmp_path, monkeypatch):
def test_flybase_maps_current_records_release_once(tmp_path, monkeypatch):
mod, opened = _flybase(tmp_path, monkeypatch, "FB2026_03, released September 17, 2026",
lambda ids: (_ for _ in ()).throw(AssertionError("queried")))
out = tmp_path / "gh_output"
monkeypatch.setenv("GITHUB_OUTPUT", str(out))
record = tmp_path / "checks" / "flybase_release_check.json"
assert mod.main() == 0 and opened == []
rec = json.loads(record.read_text())
assert rec["release"] == "FB2026_03" and rec["maps_current"] is True
assert out.read_text() == "changed=true\n"
assert mod.main() == 0 and out.read_text() == "changed=true\nchanged=false\n" # once per release


def test_flybase_maps_current_dry_run_writes_nothing(tmp_path, monkeypatch):
mod, opened = _flybase(tmp_path, monkeypatch, "FB2026_03, released September 17, 2026",
lambda ids: (_ for _ in ()).throw(AssertionError("queried")))
monkeypatch.setattr("sys.argv", ["check_flybase_release.py", "--dry-run"])
assert mod.main() == 0 and opened == []
assert not (tmp_path / "checks" / "flybase_release_check.json").exists()

Expand Down
Loading