Skip to content

Add GET /api/v1/commitfests endpoint listing all commitfests - #114

Merged
JelteF merged 3 commits into
postgres:mainfrom
kjrocker:api-commitfests-index
Sep 1, 2026
Merged

Add GET /api/v1/commitfests endpoint listing all commitfests#114
JelteF merged 3 commits into
postgres:mainfrom
kjrocker:api-commitfests-index

Conversation

@kjrocker

@kjrocker kjrocker commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

There's no way to discover which commitfests exist. needs_ci returns only the two or three currently relevant ones, and /api/v1/commitfests/<cfid>/patches requires a cfid.

This adds GET /api/v1/commitfests which returns every commitfest, closed and draft ones included:

{"commitfests": [{"id": 1, "name": "PG18-3", "status": "Closed", "draft": false,
                  "startdate": "2024-11-01", "enddate": "2024-11-30"}, ...]}

This data is all already available from /commitfest_history and /archive, but those would need to be scraped, this makes the data machine-readable.

Notes:

  • Order by ID since start dates can tie and this gives us a stable order.
  • No pagination because it's a small dataset.
  • I've exposed the 'draft' field through CommitFest.to_json(). This does add the key to needs_ci. If we'd rather be strict about that endpoint, I can build the dict inline in a new view instead.

@kjrocker
kjrocker force-pushed the api-commitfests-index branch 3 times, most recently from b49d1d9 to d894953 Compare September 1, 2026 20:49
Commitfests marked as draft are otherwise indistinguishable from regular
ones in the API output, since they share the Open status.
There is currently no way to discover which commitfests exist. The
needs_ci endpoint only returns the two or three currently relevant ones,
and the patches endpoint requires a commitfest id you already know. API
consumers are left enumerating ids until they get a 404, or scraping the
HTML pages that already show this data.

This returns every commitfest, closed and draft ones included, ordered
by id.

It deliberately does not use CommitFest.relevant_commitfests(), which
has write side effects and can return unsaved objects.
@kjrocker
kjrocker force-pushed the api-commitfests-index branch from d894953 to ed8ca0e Compare September 1, 2026 20:58
@JelteF

JelteF commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

Linter/formatting check is failing. Other than that this seems like a good addition.

@kjrocker

kjrocker commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

The linter/formatting failures are throughout the repo, it seems like ruff pulled in a new version with different defaults.

@JelteF
JelteF merged commit 07e2bc6 into postgres:main Sep 1, 2026
2 checks passed
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.

2 participants