Rename RepositoryNode.releases to recent_releases
- Dominant language
- Python
- Stars
- 451
- Forks
- 707
- Avg merge
- 22h 59m
- Merged PRs (30d)
- 91
Description
**Describe the issue**
The GraphQL `RepositoryNode` in `backend/apps/github/api/internal/nodes/repository.py` exposes a field named `releases` that returns a limited list of **recent** releases (ordered by `-published_at`). An in-code TODO asks to rename it to `recent_releases` for clarity and consistency with `ProjectNode`.
- **File:** `backend/apps/github/api/internal/nodes/repository.py`
- **Lines:** 81–85
**Current behavior**
- Schema field is `releases`; it returns the most recent releases (up to `RECENT_RELEASES_LIMIT`). The name suggests the full set.
**Expected behavior**
- Schema field is `recent_releases`; same data and limit, clearer name.
**Are you going to work on this?**
- [x] Yes
- [ ] No
**Proposed solution (minimal, will work)**
**Context:** Same node also has `issues` => `recent_issues` . This rename is a breaking GraphQL change; backend and frontend must be updated together. Doing both renames in one PR is recommended.
1. **Backend — rename method and remove TODO**
In `backend/apps/github/api/internal/nodes/repository.py`, replace the `releases` method (lines 81–85) with:
```python
@strawberry.field
def recent_releases(self) -> list[ReleaseNode]:
"""Resolve recent releases."""
return self.published_releases.order_by("-published_at")[:RECENT_RELEASES_LIMIT]
```
Remove the TODO comment. Logic unchanged.
2. **Frontend — query and usage**
- In `frontend/src/server/queries/repositoryQueries.ts`, inside the `repository { ... }` selection in `GET_REPOSITORY_DATA`, change `releases` to `recentReleases`.
- In `frontend/src/app/organizations/[organizationKey]/repositories/[repositoryKey]/page.tsx`, change `repository.releases` to `repository.recentReleases` (or the name from your generated types).
- Regenerate GraphQL types (e.g. codegen) so generated types use `recentReleases`.
3. **Backend tests**
In `backend/tests/apps/github/api/internal/nodes/repository_test.py`:
- Change the field lookup from `"releases"` to `"recent_releases"` (e.g. in `test_resolve_releases` → `test_resolve_recent_releases`).
- Change `RepositoryNode.releases(mock_repository)` to `RepositoryNode.recent_releases(mock_repository)` (e.g. in `test_releases_method` → `test_recent_releases_method`).
Run `make check-test`.
4. **Frontend tests and mocks**
- In repository mocks (e.g. `frontend/__tests__/unit/data/mockRepositoryData.ts`), rename `releases` to `recentReleases`.
- In tests that reference `repository.releases`, use `repository.recentReleases`. Update e2e mocks if they use this shape.
- Run the frontend test suite.
Contributor guide
Assessment
This issue has not been assessed yet.