You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tooling.apache.org by ar...@apache.org on 2026/10/05 15:10:19 UTC
(tooling-trusted-releases) 02/02: #1707 - broad documentation fixes
This is an automated email from the ASF dual-hosted git repository.
alitheg pushed a commit to branch arm
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-releases.git
commit 9a2b64890a52705a31bae4c52694822f1c15054c
Author: Alastair McFarlane <ar...@apache.org>
AuthorDate: Mon Oct 5 16:00:23 2026 +0100
#1707 - broad documentation fixes
---
atr/docs/api-documentation-policy.md | 72 +++--
...ving-releases.md => archiving-and-lifecycle.md} | 81 ++---
atr/docs/asf-modules.md | 183 ++++++++---
atr/docs/authentication-security.md | 333 +++++++++++++++-----
atr/docs/authorization-security.md | 207 ++++++++-----
atr/docs/build-processes.md | 46 ++-
atr/docs/checks.md | 185 +++++++++--
atr/docs/code-conventions.md | 170 +++++++---
atr/docs/code-policies.md | 8 +-
atr/docs/compose-phase.md | 28 +-
atr/docs/database.md | 344 ++++++++++++++++-----
atr/docs/dependency-updates.md | 112 ++++---
atr/docs/developer-guide.md | 17 +-
atr/docs/file-handling.md | 48 ++-
atr/docs/finish-phase.md | 30 +-
atr/docs/getting-started.md | 49 +--
atr/docs/glossary.md | 83 +++++
atr/docs/how-to-contribute.md | 83 +++--
atr/docs/index.md | 9 +-
atr/docs/input-validation.md | 171 +++++++---
atr/docs/license-checks.md | 29 +-
atr/docs/making-releases.md | 41 +++
atr/docs/moving-to-atr.md | 88 ++++--
atr/docs/overview-of-the-code.md | 169 +++++++---
atr/docs/podling-releases.md | 59 ++--
atr/docs/project-configuration.md | 159 +++++++---
atr/docs/projects.md | 160 ++++++----
atr/docs/promoting-to-release.md | 44 ++-
atr/docs/release-catalog.md | 72 +++--
atr/docs/release-manager-setup.md | 84 +++--
atr/docs/release-process-description.md | 34 --
atr/docs/resource-management.md | 167 +++++++---
atr/docs/running-and-creating-tests.md | 94 ++++--
atr/docs/running-the-server.md | 43 ++-
atr/docs/sbom-architecture.md | 92 ++++--
atr/docs/sbom-workflows.md | 58 +++-
atr/docs/scope.md | 145 +++++----
atr/docs/sessions.md | 199 ++++++------
atr/docs/signing-artifacts.md | 55 +++-
atr/docs/staging-and-voting.md | 59 +++-
atr/docs/storage-interface.md | 313 ++++++++++++++-----
atr/docs/tasks.md | 29 +-
atr/docs/tls-security-configuration.md | 28 +-
atr/docs/trusted-publishing.md | 180 ++++++++---
atr/docs/uploading-files.md | 82 +++--
atr/docs/user-interface.md | 157 ++++++++--
atr/docs/vote-phase.md | 36 +--
atr/get/docs.py | 17 +-
scripts/docs_check.py | 142 ++++++++-
49 files changed, 3630 insertions(+), 1464 deletions(-)
diff --git a/atr/docs/api-documentation-policy.md b/atr/docs/api-documentation-policy.md
index 2db61e2d..d1412d33 100644
--- a/atr/docs/api-documentation-policy.md
+++ b/atr/docs/api-documentation-policy.md
@@ -24,27 +24,44 @@ ATR publishes machine-readable API documentation at two endpoints:
* `/api/openapi.json` — the OpenAPI 3 specification for the ATR HTTP API
* `/api/docs` — a Swagger UI rendering of that specification
-Both endpoints are reachable without authentication. This document records the reason that is the intended behaviour, what the public surface does and does not include, and what protections are in place at the endpoints the specification describes.
+Both endpoints are reachable without authentication. This document records the reason that is the
+intended behaviour, what the public surface does and does not include, and what protections are in
+place at the endpoints the specification describes.
## Decision
-`/api/openapi.json` and `/api/docs` are **intentionally public** and do not require authentication. The corresponding inline `audit_guidance` comment in [`atr/server.py`](/ref/atr/server.py) is the source of truth for the implementation; this page is the policy record.
+`/api/openapi.json` and `/api/docs` are **intentionally public** and do not require authentication.
+The corresponding inline `audit_guidance` comment in [`atr/server.py`](/ref/atr/server.py) is the
+source of truth for the implementation; this page is the policy record.
## Rationale
-1. **ATR exposes a public API by design.** The HTTP API is consumed by the `atr` CLI client, by ASF tooling GitHub Actions, and by other release tooling outside the ASF. Publishing the specification publicly is the most direct way for those clients, and for prospective contributors, to discover what the API offers.
+1. **ATR exposes a public API by design.** The HTTP API is consumed by the `atr` CLI client, by ASF
+ tooling GitHub Actions, and by other release tooling outside the ASF. Publishing the
+ specification publicly is the most direct way for those clients, and for prospective
+ contributors, to discover what the API offers.
-2. **Open-source ASF practice.** ATR is an Apache Software Foundation project. Project interfaces and their documentation are expected to be openly accessible.
+2. **Open-source ASF practice.** ATR is an Apache Software Foundation project. Project interfaces
+ and their documentation are expected to be openly accessible.
-3. **No admin or internal surface is exposed.** The `ApiOnlyOpenAPIProvider` class in [`atr/server.py`](/ref/atr/server.py) filters the generated specification so that only routes whose path begins with `/api` appear. Admin routes, internal blueprints, and the web UI's own endpoints are excluded from the published spec, so an unauthenticated reader does not learn about them from this channel.
+3. **No admin or internal surface is exposed.** The `ApiOnlyOpenAPIProvider` class in
+ [`atr/server.py`](/ref/atr/server.py) filters the generated specification so that only routes
+ whose path begins with `/api` appear. Admin routes, internal blueprints, and the web UI's own
+ endpoints are excluded from the published spec, so an unauthenticated reader does not learn about
+ them from this channel.
-4. **Documenting an endpoint does not grant access to it.** The `@quart_schema.hide` decorator on the Swagger UI route only suppresses that route from appearing in the spec; it does not relax the rate limit, the CSRF posture, or any per-endpoint authentication check. Authentication for the documented API is enforced separately, at the endpoint, as described below.
+4. **Documenting an endpoint does not grant access to it.** The `@quart_schema.hide` decorator on
+ the Swagger UI route only suppresses that route from appearing in the spec; it does not relax the
+ rate limit, the CSRF posture, or any per-endpoint authentication check. Authentication for the
+ documented API is enforced separately, at the endpoint, as described below.
## What the public spec contains
* Paths under `/api`
-* HTTP methods, parameter names and types, request body schemas, and response schemas for those paths
-* The `BearerAuth` security scheme declaration, so that clients know JWT Bearer tokens are the expected credential for protected operations
+* HTTP methods, parameter names and types, request body schemas, and response schemas for those
+ paths
+* The `BearerAuth` security scheme declaration, so that clients know JWT Bearer tokens are the
+ expected credential for protected operations
## What the public spec does not contain
@@ -54,26 +71,41 @@ Both endpoints are reachable without authentication. This document records the r
## Endpoint-level authentication is unchanged
-The endpoints described by the published specification continue to enforce their own authentication and rate limits independently of whether the spec is public:
+The endpoints described by the published specification continue to enforce their own authentication
+and rate limits independently of whether the spec is public:
-* Protected API endpoints require a valid JWT Bearer token, issued from a Personal Access Token. See `3.12.` [Authentication security](authentication-security) for the full authentication model.
-* The `/api` blueprint applies a blueprint-wide rate limit in [`atr/blueprints/api.py`](/ref/atr/blueprints/api.py), and JWT issuance has its own tighter limits.
+* Protected API endpoints require a valid JWT Bearer token, issued from a Personal Access Token. See
+ `3.12.` [Authentication security](authentication-security) for the full authentication model.
+* The `/api` blueprint applies a blueprint-wide rate limit in
+ [`atr/blueprints/api.py`](/ref/atr/blueprints/api.py), and JWT issuance has its own tighter
+ limits.
-Publishing the specification therefore tells a reader *which* endpoints exist and *what shape* requests must take; it does not allow them to call protected endpoints.
+Publishing the specification therefore tells a reader *which* endpoints exist and *what shape*
+requests must take; it does not allow them to call protected endpoints.
## ASVS reference
This decision addresses ASVS v5 §13.4.5 (L2). The control is satisfied because:
-* The public specification is filtered by `ApiOnlyOpenAPIProvider` and does not leak admin functionality or internal implementation details.
-* Each endpoint documented in the specification enforces its own authentication and rate-limit requirements.
-* The decision is recorded both as an inline `audit_guidance` comment in the code and in this document.
+* The public specification is filtered by `ApiOnlyOpenAPIProvider` and does not leak admin
+ functionality or internal implementation details.
+* Each endpoint documented in the specification enforces its own authentication and rate-limit
+ requirements.
+* The decision is recorded both as an inline `audit_guidance` comment in the code and in this
+ document.
-If the public-by-default policy ever needs to change, the appropriate path is to remove the route registrations in `_app_setup_api_docs` (or place them behind an authentication check) and update this section.
+If the public-by-default policy ever needs to change, the appropriate path is to remove the route
+registrations in `_app_setup_api_docs` (or place them behind an authentication check) and update
+this section.
## Implementation references
-* [`server.py`](/ref/atr/server.py) — `_app_setup_api_docs` registers the `/api/docs` and `/api/openapi.json` routes and carries the inline `audit_guidance` comment; `ApiOnlyOpenAPIProvider` restricts the generated spec to `/api` routes
-* [`blueprints/api.py`](/ref/atr/blueprints/api.py) — defines the `/api` blueprint and the blueprint-wide rate limit
-* [`jwtoken.py`](/ref/atr/jwtoken.py) — JWT verification and the decorators that protect individual API endpoints
-* [`templates/about.html`](/ref/atr/templates/about.html) — the public "About" page links to `/api/docs` so that prospective API users can discover the documentation
+* [`server.py`](/ref/atr/server.py) — `_app_setup_api_docs` registers the `/api/docs` and
+ `/api/openapi.json` routes and carries the inline `audit_guidance` comment;
+ `ApiOnlyOpenAPIProvider` restricts the generated spec to `/api` routes
+* [`blueprints/api.py`](/ref/atr/blueprints/api.py) — defines the `/api` blueprint and the
+ blueprint-wide rate limit
+* [`jwtoken.py`](/ref/atr/jwtoken.py) — JWT verification and the decorators that protect individual
+ API endpoints
+* [`templates/about.html`](/ref/atr/templates/about.html) — the public "About" page links to
+ `/api/docs` so that prospective API users can discover the documentation
diff --git a/atr/docs/archiving-releases.md b/atr/docs/archiving-and-lifecycle.md
similarity index 60%
rename from atr/docs/archiving-releases.md
rename to atr/docs/archiving-and-lifecycle.md
index 3c82b8fe..f37fc755 100644
--- a/atr/docs/archiving-releases.md
+++ b/atr/docs/archiving-and-lifecycle.md
@@ -1,6 +1,6 @@
# 5.4. Archiving and lifecycle
-**Up**: `5.` [Making releases](release-process-description)
+**Up**: `5.` [Making releases](making-releases)
**Prev**: `5.3.1.` [Promoting to release](promoting-to-release)
@@ -21,9 +21,9 @@
A release does not end at its announcement. ASF
[release distribution policy](https://infra.apache.org/release-distribution.html#archival) is that
the distribution area should hold only the current release of each line, so an older release is
-***archived*** once it has been superseded or is no longer supported. An archived release is not lost: its files remain
-available from [archive.apache.org](https://archive.apache.org/), and it stays in the
-[Release catalog](release-catalog).
+***archived*** once it has been superseded or is no longer supported. An archived release is not
+lost: its files remain available from [archive.apache.org](https://archive.apache.org/), and it
+stays in the [Release catalog](release-catalog).
This page describes how a release is archived, what archiving does, and how to record the end of
support for a line of releases.
@@ -32,16 +32,16 @@ support for a line of releases.
When a release is archived, ATR:
-* marks it as archived, so that it moves from the project's current releases to its archive, both
- in ATR and in the release catalog,
+* marks it as archived, so that it moves from the project's current releases to its archive, both in
+ ATR and in the release catalog,
* removes the release's files from `svn:dist:release`, and so from the download servers,
* records the event, which is published as an "end of distribution" event among the project's
[lifecycle events](#lifecycle-events).
-ATR removes only the files that it knows belong to the release. Where a release has a directory
-to itself, the whole directory is removed. Where it shares a directory with other releases, only
-its own files are removed. If other files remain in the release's own directory afterwards, ATR
-tells you, because they may need to be cleaned up by hand.
+ATR removes only the files that it knows belong to the release. Where a release has a directory to
+itself, the whole directory is removed. Where it shares a directory with other releases, only its
+own files are removed. If other files remain in the release's own directory afterwards, ATR tells
+you, because they may need to be cleaned up by hand.
Files committed to `svn:dist:release` are picked up by archive.apache.org automatically, so you do
not have to copy a release there before archiving it.
@@ -49,41 +49,42 @@ not have to copy a release there before archiving it.
## Archiving a release
Members of the project's committee archive a release from the "Release actions" card on the
-release's page, which you reach from the release's entry on the project page. Use "Archive
-release", and type `ARCHIVE` to confirm.
+release's page, which you reach from the release's entry on the project page. Use "Archive release",
+and type `ARCHIVE` to confirm.
If the release is the latest in its cycle, the card warns you that the cycle will have no current
-release in the downloads area once it is archived. A release is the latest in its cycle according
-to the project's version scheme, described under [Lifecycle](project-configuration#lifecycle).
+release in the downloads area once it is archived. A release is the latest in its cycle according to
+the project's version scheme, described under [Lifecycle](project-configuration#lifecycle).
## Archiving the prior release automatically
-Most releases supersede the one before them, so ATR can archive the prior release for you when
-the new one is announced:
+Most releases supersede the one before them, so ATR can archive the prior release for you when the
+new one is announced:
1. Enable "Allow auto-archive" on the project's [Finish](project-configuration#finish) tab.
2. When you start a release, select "Auto archive prior release".
-3. When you announce the release, the announcement form shows the version that will be archived,
- and you can still choose to clear the option there.
+3. When you announce the release, the announcement form shows the version that will be archived, and
+ you can still choose to clear the option there.
-The prior release is the previous release in the same cycle, so a new `2.x` release does not
-archive a `1.x` release that is still supported.
+The prior release is the previous release in the same cycle, so a new `2.x` release does not archive
+a `1.x` release that is still supported.
## Archiving outside ATR
-ATR watches `svn:dist:release`. If the files of a release are removed from it directly, without
-ATR, the release is archived in ATR and in the release catalog once the removal has been
-committed. If the files of an archived release are later committed back, the release is restored
-as a current release.
+ATR watches `svn:dist:release`. If the files of a release are removed from it directly, without ATR,
+the release is archived in ATR and in the release catalog once the removal has been committed. If
+the files of an archived release are later committed back, the release is restored as a current
+release.
## Lifecycle events
-Archiving records that a release is no longer distributed. The end of development and support
-are properties of a whole ***cycle***, such as all `2.x` releases, and you record them as the
+Archiving records that a release is no longer distributed. The end of development and support are
+properties of a whole ***cycle***, such as all `2.x` releases, and you record them as the
[cycle's dates](project-configuration#cycle-dates).
-ATR publishes both as lifecycle events in the [Release catalog](release-catalog#machine-readable-data),
-in a `cle.json` document for each project. The document follows the
+ATR publishes both as lifecycle events in the
+[Release catalog](release-catalog#machine-readable-data), in a `cle.json` document for each project.
+The document follows the
[Common Lifecycle Enumeration](https://ecma-international.org/publications-and-standards/standards/ecma-428/)
(***CLE***) standard, which defines the events. What you do in ATR produces them as follows:
@@ -97,21 +98,21 @@ defines, so you can fix a mistake without hiding it from consumers of the feed.
## Retiring a project
-A project that is no longer maintained can be retired. Retiring a project requires
-***Contingent Approval*** from the committee, which is a vote held through the ASF's Contingent
-Approval Portal (***CAP***), currently at [cap-test.apache.org](https://cap-test.apache.org/).
-Committee members cast their votes on the portal. A member of the committee uses
-"Request archival" in the Actions card on the project page, which starts the vote. It is offered
-once all the project's releases have been archived, and only where the committee has another
-active project. If the vote passes, the member who asked returns to complete the archival, which
-deletes any draft releases and retires the project.
+A project that is no longer maintained can be retired. Retiring a project requires ***Contingent
+Approval*** from the committee, which is a vote held through the ASF's Contingent Approval Portal
+(***CAP***), currently at [cap-test.apache.org](https://cap-test.apache.org/). Committee members
+cast their votes on the portal. A member of the committee uses "Request archival" in the Actions
+card on the project page, which starts the vote. It is offered once all the project's releases have
+been archived, and only where the committee has another active project. If the vote passes, the
+member who asked returns to complete the archival, which deletes any draft releases and retires the
+project.
A project that has never had a release, for example one created by mistake, is offered "Request
deletion" instead. It works in the same way, and completing it removes the project from ATR
altogether rather than retiring it.
-A retired project cannot be edited and cannot start releases. Its archived releases remain in
-the release catalog, and the project is listed on the catalog's Attic page.
+A retired project cannot be edited and cannot start releases. Its archived releases remain in the
+release catalog, and the project is listed on the catalog's Attic page.
-Contingent Approval is not available to podlings. Retiring a podling is a decision for the
-Incubator PMC.
+Contingent Approval is not available to podlings. Retiring a podling is a decision for the Incubator
+PMC.
diff --git a/atr/docs/asf-modules.md b/atr/docs/asf-modules.md
index e2d1cf81..6b9d7000 100644
--- a/atr/docs/asf-modules.md
+++ b/atr/docs/asf-modules.md
@@ -14,19 +14,32 @@
## Overview
-ATR makes use of source modules maintained by ASF, rather than only on third-party packages from PyPI. This page records which ASF-maintained modules ATR depends on, and how ATR uses each of them.
+ATR makes use of source modules maintained by ASF, rather than only on third-party packages from
+PyPI. This page records which ASF-maintained modules ATR depends on, and how ATR uses each of them.
-At present there is a single direct dependency of this kind: [ASFQuart](https://github.com/apache/infrastructure-asfquart), which forms the foundation of ATR's web application. ASFQuart in turn brings in [asfpy](https://github.com/apache/infrastructure-asfpy) as a transitive dependency, but ATR does not use asfpy directly. The two are covered in turn below.
+At present there is a single direct dependency of this kind:
+[ASFQuart](https://github.com/apache/infrastructure-asfquart), which forms the foundation of ATR's
+web application. ASFQuart in turn brings in [asfpy](https://github.com/apache/infrastructure-asfpy)
+as a transitive dependency, but ATR does not use asfpy directly. The two are covered in turn below.
## ASFQuart
-[ASFQuart](https://github.com/apache/infrastructure-asfquart) is a shared framework library maintained by ASF Infrastructure that provides common functionality for ASF web applications built on [Quart](https://quart.palletsprojects.com/) (an async Python web framework). ATR uses ASFQuart as the foundation of its web application, relying on it for application construction, session management, OAuth integration with the ASF identity provider, and authentication enforcement.
+[ASFQuart](https://github.com/apache/infrastructure-asfquart) is a shared framework library
+maintained by ASF Infrastructure that provides common functionality for ASF web applications built
+on [Quart](https://quart.palletsprojects.com/) (an async Python web framework). ATR uses ASFQuart as
+the foundation of its web application, relying on it for application construction, session
+management, OAuth integration with the ASF identity provider, and authentication enforcement.
-ASFQuart is not an ATR dependency in the usual sense — it is infrastructure-level code shared across multiple ASF services. ATR does not modify or vendor ASFQuart; it uses the library as published. This section describes what ATR uses from ASFQuart and what security-relevant behaviour is inherited from it.
+ASFQuart is not an ATR dependency in the usual sense — it is infrastructure-level code shared across
+multiple ASF services. ATR does not modify or vendor ASFQuart; it uses the library as published.
+This section describes what ATR uses from ASFQuart and what security-relevant behaviour is inherited
+from it.
### Application construction
-ATR creates its application instance via `asfquart.construct()` in [`server.py`](/ref/atr/server.py). This call produces a `QuartApp` instance (a subclass of `quart.Quart`) with ASF-standard defaults applied:
+ATR creates its application instance via `asfquart.construct()` in
+[`server.py`](/ref/atr/server.py). This call produces a `QuartApp` instance (a subclass of
+`quart.Quart`) with ASF-standard defaults applied:
```python
app = asfquart.construct(__name__, token_file="secrets/generated/apptoken.txt")
@@ -34,21 +47,27 @@ app = asfquart.construct(__name__, token_file="secrets/generated/apptoken.txt")
The `construct()` function performs the following setup that ATR inherits:
-* Creates the Quart application with a persistent secret key (see [Application secret and session encryption](#application-secret-and-session-encryption))
+* Creates the Quart application with a persistent secret key (see
+ [Application secret and session encryption](#application-secret-and-session-encryption))
* Sets secure cookie defaults: `SameSite=Strict`, `Secure=True`, `HttpOnly=True`
* Registers a URL converter for filenames (`FilenameConverter`)
* Sets up the ASF OAuth endpoint at the default `/auth` URI
* Registers an error handler that redirects unauthenticated users to the OAuth login flow
-ATR then overrides the OAuth URLs to use the non-OIDC ASF OAuth endpoints and applies its own configuration via `app.config.from_object()`, taking care to preserve the ASFQuart-generated secret key.
+ATR then overrides the OAuth URLs to use the non-OIDC ASF OAuth endpoints and applies its own
+configuration via `app.config.from_object()`, taking care to preserve the ASFQuart-generated secret
+key.
### Session management
-ATR uses ASFQuart's session module (`asfquart.session`) for all cookie-based user sessions. ASFQuart sessions are cookie-based Quart sessions keyed by the application ID, which means multiple ASFQuart applications on the same host do not share sessions.
+ATR uses ASFQuart's session module (`asfquart.session`) for all cookie-based user sessions. ASFQuart
+sessions are cookie-based Quart sessions keyed by the application ID, which means multiple ASFQuart
+applications on the same host do not share sessions.
#### Reading sessions
-ATR calls `asfquart.session.read()` throughout the codebase to obtain the current user's session. This function:
+ATR calls `asfquart.session.read()` throughout the codebase to obtain the current user's session.
+This function:
1. Looks up the session cookie by application ID
2. Checks whether the session has expired (default: 7 days of inactivity)
@@ -56,31 +75,44 @@ ATR calls `asfquart.session.read()` throughout the codebase to obtain the curren
4. If valid, updates the last-access timestamp and returns a `ClientSession` object
5. If expired or absent, returns `None`
-The returned `ClientSession` object provides: `uid` (ASF user ID), `dn` (distinguished name), `fullname`, `email`, `committees` (PMC memberships), `projects` (committer memberships), `isMember`, `isChair`, `isRole` (role/service account flag), `mfa`, and a `metadata` dict for application-specific data.
+The returned `ClientSession` object provides: `uid` (ASF user ID), `dn` (distinguished name),
+`fullname`, `email`, `committees` (PMC memberships), `projects` (committer memberships), `isMember`,
+`isChair`, `isRole` (role/service account flag), `mfa`, and a `metadata` dict for
+application-specific data.
-ATR uses the `metadata` dict to track admin impersonation state (the `admin` key stores the original admin's UID when browsing as another user).
+ATR uses the `metadata` dict to track admin impersonation state (the `admin` key stores the original
+admin's UID when browsing as another user).
#### Writing and clearing sessions
-ATR calls `asfquart.session.write()` to create sessions after OAuth login and during admin impersonation. The write function stores the session data with creation (`cts`) and last-update (`uts`) timestamps. ATR calls `asfquart.session.clear()` to destroy sessions on logout, session expiry, and when ending admin impersonation.
+ATR calls `asfquart.session.write()` to create sessions after OAuth login and during admin
+impersonation. The write function stores the session data with creation (`cts`) and last-update
+(`uts`) timestamps. ATR calls `asfquart.session.clear()` to destroy sessions on logout, session
+expiry, and when ending admin impersonation.
#### Session expiry
ASFQuart enforces two expiry checks within `session.read()`:
* **Inactivity expiry**: sessions unused for longer than `expiry_time` (default 7 days) are deleted
-* **Maximum lifetime**: if `MAX_SESSION_AGE` is set in the application config, sessions older than this value are deleted regardless of activity
+* **Maximum lifetime**: if `MAX_SESSION_AGE` is set in the application config, sessions older than
+ this value are deleted regardless of activity
-ATR additionally enforces its own absolute session maximum via `ABSOLUTE_SESSION_MAX_SECONDS` in a `before_request` hook in [`server.py`](/ref/atr/server.py), which is independent of ASFQuart's expiry.
+ATR additionally enforces its own absolute session maximum via `ABSOLUTE_SESSION_MAX_SECONDS` in a
+`before_request` hook in [`server.py`](/ref/atr/server.py), which is independent of ASFQuart's
+expiry.
### OAuth authentication
-ATR uses ASFQuart's generic OAuth endpoint (`asfquart.generics.setup_oauth`) to handle the ASF OAuth login flow. The endpoint is registered at `/auth` and handles:
+ATR uses ASFQuart's generic OAuth endpoint (`asfquart.generics.setup_oauth`) to handle the ASF OAuth
+login flow. The endpoint is registered at `/auth` and handles:
-* `/auth?login` — initiates the OAuth flow by generating a cryptographic state token (`secrets.token_hex(16)`) and redirecting to the ASF OAuth service
+* `/auth?login` — initiates the OAuth flow by generating a cryptographic state token
+ (`secrets.token_hex(16)`) and redirecting to the ASF OAuth service
* `/auth?login=/path` — same as above, but redirects the user to `/path` after successful login
* `/auth?logout` — clears the user's session
-* `/auth?state=...&code=...` — callback from the ASF OAuth service that exchanges the authorization code for user data
+* `/auth?state=...&code=...` — callback from the ASF OAuth service that exchanges the authorization
+ code for user data
ATR overrides the default OAuth URLs to use the non-OIDC endpoints:
@@ -89,78 +121,133 @@ asfquart.generics.OAUTH_URL_INIT = "https://oauth.apache.org/auth?state=%s&redir
asfquart.generics.OAUTH_URL_CALLBACK = "https://oauth.apache.org/token?code=%s"
```
-The OAuth flow has a configurable workflow timeout (default 15 minutes) after which pending state tokens expire. State tokens are consumed immediately on use to prevent replay. The callback enforces HTTPS on the redirect URI and always uses a `Refresh` header (instead of a 302 redirect) when returning the user after login, in case `SameSite=Strict` is set, since the `Refresh` header approach counts as a same-site navigation, preserving the cookie.
+The OAuth flow has a configurable workflow timeout (default 15 minutes) after which pending state
+tokens expire. State tokens are consumed immediately on use to prevent replay. The callback enforces
+HTTPS on the redirect URI and always uses a `Refresh` header (instead of a 302 redirect) when
+returning the user after login, in case `SameSite=Strict` is set, since the `Refresh` header
+approach counts as a same-site navigation, preserving the cookie.
-ASFQuart also sets up a login enforcement handler (`enforce_login`) that intercepts `AuthenticationFailed` exceptions and redirects unauthenticated users to the OAuth flow. This handler respects the `X-No-Redirect` header and `Authorization` headers, so API clients receive error responses rather than HTML redirects.
+ASFQuart also sets up a login enforcement handler (`enforce_login`) that intercepts
+`AuthenticationFailed` exceptions and redirects unauthenticated users to the OAuth flow. This
+handler respects the `X-No-Redirect` header and `Authorization` headers, so API clients receive
+error responses rather than HTML redirects.
#### Open redirect prevention
-The OAuth endpoint validates redirect URIs in both login and logout flows: URIs must start with a single `/` and must not start with `//`. This prevents open redirect attacks where an attacker crafts a login URL that redirects to an external site after authentication.
+The OAuth endpoint validates redirect URIs in both login and logout flows: URIs must start with a
+single `/` and must not start with `//`. This prevents open redirect attacks where an attacker
+crafts a login URL that redirects to an external site after authentication.
### Authentication decorators
-ATR uses ASFQuart's `auth.require` decorator to enforce authentication on web routes. The decorator is applied in ATR's blueprint modules ([`blueprints/get.py`](/ref/atr/blueprints/get.py) and [`blueprints/post.py`](/ref/atr/blueprints/post.py)):
+ATR uses ASFQuart's `auth.require` decorator to enforce authentication on web routes. The decorator
+is applied in ATR's blueprint modules ([`blueprints/get.py`](/ref/atr/blueprints/get.py) and
+[`blueprints/post.py`](/ref/atr/blueprints/post.py)):
```python
decorated = wrapper if public else auth.require(auth.Requirements.committer)(wrapper)
```
-The `auth.require` decorator reads the current session via `asfquart.session.read()` and raises `AuthenticationFailed` (HTTP 403) if no valid session exists or if the specified requirement is not met. ATR uses only the `Requirements.committer` check, which verifies that any authenticated session exists. Further authorization (PMC membership, project participation) is handled by ATR's own [`principal`](/ref/atr/principal.py) module and storage layer.
+The `auth.require` decorator reads the current session via `asfquart.session.read()` and raises
+`AuthenticationFailed` (HTTP 403) if no valid session exists or if the specified requirement is not
+met. ATR uses only the `Requirements.committer` check, which verifies that any authenticated session
+exists. Further authorization (PMC membership, project participation) is handled by ATR's own
+[`principal`](/ref/atr/principal.py) module and storage layer.
### Exception handling
-ATR uses ASFQuart's `ASFQuartException` class as a general-purpose HTTP error exception throughout its codebase. The exception carries a message and an HTTP status code. ATR raises it for authentication failures (401), authorization failures (403), validation errors, and other HTTP error conditions.
+ATR uses ASFQuart's `ASFQuartException` class as a general-purpose HTTP error exception throughout
+its codebase. The exception carries a message and an HTTP status code. ATR raises it for
+authentication failures (401), authorization failures (403), validation errors, and other HTTP error
+conditions.
-ATR registers error handlers for `ASFQuartException` in both the main application ([`server.py`](/ref/atr/server.py)) and the API blueprint ([`blueprints/api.py`](/ref/atr/blueprints/api.py)). The API handler returns JSON error responses; the main handler renders HTML error pages.
+ATR registers error handlers for `ASFQuartException` in both the main application
+([`server.py`](/ref/atr/server.py)) and the API blueprint
+([`blueprints/api.py`](/ref/atr/blueprints/api.py)). The API handler returns JSON error responses;
+the main handler renders HTML error pages.
### Application secret and session encryption
-ASFQuart manages the Quart `secret_key`, which is used to sign session cookies. The `QuartApp` constructor either reads the secret from a token file or generates a new one:
+ASFQuart manages the Quart `secret_key`, which is used to sign session cookies. The `QuartApp`
+constructor either reads the secret from a token file or generates a new one:
-* If the token file exists (`secrets/generated/apptoken.txt` in ATR's case), the secret is read from it
-* If the token file does not exist, a new secret is generated via `secrets.token_hex()` and written to the file with mode `0o600` (owner read/write only)
-* If the file cannot be written (permission error), the secret is generated in memory only, meaning sessions will not survive server restarts
+* If the token file exists (`secrets/generated/apptoken.txt` in ATR's case), the secret is read from
+ it
+* If the token file does not exist, a new secret is generated via `secrets.token_hex()` and written
+ to the file with mode `0o600` (owner read/write only)
+* If the file cannot be written (permission error), the secret is generated in memory only, meaning
+ sessions will not survive server restarts
-ASFQuart warns (to stderr) if the token file has permissions other than `0o600`. ATR preserves the ASFQuart-generated secret key when applying its own configuration, since `app.config.from_object()` would otherwise overwrite it.
+ASFQuart warns (to stderr) if the token file has permissions other than `0o600`. ATR preserves the
+ASFQuart-generated secret key when applying its own configuration, since `app.config.from_object()`
+would otherwise overwrite it.
### JWT signing key storage
-ATR stores its JWT signing key in the Quart application's `extensions` dict, which is provided by the `QuartApp` instance from ASFQuart. The [`jwtoken`](/ref/atr/jwtoken.py) module calls `asfquart.APP.extensions` to read and write the signing key. This is standard Quart functionality exposed through ASFQuart's application instance.
+ATR stores its JWT signing key in the Quart application's `extensions` dict, which is provided by
+the `QuartApp` instance from ASFQuart. The [`jwtoken`](/ref/atr/jwtoken.py) module calls
+`asfquart.APP.extensions` to read and write the signing key. This is standard Quart functionality
+exposed through ASFQuart's application instance.
### Application extensions
-ATR uses the `QuartApp.extensions` dict (a standard Quart feature inherited from ASFQuart) to store application-wide cached data including the admin user set, project version cache, and JWT signing key. These are accessed via `asfquart.APP.extensions` throughout the codebase.
+ATR uses the `QuartApp.extensions` dict (a standard Quart feature inherited from ASFQuart) to store
+application-wide cached data including the admin user set, project version cache, and JWT signing
+key. These are accessed via `asfquart.APP.extensions` throughout the codebase.
### What ATR does not use from ASFQuart
ASFQuart provides several capabilities that ATR does not use:
-* **LDAP authentication** (`asfquart.ldap`): ASFQuart supports HTTP Basic authentication against ASF LDAP. ATR performs its own LDAP lookups via its [`ldap`](/ref/atr/ldap.py) module for authorization data, but does not use ASFQuart's LDAP authentication path.
-* **Bearer token handler** (`app.token_handler`): ASFQuart supports registering a callback for `Authorization: Bearer` tokens. ATR implements its own JWT verification in [`jwtoken.py`](/ref/atr/jwtoken.py) rather than using this mechanism.
-* **EZT template watcher** (`app.tw`): ASFQuart includes a file-watching template system based on EZT. ATR uses Jinja2 templates with its own preloading system instead.
-* **YAML configuration** (`asfquart.config`): ASFQuart provides a YAML config reader. ATR uses its own [`config`](/ref/atr/config.py) module with Python class-based configuration.
-* **Development server** (`app.runx()`): ASFQuart provides an extended development server with hot reloading. ATR uses Hypercorn directly.
+* **LDAP authentication** (`asfquart.ldap`): ASFQuart supports HTTP Basic authentication against ASF
+ LDAP. ATR performs its own LDAP lookups via its [`ldap`](/ref/atr/ldap.py) module for
+ authorization data, but does not use ASFQuart's LDAP authentication path.
+* **Bearer token handler** (`app.token_handler`): ASFQuart supports registering a callback for
+ `Authorization: Bearer` tokens. ATR implements its own JWT verification in
+ [`jwtoken.py`](/ref/atr/jwtoken.py) rather than using this mechanism.
+* **EZT template watcher** (`app.tw`): ASFQuart includes a file-watching template system based on
+ EZT. ATR uses Jinja2 templates with its own preloading system instead.
+* **YAML configuration** (`asfquart.config`): ASFQuart provides a YAML config reader. ATR uses its
+ own [`config`](/ref/atr/config.py) module with Python class-based configuration.
+* **Development server** (`app.runx()`): ASFQuart provides an extended development server with hot
+ reloading. ATR uses Hypercorn directly.
### Security considerations for auditors
-When auditing ATR's authentication and session handling, be aware that several security-critical behaviours originate in ASFQuart rather than in ATR's own code:
+When auditing ATR's authentication and session handling, be aware that several security-critical
+behaviours originate in ASFQuart rather than in ATR's own code:
-* **Session cookie attributes** (`SameSite`, `Secure`, `HttpOnly`) are set by `asfquart.construct()`, not by ATR.
-* **Session expiry logic** (inactivity timeout, maximum lifetime) is implemented in `asfquart.session.read()`. ATR adds an additional absolute lifetime check, but the primary expiry logic is in ASFQuart.
-* **OAuth state management** (generation, validation, timeout, single-use) is handled by `asfquart.generics.setup_oauth()`.
+* **Session cookie attributes** (`SameSite`, `Secure`, `HttpOnly`) are set by
+ `asfquart.construct()`, not by ATR.
+* **Session expiry logic** (inactivity timeout, maximum lifetime) is implemented in
+ `asfquart.session.read()`. ATR adds an additional absolute lifetime check, but the primary expiry
+ logic is in ASFQuart.
+* **OAuth state management** (generation, validation, timeout, single-use) is handled by
+ `asfquart.generics.setup_oauth()`.
* **Open redirect prevention** on login/logout URIs is enforced by `asfquart.generics`.
-* **Secret key persistence and file permissions** are managed by `asfquart.base.QuartApp.__init__()`.
-* **Authentication gating** on web routes uses `asfquart.auth.require`, which reads the session and raises `AuthenticationFailed`.
+* **Secret key persistence and file permissions** are managed by
+ `asfquart.base.QuartApp.__init__()`.
+* **Authentication gating** on web routes uses `asfquart.auth.require`, which reads the session and
+ raises `AuthenticationFailed`.
-The source code for ASFQuart is maintained at [github.com/apache/infrastructure-asfquart](https://github.com/apache/infrastructure-asfquart).
+The source code for ASFQuart is maintained at
+[github.com/apache/infrastructure-asfquart](https://github.com/apache/infrastructure-asfquart).
## asfpy
-[asfpy](https://github.com/apache/infrastructure-asfpy) is ASF Infrastructure's general-purpose Python utility library, offering helpers for LDAP, messaging, and PubSub among other things. It reaches ATR only as a transitive dependency of ASFQuart, which requires it — ATR declares no direct dependency on asfpy and imports nothing from it.
+[asfpy](https://github.com/apache/infrastructure-asfpy) is ASF Infrastructure's general-purpose
+Python utility library, offering helpers for LDAP, messaging, and PubSub among other things. It
+reaches ATR only as a transitive dependency of ASFQuart, which requires it — ATR declares no direct
+dependency on asfpy and imports nothing from it.
-Two parts of ATR cover ground that asfpy also covers, and in both cases ATR uses its own implementation rather than asfpy's:
+Two parts of ATR cover ground that asfpy also covers, and in both cases ATR uses its own
+implementation rather than asfpy's:
-* **Mail**: ATR sends signed mail through its own [`mail`](/ref/atr/mail.py) module. As the code notes, this is deliberately very different from the asfpy version — it is typed and built on `asyncio`, and ATR's need to sign a message before sending does not fit asfpy's design.
-* **PubSub**: ATR consumes the ASF PubSub stream through its own [`pubsub`](/ref/atr/pubsub.py) module rather than through `asfpy.pubsub`.
+* **Mail**: ATR sends signed mail through its own [`mail`](/ref/atr/mail.py) module. As the code
+ notes, this is deliberately very different from the asfpy version — it is typed and built on
+ `asyncio`, and ATR's need to sign a message before sending does not fit asfpy's design.
+* **PubSub**: ATR consumes the ASF PubSub stream through its own [`pubsub`](/ref/atr/pubsub.py)
+ module rather than through `asfpy.pubsub`.
-Because ATR does not call into asfpy, it would be unaffected if ASFQuart were to drop asfpy from its own dependencies in future.
+Because ATR does not call into asfpy, it would be unaffected if ASFQuart were to drop asfpy from its
+own dependencies in future.
diff --git a/atr/docs/authentication-security.md b/atr/docs/authentication-security.md
index 1cdfc20d..11ebb551 100644
--- a/atr/docs/authentication-security.md
+++ b/atr/docs/authentication-security.md
@@ -26,52 +26,83 @@
ATR uses several authentication mechanisms depending on the access method:
* **Web interface**: ASF OAuth provides browser-based sessions
-* **API**: Personal Access Tokens (PATs) authenticate users to obtain short-lived JSON Web Tokens (JWTs), which then authenticate API requests
+* **API**: Personal Access Tokens (PATs) authenticate users to obtain short-lived JSON Web Tokens
+ (JWTs), which then authenticate API requests
* **SSH**: Temporary SSH keys authenticate automated uploads from GitHub Actions workflows
-All mechanisms require encrypted transport (HTTPS or SSH). Authentication verifies the identity of users, while authorization (covered in [Authorization security](authorization-security)) determines what actions they can perform.
+All mechanisms require encrypted transport (HTTPS or SSH). Authentication verifies the identity of
+users, while authorization (covered in [Authorization security](authorization-security)) determines
+what actions they can perform.
## OAuth architecture and security responsibilities
-ATR participates in several authentication protocols but does not implement an OAuth Authorization Server. Understanding which roles ATR fills is important for knowing which security requirements apply to ATR versus external services.
+ATR participates in several authentication protocols but does not implement an OAuth Authorization
+Server. Understanding which roles ATR fills is important for knowing which security requirements
+apply to ATR versus external services.
### ATR's roles
-**OAuth Client.** ATR delegates user authentication to the ASF OAuth service at `oauth.apache.org` via the [ASFQuart](https://github.com/apache/infrastructure-asfquart) framework. ATR redirects users to the ASF authorization endpoint, receives an authorization code in the callback, and immediately exchanges that code for session data. ATR does not store authorization codes, issue OAuth tokens, or manage OAuth client registrations.
+**OAuth Client.** ATR delegates user authentication to the ASF OAuth service at `oauth.apache.org`
+via the [ASFQuart](https://github.com/apache/infrastructure-asfquart) framework. ATR redirects users
+to the ASF authorization endpoint, receives an authorization code in the callback, and immediately
+exchanges that code for session data. ATR does not store authorization codes, issue OAuth tokens, or
+manage OAuth client registrations.
-**OIDC Relying Party.** For [trusted publishing](trusted-publishing) workflows, ATR validates OIDC ID tokens issued by GitHub Actions (`token.actions.githubusercontent.com`). ATR verifies the token signature using the provider's JWKS endpoint, checks the issuer, audience, expiration, and expected claims, and enforces actor identity requirements that differ between project TP and ATR distribution workflows. ATR does not issue OIDC tokens. See [GitHub Actions OIDC](#github-actions-oidc-tru [...]
+**OIDC Relying Party.** For [trusted publishing](trusted-publishing) workflows, ATR validates OIDC
+ID tokens issued by GitHub Actions (`token.actions.githubusercontent.com`). ATR verifies the token
+signature using the provider's JWKS endpoint, checks the issuer, audience, expiration, and expected
+claims, and enforces actor identity requirements that differ between project TP and ATR distribution
+workflows. ATR does not issue OIDC tokens. See
+[GitHub Actions OIDC](#github-actions-oidc-trusted-publishing) below for full detail.
-**Resource Server.** ATR issues its own short-lived JWTs (30-minute TTL, HS256) for API access. These are a custom API authentication mechanism, not OAuth access tokens or refresh tokens. See [API authentication](#api-authentication) below.
+**Resource Server.** ATR issues its own short-lived JWTs (30-minute TTL, HS256) for API access.
+These are a custom API authentication mechanism, not OAuth access tokens or refresh tokens. See
+[API authentication](#api-authentication) below.
### What ATR does not implement
-ATR does not implement any OAuth Authorization Server functionality: there is no authorization endpoint, no token endpoint with OAuth grant type handling, no authorization code generation or lifetime management, no client registration, no refresh token issuance or rotation, and no support for the Implicit or Resource Owner Password Credentials flows.
+ATR does not implement any OAuth Authorization Server functionality: there is no authorization
+endpoint, no token endpoint with OAuth grant type handling, no authorization code generation or
+lifetime management, no client registration, no refresh token issuance or rotation, and no support
+for the Implicit or Resource Owner Password Credentials flows.
### ASVS applicability
-The OWASP ASVS V10.4 requirements target OAuth Authorization Servers. Because ATR is not an Authorization Server, V10.4.1 through V10.4.5 (redirect URI validation, authorization code single-use and lifetime, grant type restrictions, refresh token replay mitigation) are the responsibility of `oauth.apache.org`, not ATR.
+The OWASP ASVS V10.4 requirements target OAuth Authorization Servers. Because ATR is not an
+Authorization Server, V10.4.1 through V10.4.5 (redirect URI validation, authorization code
+single-use and lifetime, grant type restrictions, refresh token replay mitigation) are the
+responsibility of `oauth.apache.org`, not ATR.
-The ASVS sections applicable to ATR are V10.2 (OAuth Client) and V10.3 (OAuth Resource Server). The OAuth client security controls that ATR implements are described in the sections below.
+The ASVS sections applicable to ATR are V10.2 (OAuth Client) and V10.3 (OAuth Resource Server). The
+OAuth client security controls that ATR implements are described in the sections below.
### OAuth client security controls
-* **State parameter**: Generated with `secrets.token_hex(16)` and enforced as single-use (removed immediately on callback). Stale states expire after 900 seconds.
-* **Authorization code exchange**: Codes received from `oauth.apache.org` are exchanged immediately over HTTPS and are never stored locally.
-* **Session cookies**: Configured with `Secure`, `HttpOnly`, `SameSite=Strict`, and the `__Host-` prefix.
+* **State parameter**: Generated with `secrets.token_hex(16)` and enforced as single-use (removed
+ immediately on callback). Stale states expire after 900 seconds.
+* **Authorization code exchange**: Codes received from `oauth.apache.org` are exchanged immediately
+ over HTTPS and are never stored locally.
+* **Session cookies**: Configured with `Secure`, `HttpOnly`, `SameSite=Strict`, and the `__Host-`
+ prefix.
* **Session lifetime**: Enforced with a configurable absolute maximum (default 72 hours).
-* **TLS enforcement**: All outbound requests to OAuth and OIDC endpoints use a hardened TLS context via [`util.create_secure_ssl_context()`](/ref/atr/util.py).
+* **TLS enforcement**: All outbound requests to OAuth and OIDC endpoints use a hardened TLS context
+ via [`util.create_secure_ssl_context()`](/ref/atr/util.py).
## Transport security
-All ATR routes, on both the website and the API, require HTTPS using TLS 1.2 or newer. This is enforced at the httpd layer in front of the application. Requests over plain HTTP are redirected to HTTPS.
+All ATR routes, on both the website and the API, require HTTPS using TLS 1.2 or newer. This is
+enforced at the httpd layer in front of the application. Requests over plain HTTP are redirected to
+HTTPS.
-Tokens and credentials must never appear in URLs, as URLs may be logged or cached. They must only be transmitted in request headers or POST bodies over HTTPS.
+Tokens and credentials must never appear in URLs, as URLs may be logged or cached. They must only be
+transmitted in request headers or POST bodies over HTTPS.
## Web authentication
### ASF OAuth integration
-Browser users authenticate through [ASF OAuth](https://oauth.apache.org/api.html). The authentication flow works as follows:
+Browser users authenticate through [ASF OAuth](https://oauth.apache.org/api.html). The
+authentication flow works as follows:
1. User clicks "Sign in" on the ATR website
2. ATR redirects the user to the ASF OAuth service
@@ -79,44 +110,57 @@ Browser users authenticate through [ASF OAuth](https://oauth.apache.org/api.html
4. ASF OAuth redirects the user back to ATR with session information
5. ATR creates a server-side session linked to the user's ASF UID
-The session is managed by [ASFQuart](https://github.com/apache/infrastructure-asfquart), which handles the OAuth handshake and session cookie management.
+The session is managed by [ASFQuart](https://github.com/apache/infrastructure-asfquart), which
+handles the OAuth handshake and session cookie management.
### Session management
-Sessions are stored server-side. The browser receives only a session cookie that references the server-side session data. Session cookies are configured with security attributes:
+Sessions are stored server-side. The browser receives only a session cookie that references the
+server-side session data. Session cookies are configured with security attributes:
* `HttpOnly` - prevents JavaScript access to the cookie
* `Secure` - cookie is only sent over HTTPS
* `SameSite=Strict` - provides CSRF protection for most requests
-Session data includes the user's ASF UID and is used to authorize requests. The session expires after a configured maximum lifetime (default 72 hours), a period of inactivity, or when the user logs out.
+Session data includes the user's ASF UID and is used to authorize requests. The session expires
+after a configured maximum lifetime (default 72 hours), a period of inactivity, or when the user
+logs out.
### Session caching
-Authorization data fetched from LDAP (committee memberships, project participation) is cached in [`principal.Cache`](/ref/atr/principal.py) (Cache) for performance. The cache has a TTL of 300 seconds, defined by `cache_for_at_most_seconds`. After the TTL expires, the next request will refresh the cache from LDAP.
+Authorization data fetched from LDAP (committee memberships, project participation) is cached in
+[`principal.Cache`](/ref/atr/principal.py) (Cache) for performance. The cache has a TTL of 300
+seconds, defined by `cache_for_at_most_seconds`. After the TTL expires, the next request will
+refresh the cache from LDAP.
## API authentication
-API access uses a two-token system: Personal Access Tokens (PATs) for long-term credentials and JSON Web Tokens (JWTs) for short-term API access.
+API access uses a two-token system: Personal Access Tokens (PATs) for long-term credentials and JSON
+Web Tokens (JWTs) for short-term API access.
### Personal Access Tokens (PATs)
-Committers can obtain PATs from the `/tokens` page on the ATR website. PATs have the following properties:
+Committers can obtain PATs from the `/tokens` page on the ATR website. PATs have the following
+properties:
* **Validity**: 180 days from creation, while LDAP account is still active
* **Format**: New PATs are Noisy Secrets using the `tooling.apache.org` namespace
* **Storage**: ATR stores only SHA3-256 hashes, never the plaintext PAT
-* **Revocation**: Users can revoke their own PATs at any time; admins can revoke all PATs for any user via the "Revoke user tokens" tab of the admin Users dashboard
-* **IP restriction**: A PAT may optionally be bound to a single IP or CIDR. When set, JWT issuance is refused from any other address
+* **Revocation**: Users can revoke their own PATs at any time; admins can revoke all PATs for any
+ user via the "Revoke user tokens" tab of the admin Users dashboard
+* **IP restriction**: A PAT may optionally be bound to a single IP or CIDR. When set, JWT issuance
+ is refused from any other address
* **Purpose**: PATs are used solely to obtain JWTs; they cannot be used directly for API access
-Only authenticated committers (signed in via ASF OAuth) can create PATs. Each user can have multiple active PATs.
+Only authenticated committers (signed in via ASF OAuth) can create PATs. Each user can have multiple
+active PATs.
PATs are rejected if the user who created them has been banned in or removed from LDAP.
### JSON Web Tokens (JWTs)
-To access protected API endpoints, users must first obtain a JWT by exchanging their PAT. This is done by POSTing to `/api/jwt`:
+To access protected API endpoints, users must first obtain a JWT by exchanging their PAT. This is
+done by POSTing to `/api/jwt`:
```text
POST /api/jwt
@@ -135,7 +179,8 @@ JWTs have the following properties:
* **Algorithm**: HS256 (HMAC-SHA256)
* **Validity**: 30 minutes from creation
-* **Claims**: `sub` (ASF UID), `iss` (issuer), `aud` (audience), `iat` (issued at), `nbf` (not before), `exp` (expiration), `jti` (unique token ID)
+* **Claims**: `sub` (ASF UID), `iss` (issuer), `aud` (audience), `iat` (issued at), `nbf` (not
+ before), `exp` (expiration), `jti` (unique token ID)
* **Storage**: JWTs are stateless; ATR does not store issued JWTs
The JWT is used in the `Authorization` header as a bearer token:
@@ -146,77 +191,160 @@ Authorization: Bearer jwt_token_value
### Token handling
-The [`jwtoken`](/ref/atr/jwtoken.py) module handles JWT creation and verification. Protected API endpoints declare a header auth scheme (`auth_scheme=api_auth.Auth.BEARER` or `SYSTEM_BEARER`); the route then runs `jwtoken.authenticate()`, which extracts the JWT from the `Authorization` header, verifies its signature and required claims, and makes the user's ASF UID available to the handler. Verification applies a deliberate two minute leeway to the time based JWT checks to tolerate small [...]
+The [`jwtoken`](/ref/atr/jwtoken.py) module handles JWT creation and verification. Protected API
+endpoints declare a header auth scheme (`auth_scheme=api_auth.Auth.BEARER` or `SYSTEM_BEARER`); the
+route then runs `jwtoken.authenticate()`, which extracts the JWT from the `Authorization` header,
+verifies its signature and required claims, and makes the user's ASF UID available to the handler.
+Verification applies a deliberate two minute leeway to the time based JWT checks to tolerate small
+clock skew between ATR and API clients.
### System tokens
-Most PATs belong to a committer and are tied to their LDAP account. ATR also supports *system tokens*: PATs minted for a trusted service caller rather than a person, flagged with `is_system` in the database. A system PAT has no owning user, so its `asfuid` is null; the administrator who minted it is recorded in `created_by`, which is always set on every PAT. The JWT a system PAT mints carries a fixed service identity, `system`, which has no LDAP account. System tokens are restricted to f [...]
-
-A system token is exchanged for a JWT at `/api/jwt`, requesting the `system` identity. The resulting JWT carries an additional `atr_sys` claim and `system` as its subject. Because that identity has no LDAP account, verification skips the LDAP active check for these JWTs. It still re-validates the backing PAT on every request, so revoking the PAT immediately invalidates every JWT issued from it. Two further checks apply: a system JWT must be backed by a system PAT, and its subject must be [...]
-
-Endpoints that should accept only system tokens declare `auth_scheme=api_auth.Auth.SYSTEM_BEARER` on their `@api.typed` route, which rejects ordinary user JWTs. The committee membership check that gates committer-driven writes does not apply, so any committee authorisation for these endpoints must be established by the calling service before it reaches ATR. The only such endpoint at present is `/project/config`, which the `.asf.yaml` processor uses to create and update projects.
+Most PATs belong to a committer and are tied to their LDAP account. ATR also supports *system
+tokens*: PATs minted for a trusted service caller rather than a person, flagged with `is_system` in
+the database. A system PAT has no owning user, so its `asfuid` is null; the administrator who minted
+it is recorded in `created_by`, which is always set on every PAT. The JWT a system PAT mints carries
+a fixed service identity, `system`, which has no LDAP account. System tokens are restricted to
+foundation administrators; committers cannot create them from the `/tokens` page.
+
+A system token is exchanged for a JWT at `/api/jwt`, requesting the `system` identity. The resulting
+JWT carries an additional `atr_sys` claim and `system` as its subject. Because that identity has no
+LDAP account, verification skips the LDAP active check for these JWTs. It still re-validates the
+backing PAT on every request, so revoking the PAT immediately invalidates every JWT issued from it.
+Two further checks apply: a system JWT must be backed by a system PAT, and its subject must be
+`system`. The creating administrator and the PAT name are recorded in the audit log when the JWT is
+issued.
+
+Endpoints that should accept only system tokens declare `auth_scheme=api_auth.Auth.SYSTEM_BEARER` on
+their `@api.typed` route, which rejects ordinary user JWTs. The committee membership check that
+gates committer-driven writes does not apply, so any committee authorisation for these endpoints
+must be established by the calling service before it reaches ATR. The only such endpoint at present
+is `/project/config`, which the `.asf.yaml` processor uses to create and update projects.
## GitHub Actions OIDC (Trusted Publishing)
-GitHub Actions workflows authenticate to ATR using OIDC tokens issued by GitHub (`token.actions.githubusercontent.com`). ATR uses this mechanism in two distinct contexts with different authorization requirements, described below.
+GitHub Actions workflows authenticate to ATR using OIDC tokens issued by GitHub
+(`token.actions.githubusercontent.com`). ATR uses this mechanism in two distinct contexts with
+different authorization requirements, described below.
### Token validation
-All OIDC-authenticated endpoints share the same cryptographic validation, implemented in `jwtoken.verify_github_oidc`. The caller then applies context-specific checks on top.
+All OIDC-authenticated endpoints share the same cryptographic validation, implemented in
+`jwtoken.verify_github_oidc`. The caller then applies context-specific checks on top.
-**Header safety.** Before any other processing, ATR inspects the unverified JWT header and rejects any token that contains `jku`, `x5u`, or `jwk` fields. These fields could redirect key lookup to an attacker-controlled endpoint.
+**Header safety.** Before any other processing, ATR inspects the unverified JWT header and rejects
+any token that contains `jku`, `x5u`, or `jwk` fields. These fields could redirect key lookup to an
+attacker-controlled endpoint.
-**JWKS retrieval.** ATR fetches the JWKS URI from GitHub's OIDC discovery document (`token.actions.githubusercontent.com/.well-known/openid-configuration`) over a hardened TLS session (`util.create_secure_session`). The resulting URI is then validated: its hostname must be `token.actions.githubusercontent.com` and its scheme must be `https`. This prevents a compromised or redirected discovery response from substituting a different key set.
+**JWKS retrieval.** ATR fetches the JWKS URI from GitHub's OIDC discovery document
+(`token.actions.githubusercontent.com/.well-known/openid-configuration`) over a hardened TLS session
+(`util.create_secure_session`). The resulting URI is then validated: its hostname must be
+`token.actions.githubusercontent.com` and its scheme must be `https`. This prevents a compromised or
+redirected discovery response from substituting a different key set.
-**Signature and standard claims.** The token is verified using RS256 with the key obtained from JWKS. The `iss` must be `https://token.actions.githubusercontent.com`, the `aud` must be `atr-test-v1`, and both `exp` and `iat` must be present.
+**Signature and standard claims.** The token is verified using RS256 with the key obtained from
+JWKS. The `iss` must be `https://token.actions.githubusercontent.com`, the `aud` must be
+`atr-test-v1`, and both `exp` and `iat` must be present.
-**Enterprise and environment claims.** Four additional claims are checked against hardcoded expected values: `enterprise` must be `the-asf`, `enterprise_id` must match the ASF GitHub enterprise, `repository_owner` must be `apache`, and `runner_environment` must be `github-hosted`. Together these constrain the token to workflows running inside the ASF GitHub enterprise, on official GitHub-hosted runners, under the `apache` organisation.
+**Enterprise and environment claims.** Four additional claims are checked against hardcoded expected
+values: `enterprise` must be `the-asf`, `enterprise_id` must match the ASF GitHub enterprise,
+`repository_owner` must be `apache`, and `runner_environment` must be `github-hosted`. Together
+these constrain the token to workflows running inside the ASF GitHub enterprise, on official
+GitHub-hosted runners, under the `apache` organisation.
### Project Trusted Publishing
-Project TP allows an `apache/*` project repository to upload release artifacts and perform actions on its own ATR project directly from a GitHub Actions workflow. The workflow is defined in [tooling-actions](https://github.com/apache/tooling-actions) and called from the project's own repository.
+Project TP allows an `apache/*` project repository to upload release artifacts and perform actions
+on its own ATR project directly from a GitHub Actions workflow. The workflow is defined in
+[tooling-actions](https://github.com/apache/tooling-actions) and called from the project's own
+repository.
-**Actor requirement.** After cryptographic validation, `interaction.trusted_jwt` checks that `actor_id` resolves to a human committer: it performs an LDAP lookup to map the numeric GitHub user ID to an ASF UID. If `actor_id` belongs to the ASF Infrastructure service account instead, the request is rejected. The committer must have their GitHub account registered in LDAP.
+**Actor requirement.** After cryptographic validation, `interaction.trusted_jwt` checks that
+`actor_id` resolves to a human committer: it performs an LDAP lookup to map the numeric GitHub user
+ID to an ASF UID. If `actor_id` belongs to the ASF Infrastructure service account instead, the
+request is rejected. The committer must have their GitHub account registered in LDAP.
-**Repository and workflow binding.** `interaction._trusted_project` further validates the `repository` and `workflow_ref` claims from the token against release policies stored in ATR. Only pre-registered workflow paths from pre-registered repositories are accepted, so an arbitrary workflow in an `apache/*` repo cannot invoke these endpoints.
+**Repository and workflow binding.** `interaction._trusted_project` further validates the
+`repository` and `workflow_ref` claims from the token against release policies stored in ATR. Only
+pre-registered workflow paths from pre-registered repositories are accepted, so an arbitrary
+workflow in an `apache/*` repo cannot invoke these endpoints.
### ATR distribution workflows
-ATR uses a separate set of endpoints to orchestrate distribution to third-party platforms such as Maven Central. These workflows live in [tooling-actions](https://github.com/apache/tooling-actions) and are triggered by ATR itself, not by project committers.
+ATR uses a separate set of endpoints to orchestrate distribution to third-party platforms such as
+Maven Central. These workflows live in [tooling-actions](https://github.com/apache/tooling-actions)
+and are triggered by ATR itself, not by project committers.
-**Trust chain.** An authenticated committer initiates a release distribution through ATR. ATR dispatches the workflow via the ASF Infrastructure service account, passing the required context (including the SSH public key) into the workflow. The workflow runs on GitHub Actions and calls back to ATR with a GitHub OIDC token.
+**Trust chain.** An authenticated committer initiates a release distribution through ATR. ATR
+dispatches the workflow via the ASF Infrastructure service account, passing the required context
+(including the SSH public key) into the workflow. The workflow runs on GitHub Actions and calls back
+to ATR with a GitHub OIDC token.
-**Actor requirement.** `interaction.trusted_jwt_for_dist` checks that `actor_id` matches `GITHUB_TRUSTED_ROLE_NID`, the hardcoded numeric ID of the ASF Infrastructure service account. If `actor_id` belongs to a human committer instead, the request is rejected. The check uses the numeric ID, which is stable across account renames.
+**Actor requirement.** `interaction.trusted_jwt_for_dist` checks that `actor_id` matches
+`GITHUB_TRUSTED_ROLE_NID`, the hardcoded numeric ID of the ASF Infrastructure service account. If
+`actor_id` belongs to a human committer instead, the request is rejected. The check uses the numeric
+ID, which is stable across account renames.
-The OIDC token proves that the callback came from a workflow ATR itself started. The original authorization is inherited from the committer who initiated the distribution in ATR — the service account carries no privileges of its own beyond triggering the workflow.
+The OIDC token proves that the callback came from a workflow ATR itself started. The original
+authorization is inherited from the committer who initiated the distribution in ATR — the service
+account carries no privileges of its own beyond triggering the workflow.
-The workflow also carries the originating committer's ASF UID as a parameter. ATR trusts this value because the service account gate already establishes that only ATR could have dispatched the workflow, and ATR embedded the UID when it did so.
+The workflow also carries the originating committer's ASF UID as a parameter. ATR trusts this value
+because the service account gate already establishes that only ATR could have dispatched the
+workflow, and ATR embedded the UID when it did so.
### SSH key scope
-In both cases, the workflow calls ATR's SSH registration endpoint (`/publisher/ssh/register` for project TP, `/distribute/ssh/register` for distribution workflows), which generates a temporary SSH key bound to the specific project. The key cannot be used for any other project, and `ssh.SSHServer` checks this before it looks anything up, so a key can't be used to find out what exists in other projects. Distribution workflows only download, so their keys are read-only: a key whose `github_ [...]
-The identity attached to the key differs: for project TP it is the committer resolved via LDAP from the OIDC `actor_id`; for distribution workflows it is the committer's ASF UID passed through the workflow, trusted because only the service account — which only ATR can trigger — could have put it there.
-
-**Single-use registration.** An OIDC token registers a key once. `storage.writers.ssh.add_workflow_key` records the token's `jti` in `workflowjti` before it inserts the key, so a token replayed within its validity window fails on the primary key and mints nothing. Rows are pruned once the token's own `exp` has passed. Tokens are not single-use across the other OIDC endpoints, because a workflow mints one token per job and presents it to several of them.
+In both cases, the workflow calls ATR's SSH registration endpoint (`/publisher/ssh/register` for
+project TP, `/distribute/ssh/register` for distribution workflows), which generates a temporary SSH
+key bound to the specific project. The key cannot be used for any other project, and `ssh.SSHServer`
+checks this before it looks anything up, so a key can't be used to find out what exists in other
+projects. Distribution workflows only download, so their keys are read-only: a key whose
+`github_nid` is `GITHUB_TRUSTED_ROLE_NID` can't be used to upload, because only the distribution
+registration endpoint accepts that actor. The identity attached to the key differs: for project TP
+it is the committer resolved via LDAP from the OIDC `actor_id`; for distribution workflows it is the
+committer's ASF UID passed through the workflow, trusted because only the service account — which
+only ATR can trigger — could have put it there.
+
+**Single-use registration.** An OIDC token registers a key once.
+`storage.writers.ssh.add_workflow_key` records the token's `jti` in `workflowjti` before it inserts
+the key, so a token replayed within its validity window fails on the primary key and mints nothing.
+Rows are pruned once the token's own `exp` has passed. Tokens are not single-use across the other
+OIDC endpoints, because a workflow mints one token per job and presents it to several of them.
## SSH authentication
-ATR provides an SSH server for rsync file upload, and for automated release artifact uploads from GitHub Actions workflows. This is a distinct authentication pathway from the web and API mechanisms described above.
+ATR provides an SSH server for rsync file upload, and for automated release artifact uploads from
+GitHub Actions workflows. This is a distinct authentication pathway from the web and API mechanisms
+described above.
### Authentication mechanism
-The SSH server supports only public key authentication — password authentication is disabled and rejected. The authentication flow accepts SSH keys for rsync connections from the user, or, depending on the route, is tightly integrated with the GitHub Actions OIDC workflows described in the previous section:
-
-1. A GitHub Actions workflow authenticates to ATR via OIDC (see [GitHub Actions OIDC](#github-actions-oidc-trusted-publishing) above) and calls the SSH key registration endpoint.
-2. ATR generates a temporary SSH key pair, stores the public key in the database with a 20-minute TTL, and returns the private key to the workflow.
-3. The workflow uses the private key to connect to ATR's SSH server and upload release artifacts via rsync.
-4. The SSH server validates the presented public key against the database, checking existence, expiration, and project binding.
-
-Each such SSH key is bound to a specific project context and cannot be used for any other project. See [SSH key scope](#ssh-key-scope) above for how the key binding differs between project Trusted Publishing and ATR distribution workflows.
+The SSH server supports only public key authentication — password authentication is disabled and
+rejected. The authentication flow accepts SSH keys for rsync connections from the user, or,
+depending on the route, is tightly integrated with the GitHub Actions OIDC workflows described in
+the previous section:
+
+1. A GitHub Actions workflow authenticates to ATR via OIDC (see
+ [GitHub Actions OIDC](#github-actions-oidc-trusted-publishing) above) and calls the SSH key
+ registration endpoint.
+2. ATR generates a temporary SSH key pair, stores the public key in the database with a 20-minute
+ TTL, and returns the private key to the workflow.
+3. The workflow uses the private key to connect to ATR's SSH server and upload release artifacts via
+ rsync.
+4. The SSH server validates the presented public key against the database, checking existence,
+ expiration, and project binding.
+
+Each such SSH key is bound to a specific project context and cannot be used for any other project.
+See [SSH key scope](#ssh-key-scope) above for how the key binding differs between project Trusted
+Publishing and ATR distribution workflows.
### SSH server configuration
-The SSH server in [`ssh.py`](/ref/atr/ssh.py) applies a hardened security configuration. Cipher suites, key exchange algorithms, and MAC algorithms are restricted to those approved by the Hardened OpenSSH Server v9.9 policy from [ssh-audit](https://www.ssh-audit.com/). Only algorithms supported by both the policy and the asyncssh library are enabled.
+The SSH server in [`ssh.py`](/ref/atr/ssh.py) applies a hardened security configuration. Cipher
+suites, key exchange algorithms, and MAC algorithms are restricted to those approved by the Hardened
+OpenSSH Server v9.9 policy from [ssh-audit](https://www.ssh-audit.com/). Only algorithms supported
+by both the policy and the asyncssh library are enabled.
## Token lifecycle
@@ -240,30 +368,63 @@ ASF OAuth (web login)
└──▶ rsync Upload
```
-For web users, authentication happens once via ASF OAuth, and the session persists until logout or expiration. For API users, the flow is: obtain a PAT once (via the web interface), then exchange it for JWTs as needed (JWTs expire quickly, so this exchange happens frequently in long-running scripts). For automated uploads, the flow extends further: a GitHub Actions workflow authenticates via OIDC, registers a temporary SSH key, and uses it to upload artifacts via rsync.
+For web users, authentication happens once via ASF OAuth, and the session persists until logout or
+expiration. For API users, the flow is: obtain a PAT once (via the web interface), then exchange it
+for JWTs as needed (JWTs expire quickly, so this exchange happens frequently in long-running
+scripts). For automated uploads, the flow extends further: a GitHub Actions workflow authenticates
+via OIDC, registers a temporary SSH key, and uses it to upload artifacts via rsync.
## Adaptive response
-ATR does not currently implement any adaptive responses such as progressive delays or challenge page in its own authentication code. Its response to repeated failures is fixed rather than adaptive. Ordinary web requests are limited to `100` requests per minute and `1000` per hour. The limiter groups traffic by authenticated ASF UID when a session exists, and by client address otherwise. API requests have their own ceiling of `500` requests per hour. The JWT issue endpoints on the website [...]
-
-SSH follows the same general policy. ATR allows at most `100` SSH connections per minute from one client address. It also allows at most `10` successful SSH authentications per minute for one ASF UID. If either limit is exceeded then ATR closes the connection.
-
-Browser sign in is delegated to `oauth.apache.org`, so ATR does not process passwords and does not define how the ASF OAuth service handles repeated password failures. The credentials that ATR does verify directly are long random PATs, ATR signed JWTs, and public keys. For those mechanisms, ATR relies on fixed throttling, short token lifetimes, PAT and LDAP revalidation, and prompt revocation rather than challenge based escalation.
-
-There is one automatic containment step that goes beyond a simple reject: when LDAP marks an account as inactive, ATR revokes that user's sessions, PATs, and SSH keys.
-
-**Revoke all user PATs** in *Admin → Users* deletes ordinary user PATs and invalidates JWTs issued from them. System tokens, browser sessions, and SSH keys are unaffected. Afterwards, the administrator can email the affected owners, edit the site banner, or finish without a notice. Each revocation saves its own recipient list, and the email goes To the initiating administrator and BCC to the other affected owners, once per owner. Only the subject and message are editable. Sending queues [...]
-
-ATR also does not ship with built in alert thresholds or automatic blocking rules for repeated failures. Instead it writes authentication events to `<STATE_DIR>/audit/daily/YYYY-MM-DD.jsonl` and request summaries to `<STATE_DIR>/logs/requests.log`.
+ATR does not currently implement any adaptive responses such as progressive delays or challenge page
+in its own authentication code. Its response to repeated failures is fixed rather than adaptive.
+Ordinary web requests are limited to `100` requests per minute and `1000` per hour. The limiter
+groups traffic by authenticated ASF UID when a session exists, and by client address otherwise. API
+requests have their own ceiling of `500` requests per hour. The JWT issue endpoints on the website
+and the API are tighter at `10` requests per hour. When an HTTP limit is exceeded, ATR returns
+`429 Too Many Requests`. For API responses it also includes `retry_after` when the limiter provides
+one.
+
+SSH follows the same general policy. ATR allows at most `100` SSH connections per minute from one
+client address. It also allows at most `10` successful SSH authentications per minute for one ASF
+UID. If either limit is exceeded then ATR closes the connection.
+
+Browser sign in is delegated to `oauth.apache.org`, so ATR does not process passwords and does not
+define how the ASF OAuth service handles repeated password failures. The credentials that ATR does
+verify directly are long random PATs, ATR signed JWTs, and public keys. For those mechanisms, ATR
+relies on fixed throttling, short token lifetimes, PAT and LDAP revalidation, and prompt revocation
+rather than challenge based escalation.
+
+There is one automatic containment step that goes beyond a simple reject: when LDAP marks an account
+as inactive, ATR revokes that user's sessions, PATs, and SSH keys.
+
+**Revoke all user PATs** in *Admin → Users* deletes ordinary user PATs and invalidates JWTs issued
+from them. System tokens, browser sessions, and SSH keys are unaffected. Afterwards, the
+administrator can email the affected owners, edit the site banner, or finish without a notice. Each
+revocation saves its own recipient list, and the email goes To the initiating administrator and BCC
+to the other affected owners, once per owner. Only the subject and message are editable. Sending
+queues a background task and consumes the saved notice, to prevent duplicate submissions, and
+delivery failures are shown in *Admin → System → Tasks*. Multi-recipient emails share one SMTP
+connection and use batches of up to 100 recipients, with failures reported per address.
+
+ATR also does not ship with built in alert thresholds or automatic blocking rules for repeated
+failures. Instead it writes authentication events to `<STATE_DIR>/audit/daily/YYYY-MM-DD.jsonl` and
+request summaries to `<STATE_DIR>/logs/requests.log`.
## Audit Logging
-The daily audit logs at `<STATE_DIR>/audit/daily/YYYY-MM-DD.jsonl` contain authentication events under the logger `atr.auth`, alongside storage and submitted-key events. Authentication events include authentication success/failures, token issuance/revocation,
-and anything else that would be relevant to authentication when investigating a potential security issue.
+The daily audit logs at `<STATE_DIR>/audit/daily/YYYY-MM-DD.jsonl` contain authentication events
+under the logger `atr.auth`, alongside storage and submitted-key events. Authentication events
+include authentication success/failures, token issuance/revocation, and anything else that would be
+relevant to authentication when investigating a potential security issue.
-Each entry is also tagged with the `request_id` and `source_ip` of the originating request, where one is in scope, so auth events can be correlated with the request summaries in `<STATE_DIR>/logs/requests.log`. Both are pulled from the request log context rather than passed at the call site.
+Each entry is also tagged with the `request_id` and `source_ip` of the originating request, where
+one is in scope, so auth events can be correlated with the request summaries in
+`<STATE_DIR>/logs/requests.log`. Both are pulled from the request log context rather than passed at
+the call site.
-This log is logged to by calling the specialised methods on atr.log (all args passed below as kwargs for readability):
+This log is logged to by calling the specialised methods on atr.log (all args passed below as kwargs
+for readability):
```python
import atr.log as log
@@ -317,11 +478,17 @@ Tokens must be protected by the user at all times:
* [`server.py`](/ref/atr/server.py) - Default web rate limits, 429 handling, and request logging
* [`blueprints/api.py`](/ref/atr/blueprints/api.py) - API wide rate limiting
* [`api/__init__.py`](/ref/atr/api/__init__.py) - Tighter API limits for JWT creation
-* [`jwtoken.py`](/ref/atr/jwtoken.py) - JWT creation, verification, and decorators; `verify_github_oidc` implements the OIDC validation chain
-* [`blueprints/api_auth.py`](/ref/atr/blueprints/api_auth.py) - per-endpoint auth level decorators, including `system_bearer`
-* [`db/interaction.py`](/ref/atr/db/interaction.py) - `validate_trusted_jwt` implements the service account authorisation, `trusted_jwt_for_dist` implements gating based on the service account
+* [`jwtoken.py`](/ref/atr/jwtoken.py) - JWT creation, verification, and decorators;
+ `verify_github_oidc` implements the OIDC validation chain
+* [`blueprints/api_auth.py`](/ref/atr/blueprints/api_auth.py) - per-endpoint auth level decorators,
+ including `system_bearer`
+* [`db/interaction.py`](/ref/atr/db/interaction.py) - `validate_trusted_jwt` implements the service
+ account authorisation, `trusted_jwt_for_dist` implements gating based on the service account
* [`ldap.py`](/ref/atr/ldap.py) - Account deactivation handling and credential revocation
-* [`storage/writers/tokens.py`](/ref/atr/storage/writers/tokens.py) - Token creation, deletion, and admin revocation
-* [`post/tokens.py`](/ref/atr/post/tokens.py) - Tighter web limits for JWT issuance and token management
+* [`storage/writers/tokens.py`](/ref/atr/storage/writers/tokens.py) - Token creation, deletion, and
+ admin revocation
+* [`post/tokens.py`](/ref/atr/post/tokens.py) - Tighter web limits for JWT issuance and token
+ management
* [`ssh.py`](/ref/atr/ssh.py) - SSH server implementation, authentication, and rsync handling
-* [`storage/writers/ssh.py`](/ref/atr/storage/writers/ssh.py) - SSH key management and admin revocation
+* [`storage/writers/ssh.py`](/ref/atr/storage/writers/ssh.py) - SSH key management and admin
+ revocation
diff --git a/atr/docs/authorization-security.md b/atr/docs/authorization-security.md
index 5a60b692..a86d88e6 100644
--- a/atr/docs/authorization-security.md
+++ b/atr/docs/authorization-security.md
@@ -25,15 +25,19 @@
## Overview
-ATR uses role-based access control (RBAC) where roles are derived from ASF LDAP group memberships. Authentication (covered in [Authentication security](authentication-security)) establishes *who* a user is; authorization determines *what* they can do.
+ATR uses role-based access control (RBAC) where roles are derived from ASF LDAP group memberships.
+Authentication (covered in [Authentication security](authentication-security)) establishes *who* a
+user is; authorization determines *what* they can do.
-The authorization model is committee-centric: most permissions are granted based on a user's relationship to a committee (PMC membership) or project (committer status).
+The authorization model is committee-centric: most permissions are granted based on a user's
+relationship to a committee (PMC membership) or project (committer status).
## Roles and principals
### Note
-This documents the current status of roles in the application, which will be reorganized, per these Issues:
+This documents the current status of roles in the application, which will be reorganized, per these
+Issues:
* [Review permissions for all actions in ATR](https://github.com/apache/tooling-trusted-releases/issues/242)
* [Allow release managers to be designated](https://github.com/apache/tooling-trusted-releases/issues/520)
@@ -43,34 +47,56 @@ ATR recognizes the following roles, derived from ASF LDAP:
* **Public**: Unauthenticated users. Can view public information about releases and projects.
-* **Committer**: Any authenticated ASF committer. Can create Personal Access Tokens and view their own committees and projects. Determined by existence in LDAP `ou=people,dc=apache,dc=org`.
+* **Committer**: Any authenticated ASF committer. Can create Personal Access Tokens and view their
+ own committees and projects. Determined by existence in LDAP `ou=people,dc=apache,dc=org`.
-* **Project Participant**: A committer who is a member of a specific project. Can start releases, upload artifacts, and cast votes for that project. Determined by the `member` attribute in the project's LDAP group.
+* **Project Participant**: A committer who is a member of a specific project. Can start releases,
+ upload artifacts, and cast votes for that project. Determined by the `member` attribute in the
+ project's LDAP group.
-* **Release Manager**: A committer designated by the PMC as a release manager, through the roster on the committee page. Has all participant permissions plus can start and resolve votes, publish and announce releases, record distributions, and edit project metadata and policy, but does not get a binding vote. All PMC members are release managers, so PMC members cannot be designated, and a designation is removed automatically when a designated release manager joins the PMC. Designations a [...]
+* **Release Manager**: A committer designated by the PMC as a release manager, through the roster on
+ the committee page. Has all participant permissions plus can start and resolve votes, publish and
+ announce releases, record distributions, and edit project metadata and policy, but does not get a
+ binding vote. All PMC members are release managers, so PMC members cannot be designated, and a
+ designation is removed automatically when a designated release manager joins the PMC. Designations
+ are stored in the ATR database, not in LDAP.
-* **PMC Member**: A committer who is on the PMC (Project Management Committee) for a specific committee. Has all release manager permissions plus can designate release managers, create and archive projects, manage categories and check ignores, and manage signing keys. Determined by the `owner` attribute in the committee's LDAP group.
+* **PMC Member**: A committer who is on the PMC (Project Management Committee) for a specific
+ committee. Has all release manager permissions plus can designate release managers, create and
+ archive projects, manage categories and check ignores, and manage signing keys. Determined by the
+ `owner` attribute in the committee's LDAP group.
-* **Chair**: A PMC chair. Currently has the same permissions as PMC Member in ATR. Determined by membership in `cn=pmc-chairs,ou=groups,ou=services,dc=apache,dc=org`.
+* **Chair**: A PMC chair. Currently has the same permissions as PMC Member in ATR. Determined by
+ membership in `cn=pmc-chairs,ou=groups,ou=services,dc=apache,dc=org`.
-* **ASF Member**: An ASF Member. Currently has the same permissions as a regular committer in ATR, though this may change. Determined by membership in `cn=member,ou=groups,dc=apache,dc=org`.
+* **ASF Member**: An ASF Member. Currently has the same permissions as a regular committer in ATR,
+ though this may change. Determined by membership in `cn=member,ou=groups,dc=apache,dc=org`.
-* **Infrastructure Root**: ASF Infrastructure team with root access. Has administrative capabilities. Determined by membership in `cn=infrastructure-root,ou=groups,ou=services,dc=apache,dc=org`.
+* **Infrastructure Root**: ASF Infrastructure team with root access. Has administrative
+ capabilities. Determined by membership in
+ `cn=infrastructure-root,ou=groups,ou=services,dc=apache,dc=org`.
-* **Tooling Team**: Members of the ASF Tooling service group, determined by membership in `cn=tooling,ou=groups,ou=services,dc=apache,dc=org`. This group grants ATR administrator rights only (alongside Infrastructure Root). The "tooling" committee roster is sourced separately from the Tooling PMC group `cn=tooling,ou=project,ou=groups,dc=apache,dc=org`, like any other PMC.
+* **Tooling Team**: Members of the ASF Tooling service group, determined by membership in
+ `cn=tooling,ou=groups,ou=services,dc=apache,dc=org`. This group grants ATR administrator rights
+ only (alongside Infrastructure Root). The "tooling" committee roster is sourced separately from
+ the Tooling PMC group `cn=tooling,ou=project,ou=groups,dc=apache,dc=org`, like any other PMC.
## LDAP integration
-Authorization data is fetched from ASF LDAP using the [`principal`](/ref/atr/principal.py) module. The key LDAP bases are:
+Authorization data is fetched from ASF LDAP using the [`principal`](/ref/atr/principal.py) module.
+The key LDAP bases are:
* `ou=people,dc=apache,dc=org` - All committers
* `ou=project,ou=groups,dc=apache,dc=org` - Project and committee groups
* `cn=member,ou=groups,dc=apache,dc=org` - ASF Members
* `cn=pmc-chairs,ou=groups,ou=services,dc=apache,dc=org` - PMC Chairs
* `cn=infrastructure-root,ou=groups,ou=services,dc=apache,dc=org` - Infrastructure root
-* `cn=tooling,ou=groups,ou=services,dc=apache,dc=org` - Tooling service group (grants ATR admin rights only; the "tooling" committee is sourced from `ou=project,ou=groups` like any PMC)
+* `cn=tooling,ou=groups,ou=services,dc=apache,dc=org` - Tooling service group (grants ATR admin
+ rights only; the "tooling" committee is sourced from `ou=project,ou=groups` like any PMC)
-The [`Committer`](/ref/atr/principal.py) (Committer) class fetches a user's full authorization profile from LDAP, including their committee memberships (PMC membership) and project participations (committer access).
+The [`Committer`](/ref/atr/principal.py) (Committer) class fetches a user's full authorization
+profile from LDAP, including their committee memberships (PMC membership) and project participations
+(committer access).
## Access control for releases
@@ -79,14 +105,17 @@ Release operations have the following access requirements:
**View release information** (public pages, download links):
* Allowed for: Everyone, including unauthenticated users
-* This includes the following API endpoints, which are intentionally unauthenticated because they serve the same public information available on the website:
+* This includes the following API endpoints, which are intentionally unauthenticated because they
+ serve the same public information available on the website:
* `/api/checks/list/<project>/<version>` — check results for a release
* `/api/checks/ongoing/<project>/<version>` — count of ongoing checks
* `/api/release/paths/<project>/<version>` — file paths in a release
* `/api/release/revisions/<project>/<version>` — revision history of a release
* `/api/ssh-keys/list/<asf_uid>` — enumerates SSH key fingerprints for any user
* `/api/keys/user/<asf_uid>` — enumerates OpenPGP keys for any user
-* Rationale: ASF release artifacts, their check results, and their metadata are public by design. The release process is transparent and these endpoints support tooling that consumes public release data.
+* Rationale: ASF release artifacts, their check results, and their metadata are public by design.
+ The release process is transparent and these endpoints support tooling that consumes public
+ release data.
**Start a new release**:
@@ -106,7 +135,9 @@ Release operations have the following access requirements:
**Resolve a vote (tally votes and determine outcome)**:
* Allowed for: Release managers and PMC members
-* Checked via: the release manager storage tier, obtained with `as_project_release_manager`, which admits a project's designated release managers (`is_release_manager`) and its PMC members (`is_member_of`)
+* Checked via: the release manager storage tier, obtained with `as_project_release_manager`, which
+ admits a project's designated release managers (`is_release_manager`) and its PMC members
+ (`is_member_of`)
**Finish a release (publish to distribution)**:
@@ -121,10 +152,10 @@ Release operations have the following access requirements:
## Phase-based access control
A release moves through four phases - draft (`RELEASE_CANDIDATE_DRAFT`), candidate
-(`RELEASE_CANDIDATE`), preview (`RELEASE_PREVIEW`), and published (`RELEASE`). The
-phase a release is in, alongside the caller's role, determines which operations are
-permitted. The tables below consolidate those phase rules; the roles they name are
-defined in [Roles and principals](#roles-and-principals).
+(`RELEASE_CANDIDATE`), preview (`RELEASE_PREVIEW`), and published (`RELEASE`). The phase a release
+is in, alongside the caller's role, determines which operations are permitted. The tables below
+consolidate those phase rules; the roles they name are defined in
+[Roles and principals](#roles-and-principals).
### Release lifecycle operations
@@ -152,21 +183,19 @@ ATR administrators may act throughout.
## Access control for third-party distributions
-A distribution records where a release's artifacts have been published to a
-third-party platform - for example a package registry or a download platform.
-Release managers record and remove these distributions:
+A distribution records where a release's artifacts have been published to a third-party platform -
+for example a package registry or a download platform. Release managers record and remove these
+distributions:
* **Record** a distribution - note a distribution that exists on a platform.
* **Delete** a distribution - remove a recorded distribution.
-**Allowed for**: Release managers and PMC members, obtained with
-`as_project_release_manager`.
+**Allowed for**: Release managers and PMC members, obtained with `as_project_release_manager`.
**Constraints** (applied to both):
* The release must belong to the caller's own committee.
-* The project must be active; all release actions are disabled once a project is
- archived.
+* The project must be active; all release actions are disabled once a project is archived.
* Writing to an embargoed release additionally requires PMC membership.
## Access control for tokens
@@ -208,20 +237,24 @@ Token operations apply to the authenticated user:
**System tokens**:
* Allowed for: Foundation administrators only (not committer self-service)
-* Note: System tokens are PATs for a service identity rather than a person. Endpoints that accept them (via `auth_scheme=api_auth.Auth.SYSTEM_BEARER`) apply no committee membership check, so the calling service must establish any committee authorisation upstream. See [System tokens](authentication-security#system-tokens) in the authentication guide for the mechanism.
+* Note: System tokens are PATs for a service identity rather than a person. Endpoints that accept
+ them (via `auth_scheme=api_auth.Auth.SYSTEM_BEARER`) apply no committee membership check, so the
+ calling service must establish any committee authorisation upstream. See
+ [System tokens](authentication-security#system-tokens) in the authentication guide for the
+ mechanism.
## Access control for keys
-ATR holds two kinds of key: OpenPGP signing keys, used to sign release artifacts,
-and SSH keys, used to authenticate rsync uploads.
+ATR holds two kinds of key: OpenPGP signing keys, used to sign release artifacts, and SSH keys, used
+to authenticate rsync uploads.
### OpenPGP signing keys
**Upload an OpenPGP key**:
* Allowed for: Any committer, for their own key
-* Checked via: `ensure_stored_one` on the committer tier; the key is stored
- against the ASF UID found in its own user IDs
+* Checked via: `ensure_stored_one` on the committer tier; the key is stored against the ASF UID
+ found in its own user IDs
**Associate a key with a committee**:
@@ -231,10 +264,9 @@ and SSH keys, used to authenticate rsync uploads.
**Delete an OpenPGP key**:
* Allowed for: The key's owner (a committer)
-* Checked via: `delete_key` on the committer tier, which matches the key by the
- caller's ASF UID
-* Constraint: a key managed in a committee's SVN KEYS file (reflect mode) cannot
- be deleted in ATR; it must be removed in SVN
+* Checked via: `delete_key` on the committer tier, which matches the key by the caller's ASF UID
+* Constraint: a key managed in a committee's SVN KEYS file (reflect mode) cannot be deleted in ATR;
+ it must be removed in SVN
**Import a committee KEYS file**:
@@ -257,35 +289,33 @@ and SSH keys, used to authenticate rsync uploads.
* Allowed for: Participants of the committee
* Checked via: `add_workflow_key` on the committee participant tier
-* Note: workflow keys authenticate automated release workflows rather than a
- person; each is minted once against a single-use OIDC token
+* Note: workflow keys authenticate automated release workflows rather than a person; each is minted
+ once against a single-use OIDC token
**Revoke all of a user's SSH keys**:
* Allowed for: ATR administrators only
-* See [Access control for tokens](#access-control-for-tokens), which documents
- this operation alongside token revocation
+* See [Access control for tokens](#access-control-for-tokens), which documents this operation
+ alongside token revocation
## Access control for project policy
-Each project has a release policy governing how its releases are composed, voted
-on, and finished. The policy is changed through a set of edit operations, all on
-the release manager tier:
+Each project has a release policy governing how its releases are composed, voted on, and finished.
+The policy is changed through a set of edit operations, all on the release manager tier:
* **Compose policy** (`edit_compose`) - composition and artifact settings.
* **Vote policy** (`edit_vote`) - voting settings.
* **Finish policy** (`edit_finish`) - settings applied when a release is finished.
-* **Trusted publishing** (`edit_trusted_publishing`) - trusted publishing
- configuration (see [Trusted Publishing](trusted-publishing)).
+* **Trusted publishing** (`edit_trusted_publishing`) - trusted publishing configuration (see
+ [Trusted Publishing](trusted-publishing)).
* **Version scheme** (`edit_version_scheme`) - the project's version numbering.
* **Cycle dates** (`edit_cycle_dates`) - release cycle dates.
-**Allowed for**: Release managers and PMC members, obtained with
-`as_project_release_manager`.
+**Allowed for**: Release managers and PMC members, obtained with `as_project_release_manager`.
-**See also**: value and type constraints on these settings - such as which vote
-modes a project may use - are validation rather than access control, and are
-covered under [Business logic validation](input-validation#business-logic-validation).
+**See also**: value and type constraints on these settings - such as which vote modes a project may
+use - are validation rather than access control, and are covered under
+[Business logic validation](input-validation#business-logic-validation).
## Access control for projects
@@ -305,38 +335,37 @@ Project metadata and lifecycle operations span two tiers.
* Allowed for: PMC members
* Obtained with: `as_committee_member`
-* Constraint: each takes an approval request, tying the action to a recorded
- approval rather than a single click
+* Constraint: each takes an approval request, tying the action to a recorded approval rather than a
+ single click
## Access control for administrators
-ATR administrators can act across every committee and project, beyond what any
-committee role grants. Administrative rights are not tied to a committee.
+ATR administrators can act across every committee and project, beyond what any committee role
+grants. Administrative rights are not tied to a committee.
### Who is an administrator
-Administrator identity is determined by [`is_admin`](/ref/atr/user.py). The
-administrator set is drawn from ASF LDAP - the Infrastructure Root and Tooling
-service groups (see [Roles and principals](#roles-and-principals)) - fetched by
-`fetch_admin_users`, cached, and refreshed periodically. Additional
-administrators can be configured through `ADMIN_USERS_ADDITIONAL`.
+Administrator identity is determined by [`is_admin`](/ref/atr/user.py). The administrator set is
+drawn from ASF LDAP - the Infrastructure Root and Tooling service groups (see
+[Roles and principals](#roles-and-principals)) - fetched by `fetch_admin_users`, cached, and
+refreshed periodically. Additional administrators can be configured through
+`ADMIN_USERS_ADDITIONAL`.
### Downgrade and impersonation
-Administrators have two controls that change how their session acts, both recorded
-on the session (see [Sessions](sessions)):
+Administrators have two controls that change how their session acts, both recorded on the session
+(see [Sessions](sessions)):
-* **Downgrade**: an administrator can drop their own admin rights for the session.
- While the session is downgraded, `is_admin` returns false and the administrator
- is treated as an ordinary user.
-* **Browse as**: an administrator can act as another user. The session records the
- real administrator in `admin_uid`, so both the acting identity and the
- administrator behind it are known.
+* **Downgrade**: an administrator can drop their own admin rights for the session. While the session
+ is downgraded, `is_admin` returns false and the administrator is treated as an ordinary user.
+* **Browse as**: an administrator can act as another user. The session records the real
+ administrator in `admin_uid`, so both the acting identity and the administrator behind it are
+ known.
### Administrator-only operations
-Administrator rights gate operations that are foundation-wide or destructive,
-rather than belonging to a single committee. These include:
+Administrator rights gate operations that are foundation-wide or destructive, rather than belonging
+to a single committee. These include:
* Revoking all of a user's personal access tokens or SSH keys (see
[Access control for tokens](#access-control-for-tokens)).
@@ -346,11 +375,11 @@ rather than belonging to a single committee. These include:
[Access control for keys](#access-control-for-keys)).
* Deleting or cancelling a finished, published release (see
[Access control for releases](#access-control-for-releases)).
-* Foundation-wide catalogue and site administration, such as catalogue rebuilds,
- structural corrections, and the site banner.
+* Foundation-wide catalogue and site administration, such as catalogue rebuilds, structural
+ corrections, and the site banner.
-The admin dashboard is the definitive surface for these operations; this list
-describes the categories rather than every individual action.
+The admin dashboard is the definitive surface for these operations; this list describes the
+categories rather than every individual action.
## Implementation patterns
@@ -390,7 +419,8 @@ projects = auth.participant_of() # Returns frozenset of project names
### Web vs API authorization
-For web requests, the [`Authorisation`](/ref/atr/principal.py) (Authorisation) class reads the session automatically:
+For web requests, the [`Authorisation`](/ref/atr/principal.py) (Authorisation) class reads the
+session automatically:
```python
auth = await Authorisation() # Uses ASFQuart session
@@ -406,27 +436,38 @@ Both paths use the same authorization logic and caching.
## Caching behavior
-LDAP queries are expensive, so authorization data is cached in [`principal.Cache`](/ref/atr/principal.py) (Cache). The cache stores:
+LDAP queries are expensive, so authorization data is cached in
+[`principal.Cache`](/ref/atr/principal.py) (Cache). The cache stores:
* `member_of` - Set of committees where the user is a PMC member
* `participant_of` - Set of projects where the user is a committer
* `last_refreshed` - Timestamp of last LDAP query
-The cache TTL is 300 seconds (`cache_for_at_most_seconds`). When the cache is stale, the next authorization check triggers an LDAP refresh.
+The cache TTL is 300 seconds (`cache_for_at_most_seconds`). When the cache is stale, the next
+authorization check triggers an LDAP refresh.
-The cache is per-user and in-memory. It does not persist across server restarts. If LDAP group memberships change, users may need to wait up to 5 minutes for ATR to reflect the change, or log out and back in.
+The cache is per-user and in-memory. It does not persist across server restarts. If LDAP group
+memberships change, users may need to wait up to 5 minutes for ATR to reflect the change, or log out
+and back in.
### Test mode
-When running in test mode (env == `TESTS`), a special "test" user and "test" committee are available. **This should never be enabled in production.** The security implications are significant:
+When running in test mode (env == `TESTS`), a special "test" user and "test" committee are
+available. **This should never be enabled in production.** The security implications are
+significant:
-1. All authenticated users (not just the test user) are granted membership in the "test" committee and project [`principal`](/ref/atr/principal.py).
-2. Authorization checks in the storage layer are completely skipped for the test committee [`release`](/ref/atr/storage/writers/release.py).
+1. All authenticated users (not just the test user) are granted membership in the "test" committee
+ and project [`principal`](/ref/atr/principal.py).
+2. Authorization checks in the storage layer are completely skipped for the test committee
+ [`release`](/ref/atr/storage/writers/release.py).
3. Rate limiting is disabled [`server`](/ref/atr/server.py).
4. A hardcoded "test" user bypasses LDAP verification.
-If this is accidentally left enabled in production, every authenticated user gains unauthorized access to the test committee and its resources. This flag is intended for use only in development and test environments where `DEBUG_MODE` is also set.
-As such, on starting the server in production mode (env == `PRODUCTION`), a safety check will run to ensure certain sensitive values are not misconfigured.
+If this is accidentally left enabled in production, every authenticated user gains unauthorized
+access to the test committee and its resources. This flag is intended for use only in development
+and test environments where `DEBUG_MODE` is also set. As such, on starting the server in production
+mode (env == `PRODUCTION`), a safety check will run to ensure certain sensitive values are not
+misconfigured.
## Implementation references
diff --git a/atr/docs/build-processes.md b/atr/docs/build-processes.md
index 888e7b84..6042d15b 100644
--- a/atr/docs/build-processes.md
+++ b/atr/docs/build-processes.md
@@ -12,14 +12,38 @@
## Documentation build script
-To **regenerate the documentation**, run `make docs`. Pre-commit runs this too. Review and stage any regenerated Markdown, then rerun.
-
-The ATR documentation that you're reading right now is structured like a book, with numbered chapters, sections, and navigation links between pages. We could maintain all of this by hand, but that would be tedious and error-prone. Instead, we use [`scripts/docs_build.py`](/ref/scripts/docs_build.py) to generate the navigation automatically from a single table of contents.
-
-The script reads the table of contents in [`atr/docs/index.md`](/ref/atr/docs/index.md), extracts the hierarchy of pages, and then updates every referenced page to include the correct navigation links, page numbers, and section listings. This means that when we want to reorganize the documentation (say, inserting a new chapter or moving sections around) we only need to edit the table of contents, run the script, and all the navigation is updated automatically.
-
-The implementation is straightforward. The [`parse_toc`](/ref/scripts/docs_build.py) (parse_toc) function extracts entries from the table of contents section in the index, and [`build_navigation`](/ref/scripts/docs_build.py) (build_navigation) computes the up, previous, and next relationships for each page. The [`update_document`](/ref/scripts/docs_build.py) (update_document) function is then called for each page, which rewrites the page heading to match the canonical numbering from the [...]
-
-The navigation block itself is generated by [`generate_navigation_block`](/ref/scripts/docs_build.py) (generate_navigation_block), which formats the up, previous, and next links, adds a list of subpages if any exist, and includes a table of contents for the page's sections as extracted by [`extract_h2_headings`](/ref/scripts/docs_build.py) (extract_h2_headings). This keeps all of the navigational machinery separate from the actual content, which starts at the first `##` heading.
-
-We also validate that every page in the table of contents exists, and that there are no unlinked Markdown files in the documentation directory. The [`validate_files`](/ref/scripts/docs_build.py) (validate_files) function performs these checks and fails with a descriptive error if anything is wrong. This prevents us from accidentally forgetting to add a page to the table of contents, or from leaving old pages lying around that we meant to delete.
+To **regenerate the documentation**, run `make docs`. Pre-commit runs this too. Review and stage any
+regenerated Markdown, then rerun.
+
+The ATR documentation that you're reading right now is structured like a book, with numbered
+chapters, sections, and navigation links between pages. We could maintain all of this by hand, but
+that would be tedious and error-prone. Instead, we use
+[`scripts/docs_build.py`](/ref/scripts/docs_build.py) to generate the navigation automatically from
+a single table of contents.
+
+The script reads the table of contents in [`atr/docs/index.md`](/ref/atr/docs/index.md), extracts
+the hierarchy of pages, and then updates every referenced page to include the correct navigation
+links, page numbers, and section listings. This means that when we want to reorganize the
+documentation (say, inserting a new chapter or moving sections around) we only need to edit the
+table of contents, run the script, and all the navigation is updated automatically.
+
+The implementation is straightforward. The [`parse_toc`](/ref/scripts/docs_build.py) (parse_toc)
+function extracts entries from the table of contents section in the index, and
+[`build_navigation`](/ref/scripts/docs_build.py) (build_navigation) computes the up, previous, and
+next relationships for each page. The [`update_document`](/ref/scripts/docs_build.py)
+(update_document) function is then called for each page, which rewrites the page heading to match
+the canonical numbering from the `index.md` table of contents and injects a navigation block before
+the first `##` section.
+
+The navigation block itself is generated by
+[`generate_navigation_block`](/ref/scripts/docs_build.py) (generate_navigation_block), which formats
+the up, previous, and next links, adds a list of subpages if any exist, and includes a table of
+contents for the page's sections as extracted by [`extract_h2_headings`](/ref/scripts/docs_build.py)
+(extract_h2_headings). This keeps all of the navigational machinery separate from the actual
+content, which starts at the first `##` heading.
+
+We also validate that every page in the table of contents exists, and that there are no unlinked
+Markdown files in the documentation directory. The [`validate_files`](/ref/scripts/docs_build.py)
+(validate_files) function performs these checks and fails with a descriptive error if anything is
+wrong. This prevents us from accidentally forgetting to add a page to the table of contents, or from
+leaving old pages lying around that we meant to delete.
diff --git a/atr/docs/checks.md b/atr/docs/checks.md
index 2a3c99dc..78976d06 100644
--- a/atr/docs/checks.md
+++ b/atr/docs/checks.md
@@ -18,9 +18,14 @@
## Overview
-ATR runs automated checks on release artifacts so that you can validate compliance and completeness before a vote. The checks focus on signatures, hashes, archive layout, licensing, and software bill of materials (SBOM) content. This document explains what ATR checks, when those checks run, and how to interpret results.
+ATR runs automated checks on release artifacts so that you can validate compliance and completeness
+before a vote. The checks focus on signatures, hashes, archive layout, licensing, and software bill
+of materials (SBOM) content. This document explains what ATR checks, when those checks run, and how
+to interpret results.
-Checks are recorded against the release revision that you upload, and the results remain visible to reviewers and voters. The checks run in the background and appear in the checks view for the revision as they complete.
+Checks are recorded against the release revision that you upload, and the results remain visible to
+reviewers and voters. The checks run in the background and appear in the checks view for the
+revision as they complete.
## How ATR selects checks
@@ -33,53 +38,106 @@ ATR chooses checks for each new draft revision based on file names and project p
ATR also checks file names and required signatures and checksums across the revision.
-Project policy identifies source and binary artifacts and sets exclusions for license checks. For source artifacts, you can choose lightweight license checks, Apache RAT, or both. Binary artifacts always use the lightweight checks.
+Project policy identifies source and binary artifacts and sets exclusions for license checks. For
+source artifacts, you can choose lightweight license checks, Apache RAT, or both. Binary artifacts
+always use the lightweight checks.
## Understanding check results
-Each check result has a status of note, suggestion, concern, blocker, or exception. A note indicates that the check ran and has nothing substantial to report. A suggestion indicates a structural or recommendation difference that release managers may consider but is not a policy violation. A concern indicates that ATR could not be certain about a condition and the release manager must investigate. A blocker indicates that a mandatory policy condition was violated and the release cannot pr [...]
+Each check result has a status of note, suggestion, concern, blocker, or exception. A note indicates
+that the check ran and has nothing substantial to report. A suggestion indicates a structural or
+recommendation difference that release managers may consider but is not a policy violation. A
+concern indicates that ATR could not be certain about a condition and the release manager must
+investigate. A blocker indicates that a mandatory policy condition was violated and the release
+cannot proceed. An exception indicates that the check could not complete due to some unexpected
+internal ATR error.
-Each check section below names the exact checker key that ATR records for that check. If you would like checks to change for all projects, you can file an ATR issue.
+Each check section below names the exact checker key that ATR records for that check. If you would
+like checks to change for all projects, you can file an ATR issue.
## Individual checks
### Path and naming checks
-ATR validates the file layout of the revision against ASF release rules. For each artifact it expects a matching signature file with the `.asc` suffix and at least one checksum file with the `.sha256` or `.sha512` suffix. It verifies that metadata files correspond to an existing artifact and warns when a metadata suffix is recommended against by policy. It rejects `.md5` checksums and `.sig` signature files and warns about `.sha1` and `.sha`. It rejects dotfiles except for those under th [...]
+ATR validates the file layout of the revision against ASF release rules. For each artifact it
+expects a matching signature file with the `.asc` suffix and at least one checksum file with the
+`.sha256` or `.sha512` suffix. It verifies that metadata files correspond to an existing artifact
+and warns when a metadata suffix is recommended against by policy. It rejects `.md5` checksums and
+`.sig` signature files and warns about `.sha1` and `.sha`. It rejects dotfiles except for those
+under the `.atr` directory, and it rejects a `KEYS` file inside the artifact bundle because keys are
+managed through the keys section. If the project is a podling, it requires the word "incubating" in
+artifact filenames.
-This check records separate checker keys for concerns, suggestions, and notes. It uses `atr.tasks.checks.paths.check_errors` for concerns, `atr.tasks.checks.paths.check_warnings` for suggestions, and `atr.tasks.checks.paths.check_success` for notes. The requirement that a release contains at least one source artifact is recorded under `atr.tasks.checks.paths.check_source`.
+This check records separate checker keys for concerns, suggestions, and notes. It uses
+`atr.tasks.checks.paths.check_errors` for concerns, `atr.tasks.checks.paths.check_warnings` for
+suggestions, and `atr.tasks.checks.paths.check_success` for notes. The requirement that a release
+contains at least one source artifact is recorded under `atr.tasks.checks.paths.check_source`.
### Hash verification
-For each `.sha256` or `.sha512` file, ATR computes the hash of the referenced artifact and compares it with the expected value. It supports files that contain just the hash as well as files that include a filename and hash on the same line. If the suffix does not indicate `sha256` or `sha512`, the check fails.
+For each `.sha256` or `.sha512` file, ATR computes the hash of the referenced artifact and compares
+it with the expected value. It supports files that contain just the hash as well as files that
+include a filename and hash on the same line. If the suffix does not indicate `sha256` or `sha512`,
+the check fails.
The checker key is `atr.tasks.checks.file_hash.check`.
### Signature verification
-For each `.asc` signature file, ATR verifies the signature against the matching artifact using the public keys stored for the release committee. The signature is accepted only when it verifies and when the signing key is associated with an ASF UID or is the committee's automated release signing key, with a primary UID containing "Automated Release Signing" or "Services RM" (ignoring case) and the email address `private@`[_committee name_]`.apache.org`. If no suitable key is found or the [...]
+For each `.asc` signature file, ATR verifies the signature against the matching artifact using the
+public keys stored for the release committee. The signature is accepted only when it verifies and
+when the signing key is associated with an ASF UID or is the committee's automated release signing
+key, with a primary UID containing "Automated Release Signing" or "Services RM" (ignoring case) and
+the email address `private@`[_committee name_]`.apache.org`. If no suitable key is found or the
+signature does not match the artifact, the check fails.
-The key which made the signature, which may be a subkey, must also meet the minimum strength for signing releases. ATR records a blocker when a signature was made by a DSA key of any size, or by an RSA key shorter than 2048 bits, even if the signature itself verifies. See [Required key settings](release-manager-setup#required-key-settings) for the full list.
+The key which made the signature, which may be a subkey, must also meet the minimum strength for
+signing releases. ATR records a blocker when a signature was made by a DSA key of any size, or by an
+RSA key shorter than 2048 bits, even if the signature itself verifies. See
+[Required key settings](release-manager-setup#required-key-settings) for the full list.
-ATR also raises a concern when the ASF UID of the signing key is not one of the ASF UIDs recorded as having uploaded the artifact, because an artifact is expected to be signed by the person who uploaded it. The automated release signing key is exempt. The concern does not block a vote, but it must be acknowledged before one is started.
+ATR also raises a concern when the ASF UID of the signing key is not one of the ASF UIDs recorded as
+having uploaded the artifact, because an artifact is expected to be signed by the person who
+uploaded it. The automated release signing key is exempt. The concern does not block a vote, but it
+must be acknowledged before one is started.
-The checker key is `atr.tasks.checks.signature.check`, and the uploader concern is recorded under `atr.tasks.checks.signature.check_uploader_mismatch`.
+The checker key is `atr.tasks.checks.signature.check`, and the uploader concern is recorded under
+`atr.tasks.checks.signature.check_uploader_mismatch`.
### Archive integrity checks
-ATR validates new archives in supported formats before creating a revision. If an archive is corrupt or exceeds the extraction limits, the upload fails and the error appears on the compose page. See [Archive validation](uploading-files#archive-validation) for what happens while an upload is checked and how to retry a failed upload.
+ATR validates new archives in supported formats before creating a revision. If an archive is corrupt
+or exceeds the extraction limits, the upload fails and the error appears on the compose page. See
+[Archive validation](uploading-files#archive-validation) for what happens while an upload is checked
+and how to retry a failed upload.
### Archive structure checks
-ATR expects each archive to contain exactly one root directory. The expected root name is derived from the archive filename base, without extension. When the archive filename base ends with the suffix `source` or `src`, ATR accepts a root directory that either includes that suffix or omits it. When the archive filename base has no such suffix, the root directory must match the base. If the root does not match, ATR records a concern so that you can review project conventions. Structure ch [...]
+ATR expects each archive to contain exactly one root directory. The expected root name is derived
+from the archive filename base, without extension. When the archive filename base ends with the
+suffix `source` or `src`, ATR accepts a root directory that either includes that suffix or omits it.
+When the archive filename base has no such suffix, the root directory must match the base. If the
+root does not match, ATR records a concern so that you can review project conventions. Structure
+checks are skipped for artifacts that are classified as binary by project policy.
-ATR also recognizes `npm pack` archives. When the root directory is named package, ATR looks for a file named `package.json` and validates that it contains a name and version. If the file is present and valid, ATR treats this layout as acceptable. If the package name and version do not match the archive filename base, ATR records a concern.
+ATR also recognizes `npm pack` archives. When the root directory is named package, ATR looks for a
+file named `package.json` and validates that it contains a name and version. If the file is present
+and valid, ATR treats this layout as acceptable. If the package name and version do not match the
+archive filename base, ATR records a concern.
-The checker key for tar based structure checks is `atr.tasks.checks.targz.structure`. The checker key for zip structure checks is `atr.tasks.checks.zipformat.structure`.
+The checker key for tar based structure checks is `atr.tasks.checks.targz.structure`. The checker
+key for zip structure checks is `atr.tasks.checks.zipformat.structure`.
### License files in archives
-ATR checks for `LICENSE` and `NOTICE` files at the top level of the root directory each archive. It requires exactly one of each. The `LICENSE` content must match the Apache License text with only whitespace differences, though `https` may be used in place of `http` for Apache license URLs. The `NOTICE` file must be valid UTF-8 text and must include a product line, an ASF copyright statement, and the standard ASF attribution line. For podling projects ATR also requires a `DISCLAIMER` or [...]
+ATR checks for `LICENSE` and `NOTICE` files at the top level of the root directory each archive. It
+requires exactly one of each. The `LICENSE` content must match the Apache License text with only
+whitespace differences, though `https` may be used in place of `http` for Apache license URLs. The
+`NOTICE` file must be valid UTF-8 text and must include a product line, an ASF copyright statement,
+and the standard ASF attribution line. For podling projects ATR also requires a `DISCLAIMER` or
+`DISCLAIMER-WIP` file at the same level. These lightweight license checks can run for both source
+and binary archives but if your project selects Apache RAT only for source artifacts, the
+lightweight checks are skipped for source archives. They still run for binary archives.
The checker key is `atr.tasks.checks.license.files`.
@@ -87,7 +145,14 @@ You can [read more about license checks](license-checks).
### License headers in source files
-ATR performs a lightweight scan of source files inside each archive to verify Apache License headers. It inspects the first four kilobytes of each file with a recognized source file suffix and checks for the standard Apache License header text or the [three-field SPDX form](license-checks#accepted-headers). Files with generated file suffixes such as `.bundle.js`, `.chunk.js`, `.css.map`, `.js.map`, `.min.css`, `.min.js`, and `.min.map` are treated as generated and are skipped. Files that [...]
+ATR performs a lightweight scan of source files inside each archive to verify Apache License
+headers. It inspects the first four kilobytes of each file with a recognized source file suffix and
+checks for the standard Apache License header text or the
+[three-field SPDX form](license-checks#accepted-headers). Files with generated file suffixes such as
+`.bundle.js`, `.chunk.js`, `.css.map`, `.js.map`, `.min.css`, `.min.js`, and `.min.map` are treated
+as generated and are skipped. Files that include generated markers such as `Generated By JJTree` or
+`Generated By JavaCC` are always accepted as valid. If you configure lightweight exclusions in your
+project policy, those patterns are also skipped for source artifacts.
The checker key is `atr.tasks.checks.license.headers`.
@@ -95,7 +160,15 @@ You can [read more about license checks](license-checks).
### Apache RAT license scan
-ATR can run Apache RAT on source archives unless your project policy selects lightweight mode only. RAT runs in a temporary extraction directory, uses standard exclusions for common SCM and IDE files, and always excludes known generated file patterns. If the archive includes a RAT excludes file with the standard name `.rat-excludes`, ATR uses it as the exclusion file and sets the scan root to the directory that contains it. ATR records a concern if more than one such file is present or i [...]
+ATR can run Apache RAT on source archives unless your project policy selects lightweight mode only.
+RAT runs in a temporary extraction directory, uses standard exclusions for common SCM and IDE files,
+and always excludes known generated file patterns. If the archive includes a RAT excludes file with
+the standard name `.rat-excludes`, ATR uses it as the exclusion file and sets the scan root to the
+directory that contains it. ATR records a concern if more than one such file is present or if files
+exist outside that scan root. If no such file exists, ATR can apply project policy RAT exclusions
+and an extended set of standard exclusions. The check records concerns for unapproved or unknown
+licenses, and records per file results for those files. RAT does not run for binary artifacts, even
+if those files are packaged in an archive format that otherwise triggers license checks.
The checker key is `atr.tasks.checks.rat.check`.
@@ -103,46 +176,94 @@ You can [read more about license checks](license-checks).
## SBOM checks
-ATR recognizes CycloneDX SBOM files with the `.cdx.json` suffix. When you upload such a file, ATR runs a special scoring tool check that evaluates NTIA 2021 conformance, CycloneDX validation results, license signals, and vulnerability data derived from the SBOM. If a previous release exists, ATR compares current and prior license and vulnerability information and records that context with the result. ATR also provides additional SBOM tasks that you can run from the interface: you can ask [...]
+ATR recognizes CycloneDX SBOM files with the `.cdx.json` suffix. When you upload such a file, ATR
+runs a special scoring tool check that evaluates NTIA 2021 conformance, CycloneDX validation
+results, license signals, and vulnerability data derived from the SBOM. If a previous release
+exists, ATR compares current and prior license and vulnerability information and records that
+context with the result. ATR also provides additional SBOM tasks that you can run from the
+interface: you can ask ATR to generate a CycloneDX SBOM from an archive using the syft tool, to
+score a SBOM using SBOM QS, to augment an existing SBOM with NTIA properties, or to run an OSV
+vulnerability scan that updates the SBOM. These tasks may create a new revision because the SBOM
+file is updated with new content.
-SBOM tasks record task results rather than check results, so there is no checker key to use in ignore rules for SBOM tasks. The results are presented separately from regular checks, on their own page.
+SBOM tasks record task results rather than check results, so there is no checker key to use in
+ignore rules for SBOM tasks. The results are presented separately from regular checks, on their own
+page.
## Check caching and reruns
-To save time, ATR caches check results based on a hash of the check inputs, and will therefore sometimes reuse results from a prior run if the file is identical.
+To save time, ATR caches check results based on a hash of the check inputs, and will therefore
+sometimes reuse results from a prior run if the file is identical.
-_For debugging only_, an admin can force a cache bust by clicking the "Disable global cache" button in the compose phase, which will add a release-specific suffix to the cache key, forcing a re-run.
+_For debugging only_, an admin can force a cache bust by clicking the "Disable global cache" button
+in the compose phase, which will add a release-specific suffix to the cache key, forcing a re-run.
## Project policy inputs
-Several project and committee settings influence which checks run, what they skip, and how their results are interpreted. This section lists each setting that can change the outcome of a check, where to find it, and what it does. Most of these settings live on the project settings page in the _Release policy - Compose options_ form. Committee signing keys are managed separately.
+Several project and committee settings influence which checks run, what they skip, and how their
+results are interpreted. This section lists each setting that can change the outcome of a check,
+where to find it, and what it does. Most of these settings live on the project settings page in the
+_Release policy - Compose options_ form. Committee signing keys are managed separately.
### Source and binary artifact paths
-You can configure path patterns that tell ATR which of your artifacts are source artifacts and which are binary. These are the _Source artifact paths_ and _Binary artifact paths_ fields in the compose options form, and they accept one .gitignore style pattern per line. ATR uses these patterns to classify each file, and the classification makes several checks behave differently depending on whether an artifact is source or binary: archive structure checks are skipped for binary artifacts, [...]
+You can configure path patterns that tell ATR which of your artifacts are source artifacts and which
+are binary. These are the _Source artifact paths_ and _Binary artifact paths_ fields in the compose
+options form, and they accept one .gitignore style pattern per line. ATR uses these patterns to
+classify each file, and the classification makes several checks behave differently depending on
+whether an artifact is source or binary: archive structure checks are skipped for binary artifacts,
+RAT checks never runs on binary artifacts, and source tree comparisons only run for source
+artifacts.
-Please note that there is [currently a bug](https://github.com/apache/tooling-trusted-releases/issues/630) where license file exclusions are not applied when a source archive is not explicitly classified through release policy options.
+Please note that there is
+[currently a bug](https://github.com/apache/tooling-trusted-releases/issues/630) where license file
+exclusions are not applied when a source archive is not explicitly classified through release policy
+options.
### License check mode
-The _Source artifact license checker_ setting controls which license checks run on source archives. You can set it to _Both_ (the default), _Lightweight_, or _RAT_. Binary artifacts always use the lightweight checks regardless of this setting, because RAT does not operate on binary artifacts. In _Lightweight_ mode, therefore, the RAT check is skipped entirely. In _RAT_ mode, the lightweight checks are skipped for source artifacts only.
+The _Source artifact license checker_ setting controls which license checks run on source archives.
+You can set it to _Both_ (the default), _Lightweight_, or _RAT_. Binary artifacts always use the
+lightweight checks regardless of this setting, because RAT does not operate on binary artifacts. In
+_Lightweight_ mode, therefore, the RAT check is skipped entirely. In _RAT_ mode, the lightweight
+checks are skipped for source artifacts only.
You can [read more about license checks](license-checks).
### License check exclusions
-Two separate sets of exclusion patterns let you skip files during license scanning. The _RAT source excludes_ are applied when RAT scans a source artifact that does not contain its own `.rat-excludes` file. The _Lightweight source excludes_ are always applied during the lightweight license header scan for source artifacts. In both cases the exclusions only take effect for artifacts that are classified as source by the source artifact paths setting (this is a [bug](https://github.com/apac [...]
+Two separate sets of exclusion patterns let you skip files during license scanning. The _RAT source
+excludes_ are applied when RAT scans a source artifact that does not contain its own `.rat-excludes`
+file. The _Lightweight source excludes_ are always applied during the lightweight license header
+scan for source artifacts. In both cases the exclusions only take effect for artifacts that are
+classified as source by the source artifact paths setting (this is a
+[bug](https://github.com/apache/tooling-trusted-releases/issues/630)).
-If you would rather not maintain the RAT excludes here as well as in your project, set a _RAT excludes URL_ pointing at a `.rat-excludes` file your project already keeps in git. We fetch it fresh for each revision we check, and record what we used against the revision. The URL must be on an `apache.org` host or `raw.githubusercontent.com`. When a source artifact ships its own `.rat-excludes` that still wins, then the URL, then the _RAT source excludes_ typed above.
+If you would rather not maintain the RAT excludes here as well as in your project, set a _RAT
+excludes URL_ pointing at a `.rat-excludes` file your project already keeps in git. We fetch it
+fresh for each revision we check, and record what we used against the revision. The URL must be on
+an `apache.org` host or `raw.githubusercontent.com`. When a source artifact ships its own
+`.rat-excludes` that still wins, then the URL, then the _RAT source excludes_ typed above.
You can [read more about license check exclusions](license-checks#project-policy-exclusions).
### Committee signing keys
-Signature verification depends on the public signing keys registered for the project's committee. ATR verifies each `.asc` signature against the set of keys linked to the committee, and accepts a signature only when the signing key has a valid ASF UID association or follows the automated release key naming convention, containing "Automated Release Signing" or "Services RM" (ignoring case) in its primary UID with the email address `private@`_committee_`.apache.org`.
+Signature verification depends on the public signing keys registered for the project's committee.
+ATR verifies each `.asc` signature against the set of keys linked to the committee, and accepts a
+signature only when the signing key has a valid ASF UID association or follows the automated release
+key naming convention, containing "Automated Release Signing" or "Services RM" (ignoring case) in
+its primary UID with the email address `private@`_committee_`.apache.org`.
-If a key has not been imported for the committee, or if it lacks both an ASF UID and the naming convention, signature checks will fail for artifacts signed with that key. Committee members manage these keys through the committee keys page, or through the `KEYS` file in SVN, depending on the committee's KEYS management mode, described in [The KEYS file](moving-to-atr#the-keys-file). See [signing artifacts](signing-artifacts) for background on how to create and register keys.
+If a key has not been imported for the committee, or if it lacks both an ASF UID and the naming
+convention, signature checks will fail for artifacts signed with that key. Committee members manage
+these keys through the committee keys page, or through the `KEYS` file in SVN, depending on the
+committee's KEYS management mode, described in [The KEYS file](moving-to-atr#the-keys-file). See
+[signing artifacts](signing-artifacts) for background on how to create and register keys.
### Podling status
-If the project belongs to an incubating podling, ATR passes this to certain checks automatically. The path and naming check requires the word "incubating" in artifact filenames for podlings, and the license file check looks for a `DISCLAIMER` or `DISCLAIMER-WIP` file in the archive root. Podling status comes from the committee record and is not something that you can configure per project.
+If the project belongs to an incubating podling, ATR passes this to certain checks automatically.
+The path and naming check requires the word "incubating" in artifact filenames for podlings, and the
+license file check looks for a `DISCLAIMER` or `DISCLAIMER-WIP` file in the archive root. Podling
+status comes from the committee record and is not something that you can configure per project.
diff --git a/atr/docs/code-conventions.md b/atr/docs/code-conventions.md
index f5e50498..0f403e9b 100644
--- a/atr/docs/code-conventions.md
+++ b/atr/docs/code-conventions.md
@@ -20,13 +20,16 @@
### Follow PEP 8 rules by default
-Follow [PEP 8](https://peps.python.org/pep-0008/) unless otherwise indicated in this document. Some of the conventions listed below recapitulate or add exceptions to PEP 8 rules.
+Follow [PEP 8](https://peps.python.org/pep-0008/) unless otherwise indicated in this document. Some
+of the conventions listed below recapitulate or add exceptions to PEP 8 rules.
Obey all project local lints, e.g. the use of `ruff` and specific `ruff` rules.
### Keep the primary execution path to the left
-Structure code so that the most likely, normal, successful execution path remains at the level of least indentation. Handle error cases and edge conditions early with guard clauses, and then continue with the main logic. This makes it easier to identify the primary execution flow.
+Structure code so that the most likely, normal, successful execution path remains at the level of
+least indentation. Handle error cases and edge conditions early with guard clauses, and then
+continue with the main logic. This makes it easier to identify the primary execution flow.
```python
# Avoid
@@ -56,13 +59,21 @@ def process_data(data):
### Avoid excessive indentation
-When you find yourself nesting code more than two or three levels deep, extract the nested logic into separate functions. This improves readability, testability, and maintainability. Each function should handle a single, well defined piece of logic.
+When you find yourself nesting code more than two or three levels deep, extract the nested logic
+into separate functions. This improves readability, testability, and maintainability. Each function
+should handle a single, well defined piece of logic.
### Do not use lint or type checker ignore statements
-You must not use `# noqa`, `# type: ignore`, or equivalents such as `cast`, even to ignore specific errors. The single exception to this is when there is a bug in the linter or type checker. Such ignores should be scoped to the category of error being raised by the checker. We currently use pyright for type checking, where one additional restriction is that ignores of the style `# type: ignore` or `# type: ignore[category]` [must not be used](https://github.com/apache/tooling-trusted-rel [...]
+You must not use `# noqa`, `# type: ignore`, or equivalents such as `cast`, even to ignore specific
+errors. The single exception to this is when there is a bug in the linter or type checker. Such
+ignores should be scoped to the category of error being raised by the checker. We currently use
+pyright for type checking, where one additional restriction is that ignores of the style
+`# type: ignore` or `# type: ignore[category]`
+[must not be used](https://github.com/apache/tooling-trusted-releases/issues/375).
-File level lint ignores can be added to the project's `pyproject.toml`, but they must be used sparingly.
+File level lint ignores can be added to the project's `pyproject.toml`, but they must be used
+sparingly.
### Use double quotes for all strings
@@ -70,7 +81,9 @@ This includes triple quoted strings.
### Prefix private interfaces with a single underscore
-Prefix private interfaces, e.g. functions, constants, variables, with a single underscore. An interface is private when used exclusively within its containing module and not referenced by external code, templates, or processes.
+Prefix private interfaces, e.g. functions, constants, variables, with a single underscore. An
+interface is private when used exclusively within its containing module and not referenced by
+external code, templates, or processes.
Exceptions to this rule include:
@@ -80,25 +93,32 @@ Exceptions to this rule include:
* Methods requiring interface compatibility with their superclass
* Nested functions (which should generally be avoided)
-Scripts are explicitly _not_ an exception. Underscores should be used to prefix private interfaces in scripts for consistency, e.g. so that linters don't need to carry exceptions, and to ease potential migration to modules.
+Scripts are explicitly _not_ an exception. Underscores should be used to prefix private interfaces
+in scripts for consistency, e.g. so that linters don't need to carry exceptions, and to ease
+potential migration to modules.
### Avoid nested functions
-Function definitions should be at the top level. This is not a hard rule, but should only be broken when absolutely necessary.
+Function definitions should be at the top level. This is not a hard rule, but should only be broken
+when absolutely necessary.
### Use UPPERCASE for top level constants
-Define top level constants using `UPPERCASE` letters. Don't forget to apply an underscore prefix to constants which are private to their module.
+Define top level constants using `UPPERCASE` letters. Don't forget to apply an underscore prefix to
+constants which are private to their module.
Do not use uppercase for constants within functions and methods.
### Use the `Final` type with all constants
-This pattern must be followed for top level constants, and should be followed for function and method level constants too. The longer the function, the more important the use of `Final`.
+This pattern must be followed for top level constants, and should be followed for function and
+method level constants too. The longer the function, the more important the use of `Final`.
### Prefix global variables with `global_`
-Top level variables should be avoided. When their use is necessary, prefix them with `global_`, using lowercase letters, to ensure clear identification of their scope. Use an underscore prefix too, `_global_`, when the variable is private.
+Top level variables should be avoided. When their use is necessary, prefix them with `global_`,
+using lowercase letters, to ensure clear identification of their scope. Use an underscore prefix
+too, `_global_`, when the variable is private.
### Import modules as their least significant name part
@@ -112,11 +132,15 @@ import a.b.c as c
import a.b.c
```
-This convention aligns with Go's package naming practices. Follow [Go naming rules](https://go.dev/blog/package-names) for all modules.
+This convention aligns with Go's package naming practices. Follow
+[Go naming rules](https://go.dev/blog/package-names) for all modules.
-This only applies to modules outside of the Python standard library. The standard library module `os.path`, for example, must always be imported using the form `import os.path`, and _not_ `import os.path as path`.
+This only applies to modules outside of the Python standard library. The standard library module
+`os.path`, for example, must always be imported using the form `import os.path`, and _not_
+`import os.path as path`.
-Furthermore, if a third party module to be imported would conflict with a Python standard library module, then that third party module must be imported with one extra level.
+Furthermore, if a third party module to be imported would conflict with a Python standard library
+module, then that third party module must be imported with one extra level.
```python
# Prefer
@@ -130,17 +154,24 @@ import sqlalchemy.ext.asyncio as asyncio
import aiofiles.os.path as path
```
-It's possible to use `from a.b import c` instead of `import a.b.c as c` when `c` is a module, but we prefer the latter form because it makes it clear that `c` must be a module, whereas in the former `from a.b import c` form, `c` could be any interface.
+It's possible to use `from a.b import c` instead of `import a.b.c as c` when `c` is a module, but we
+prefer the latter form because it makes it clear that `c` must be a module, whereas in the former
+`from a.b import c` form, `c` could be any interface.
-TODO: There's a question as to whether we could actually use `import aiofiles.os.path as path` since we import `os.path` as `os.path` and not `path`.
+TODO: There's a question as to whether we could actually use `import aiofiles.os.path as path` since
+we import `os.path` as `os.path` and not `path`.
-TODO: Sometimes we're using `as` for standard library modules. We should decide what to do about this.
+TODO: Sometimes we're using `as` for standard library modules. We should decide what to do about
+this.
### Avoid duplicated module names
-Try to avoid using, for example, `baking/apple/pie.py` and `baking/cherry/pie.py` because these will both be imported as `pie` and one will have to be renamed.
+Try to avoid using, for example, `baking/apple/pie.py` and `baking/cherry/pie.py` because these will
+both be imported as `pie` and one will have to be renamed.
-If there are duplicates imported within a single file, they should be disambiguated by the next level up. In the pie example, that would be `import baking.apple as apple` and then `apple.pie`, and `import baking.cherry as cherry` and `cherry.pie`.
+If there are duplicates imported within a single file, they should be disambiguated by the next
+level up. In the pie example, that would be `import baking.apple as apple` and then `apple.pie`, and
+`import baking.cherry as cherry` and `cherry.pie`.
### Never import names directly from modules
@@ -156,7 +187,8 @@ from p.q.r import s
s()
```
-The `collections.abc`, `types`, and `typing` modules are an exception to this rule. Always import `collections.abc`, `types` and `typing` interfaces directly using the `from` syntax:
+The `collections.abc`, `types`, and `typing` modules are an exception to this rule. Always import
+`collections.abc`, `types` and `typing` interfaces directly using the `from` syntax:
```python
# Prefer
@@ -170,7 +202,8 @@ import typing
CONSTANT: typing.Final = "CONSTANT"
```
-In tests, only, `playwright.sync_api` is another exception. Use `from playwright.sync_api import expect`, for example.
+In tests, only, `playwright.sync_api` is another exception. Use
+`from playwright.sync_api import expect`, for example.
### Use concise typing patterns
@@ -190,36 +223,54 @@ def example() -> List[Optional[str]]:
### Never name interfaces after their module
-Do not name interfaces with the same identifier as their containing module. For example, in a module named `example`, the function names `example` and `example_function` are prohibited.
+Do not name interfaces with the same identifier as their containing module. For example, in a module
+named `example`, the function names `example` and `example_function` are prohibited.
### Keep modules small and focused
-Maintain modules with a reasonable number of interfaces. Though no strict limits are enforced, modules containing numerous classes, constants, or functions should be considered for logical subdivision. Exceptions may be made when closely related functionality necessitates grouping multiple interfaces within a single module.
+Maintain modules with a reasonable number of interfaces. Though no strict limits are enforced,
+modules containing numerous classes, constants, or functions should be considered for logical
+subdivision. Exceptions may be made when closely related functionality necessitates grouping
+multiple interfaces within a single module.
### Sort functions alphabetically
-Wherever possible, the order of functions within each module should be alphabetical by name. Take advantage of this convention by grouping related functions under a common prefix (including grouping helper functions with their caller), and using numbers in the names of functions called in serial order. As an exception to this rule, underscored (and hence private) functions are sorted below public functions.
+Wherever possible, the order of functions within each module should be alphabetical by name. Take
+advantage of this convention by grouping related functions under a common prefix (including grouping
+helper functions with their caller), and using numbers in the names of functions called in serial
+order. As an exception to this rule, underscored (and hence private) functions are sorted below
+public functions.
### Keep cyclomatic complexity below 10
-We limit function complexity to a score of 10. If the linter complains, your function is doing too much.
+We limit function complexity to a score of 10. If the linter complains, your function is doing too
+much.
-Cyclomatic complexity counts the number of independent paths through code: more if and else branches, loops, and exception handlers means higher complexity. Complex code is harder to test, maintain, and understand. The easiest way to fix high complexity is usually to refactor a chunk of related logic into a separate helper function.
+Cyclomatic complexity counts the number of independent paths through code: more if and else
+branches, loops, and exception handlers means higher complexity. Complex code is harder to test,
+maintain, and understand. The easiest way to fix high complexity is usually to refactor a chunk of
+related logic into a separate helper function.
### Replace synchronous calls with asynchronous counterparts in async code
-Our use of blockbuster enables automatic detection of synchronous function calls within asynchronous code. When detected, replace these calls with their asynchronous equivalents without performance testing. The conversion process typically requires minimal, trivial effort.
+Our use of blockbuster enables automatic detection of synchronous function calls within asynchronous
+code. When detected, replace these calls with their asynchronous equivalents without performance
+testing. The conversion process typically requires minimal, trivial effort.
Exceptions to this rule apply only in these scenarios:
* When dealing with third party dependencies
* When the asynchronous equivalent function is unknown
-If either exception applies, either submit a brief issue with the blockbuster traceback, notify the team via Slack, or add a code comment if part of another commit. An ATR Tooling engineer will address the issue without requiring significant time investment from you.
+If either exception applies, either submit a brief issue with the blockbuster traceback, notify the
+team via Slack, or add a code comment if part of another commit. An ATR Tooling engineer will
+address the issue without requiring significant time investment from you.
### Use explicit `commit()` for database transactions
-When writing database mutations within a `db.session()`, prefer calling `await data.commit()` explicitly after the mutations, rather than wrapping them in `async with data.begin():`. The explicit commit makes the transaction boundary visible and is the more common pattern that we use.
+When writing database mutations within a `db.session()`, prefer calling `await data.commit()`
+explicitly after the mutations, rather than wrapping them in `async with data.begin():`. The
+explicit commit makes the transaction boundary visible and is the more common pattern that we use.
```python
# Prefer
@@ -245,7 +296,8 @@ a or b and c == d or not e or f
(a or b) and (c == d) or (not e) or f
```
-Because `f` is not a complex expression, it does not get parenthesised. Also because this rule is about subexpressions only, we do not put parentheses around the top level.
+Because `f` is not a complex expression, it does not get parenthesised. Also because this rule is
+about subexpressions only, we do not put parentheses around the top level.
```python
# Avoid
@@ -259,11 +311,20 @@ if a or b:
### Use terse comments on their own lines
-Place comments on dedicated lines preceding the relevant code block. Comments at the ends of lines are strictly reserved for linter or type checker directives. This convention enhances code scannability for such directives. General comments must not appear at the end of code lines: PEP 8 says to use inline comments "sparingly", but we disallow them to make it easier to evaluate non-conformance. Keep comments concise, using sentence case without terminal punctuation. Each sentence forming [...]
+Place comments on dedicated lines preceding the relevant code block. Comments at the ends of lines
+are strictly reserved for linter or type checker directives. This convention enhances code
+scannability for such directives. General comments must not appear at the end of code lines: PEP 8
+says to use inline comments "sparingly", but we disallow them to make it easier to evaluate
+non-conformance. Keep comments concise, using sentence case without terminal punctuation. Each
+sentence forming a comment must occupy its own line. Comments must not include information about
+what has changed from earlier code revisions.
### Prefer explicit checks over `assert`
-We do not use `assert`. If you need to guard against invalid states or inputs, use standard `if` checks and raise appropriate exceptions. If you need to help type checkers understand the type of a variable within a specific code block, in other words if you need to narrow a type, then use `if isinstance(...)` or `if not isinstance(...)` as appropriate.
+We do not use `assert`. If you need to guard against invalid states or inputs, use standard `if`
+checks and raise appropriate exceptions. If you need to help type checkers understand the type of a
+variable within a specific code block, in other words if you need to narrow a type, then use
+`if isinstance(...)` or `if not isinstance(...)` as appropriate.
### Never use `case _` when pattern matching exhaustive types
@@ -271,9 +332,12 @@ Using `case _` breaks type checking in such situations.
### Use f-string interpolation instead of printf style formatting
-This should be adhered to even in contexts where printf style is usually expected, such as in `log.info` calls, unless there is a reason not to, such as when there are specific printf style flags which have no f-string equivalent.
+This should be adhered to even in contexts where printf style is usually expected, such as in
+`log.info` calls, unless there is a reason not to, such as when there are specific printf style
+flags which have no f-string equivalent.
-This convention is not enforced by any checks. Enforcement is via code review. See [issue #339](https://github.com/apache/tooling-trusted-releases/issues/339) for a discussion.
+This convention is not enforced by any checks. Enforcement is via code review. See
+[issue #339](https://github.com/apache/tooling-trusted-releases/issues/339) for a discussion.
## Documentation and user interfaces
@@ -283,15 +347,27 @@ For example, a page with the title "This is an example" should be named `this-is
### Use sentence case for headings, form labels, and submission buttons
-We write headings, form labels, and submission buttons in the form "This is some text", and not "This is Some Text" or "This Is Some Text". This follows the [Wikipedia style for headings](https://en.wikipedia.org/wiki/Wikipedia:Manual_of_Style#Section_headings).
+We write headings, form labels, and submission buttons in the form "This is some text", and not
+"This is Some Text" or "This Is Some Text". This follows the
+[Wikipedia style for headings](https://en.wikipedia.org/wiki/Wikipedia:Manual_of_Style#Section_headings).
## HTML
### Use Bootstrap classes for all style
-We use Bootstrap classes for style, and avoid custom classes unless absolutely necessary. If you think that you have to resort to a custom class, consult the list of [Bootstrap classes](https://bootstrapclasses.com/) for guidance. There is usually a class for what you want to achieve, and if there isn't then you may be making things too complicated. Complicated, custom style is difficult for a team to maintain. If you still believe that a new class is strictly warranted, then the class m [...]
+We use Bootstrap classes for style, and avoid custom classes unless absolutely necessary. If you
+think that you have to resort to a custom class, consult the list of
+[Bootstrap classes](https://bootstrapclasses.com/) for guidance. There is usually a class for what
+you want to achieve, and if there isn't then you may be making things too complicated. Complicated,
+custom style is difficult for a team to maintain. If you still believe that a new class is strictly
+warranted, then the class must be prefixed with a project key, e.g. `example-` if the project is
+called `example`. Classes can go in `<style>` elements in `stylesheet` template blocks in such
+cases. The use of the `style` attribute on any HTML element is forbidden.
-The `custom.scss` file in our Bootstrap customisation is for adjusting Bootstrap classes only. Classes which we add, even if they seem to follow the Bootstrap feel, go in `atr.css` and should be given an `atr-` prefix to distinguish them from Bootstrap classes. The `.atr-hide` class, for example, just applies `display: none` and has a Bootstrap feel to it but belongs in `atr.css`.
+The `custom.scss` file in our Bootstrap customisation is for adjusting Bootstrap classes only.
+Classes which we add, even if they seem to follow the Bootstrap feel, go in `atr.css` and should be
+given an `atr-` prefix to distinguish them from Bootstrap classes. The `.atr-hide` class, for
+example, just applies `display: none` and has a Bootstrap feel to it but belongs in `atr.css`.
## Markdown
@@ -303,17 +379,26 @@ Do not use `*` for emphasis or `__` for strong emphasis.
### Do not use JavaScript unless necessary
-It is often possible to avoid using JavaScript without significant loss of functionality, but it may require a little more thought. JavaScript is not, however, something to avoid by rote. User experiences can be significantly improved with thoughtful application of JavaScript. Therefore, default to not using JavaScript, but consider how it could be used concisely and with care to improve UX.
+It is often possible to avoid using JavaScript without significant loss of functionality, but it may
+require a little more thought. JavaScript is not, however, something to avoid by rote. User
+experiences can be significantly improved with thoughtful application of JavaScript. Therefore,
+default to not using JavaScript, but consider how it could be used concisely and with care to
+improve UX.
### Use best practices for installing JavaScript dependencies
-Disable lifecycle scripts, separate the process into pinning and building from pinned versions, ensure that versions are properly pinned (e.g. using `save-exact` and `save-prefix` in npm), run audits automatically after installation, and set a package cooldown of 14 days. Manually update in case of a CVE within the 14 day cooldown period. If possible, run the whole process in an OCI container with a non-root build user in the container.
+Disable lifecycle scripts, separate the process into pinning and building from pinned versions,
+ensure that versions are properly pinned (e.g. using `save-exact` and `save-prefix` in npm), run
+audits automatically after installation, and set a package cooldown of 14 days. Manually update in
+case of a CVE within the 14 day cooldown period. If possible, run the whole process in an OCI
+container with a non-root build user in the container.
## Shell
### Use POSIX sh only
-Do not use bash or other idioms, only POSIX sh. Ensure that all commands called from the shell script are available in the POSIX standard, using only POSIX flags and arguments.
+Do not use bash or other idioms, only POSIX sh. Ensure that all commands called from the shell
+script are available in the POSIX standard, using only POSIX flags and arguments.
### Use two spaces for indentation
@@ -327,4 +412,7 @@ Avoid the use of `; then`. Always put keywords on their own line.
### Be FHS compliant
-Don't create directories which are not defined in the most recent [Filesystem Hierarchy Standard](https://refspecs.linuxfoundation.org/FHS_3.0/fhs/index.html). If adding a directory whose role in the FHS is unclear, try to copy practices from established Linux distributions.
+Don't create directories which are not defined in the most recent
+[Filesystem Hierarchy Standard](https://refspecs.linuxfoundation.org/FHS_3.0/fhs/index.html). If
+adding a directory whose role in the FHS is unclear, try to copy practices from established Linux
+distributions.
diff --git a/atr/docs/code-policies.md b/atr/docs/code-policies.md
index 60a2ed89..20220c83 100644
--- a/atr/docs/code-policies.md
+++ b/atr/docs/code-policies.md
@@ -20,8 +20,12 @@ These policies cover security and other miscellaneous policies that describe how
### Tasks
-* Secret values must never be passed to tasks. This ensures that `Task` objects and results can be considered public.
+* Secret values must never be passed to tasks. This ensures that `Task` objects and results can be
+ considered public.
### Dependencies
-* Every `.pth` file installed into the project's virtual environment must appear in the allowlist of [`scripts/check_pth_files.py`](/ref/scripts/check_pth_files.py), enforced by `make sync` and pre-commit, because Python executes their `import` lines on every interpreter startup and they are a known supply-chain attack vector.
+* Every `.pth` file installed into the project's virtual environment must appear in the allowlist of
+ [`scripts/check_pth_files.py`](/ref/scripts/check_pth_files.py), enforced by `make sync` and
+ pre-commit, because Python executes their `import` lines on every interpreter startup and they are
+ a known supply-chain attack vector.
diff --git a/atr/docs/compose-phase.md b/atr/docs/compose-phase.md
index 22218751..d0f2c4e6 100644
--- a/atr/docs/compose-phase.md
+++ b/atr/docs/compose-phase.md
@@ -1,8 +1,8 @@
# 5.1. Compose phase
-**Up**: `5.` [Making releases](release-process-description)
+**Up**: `5.` [Making releases](making-releases)
-**Prev**: `5.` [Making releases](release-process-description)
+**Prev**: `5.` [Making releases](making-releases)
**Next**: `5.1.1.` [Uploading files](uploading-files)
@@ -25,9 +25,9 @@
The ***compose*** phase is where a ***Release Candidate*** is built up from its parts. The
***Release Manager*** assembles the ***Release Artifacts***, uploads them to ATR, and runs the
platform's checks against them. Composing is deliberately iterative: the Release Manager can add,
-replace, and remove artifacts, and re-run the checks, until the candidate is ready to put to a
-vote. The candidate is held in ATR throughout, and nothing is committed to the Apache
-distribution servers until the [finish phase](finish-phase).
+replace, and remove artifacts, and re-run the checks, until the candidate is ready to put to a vote.
+The candidate is held in ATR throughout, and nothing is committed to the Apache distribution servers
+until the [finish phase](finish-phase).
For a step by step walkthrough of this phase with screenshots, see the
[Compose section of the tutorial](/tutorial#compose).
@@ -36,15 +36,15 @@ For a step by step walkthrough of this phase with screenshots, see the
The compose phase is mostly the work of the Release Manager, on behalf of the PMC:
-* Assemble the release artifacts and upload them to the candidate. The ways of doing so are
- listed under [How files reach ATR](#how-files-reach-atr).
+* Assemble the release artifacts and upload them to the candidate. The ways of doing so are listed
+ under [How files reach ATR](#how-files-reach-atr).
* Sign each artifact and register the corresponding key, so that ATR and, later, end users can
verify the signatures. See [Signing artifacts](signing-artifacts), and
- [Release managers](release-manager-setup) for the keys and access methods available to you.
+ [Release manager setup](release-manager-setup) for the keys and access methods available to you.
* Run the checks and resolve anything they report before starting a vote.
-Other PMC members are not required to act during compose, but the candidate is visible to them,
-and it is good practice to review it before it goes to a vote.
+Other PMC members are not required to act during compose, but the candidate is visible to them, and
+it is good practice to review it before it goes to a vote.
## How files reach ATR
@@ -59,8 +59,8 @@ There are many ways to get files into a candidate:
* upload from a [GitHub Actions workflow](uploading-files#github-actions) using
[Trusted Publishing](trusted-publishing).
-[Uploading files](uploading-files) gives the commands and setup for each of these, and explains
-how each change to a candidate is recorded as a [revision](uploading-files#revisions).
+[Uploading files](uploading-files) gives the commands and setup for each of these, and explains how
+each change to a candidate is recorded as a [revision](uploading-files#revisions).
The SVN `dist/dev` import is one option among others, and we expect most release managers not to
need it. See [The earlier dist/dev workflow](staging-and-voting#the-earlier-distdev-workflow) for
@@ -78,5 +78,5 @@ software bill of materials where one is provided:
Most check results are there to help you produce a candidate that the PMC can vote on with
confidence, and you can keep iterating whatever they report. A ***blocker***, though, means that a
-mandatory policy condition has been violated, and the candidate cannot proceed to a vote until it
-is resolved.
+mandatory policy condition has been violated, and the candidate cannot proceed to a vote until it is
+resolved.
diff --git a/atr/docs/database.md b/atr/docs/database.md
index f010708c..86a2bd0a 100644
--- a/atr/docs/database.md
+++ b/atr/docs/database.md
@@ -16,77 +16,178 @@
## Introduction
-ATR stores all of its data in a SQLite database. The database schema is defined in [`models.sql`](/ref/atr/models/sql.py) using [SQLModel](https://sqlmodel.tiangolo.com/), which uses [Pydantic](https://docs.pydantic.dev/latest/) for data validation and [SQLAlchemy](https://www.sqlalchemy.org/) for database operations. This page explains the main features of the database schema to help you understand how data is structured in ATR.
+ATR stores all of its data in a SQLite database. The database schema is defined in
+[`models.sql`](/ref/atr/models/sql.py) using [SQLModel](https://sqlmodel.tiangolo.com/), which uses
+[Pydantic](https://docs.pydantic.dev/latest/) for data validation and
+[SQLAlchemy](https://www.sqlalchemy.org/) for database operations. This page explains the main
+features of the database schema to help you understand how data is structured in ATR.
## Core models
-The most important models in ATR are [`Committee`](/ref/atr/models/sql.py) (Committee), [`Project`](/ref/atr/models/sql.py) (Project), [`Release`](/ref/atr/models/sql.py) (Release), and [`Artifact`](/ref/atr/models/sql.py) (Artifact).
-
-A [`Committee`](/ref/atr/models/sql.py) (Committee) represents a PMC or PPMC at the ASF. Each committee has a key, which is the primary key, and an optional name from which its display name is derived (falling back to the key, and marked as incubating for podlings). Committees can have child committees, which is used for the relationship between the Incubator PMC and individual podling PPMCs. Committees also have lists of committee members and committers stored as JSON arrays.
-
-A [`Project`](/ref/atr/models/sql.py) (Project) belongs to a committee and can have multiple releases. Projects have a key as the primary key, along with metadata such as a description and category and programming language tags. Each project can optionally have a [`ReleasePolicy`](/ref/atr/models/sql.py) (ReleasePolicy) that defines how releases should be handled, including e.g. vote templates and GitHub workflow configuration.
-
-A [`Release`](/ref/atr/models/sql.py) (Release) belongs to a project and represents a specific version of software which is voted on by a committee. The primary key is a key derived from the project key and version. Releases have a phase that indicates their current state in the release process, from draft composition to final publication. Each release can have multiple [`Revision`](/ref/atr/models/sql.py) (Revision) instances before final publication, representing iterations of the unde [...]
-
-An [`Artifact`](/ref/atr/models/sql.py) (Artifact) represents a single distributable file, such as a source tarball or a convenience binary, together with the paths to its detached signature, checksum, and CycloneDX SBOM where those exist. The release catalogue is built from artifacts: each one records the project and version it belongs to, the fingerprint of the key that signed it, and whether it came through ATR (`managed`) or was catalogued from an existing dist tree. An artifact link [...]
+The most important models in ATR are [`Committee`](/ref/atr/models/sql.py) (Committee),
+[`Project`](/ref/atr/models/sql.py) (Project), [`Release`](/ref/atr/models/sql.py) (Release), and
+[`Artifact`](/ref/atr/models/sql.py) (Artifact).
+
+A [`Committee`](/ref/atr/models/sql.py) (Committee) represents a PMC or PPMC at the ASF. Each
+committee has a key, which is the primary key, and an optional name from which its display name is
+derived (falling back to the key, and marked as incubating for podlings). Committees can have child
+committees, which is used for the relationship between the Incubator PMC and individual podling
+PPMCs. Committees also have lists of committee members and committers stored as JSON arrays.
+
+A [`Project`](/ref/atr/models/sql.py) (Project) belongs to a committee and can have multiple
+releases. Projects have a key as the primary key, along with metadata such as a description and
+category and programming language tags. Each project can optionally have a
+[`ReleasePolicy`](/ref/atr/models/sql.py) (ReleasePolicy) that defines how releases should be
+handled, including e.g. vote templates and GitHub workflow configuration.
+
+A [`Release`](/ref/atr/models/sql.py) (Release) belongs to a project and represents a specific
+version of software which is voted on by a committee. The primary key is a key derived from the
+project key and version. Releases have a phase that indicates their current state in the release
+process, from draft composition to final publication. Each release can have multiple
+[`Revision`](/ref/atr/models/sql.py) (Revision) instances before final publication, representing
+iterations of the underlying files. Each vote cast during the committee vote is recorded as a
+[`BallotPaper`](/ref/atr/models/sql.py) (BallotPaper), which captures the voter, their choice,
+whether their vote was binding at the time, and the revision it was cast against.
+
+An [`Artifact`](/ref/atr/models/sql.py) (Artifact) represents a single distributable file, such as a
+source tarball or a convenience binary, together with the paths to its detached signature, checksum,
+and CycloneDX SBOM where those exist. The release catalogue is built from artifacts: each one
+records the project and version it belongs to, the fingerprint of the key that signed it, and
+whether it came through ATR (`managed`) or was catalogued from an existing dist tree. An artifact
+links to a release when there is one, but its `release_key` is nullable, so historical artifacts
+catalogued from SVN without a matching ATR release are still represented.
## Other features
-The models themselves are the most important components, but to support those models we need other components such as the release cycle model, enumerations, column types, automatically populated fields, computed properties, and constraints.
+The models themselves are the most important components, but to support those models we need other
+components such as the release cycle model, enumerations, column types, automatically populated
+fields, computed properties, and constraints.
### Project cycles
-Between a project and its releases sits the [`ProjectCycle`](/ref/atr/models/sql.py) (ProjectCycle), which represents a release cycle within a project, for example `"2.x"`, `"default"`, or `"2026"`. Every project has at least one cycle: projects whose `version_method` is `"simple"` keep a single cycle named `"default"` and never expose cycle UI, while semver and calver projects can have several. Each [`Release`](/ref/atr/models/sql.py) (Release) belongs to a cycle as well as to its proje [...]
+Between a project and its releases sits the [`ProjectCycle`](/ref/atr/models/sql.py) (ProjectCycle),
+which represents a release cycle within a project, for example `"2.x"`, `"default"`, or `"2026"`.
+Every project has at least one cycle: projects whose `version_method` is `"simple"` keep a single
+cycle named `"default"` and never expose cycle UI, while semver and calver projects can have
+several. Each [`Release`](/ref/atr/models/sql.py) (Release) belongs to a cycle as well as to its
+project, via `Release.cycle_key`.
-A cycle also caches its lifecycle dates (`eod`, `eos`, `eol`) from the most recent matching [`LifecycleEvent`](/ref/atr/models/sql.py) (LifecycleEvent), where the events table is the source of truth and the columns are a denormalised cache so that "what is currently planned" reads cheaply.
+A cycle also caches its lifecycle dates (`eod`, `eos`, `eol`) from the most recent matching
+[`LifecycleEvent`](/ref/atr/models/sql.py) (LifecycleEvent), where the events table is the source of
+truth and the columns are a denormalised cache so that "what is currently planned" reads cheaply.
### Enumerations
-ATR uses Python enumerations to ensure that certain fields only contain valid values. The most important enumeration is [`ReleasePhase`](/ref/atr/models/sql.py) (ReleasePhase), which defines the four phases of a release: `RELEASE_CANDIDATE_DRAFT` for composing, `RELEASE_CANDIDATE` for voting, `RELEASE_PREVIEW` for finishing, and `RELEASE` for completed releases.
+ATR uses Python enumerations to ensure that certain fields only contain valid values. The most
+important enumeration is [`ReleasePhase`](/ref/atr/models/sql.py) (ReleasePhase), which defines the
+four phases of a release: `RELEASE_CANDIDATE_DRAFT` for composing, `RELEASE_CANDIDATE` for voting,
+`RELEASE_PREVIEW` for finishing, and `RELEASE` for completed releases.
-The [`TaskStatus`](/ref/atr/models/sql.py) (TaskStatus) enumeration defines the states a task can be in: `QUEUED`, `ACTIVE`, `COMPLETED`, `FAILED`, or `BROKEN`. `BROKEN` is a separate terminal state, used only for check tasks that couldn't produce a real verdict, for example because the worker timed out or hit a retryable error, as opposed to `FAILED`, which means the task itself genuinely errored. Keeping the two apart lets ATR tell "we couldn't check this" from "this check failed". The [...]
+The [`TaskStatus`](/ref/atr/models/sql.py) (TaskStatus) enumeration defines the states a task can be
+in: `QUEUED`, `ACTIVE`, `COMPLETED`, `FAILED`, or `BROKEN`. `BROKEN` is a separate terminal state,
+used only for check tasks that couldn't produce a real verdict, for example because the worker timed
+out or hit a retryable error, as opposed to `FAILED`, which means the task itself genuinely errored.
+Keeping the two apart lets ATR tell "we couldn't check this" from "this check failed". The
+[`TaskType`](/ref/atr/models/sql.py) (TaskType) enumeration lists all the different types of
+background tasks that ATR can execute, from signature checks to SBOM generation.
-The [`DistributionPlatform`](/ref/atr/models/sql.py) (DistributionPlatform) enumeration is more complex, as each value contains not just a name but a [`DistributionPlatformValue`](/ref/atr/models/sql.py) (DistributionPlatformValue) with template URLs and configuration for different package distribution platforms like PyPI, npm, and Maven Central.
+The [`DistributionPlatform`](/ref/atr/models/sql.py) (DistributionPlatform) enumeration is more
+complex, as each value contains not just a name but a
+[`DistributionPlatformValue`](/ref/atr/models/sql.py) (DistributionPlatformValue) with template URLs
+and configuration for different package distribution platforms like PyPI, npm, and Maven Central.
### Special column types
-SQLite does not support all the data types we need, so we use SQLAlchemy type decorators to handle conversions. The [`UTCDateTime`](/ref/atr/models/sql.py) (UTCDateTime) type ensures that all datetime values are stored in UTC and returned as timezone-aware datetime objects. When Python code provides a datetime with timezone information, the type decorator converts it to UTC before storing. When reading from the database, it adds back the UTC timezone information.
+SQLite does not support all the data types we need, so we use SQLAlchemy type decorators to handle
+conversions. The [`UTCDateTime`](/ref/atr/models/sql.py) (UTCDateTime) type ensures that all
+datetime values are stored in UTC and returned as timezone-aware datetime objects. When Python code
+provides a datetime with timezone information, the type decorator converts it to UTC before storing.
+When reading from the database, it adds back the UTC timezone information.
-The [`ResultsJSON`](/ref/atr/models/sql.py) (ResultsJSON) type handles storing task results. It automatically serializes Pydantic models to JSON when writing to the database, and deserializes them back to the appropriate result model when reading.
+The [`ResultsJSON`](/ref/atr/models/sql.py) (ResultsJSON) type handles storing task results. It
+automatically serializes Pydantic models to JSON when writing to the database, and deserializes them
+back to the appropriate result model when reading.
### Automatic field population
-Some fields are populated automatically using SQLAlchemy event listeners. When a new [`Revision`](/ref/atr/models/sql.py) (Revision) is created, the [`populate_revision_sequence_and_key`](/ref/atr/models/sql.py) (populate_revision_sequence_and_key) function runs before the database insert. Rather than reading back the highest existing sequence number, it allocates the next one from a per-release counter row in [`RevisionCounter`](/ref/atr/models/sql.py) (RevisionCounter) using an upsert. [...]
-
-The [`check_release_key`](/ref/atr/models/sql.py) (check_release_key) function runs before inserting a release. If the release key is empty, it automatically generates it from the project key and version using the [`release_key`](/ref/atr/models/sql.py) (release_key) helper function.
-
-When a new [`Project`](/ref/atr/models/sql.py) (Project) is inserted, the [`populate_default_project_cycle`](/ref/atr/models/sql.py) (populate_default_project_cycle) function runs after the insert and creates a `"default"` [`ProjectCycle`](/ref/atr/models/sql.py) (ProjectCycle) for it. This gives every project at least one cycle, so that `Release.cycle_key` always has a valid foreign key target without writers having to do that bookkeeping themselves.
+Some fields are populated automatically using SQLAlchemy event listeners. When a new
+[`Revision`](/ref/atr/models/sql.py) (Revision) is created, the
+[`populate_revision_sequence_and_key`](/ref/atr/models/sql.py) (populate_revision_sequence_and_key)
+function runs before the database insert. Rather than reading back the highest existing sequence
+number, it allocates the next one from a per-release counter row in
+[`RevisionCounter`](/ref/atr/models/sql.py) (RevisionCounter) using an upsert. That means sequence
+numbers are never reused, even after revisions or whole releases are deleted. The function sets the
+`seq` field, the zero-padded `number` field, the `key` (built from the release key and number), and
+the `parent_key` pointing at the previous revision in the chain.
+
+The [`check_release_key`](/ref/atr/models/sql.py) (check_release_key) function runs before inserting
+a release. If the release key is empty, it automatically generates it from the project key and
+version using the [`release_key`](/ref/atr/models/sql.py) (release_key) helper function.
+
+When a new [`Project`](/ref/atr/models/sql.py) (Project) is inserted, the
+[`populate_default_project_cycle`](/ref/atr/models/sql.py) (populate_default_project_cycle) function
+runs after the insert and creates a `"default"` [`ProjectCycle`](/ref/atr/models/sql.py)
+(ProjectCycle) for it. This gives every project at least one cycle, so that `Release.cycle_key`
+always has a valid foreign key target without writers having to do that bookkeeping themselves.
### Computed properties
-Some properties are computed dynamically rather than stored in the database. The `Release.latest_revision_number` property is backed by a SQLAlchemy column property that uses a correlated subquery. The subquery is defined once in [`RELEASE_LATEST_REVISION_NUMBER`](/ref/atr/models/sql.py) (RELEASE_LATEST_REVISION_NUMBER) and attached to the `Release` class as the private `_latest_revision_number` column property, so it is populated by whatever query loads the release. The public `latest_r [...]
+Some properties are computed dynamically rather than stored in the database. The
+`Release.latest_revision_number` property is backed by a SQLAlchemy column property that uses a
+correlated subquery. The subquery is defined once in
+[`RELEASE_LATEST_REVISION_NUMBER`](/ref/atr/models/sql.py) (RELEASE_LATEST_REVISION_NUMBER) and
+attached to the `Release` class as the private `_latest_revision_number` column property, so it is
+populated by whatever query loads the release. The public `latest_revision_number` is a Pydantic
+computed field that reads that value back, which is why it needs the loading session to still be
+active.
-Projects have many computed properties that provide access to release policy settings with appropriate defaults. For example, `Project.policy_start_vote_template` returns the custom vote template if one is configured, or falls back to the default vote template if not. This pattern allows projects to customize their release process while providing sensible defaults.
+Projects have many computed properties that provide access to release policy settings with
+appropriate defaults. For example, `Project.policy_start_vote_template` returns the custom vote
+template if one is configured, or falls back to the default vote template if not. This pattern
+allows projects to customize their release process while providing sensible defaults.
### Constraints and validation
-Database constraints ensure data integrity. The [`Task`](/ref/atr/models/sql.py) (Task) model includes a check constraint that validates the status transitions. A task must start in `QUEUED` state, can only transition to `ACTIVE` when `started` and `pid` are set, and can only reach a terminal state (`COMPLETED`, `FAILED`, or `BROKEN`) when the `completed` timestamp is set. `COMPLETED` additionally requires a `result`, and both `FAILED` and `BROKEN` require an `error`. These constraints p [...]
+Database constraints ensure data integrity. The [`Task`](/ref/atr/models/sql.py) (Task) model
+includes a check constraint that validates the status transitions. A task must start in `QUEUED`
+state, can only transition to `ACTIVE` when `started` and `pid` are set, and can only reach a
+terminal state (`COMPLETED`, `FAILED`, or `BROKEN`) when the `completed` timestamp is set.
+`COMPLETED` additionally requires a `result`, and both `FAILED` and `BROKEN` require an `error`.
+These constraints prevent invalid state transitions at the database level.
-Unique constraints ensure that certain combinations of fields are unique. The `Release` model has a unique constraint on `(project_key, version)` to prevent creating duplicate releases for the same project version. The `Revision` model has two unique constraints: one on `(release_key, seq)` and another on `(release_key, number)`, ensuring that revision numbers are unique within a release.
+Unique constraints ensure that certain combinations of fields are unique. The `Release` model has a
+unique constraint on `(project_key, version)` to prevent creating duplicate releases for the same
+project version. The `Revision` model has two unique constraints: one on `(release_key, seq)` and
+another on `(release_key, number)`, ensuring that revision numbers are unique within a release.
## Cascade deletions
-ATR uses two kinds of cascade deletions: ORM-level cascades managed by SQLAlchemy, and DB-level cascades enforced by SQLite foreign key constraints. Both are configured in [`models/sql.py`](/ref/atr/models/sql.py). This section documents what happens when a parent record is deleted, which child records are automatically removed, and which deletions are blocked by foreign key constraints.
+ATR uses two kinds of cascade deletions: ORM-level cascades managed by SQLAlchemy, and DB-level
+cascades enforced by SQLite foreign key constraints. Both are configured in
+[`models/sql.py`](/ref/atr/models/sql.py). This section documents what happens when a parent record
+is deleted, which child records are automatically removed, and which deletions are blocked by
+foreign key constraints.
-SQLite foreign key enforcement is enabled in ATR via `PRAGMA foreign_keys=ON` in [`db/__init__.py`](/ref/atr/db/__init__.py). This means DB-level cascades and foreign key constraints are active.
+SQLite foreign key enforcement is enabled in ATR via `PRAGMA foreign_keys=ON` in
+[`db/__init__.py`](/ref/atr/db/__init__.py). This means DB-level cascades and foreign key
+constraints are active.
### ORM-level vs DB-level cascades
-ORM cascades are configured on SQLAlchemy relationships using `sa_relationship_kwargs={"cascade": "all, delete-orphan"}`. When a parent object is deleted through the ORM (via `session.delete(parent)`), SQLAlchemy automatically deletes all related child objects before issuing the SQL DELETE for the parent. These cascades only apply when using the ORM; they do not apply to raw SQL DELETE statements or bulk `sqlmodel.delete()` queries.
+ORM cascades are configured on SQLAlchemy relationships using
+`sa_relationship_kwargs={"cascade": "all, delete-orphan"}`. When a parent object is deleted through
+the ORM (via `session.delete(parent)`), SQLAlchemy automatically deletes all related child objects
+before issuing the SQL DELETE for the parent. These cascades only apply when using the ORM; they do
+not apply to raw SQL DELETE statements or bulk `sqlmodel.delete()` queries.
-DB-level cascades are configured on foreign key columns using `ondelete="CASCADE"` or `ondelete="SET NULL"`. These are enforced by SQLite itself, regardless of whether the deletion happens through the ORM or raw SQL. When a parent row is deleted, SQLite automatically deletes (or nullifies) child rows that reference it.
+DB-level cascades are configured on foreign key columns using `ondelete="CASCADE"` or
+`ondelete="SET NULL"`. These are enforced by SQLite itself, regardless of whether the deletion
+happens through the ORM or raw SQL. When a parent row is deleted, SQLite automatically deletes (or
+nullifies) child rows that reference it.
-Some relationships have both ORM and DB cascades configured. This provides defense in depth: the ORM cascade handles the common case of deleting through the ORM, while the DB cascade provides a safety net for bulk SQL deletions, migrations, or manual database operations.
+Some relationships have both ORM and DB cascades configured. This provides defense in depth: the ORM
+cascade handles the common case of deleting through the ORM, while the DB cascade provides a safety
+net for bulk SQL deletions, migrations, or manual database operations.
### Entity relationship overview
@@ -145,62 +246,135 @@ When a Release is deleted through the ORM (`session.delete(release)`):
**Via ORM cascade** (`cascade: "all, delete-orphan"`):
-* All **Revision** records belonging to the release are deleted. Revisions have no DB-level cascade — they are only cleaned up by the ORM or by explicit bulk deletion.
+* All **Revision** records belonging to the release are deleted. Revisions have no DB-level cascade
+ — they are only cleaned up by the ORM or by explicit bulk deletion.
* All **CheckResult** records belonging to the release are deleted.
* All **Distribution** records belonging to the release are deleted.
* All **BallotPaper** records belonging to the release are deleted.
-* All **Artifact** records linked to the release are deleted. Artifact uses `cascade: "all, delete"` with `passive_deletes=True` rather than `delete-orphan`, so the ORM leans on the DB-level cascade to do the actual deletion. Only artifacts with a non-null `release_key` are affected; historical SVN artifacts catalogued without an ATR release have a null `release_key` and are left alone.
-* The release's **ReleasePolicy** (if any) is deleted. This is a one-to-one relationship with `cascade_delete=True` and `single_parent=True`.
+* All **Artifact** records linked to the release are deleted. Artifact uses `cascade: "all, delete"`
+ with `passive_deletes=True` rather than `delete-orphan`, so the ORM leans on the DB-level cascade
+ to do the actual deletion. Only artifacts with a non-null `release_key` are affected; historical
+ SVN artifacts catalogued without an ATR release have a null `release_key` and are left alone.
+* The release's **ReleasePolicy** (if any) is deleted. This is a one-to-one relationship with
+ `cascade_delete=True` and `single_parent=True`.
**Via DB cascade** (`ondelete="CASCADE"` on the foreign key):
-* All **CheckResult** records referencing the release are deleted. This is redundant with the ORM cascade when using ORM deletion, but provides coverage for raw SQL deletions.
+* All **CheckResult** records referencing the release are deleted. This is redundant with the ORM
+ cascade when using ORM deletion, but provides coverage for raw SQL deletions.
* All **Distribution** records referencing the release are deleted. Same redundancy as above.
* All **BallotPaper** records referencing the release are deleted. Same redundancy as above.
-* All **Artifact** records whose `release_key` references the release are deleted. This is the cascade the ORM relies on, given the `passive_deletes=True` above.
-* All **Quarantined** records referencing the release are deleted. This has a DB-level cascade only (no ORM cascade), because Quarantined records are not part of the Release's ORM relationships with cascade configuration.
+* All **Artifact** records whose `release_key` references the release are deleted. This is the
+ cascade the ORM relies on, given the `passive_deletes=True` above.
+* All **Quarantined** records referencing the release are deleted. This has a DB-level cascade only
+ (no ORM cascade), because Quarantined records are not part of the Release's ORM relationships with
+ cascade configuration.
### Project deletion cascades
When a Project is deleted through the ORM:
-**Via ORM cascade**: The project's **ReleasePolicy** (if any) is deleted. This uses `cascade_delete=True` with `cascade: "all, delete-orphan"` and `single_parent=True`. All of the project's **ProjectCycle** records are also deleted, using `cascade_delete=True` with `cascade: "all, delete-orphan"`; this is backed by a DB-level cascade too, since `ProjectCycle.project_key` has `ondelete="CASCADE"`. Because Project deletion is guarded when releases exist (see below), in practice only the cy [...]
-
-**Via DB cascade**: All of the project's **Artifact** records are deleted. `Artifact.project_key` is part of the artifact's composite primary key and carries `ondelete="CASCADE"`, and there is no ORM relationship from Project to Artifact, so this cascade is DB-level only. Artifacts can exist for a project with no releases (historical catalogue entries) and, unlike releases, do not block Project deletion, so deleting a release-free project takes its catalogued artifacts with it. The proje [...]
-
-**Note on `ondelete="CASCADE"` on `Project.release_policy_id`:** This foreign key has `ondelete="CASCADE"`, but the direction is from ReleasePolicy to Project — meaning if a ReleasePolicy row were deleted directly in the database, the *Project* referencing it would also be deleted. This is the reverse of the ORM cascade direction (where deleting a Project cascades to its ReleasePolicy). In practice, ReleasePolicy is never deleted independently; it is always deleted as a consequence of it [...]
-
-Project deletion is explicitly guarded in the application: [`storage/writers/project.py`](/ref/atr/storage/writers/project.py) raises an error if the project has any associated releases. This means in practice, the Release cascades described above are not triggered indirectly through Project deletion.
+**Via ORM cascade**: The project's **ReleasePolicy** (if any) is deleted. This uses
+`cascade_delete=True` with `cascade: "all, delete-orphan"` and `single_parent=True`. All of the
+project's **ProjectCycle** records are also deleted, using `cascade_delete=True` with
+`cascade: "all, delete-orphan"`; this is backed by a DB-level cascade too, since
+`ProjectCycle.project_key` has `ondelete="CASCADE"`. Because Project deletion is guarded when
+releases exist (see below), in practice only the cycles of a release-free project are ever removed
+this way.
+
+**Via DB cascade**: All of the project's **Artifact** records are deleted. `Artifact.project_key` is
+part of the artifact's composite primary key and carries `ondelete="CASCADE"`, and there is no ORM
+relationship from Project to Artifact, so this cascade is DB-level only. Artifacts can exist for a
+project with no releases (historical catalogue entries) and, unlike releases, do not block Project
+deletion, so deleting a release-free project takes its catalogued artifacts with it. The project's
+**LifecycleEvent** rows cascade the same way, since `LifecycleEvent.project_key` also has
+`ondelete="CASCADE"`.
+
+**Note on `ondelete="CASCADE"` on `Project.release_policy_id`:** This foreign key has
+`ondelete="CASCADE"`, but the direction is from ReleasePolicy to Project — meaning if a
+ReleasePolicy row were deleted directly in the database, the *Project* referencing it would also be
+deleted. This is the reverse of the ORM cascade direction (where deleting a Project cascades to its
+ReleasePolicy). In practice, ReleasePolicy is never deleted independently; it is always deleted as a
+consequence of its parent Project or Release being deleted via the ORM. The `ondelete="CASCADE"`
+here prevents a dangling foreign key if a ReleasePolicy were removed manually, but the consequence
+(deleting the Project) would be severe and unintended. Release does not have this issue because
+`Release.release_policy_id` has no `ondelete` configured.
+
+Project deletion is explicitly guarded in the application:
+[`storage/writers/project.py`](/ref/atr/storage/writers/project.py) raises an error if the project
+has any associated releases. This means in practice, the Release cascades described above are not
+triggered indirectly through Project deletion.
### SET NULL behaviour
One relationship uses `ondelete="SET NULL"` instead of CASCADE:
-* **WorkflowStatus.task_id** → Task.id: When a Task is deleted, the `task_id` column in any referencing WorkflowStatus rows is set to NULL rather than deleting the WorkflowStatus record. This preserves workflow status history even when the associated task is cleaned up.
+* **WorkflowStatus.task_id** → Task.id: When a Task is deleted, the `task_id` column in any
+ referencing WorkflowStatus rows is set to NULL rather than deleting the WorkflowStatus record.
+ This preserves workflow status history even when the associated task is cleaned up.
### Explicit deletions
Some related records are deleted explicitly in application code rather than through cascades.
-**When deleting a Release** ([`storage/writers/release.py`](/ref/atr/storage/writers/release.py)): **Task** records matching the release's project name and version are deleted with a bulk SQL DELETE before the Release itself is deleted. Tasks reference `project.key` via a nullable foreign key with no cascade, so they would not be automatically cleaned up. **RevisionCounter** records are deleted only in test mode (when `ALLOW_TESTS` is enabled and the release belongs to the test committee [...]
+**When deleting a Release** ([`storage/writers/release.py`](/ref/atr/storage/writers/release.py)):
+**Task** records matching the release's project name and version are deleted with a bulk SQL DELETE
+before the Release itself is deleted. Tasks reference `project.key` via a nullable foreign key with
+no cascade, so they would not be automatically cleaned up. **RevisionCounter** records are deleted
+only in test mode (when `ALLOW_TESTS` is enabled and the release belongs to the test committee), to
+allow revision number reuse in tests.
-**When announcing a Release** ([`storage/writers/announce.py`](/ref/atr/storage/writers/announce.py)): All **Revision** records for the release are deleted with a bulk SQL DELETE during the announce process, as part of cleaning up draft history after a release is published.
+**When announcing a Release**
+([`storage/writers/announce.py`](/ref/atr/storage/writers/announce.py)): All **Revision** records
+for the release are deleted with a bulk SQL DELETE during the announce process, as part of cleaning
+up draft history after a release is published.
-**When deleting a SigningCertificate** ([`storage/writers/keys.py`](/ref/atr/storage/writers/keys.py)): **KeyLink** records associating the key with committees are explicitly cleared and deleted before the key itself is deleted. KeyLink has no cascade configuration, so this cleanup is mandatory.
+**When deleting a SigningCertificate**
+([`storage/writers/keys.py`](/ref/atr/storage/writers/keys.py)): **KeyLink** records associating the
+key with committees are explicitly cleared and deleted before the key itself is deleted. KeyLink has
+no cascade configuration, so this cleanup is mandatory.
### Blocked deletions
-Several entities cannot be deleted while other records reference them, either because the foreign key constraint has no cascade (so a referenced parent cannot be removed while a child still points at it) or because it uses `ondelete="RESTRICT"`. Attempting to delete these will raise a database integrity error. A nullable foreign key does not exempt the parent: nullability only means a given child row may hold no reference, but any row that *does* reference the parent still blocks its deletion.
-
-**Committee** cannot be deleted while any **Project** references it through `Project.committee_key`, or while any child **Committee** references it through `parent_committee_key`. Neither foreign key has a cascade, so a referenced committee is blocked even though both columns are nullable. **KeyLink** rows do *not* block committee deletion, contrary to what the many-to-many link might suggest: `KeyLink.committee_key` has `ondelete="CASCADE"`, so a committee's key links are removed along [...]
-
-**Project** cannot be deleted while any **Release** rows reference it (Release.project_key is non-nullable, no cascade) or any **CheckResultIgnore** rows reference it (CheckResultIgnore.project_key is non-nullable, no cascade). The application also explicitly prevents Project deletion when releases exist. The other children of a project - its cycles, artifacts and lifecycle events - cascade rather than block, so they add no further deletion barriers.
-
-**ProjectCycle** cannot be deleted while any **Release** references it, since `Release.cycle_key` is non-nullable with no cascade (and `LifecycleEvent.cycle_key` references it with no cascade too). A cycle is therefore removed only via the cascade from its parent Project, once the project has no releases left.
-
-**Revision** cannot be deleted individually while another **Revision** references it as a parent (Revision.parent_key is nullable but has no `ondelete`, so deletion of a parent revision that is still referenced would violate the FK constraint). In practice, revisions are deleted in bulk per-release which avoids this issue since all revisions in the chain are removed together.
-
-**SigningKey** cannot be deleted while any **Artifact** references its fingerprint, because `Artifact.key_fingerprint` uses `ondelete="RESTRICT"`. Unlike the cases above, the block here is explicit rather than a side effect of a missing cascade: `Artifact.key_fingerprint` is nullable, but RESTRICT still refuses to remove a signing key that any artifact is attributed to, preserving the link between a published artifact and the key that signed it. Because deleting a **SigningCertificate** [...]
+Several entities cannot be deleted while other records reference them, either because the foreign
+key constraint has no cascade (so a referenced parent cannot be removed while a child still points
+at it) or because it uses `ondelete="RESTRICT"`. Attempting to delete these will raise a database
+integrity error. A nullable foreign key does not exempt the parent: nullability only means a given
+child row may hold no reference, but any row that *does* reference the parent still blocks its
+deletion.
+
+**Committee** cannot be deleted while any **Project** references it through `Project.committee_key`,
+or while any child **Committee** references it through `parent_committee_key`. Neither foreign key
+has a cascade, so a referenced committee is blocked even though both columns are nullable.
+**KeyLink** rows do *not* block committee deletion, contrary to what the many-to-many link might
+suggest: `KeyLink.committee_key` has `ondelete="CASCADE"`, so a committee's key links are removed
+along with it.
+
+**Project** cannot be deleted while any **Release** rows reference it (Release.project_key is
+non-nullable, no cascade) or any **CheckResultIgnore** rows reference it
+(CheckResultIgnore.project_key is non-nullable, no cascade). The application also explicitly
+prevents Project deletion when releases exist. The other children of a project - its cycles,
+artifacts and lifecycle events - cascade rather than block, so they add no further deletion
+barriers.
+
+**ProjectCycle** cannot be deleted while any **Release** references it, since `Release.cycle_key` is
+non-nullable with no cascade (and `LifecycleEvent.cycle_key` references it with no cascade too). A
+cycle is therefore removed only via the cascade from its parent Project, once the project has no
+releases left.
+
+**Revision** cannot be deleted individually while another **Revision** references it as a parent
+(Revision.parent_key is nullable but has no `ondelete`, so deletion of a parent revision that is
+still referenced would violate the FK constraint). In practice, revisions are deleted in bulk
+per-release which avoids this issue since all revisions in the chain are removed together.
+
+**SigningKey** cannot be deleted while any **Artifact** references its fingerprint, because
+`Artifact.key_fingerprint` uses `ondelete="RESTRICT"`. Unlike the cases above, the block here is
+explicit rather than a side effect of a missing cascade: `Artifact.key_fingerprint` is nullable, but
+RESTRICT still refuses to remove a signing key that any artifact is attributed to, preserving the
+link between a published artifact and the key that signed it. Because deleting a
+**SigningCertificate** cascades to its **SigningKey** rows (`SigningKey.certificate_fingerprint` has
+`ondelete="CASCADE"`), this RESTRICT also blocks removing a certificate whose keys have signed
+artifacts.
### Cascade coverage summary
@@ -256,22 +430,52 @@ flowchart LR
| SigningCertificate | KeyLink | — | — | Explicit clear before key deletion |
| SigningKey | Artifact | — | `RESTRICT` (blocks delete) | — |
-The ⚠️ on **ReleasePolicy → Project** indicates a reverse cascade: if a ReleasePolicy were deleted directly at the DB level, the referencing Project would also be deleted. This is a consequence of `ondelete="CASCADE"` on `Project.release_policy_id`.
+The ⚠️ on **ReleasePolicy → Project** indicates a reverse cascade: if a ReleasePolicy were deleted
+directly at the DB level, the referencing Project would also be deleted. This is a consequence of
+`ondelete="CASCADE"` on `Project.release_policy_id`.
## Schema changes and migrations
-We often have to make changes to the database model in ATR, whether that be to add a whole new model or just to rename or change some existing properties. No matter the change, this involves creating a database migration. We use Alembic to perform migrations, and this allows migrations to be *bidirectional*: we can downgrade as well as upgrade. This can be very helpful when, for example, a migration didn't apply properly or is no longer needed due to having found a different solution.
+We often have to make changes to the database model in ATR, whether that be to add a whole new model
+or just to rename or change some existing properties. No matter the change, this involves creating a
+database migration. We use Alembic to perform migrations, and this allows migrations to be
+*bidirectional*: we can downgrade as well as upgrade. This can be very helpful when, for example, a
+migration didn't apply properly or is no longer needed due to having found a different solution.
-To change the database, do not edit the SQLite directly. Instead, change the model file in [`atr/models/sql.py`](/ref/atr/models/sql.py). If you're running ATR locally, you should see from its logs that the server is now broken due to having a mismatching database. That's fine! This is the point where you now create the migration. To do so, run:
+To change the database, do not edit the SQLite directly. Instead, change the model file in
+[`atr/models/sql.py`](/ref/atr/models/sql.py). If you're running ATR locally, you should see from
+its logs that the server is now broken due to having a mismatching database. That's fine! This is
+the point where you now create the migration. To do so, run:
```shell
uv run --frozen alembic revision -m "Description of changes" --autogenerate
```
-Obviously, change `"Description of changes"` to an actual description of the changes that you made. Keep it short, around 50-60 characters. Then when you restart the server you should find that the migration is automatically applied. You should be careful, however, before restarting the server. Not all migrations apply successfully when autogenerated. Always review the automatically produced migrations in `migrations/versions` first, and ensure that they are correct before proceeding. On [...]
-
-It can be helpful to make a backup of the entire SQLite database before performing the migration, especially if the migration is particularly complex. This can help if, for example, the downgrade is broken, otherwise you may find yourself in a state from which there is no easy recovery. *Always* ensure that migrations are working locally before pushing them to GitHub, because we apply changes from GitHub directly to our deployed containers. Note that sometimes the deployed containers con [...]
-
-`tests/unit/test_migrations.py` upgrades a temporary synthetic database, inserting rows as their tables first appear. Add an INSERT at a new table's creation revision unless the migration already populates it. The test rejects empty model tables at head. For changes depending on data, add the necessary old row shapes at the preceding revision, including duplicates or legacy values when relevant. Reproduce known historical schema differences with a small explicit setup step, as the test d [...]
-
-If testing a migration in a PR, be sure to stop the server and run `uv run --frozen alembic downgrade -1` before switching back to any branch not containing the migration.
+Obviously, change `"Description of changes"` to an actual description of the changes that you made.
+Keep it short, around 50-60 characters. Then when you restart the server you should find that the
+migration is automatically applied. You should be careful, however, before restarting the server.
+Not all migrations apply successfully when autogenerated. Always review the automatically produced
+migrations in `migrations/versions` first, and ensure that they are correct before proceeding. One
+common problem is that the autogenerator leaves out server defaults. Please note that you do not
+need to include changes to enums in Alembic migrations, because they are not enforced in the SQLite
+schema.
+
+It can be helpful to make a backup of the entire SQLite database before performing the migration,
+especially if the migration is particularly complex. This can help if, for example, the downgrade is
+broken, otherwise you may find yourself in a state from which there is no easy recovery. *Always*
+ensure that migrations are working locally before pushing them to GitHub, because we apply changes
+from GitHub directly to our deployed containers. Note that sometimes the deployed containers contain
+data that causes an error that was not caught locally. In that case there is usually no option but
+to provide special triage on the deployed containers.
+
+`tests/unit/test_migrations.py` upgrades a temporary synthetic database, inserting rows as their
+tables first appear. Add an INSERT at a new table's creation revision unless the migration already
+populates it. The test rejects empty model tables at head. For changes depending on data, add the
+necessary old row shapes at the preceding revision, including duplicates or legacy values when
+relevant. Reproduce known historical schema differences with a small explicit setup step, as the
+test does for the missing task CHECK. Existing column defaults must survive between seed
+checkpoints, and an intentional removal requires updating that expectation.
+
+If testing a migration in a PR, be sure to stop the server and run
+`uv run --frozen alembic downgrade -1` before switching back to any branch not containing the
+migration.
diff --git a/atr/docs/dependency-updates.md b/atr/docs/dependency-updates.md
index 2d5f7c24..5a16c44d 100644
--- a/atr/docs/dependency-updates.md
+++ b/atr/docs/dependency-updates.md
@@ -16,95 +16,87 @@
## Overview
-ATR depends on three families of third-party code: Python packages, resolved and
-locked by uv; the Bootstrap frontend toolkit, installed through npm; and a small
-set of command-line tools baked into the container image. We make use of specific
-version pinning. Python and frontend dependency freshness are both enforced
-automatically at commit time through pre-commit hooks, the Bootstrap toolkit is
-updated by a script, and the container tools are verified at image build time.
+ATR depends on three families of third-party code: Python packages, resolved and locked by uv; the
+Bootstrap frontend toolkit, installed through npm; and a small set of command-line tools baked into
+the container image. We make use of specific version pinning. Python and frontend dependency
+freshness are both enforced automatically at commit time through pre-commit hooks, the Bootstrap
+toolkit is updated by a script, and the container tools are verified at image build time.
-This page describes how those dependencies are updated and what guardrails apply.
-It covers only ATR's own dependencies. Scanning of the release artifacts that
-users upload is a separate concern and is not covered here.
+This page describes how those dependencies are updated and what guardrails apply. It covers only
+ATR's own dependencies. Scanning of the release artifacts that users upload is a separate concern
+and is not covered here.
## Python dependencies
-Python dependencies are pinned in `uv.lock` and resolved by uv. To refresh them,
-run `make update-deps`.
+Python dependencies are pinned in `uv.lock` and resolved by uv. To refresh them, run
+`make update-deps`.
### Python dependency freshness
The `check-when-dependencies-updated` pre-commit hook runs
-[`check_when_dependencies_updated.py`](/ref/scripts/check_when_dependencies_updated.py),
-which fails if the locked dependencies are more than 30 days old. It reads the
-age from the `exclude-newer` timestamp in the `[options]` section of `uv.lock`.
-When uv has recorded only a relative `exclude-newer-span` - which leaves a
-sentinel placeholder date rather than a real timestamp - the script falls back to
-git, treating an uncommitted change to `uv.lock` as an update made now, and
-otherwise using the file's last commit time. On failure it prints
-`Run: make update-deps`.
+[`check_when_dependencies_updated.py`](/ref/scripts/check_when_dependencies_updated.py), which fails
+if the locked dependencies are more than 30 days old. It reads the age from the `exclude-newer`
+timestamp in the `[options]` section of `uv.lock`. When uv has recorded only a relative
+`exclude-newer-span` - which leaves a sentinel placeholder date rather than a real timestamp - the
+script falls back to git, treating an uncommitted change to `uv.lock` as an update made now, and
+otherwise using the file's last commit time. On failure it prints `Run: make update-deps`.
### Vulnerability scanning
-Two further pre-commit hooks scan the Python dependencies for known
-vulnerabilities:
+Two further pre-commit hooks scan the Python dependencies for known vulnerabilities:
-* `pip-audit` audits [`pip-audit.requirements`](/ref/pip-audit.requirements), a
- fully pinned export of the dependency tree, running with `--disable-pip` and
- `--no-deps`. One advisory, `PYSEC-2025-183`, is currently ignored.
-* `uv audit` queries OSV for vulnerabilities in `uv.lock`. It is being trialled
- alongside pip-audit.
+* `pip-audit` audits [`pip-audit.requirements`](/ref/pip-audit.requirements), a fully pinned export
+ of the dependency tree, running with `--disable-pip` and `--no-deps`. One advisory,
+ `PYSEC-2025-183`, is currently ignored.
+* `uv audit` queries OSV for vulnerabilities in `uv.lock`. It is being trialled alongside pip-audit.
## Frontend dependencies
The Bootstrap frontend toolkit is installed through npm and updated with
-[`bump.sh`](/ref/bootstrap/context/bump.sh), which takes the target Bootstrap
-version as its argument.
+[`bump.sh`](/ref/bootstrap/context/bump.sh), which takes the target Bootstrap version as its
+argument.
-The script enforces a 14-day cooldown: it installs the requested version with
-`npm install --before` set to a fortnight ago, so a freshly published release
-cannot be pulled in until it has been available for two weeks. It then runs
-`npm audit` to check for known vulnerabilities and `npm audit signatures` to
-verify the registry signatures, and finally reminds the operator to commit the
-updated `package.json`, `package-lock.json` and `.npm-exclude-newer`.
+The script enforces a 14-day cooldown: it installs the requested version with `npm install --before`
+set to a fortnight ago, so a freshly published release cannot be pulled in until it has been
+available for two weeks. It then runs `npm audit` to check for known vulnerabilities and
+`npm audit signatures` to verify the registry signatures, and finally reminds the operator to commit
+the updated `package.json`, `package-lock.json` and `.npm-exclude-newer`.
### Frontend dependency freshness
The `check-npm-dependencies-updated` pre-commit hook runs
-[`check_npm_dependencies_updated.py`](/ref/scripts/check_npm_dependencies_updated.py),
-which fails if the frontend dependencies are more than 60 days old - a looser
-window than Python's 30 days, since Bootstrap moves more slowly and the 14-day
-cooldown already narrows how new an update can be. `package-lock.json` carries no
-timestamp of its own, so `bump.sh` records its `--before` cutoff in
-`bootstrap/source/.npm-exclude-newer`, and the check reads the age from there. A
-`package-lock.json` edit that skips `bump.sh` does not refresh that file, which
-keeps updates on the `bump.sh` path. On failure it prints
-`Run: bootstrap/context/bump.sh VERSION`.
+[`check_npm_dependencies_updated.py`](/ref/scripts/check_npm_dependencies_updated.py), which fails
+if the frontend dependencies are more than 60 days old - a looser window than Python's 30 days,
+since Bootstrap moves more slowly and the 14-day cooldown already narrows how new an update can be.
+`package-lock.json` carries no timestamp of its own, so `bump.sh` records its `--before` cutoff in
+`bootstrap/source/.npm-exclude-newer`, and the check reads the age from there. A `package-lock.json`
+edit that skips `bump.sh` does not refresh that file, which keeps updates on the `bump.sh` path. On
+failure it prints `Run: bootstrap/context/bump.sh VERSION`.
## External tools in the container image
-The Alpine container image installs several external command-line tools at build
-time, each pinned to a specific version in
-[`Dockerfile.alpine`](/ref/Dockerfile.alpine):
+The Alpine container image installs several external command-line tools at build time, each pinned
+to a specific version in [`Dockerfile.alpine`](/ref/Dockerfile.alpine):
-* **Apache RAT** (`0.18`) - downloaded from the ASF distribution mirrors and
- checked against the published `.sha512` checksum.
-* **syft** (`1.52.0`) - installed through the pinned upstream `install.sh`, which
- is itself verified against a recorded sha256; the resulting binary is then
- verified against a per-architecture sha256.
-* **cyclonedx-cli** (`0.33.1`) - downloaded as a per-architecture release asset
- and verified against a per-architecture sha256.
-* **sbomqs** (`2.1.2`) - built with `go install` at a
- pinned version, which resolves and verifies each module against the Go checksum
- database.
+* **Apache RAT** (`0.18`) - downloaded from the ASF distribution mirrors and checked against the
+ published `.sha512` checksum.
+* **syft** (`1.52.0`) - installed through the pinned upstream `install.sh`, which is itself verified
+ against a recorded sha256; the resulting binary is then verified against a per-architecture
+ sha256.
+* **cyclonedx-cli** (`0.33.1`) - downloaded as a per-architecture release asset and verified against
+ a per-architecture sha256.
+* **sbomqs** (`2.1.2`) - built with `go install` at a pinned version, which resolves and verifies
+ each module against the Go checksum database.
-Updating a tool means editing its version and its checksum in the Dockerfile and rebuilding the image.
-The weekly tool freshness workflow reports newer releases of these tools.
+Updating a tool means editing its version and its checksum in the Dockerfile and rebuilding the
+image. The weekly tool freshness workflow reports newer releases of these tools.
## Implementation references
-* [`check_when_dependencies_updated.py`](/ref/scripts/check_when_dependencies_updated.py) - the 30-day Python freshness check
-* [`check_npm_dependencies_updated.py`](/ref/scripts/check_npm_dependencies_updated.py) - the 60-day frontend freshness check
+* [`check_when_dependencies_updated.py`](/ref/scripts/check_when_dependencies_updated.py) - the
+ 30-day Python freshness check
+* [`check_npm_dependencies_updated.py`](/ref/scripts/check_npm_dependencies_updated.py) - the 60-day
+ frontend freshness check
* [`bump.sh`](/ref/bootstrap/context/bump.sh) - the Bootstrap update script
* [`Dockerfile.alpine`](/ref/Dockerfile.alpine) - pinned external tools
* [`pip-audit.requirements`](/ref/pip-audit.requirements) - pinned tree audited by pip-audit
diff --git a/atr/docs/developer-guide.md b/atr/docs/developer-guide.md
index df0a4f56..098838a6 100644
--- a/atr/docs/developer-guide.md
+++ b/atr/docs/developer-guide.md
@@ -38,15 +38,22 @@
## Introduction
-This is a guide for developers of ATR, explaining how to make changes to the ATR source code. For more information about how to contribute those changes back to us, please read the [contribution guide](how-to-contribute).
+This is a guide for developers of ATR, explaining how to make changes to the ATR source code. For
+more information about how to contribute those changes back to us, please read the
+[contribution guide](how-to-contribute).
## Security documentation
-ATR is security-critical infrastructure for the Apache Software Foundation. Before contributing, you should familiarize yourself with our security practices:
+ATR is security-critical infrastructure for the Apache Software Foundation. Before contributing, you
+should familiarize yourself with our security practices:
-* [Authentication security](authentication-security) - How users authenticate to ATR via ASF OAuth and API tokens
-* [Authorization security](authorization-security) - The role-based access control model and LDAP integration
+* [Authentication security](authentication-security) - How users authenticate to ATR via ASF OAuth
+ and API tokens
+* [Authorization security](authorization-security) - The role-based access control model and LDAP
+ integration
* [Input validation](input-validation) - Data validation patterns and injection prevention
* [File handling](file-handling) - Upload limits, archive validation and downloads
-For reporting security vulnerabilities, see [SECURITY.md](https://github.com/apache/tooling-trusted-releases/blob/main/SECURITY.md) in the repository root.
+For reporting security vulnerabilities, see
+[SECURITY.md](https://github.com/apache/tooling-trusted-releases/blob/main/SECURITY.md) in the
+repository root.
diff --git a/atr/docs/file-handling.md b/atr/docs/file-handling.md
index e6a8a6be..874108cf 100644
--- a/atr/docs/file-handling.md
+++ b/atr/docs/file-handling.md
@@ -4,7 +4,7 @@
**Prev**: `7.21.` [SBOM architecture](sbom-architecture)
-**Next**: (none)
+**Next**: `8.` [Glossary](glossary)
**Sections**:
@@ -16,7 +16,9 @@
## Overview
-ATR validates release uploads in temporary storage before creating a revision. Archives that need validation stay in quarantine until a worker extracts them successfully. The previous revision remains available while this happens.
+ATR validates release uploads in temporary storage before creating a revision. Archives that need
+validation stay in quarantine until a worker extracts them successfully. The previous revision
+remains available while this happens.
## Uploads and limits
@@ -31,15 +33,23 @@ ATR validates release uploads in temporary storage before creating a revision. A
| KEYS file | ASCII armored public keys | 10 MiB |
| Admin catalogue import | Projects, releases, and artifacts CSV files | 512 MiB per request |
-`MAX_CONTENT_LENGTH` in [`config`](/ref/atr/config.py) sets the HTTP request limit, enforced by [`body`](/ref/atr/body.py). Form fields and encoding count towards it, so multipart and base64 uploads have less room for file content. There is no limit on the total size of a release.
+`MAX_CONTENT_LENGTH` in [`config`](/ref/atr/config.py) sets the HTTP request limit, enforced by
+[`body`](/ref/atr/body.py). Form fields and encoding count towards it, so multipart and base64
+uploads have less room for file content. There is no limit on the total size of a release.
-[`ssh`](/ref/atr/ssh.py) sets the rsync limit, and [`shared.keys`](/ref/atr/shared/keys.py) defines the key limits. Key imports reject private key material. Keys and catalogue CSV files are parsed separately from release uploads.
+[`ssh`](/ref/atr/ssh.py) sets the rsync limit, and [`shared.keys`](/ref/atr/shared/keys.py) defines
+the key limits. Key imports reject private key material. Keys and catalogue CSV files are parsed
+separately from release uploads.
## Format checks
-Release upload paths must satisfy the [path rules](input-validation#file-names). Before creating a revision, [`revision`](/ref/atr/storage/writers/revision.py) validates the whole proposed tree, including files carried over from the previous revision.
+Release upload paths must satisfy the [path rules](input-validation#file-names). Before creating a
+revision, [`revision`](/ref/atr/storage/writers/revision.py) validates the whole proposed tree,
+including files carried over from the previous revision.
-[`detection`](/ref/atr/detection.py) rejects symlinks and checks file contents against the extensions below. Empty files, unrecognized contents and format mismatches fail these checks. Files with other extensions are not inspected at this stage.
+[`detection`](/ref/atr/detection.py) rejects symlinks and checks file contents against the
+extensions below. Empty files, unrecognized contents and format mismatches fail these checks. Files
+with other extensions are not inspected at this stage.
| Expected format | Extensions |
| --- | --- |
@@ -50,23 +60,37 @@ Release upload paths must satisfy the [path rules](input-validation#file-names).
## Archive quarantine
-Quarantine applies to `.tar.gz`, `.tgz`, `.zip`, `.tar.bz2`, `.tar.xz`, `.jar`, `.war`, `.apk`, `.nar`, and `.whl` archives. ATR can reuse validation for identical content previously accepted in the same release with the same suffix, and `.tgz` and `.tar.gz` count as one suffix.
+Quarantine applies to `.tar.gz`, `.tgz`, `.zip`, `.tar.bz2`, `.tar.xz`, `.jar`, `.war`, `.apk`,
+`.nar`, and `.whl` archives. ATR can reuse validation for identical content previously accepted in
+the same release with the same suffix, and `.tgz` and `.tar.gz` count as one suffix.
-If any archive needs validation, the whole proposed revision stays outside download paths while a [`quarantine`](/ref/atr/tasks/quarantine.py) worker extracts its archives. [`archives`](/ref/atr/archives.py) sets these default extraction limits:
+If any archive needs validation, the whole proposed revision stays outside download paths while a
+[`quarantine`](/ref/atr/tasks/quarantine.py) worker extracts its archives.
+[`archives`](/ref/atr/archives.py) sets these default extraction limits:
* 2 GiB per file and per archive, configured by `MAX_EXTRACT_SIZE`
* 100,000 files per archive
* A compression ratio of 100
* A path depth of 32
-Absolute paths and hard links are rejected. Symlinks inside archives must stay within the extraction root.
+Absolute paths and hard links are rejected. Symlinks inside archives must stay within the extraction
+root.
-Once all archives pass validation, the worker creates the revision and starts the release [checks](checks). Those checks can block a vote, but the files remain downloadable. An extraction error marks the submission failed and removes the quarantined files. A worker interruption can leave the quarantine pending, which blocks starting a vote. See [Resource management](resource-management) for worker limits.
+Once all archives pass validation, the worker creates the revision and starts the release
+[checks](checks). Those checks can block a vote, but the files remain downloadable. An extraction
+error marks the submission failed and removes the quarantined files. A worker interruption can leave
+the quarantine pending, which blocks starting a vote. See [Resource management](resource-management)
+for worker limits.
## Downloads
-Individual files are public, except in embargoed releases, which are hidden from users without access. [`download`](/ref/atr/get/download.py) serves local files as `application/octet-stream` attachments. [`safe.StatePath`](/ref/atr/models/safe.py) keeps resolved paths inside managed storage. The frontend proxy must supply `X-Content-Type-Options: nosniff`, as noted in [`server`](/ref/atr/server.py). Published downloads redirect to the ASF download services.
+Individual files are public, except in embargoed releases, which are hidden from users without
+access. [`download`](/ref/atr/get/download.py) serves local files as `application/octet-stream`
+attachments. [`safe.StatePath`](/ref/atr/models/safe.py) keeps resolved paths inside managed
+storage. The frontend proxy must supply `X-Content-Type-Options: nosniff`, as noted in
+[`server`](/ref/atr/server.py). Published downloads redirect to the ASF download services.
-Committers can also download an unreleased revision as a ZIP, with no size or file count limit. File previews require a committer login and show the first 512 KiB as escaped text or a hex dump.
+Committers can also download an unreleased revision as a ZIP, with no size or file count limit. File
+previews require a committer login and show the first 512 KiB as escaped text or a hex dump.
ATR does not scan files for malware.
diff --git a/atr/docs/finish-phase.md b/atr/docs/finish-phase.md
index ff2a3613..2deffb8c 100644
--- a/atr/docs/finish-phase.md
+++ b/atr/docs/finish-phase.md
@@ -1,6 +1,6 @@
# 5.3. Finish phase
-**Up**: `5.` [Making releases](release-process-description)
+**Up**: `5.` [Making releases](making-releases)
**Prev**: `5.2.1.` [Staging and voting](staging-and-voting)
@@ -33,21 +33,19 @@ For a step by step walkthrough of this phase with screenshots, see the
The finish phase is again mostly the work of the Release Manager:
-* Distribute the release artifacts to any package distribution platforms your project uses, such
- as Maven Central, PyPI, or Docker Hub. ATR does not do this for you, but you can record the
- results on ATR. If your project's [tagging spec](project-configuration#compose) names a
- platform, ATR will not let you announce the release until a distribution to it has been
- recorded.
-* Publish the approved candidate, which commits the artifacts to `svn:dist:release`. This can be done
- automatically, if requested when the vote is started.
-* Announce the release through ATR. ATR checks that the artifacts have reached the download
- servers first, and if they have not finished propagating it asks you to try again later.
+* Distribute the release artifacts to any package distribution platforms your project uses, such as
+ Maven Central, PyPI, or Docker Hub. ATR does not do this for you, but you can record the results
+ on ATR. If your project's [tagging spec](project-configuration#compose) names a platform, ATR will
+ not let you announce the release until a distribution to it has been recorded.
+* Publish the approved candidate, which commits the artifacts to `svn:dist:release`. This can be
+ done automatically, if requested when the vote is started.
+* Announce the release through ATR. ATR checks that the artifacts have reached the download servers
+ first, and if they have not finished propagating it asks you to try again later.
## Publishing and announcing
-ATR commits the artifacts directly to `svn:dist:release` and defers the announcement until they
-are available for download, so there is no window in which the announcement points at files that
-are not yet there. After publication the release is cataloged alongside every other current and
-archived ASF release. See [Promoting to release](promoting-to-release) for the mechanics of the
-commit and announcement, and [Release catalog](release-catalog) for where the finished release
-ends up.
+ATR commits the artifacts directly to `svn:dist:release` and defers the announcement until they are
+available for download, so there is no window in which the announcement points at files that are not
+yet there. After publication the release is cataloged alongside every other current and archived ASF
+release. See [Promoting to release](promoting-to-release) for the mechanics of the commit and
+announcement, and [Release catalog](release-catalog) for where the finished release ends up.
diff --git a/atr/docs/getting-started.md b/atr/docs/getting-started.md
index 2d1e5110..39c7139a 100644
--- a/atr/docs/getting-started.md
+++ b/atr/docs/getting-started.md
@@ -4,11 +4,11 @@
**Prev**: `1.` [Scope](scope)
-**Next**: `2.1.` [Moving from the current process](moving-to-atr)
+**Next**: `2.1.` [Moving to ATR](moving-to-atr)
**Pages**:
-* `2.1.` [Moving from the current process](moving-to-atr)
+* `2.1.` [Moving to ATR](moving-to-atr)
**Sections**:
@@ -16,28 +16,33 @@
## Getting started with ATR
-There are some preparatory steps to take before you start your first ATR release as a Release Manager.
-If your PMC is new to using ATR you will want to make sure that the project you are releasing a new version for is properly configured.
-Traditionally you would commit your release candidate's artifacts to `svn:dist:dev`, whereas in ATR you move them into the system using
-one or more of several methods.
-
-1. ATR uses the ASF's multi-factor authentication at [mfa.apache.org](https://mfa.apache.org/). Make sure that you are registered first.
-2. If you are a Release Manager who is not a PMC member then you will need a PMC member to "designate" you as one from the Committee page.
- This is a change from legacy policy.
-3. Make sure that ATR has your [OpenPGP public key](/keys) linked to your PMC. If your key is already in your project's
- `KEYS` file on `svn:dist:release` then you are ready. If not then ATR allows you to manage your [OpenPGP public keys](/keys).
-4. Depending on how you choose to upload your release candidate artifacts you may need to create a [Personal Access Token](/tokens) or
- upload a [public `SSH` key](/keys).
-5. Check your PMC's [release catalog](https://release-catalog.apache.org) to make sure that the list of projects is correct. Reach out to the
- tooling team to work on any corrections.
-6. When you log in to ATR your [home page](/) shows an index of your projects. Scroll down to a project to:
+There are some preparatory steps to take before you start your first ATR release as a Release
+Manager. If your PMC is new to using ATR you will want to make sure that the project you are
+releasing a new version for is properly configured. Traditionally you would commit your release
+candidate's artifacts to `svn:dist:dev`, whereas in ATR you move them into the system using one or
+more of several methods.
+
+1. ATR uses the ASF's multi-factor authentication at [mfa.apache.org](https://mfa.apache.org/). Make
+ sure that you are registered first.
+2. If you are a Release Manager who is not a PMC member then you will need a PMC member to
+ "designate" you as one from the Committee page. This is a change from legacy policy.
+3. Make sure that ATR has your [OpenPGP public key](/keys) linked to your PMC. If your key is
+ already in your project's `KEYS` file on `svn:dist:release` then you are ready. If not then ATR
+ allows you to manage your [OpenPGP public keys](/keys).
+4. Depending on how you choose to upload your release candidate artifacts you may need to create a
+ [Personal Access Token](/tokens) or upload a [public `SSH` key](/keys).
+5. Check your PMC's [release catalog](https://release-catalog.apache.org) to make sure that the list
+ of projects is correct. Reach out to the tooling team to work on any corrections.
+6. When you log in to ATR your [home page](/) shows an index of your projects. Scroll down to a
+ project to:
* Check the project's configuration through the "About this project" link.
* See any release candidates that are in progress.
* Start a new release candidate.
- * See any finished releases, current and archived, whether made through ATR or found on https://downloads.apache.org/ and
- https://archive.apache.org/
+ * See any finished releases, current and archived, whether made through ATR or found on
+ https://downloads.apache.org/ and https://archive.apache.org/
-If your PMC is coming from the `svn:dist:dev` process, also read [Moving from the current process](moving-to-atr), which covers
-what changes and what to check before your first release.
+If your PMC is coming from the `svn:dist:dev` process, also read [Moving to ATR](moving-to-atr),
+which covers what changes and what to check before your first release.
-If your project is a podling, also read [Podling releases](podling-releases), which covers what differs for a project in the Incubator.
+If your project is a podling, also read [Podling releases](podling-releases), which covers what
+differs for a project in the Incubator.
diff --git a/atr/docs/glossary.md b/atr/docs/glossary.md
new file mode 100644
index 00000000..2203ab06
--- /dev/null
+++ b/atr/docs/glossary.md
@@ -0,0 +1,83 @@
+# 8. Glossary
+
+**Up**: [Documentation](.)
+
+**Prev**: `7.22.` [File handling](file-handling)
+
+**Next**: (none)
+
+**Sections**:
+
+* [Overview](#overview)
+* [Committees and people](#committees-and-people)
+* [Projects and releases](#projects-and-releases)
+* [Making releases](#making-releases)
+* [Keys and credentials](#keys-and-credentials)
+
+## Overview
+
+Short definitions of the terms used across this documentation, grouped by area. Each links to the
+page that covers it in full.
+
+## Committees and people
+
+* **Committee** - a PMC, or a PPMC for a podling. Committee membership is decided outside ATR. See
+ [Committee](projects#committee).
+* **PMC** - Project Management Committee, the body that oversees a top level project and votes on
+ its releases.
+* **PPMC** - Podling Project Management Committee, the committee of a project in the Apache
+ Incubator. See [Podling releases](podling-releases).
+* **Podling** - a project in the Apache Incubator. Its releases are voted on twice, by the PPMC and
+ then by the Incubator PMC.
+* **Roster** - the committers and PMC members of a committee, where committers can be designated as
+ release managers.
+* **Release manager** - a person who guides a candidate through the compose, vote, and finish
+ phases. See [Release manager setup](release-manager-setup).
+
+## Projects and releases
+
+* **Project** - the software, or bundle of software, that a committee votes on. A committee has one
+ or more projects. See [Project](projects#project).
+* **Release** - a specific version of a project's software. See [Release](projects#release).
+* **Release candidate** - a release that has not yet been voted on and published.
+* **Revision** - a snapshot of a release candidate during the compose phase. Every change to the
+ candidate's files makes a new revision. See [Revision](projects#revision).
+* **Artifact** - a file in a release, such as a source archive, a binary, or an SBOM. See
+ [Artifact](projects#artifact).
+* **Cycle** - a line of releases maintained together, such as all `2.x` releases. See
+ [Lifecycle](project-configuration#lifecycle).
+* **Version scheme** - how a project numbers its releases and groups them into cycles.
+* **Lifecycle event** - a published record of a change in a release's status, such as end of
+ distribution. See [Lifecycle events](archiving-and-lifecycle#lifecycle-events).
+* **Archived** - a superseded release whose files have been removed from the distribution area but
+ remain on archive.apache.org. See [Archiving and lifecycle](archiving-and-lifecycle).
+* **Catalog** - the public list of every ASF release, current and archived. See
+ [Release catalog](release-catalog).
+
+## Making releases
+
+* **Compose phase** - where a release candidate is assembled and checked. See
+ [Compose phase](compose-phase).
+* **Vote phase** - where the PMC decides whether the candidate becomes a release. See
+ [Vote phase](vote-phase).
+* **Finish phase** - where an approved candidate is published and announced. See
+ [Finish phase](finish-phase).
+* **Check** - an automated test that ATR runs on the artifacts in a revision. See [Checks](checks).
+* **Blocker** - a check result reporting a violation of mandatory policy, which stops the candidate
+ going to a vote.
+* **SBOM** - software bill of materials, a list of the components in an artifact. See
+ [SBOM workflows](sbom-workflows).
+* **Contingent Approval** - a vote held through the Contingent Approval Portal (CAP), used to
+ approve retiring a project. See [Retiring a project](archiving-and-lifecycle#retiring-a-project).
+
+## Keys and credentials
+
+* **Signing key** - an OpenPGP key used to sign release artifacts. A committee's signing keys are
+ its members' public keys. See [Signing artifacts](signing-artifacts).
+* **PAT** - Personal Access Token, a credential that identifies you to ATR's API and command line
+ tooling. See [Access credentials](release-manager-setup#access-credentials).
+* **JWT** - JSON Web Token, a short-lived credential issued in exchange for a PAT.
+* **Trusted Publishing** - signing release artifacts automatically in a GitHub Actions workflow,
+ available to projects with reproducible builds. See [Trusted Publishing](trusted-publishing).
+* **PURL** - Package URL, a standard identifier given to every release in the catalog. See
+ [Package URLs](release-catalog#package-urls).
diff --git a/atr/docs/how-to-contribute.md b/atr/docs/how-to-contribute.md
index 6c189dc5..646e5db6 100644
--- a/atr/docs/how-to-contribute.md
+++ b/atr/docs/how-to-contribute.md
@@ -17,7 +17,9 @@
## Quick start
-For the contribution workflow, see **[CONTRIBUTING.md](https://github.com/apache/tooling-trusted-releases/blob/main/CONTRIBUTING.md)** in the repository root.
+For the contribution workflow, see
+**[CONTRIBUTING.md](https://github.com/apache/tooling-trusted-releases/blob/main/CONTRIBUTING.md)**
+in the repository root.
That guide covers:
@@ -26,7 +28,9 @@ That guide covers:
* Running tests
* Code standards summary
-**IMPORTANT:** New contributors must introduce themselves on [the development mailing list](mailto:dev@tooling.apache.org) first, to deter spam. Please do not submit a PR until you have introduced yourself.
+**IMPORTANT:** New contributors must introduce themselves on
+[the development mailing list](mailto:dev@tooling.apache.org) first, to deter spam. Please do not
+submit a PR until you have introduced yourself.
The rest of this page covers detailed policies and guidelines.
@@ -37,7 +41,8 @@ We follow a consistent style for commit messages. The first line (subject line)
* **Use the imperative mood.** Complete the sentence "If applied, this commit will..."
* **Use sentence case.** Start with a capital letter, no full stop at the end.
* **Use articles before nouns.** Write "Fix a bug", not "Fix bug".
-* **Be specific and descriptive.** Prefer "Fix a bug in vote resolution for tied votes" to "Fix a bug".
+* **Be specific and descriptive.** Prefer "Fix a bug in vote resolution for tied votes" to "Fix a
+ bug".
* **Keep it concise.** Aim for 50-72 characters.
**Good examples:**
@@ -57,31 +62,48 @@ Updated the code.
refactoring vote resolution logic
```
-Most commits do not need a body. For complex changes, add a body separated by a blank line explaining _what_ and _why_ (not how). We typically use asterisk-itemized lists.
+Most commits do not need a body. For complex changes, add a body separated by a blank line
+explaining _what_ and _why_ (not how). We typically use asterisk-itemized lists.
## Contributing documentation
-ATR documentation lives in `atr/docs/` as Markdown files. When adding or modifying documentation, it is important to understand how the documentation is built.
+ATR documentation lives in `atr/docs/` as Markdown files. When adding or modifying documentation, it
+is important to understand how the documentation is built.
-The file [`atr/docs/index.md`](/ref/atr/docs/index.md) contains a table of contents that acts as the source of truth for the documentation build system. The [`scripts/docs_build.py`](/ref/scripts/docs_build.py) script reads this file to discover all documentation pages, generate navigation links, and validate that everything is consistent.
+The file [`atr/docs/index.md`](/ref/atr/docs/index.md) contains a table of contents that acts as the
+source of truth for the documentation build system. The
+[`scripts/docs_build.py`](/ref/scripts/docs_build.py) script reads this file to discover all
+documentation pages, generate navigation links, and validate that everything is consistent.
-When you add a new documentation file, you must also add an entry to the table of contents in `index.md`. The build will fail if any `.md` files exist in `atr/docs/` that are not listed in the table of contents, or if the table of contents references files that do not exist.
+When you add a new documentation file, you must also add an entry to the table of contents in
+`index.md`. The build will fail if any `.md` files exist in `atr/docs/` that are not listed in the
+table of contents, or if the table of contents references files that do not exist.
## ASF contribution policies
-As an Apache Software Foundation project, ATR follows standard ASF contribution and licensing policies.
+As an Apache Software Foundation project, ATR follows standard ASF contribution and licensing
+policies.
### Contributor License Agreement
-Before your first contribution, you must sign the [Apache Individual Contributor License Agreement](https://www.apache.org/licenses/contributor-agreements.html#clas) (ICLA). This is a one-time requirement.
+Before your first contribution, you must sign the
+[Apache Individual Contributor License Agreement](https://www.apache.org/licenses/contributor-agreements.html#clas)
+(ICLA). This is a one-time requirement.
-The ICLA grants the ASF the right to distribute and build upon your work, while you retain full rights to use your contributions for any other purpose. It is not a copyright assignment. See the [ASF new committers guide](https://infra.apache.org/new-committers-guide.html#submitting-your-individual-contributor-license-agreement-icla) for submission instructions.
+The ICLA grants the ASF the right to distribute and build upon your work, while you retain full
+rights to use your contributions for any other purpose. It is not a copyright assignment. See the
+[ASF new committers guide](https://infra.apache.org/new-committers-guide.html#submitting-your-individual-contributor-license-agreement-icla)
+for submission instructions.
-If your employer holds rights to your work, you may also need a [Corporate Contributor License Agreement](https://www.apache.org/licenses/contributor-agreements.html#clas) (CCLA). Consult your employer to determine if this is necessary.
+If your employer holds rights to your work, you may also need a
+[Corporate Contributor License Agreement](https://www.apache.org/licenses/contributor-agreements.html#clas)
+(CCLA). Consult your employer to determine if this is necessary.
### Licensing
-All contributions are licensed under the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). By submitting a pull request, you agree to this license.
+All contributions are licensed under the
+[Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). By submitting a pull request, you
+agree to this license.
Third-party code or dependencies must be compatible with Apache License 2.0:
@@ -90,39 +112,54 @@ Third-party code or dependencies must be compatible with Apache License 2.0:
### Code of conduct
-All contributors must follow the [ASF Code of Conduct](https://www.apache.org/foundation/policies/conduct.html).
+All contributors must follow the
+[ASF Code of Conduct](https://www.apache.org/foundation/policies/conduct.html).
## Special considerations for ATR
-ATR is developed by ASF Tooling, an ASF initiative rather than a top-level project (TLP). This affects governance and development processes. More significantly, ATR has stringent security requirements.
+ATR is developed by ASF Tooling, an ASF initiative rather than a top-level project (TLP). This
+affects governance and development processes. More significantly, ATR has stringent security
+requirements.
### Security focus
-The primary goal of ATR is to deter and minimize supply chain attacks on ASF software releases. We scrutinize all contributions for potential vulnerabilities.
+The primary goal of ATR is to deter and minimize supply chain attacks on ASF software releases. We
+scrutinize all contributions for potential vulnerabilities.
When contributing:
-* **Follow secure coding practices.** Avoid injection attacks, cross-site scripting, insecure deserialization.
+* **Follow secure coding practices.** Avoid injection attacks, cross-site scripting, insecure
+ deserialization.
* **Validate all inputs and sanitize all outputs.**
-* **Use established libraries** for cryptographic or security-sensitive functionality. Prefer well-established, independently audited, actively maintained libraries.
+* **Use established libraries** for cryptographic or security-sensitive functionality. Prefer
+ well-established, independently audited, actively maintained libraries.
* **Consider security implications.** If unsure, ask the team for guidance.
-* **Report vulnerabilities responsibly.** Do not open public issues for security problems. Follow the [ASF security reporting process](https://www.apache.org/security/).
+* **Report vulnerabilities responsibly.** Do not open public issues for security problems. Follow
+ the [ASF security reporting process](https://www.apache.org/security/).
### High quality standards
-Because of ATR's critical nature, we maintain very high code quality standards. The review process may take longer than expected, and we may request extensive changes. Our goal is to keep ATR as secure and reliable as possible.
+Because of ATR's critical nature, we maintain very high code quality standards. The review process
+may take longer than expected, and we may request extensive changes. Our goal is to keep ATR as
+secure and reliable as possible.
### Access controls
-We strongly encourage all contributors to enable two-factor authentication on their GitHub accounts, preferably with a [passkey](https://en.wikipedia.org/wiki/WebAuthn#Passkey_branding).
+We strongly encourage all contributors to enable two-factor authentication on their GitHub accounts,
+preferably with a [passkey](https://en.wikipedia.org/wiki/WebAuthn#Passkey_branding).
## Getting help
-* **Mailing list:** [dev@tooling.apache.org](https://lists.apache.org/list.html?dev@tooling.apache.org) - Primary forum for development discussions
-* **Issue tracker:** [GitHub Issues](https://github.com/apache/tooling-trusted-releases/issues) - Comment on issues or PRs
+* **Mailing list:**
+ [dev@tooling.apache.org](https://lists.apache.org/list.html?dev@tooling.apache.org) - Primary
+ forum for development discussions
+* **Issue tracker:** [GitHub Issues](https://github.com/apache/tooling-trusted-releases/issues) -
+ Comment on issues or PRs
* **Slack:** [#apache-trusted-releases](https://the-asf.slack.com/archives/C049WADAAQG) on ASF Slack
* **Documentation:** The rest of the [Developer Guide](developer-guide)
### Alternative: email patches
-If you prefer not to use GitHub, you can [email patches](https://lists.apache.org/list.html?dev@tooling.apache.org) using standard Git patch formatting.
+If you prefer not to use GitHub, you can
+[email patches](https://lists.apache.org/list.html?dev@tooling.apache.org) using standard Git patch
+formatting.
diff --git a/atr/docs/index.md b/atr/docs/index.md
index 6458f64d..1d1cfc39 100644
--- a/atr/docs/index.md
+++ b/atr/docs/index.md
@@ -8,13 +8,13 @@ NOTE: This documentation is a work in progress.
* `1.` [Scope](scope)
* `2.` [Getting started](getting-started)
- * `2.1.` [Moving from the current process](moving-to-atr)
+ * `2.1.` [Moving to ATR](moving-to-atr)
* `3.` [Projects](projects)
* `3.1.` [Project configuration](project-configuration)
-* `4.` [Release managers](release-manager-setup)
+* `4.` [Release manager setup](release-manager-setup)
* `4.1.` [Signing artifacts](signing-artifacts)
* `4.2.` [Trusted Publishing](trusted-publishing)
-* `5.` [Making releases](release-process-description)
+* `5.` [Making releases](making-releases)
* `5.1.` [Compose phase](compose-phase)
* `5.1.1.` [Uploading files](uploading-files)
* `5.1.2.` [Checks](checks)
@@ -24,7 +24,7 @@ NOTE: This documentation is a work in progress.
* `5.2.1.` [Staging and voting](staging-and-voting)
* `5.3.` [Finish phase](finish-phase)
* `5.3.1.` [Promoting to release](promoting-to-release)
- * `5.4.` [Archiving and lifecycle](archiving-releases)
+ * `5.4.` [Archiving and lifecycle](archiving-and-lifecycle)
* `5.5.` [Podling releases](podling-releases)
* `6.` [Release catalog](release-catalog)
* `7.` [Developer guide](developer-guide)
@@ -50,3 +50,4 @@ NOTE: This documentation is a work in progress.
* `7.20.` [Resource management](resource-management)
* `7.21.` [SBOM architecture](sbom-architecture)
* `7.22.` [File handling](file-handling)
+* `8.` [Glossary](glossary)
diff --git a/atr/docs/input-validation.md b/atr/docs/input-validation.md
index a1c823e9..c437cd87 100644
--- a/atr/docs/input-validation.md
+++ b/atr/docs/input-validation.md
@@ -22,7 +22,9 @@
## Overview
-Input validation is critical for ATR's security posture. As a system that handles cryptographic signatures and release artifacts, ATR must ensure that all user input is properly validated before processing. This page documents the validation strategies and patterns used throughout the codebase.
+Input validation is critical for ATR's security posture. As a system that handles cryptographic
+signatures and release artifacts, ATR must ensure that all user input is properly validated before
+processing. This page documents the validation strategies and patterns used throughout the codebase.
## Defense in depth
@@ -31,20 +33,25 @@ ATR employs multiple layers of validation:
1. **Transport layer**: HTTPS required, enforced by httpd
2. **Request layer**: ATR enforces the request body limit set by `MAX_CONTENT_LENGTH`
3. **Form layer**: Pydantic models validate structure and types
-4. **Application layer**: Business logic validation in route handlers, interaction helpers, and storage writers
+4. **Application layer**: Business logic validation in route handlers, interaction helpers, and
+ storage writers
5. **Database layer**: SQLAlchemy ORM with parameterized queries, plus constraints
6. **Markdown layer**: Via `cmarkgfm`
7. **Output layer**: Jinja2 auto-escaping for HTML output
-Each layer provides independent protection, so a failure in one layer does not compromise the system.
+Each layer provides independent protection, so a failure in one layer does not compromise the
+system.
## Form validation with Pydantic
-All form inputs in ATR are validated through [Pydantic](https://docs.pydantic.dev/latest/) models defined in [`form.py`](/ref/atr/form.py). The base class for forms is [`Form`](/ref/atr/form.py) (Form), which extends Pydantic's `BaseModel`.
+All form inputs in ATR are validated through [Pydantic](https://docs.pydantic.dev/latest/) models
+defined in [`form.py`](/ref/atr/form.py). The base class for forms is [`Form`](/ref/atr/form.py)
+(Form), which extends Pydantic's `BaseModel`.
### Defining form fields
-Form fields are defined using Python type annotations and the [`label`](/ref/atr/form.py) (label) function:
+Form fields are defined using Python type annotations and the [`label`](/ref/atr/form.py) (label)
+function:
```python
class ExampleForm(Form):
@@ -53,7 +60,8 @@ class ExampleForm(Form):
email: EmailStr = label("Contact email", widget=Widget.EMAIL)
```
-The `label` function accepts a description (shown to users), optional documentation, and an optional widget hint for rendering.
+The `label` function accepts a description (shown to users), optional documentation, and an optional
+widget hint for rendering.
### Validation process
@@ -61,11 +69,13 @@ When a form is submitted, ATR:
1. Extracts form data from the request via [`quart_request`](/ref/atr/form.py) (quart_request)
2. Passes the data to the Pydantic model for validation
-3. If validation fails, collects errors via [`flash_error_data`](/ref/atr/form.py) (flash_error_data)
+3. If validation fails, collects errors via [`flash_error_data`](/ref/atr/form.py)
+ (flash_error_data)
4. Displays errors to the user with [`flash_error_summary`](/ref/atr/form.py) (flash_error_summary)
5. If validation succeeds, proceeds with the validated data
-Pydantic provides built-in validators for common types (strings, integers, emails, URLs) and supports custom validators via decorators.
+Pydantic provides built-in validators for common types (strings, integers, emails, URLs) and
+supports custom validators via decorators.
### Custom validators
@@ -86,7 +96,8 @@ class ReleaseForm(Form):
## CSRF protection
-All POST forms must include a CSRF token. The token is generated by [`csrf_input`](/ref/atr/form.py) (csrf_input) and validated automatically by Quart-WTF:
+All POST forms must include a CSRF token. The token is generated by [`csrf_input`](/ref/atr/form.py)
+(csrf_input) and validated automatically by Quart-WTF:
```python
def csrf_input() -> htm.VoidElement:
@@ -103,7 +114,9 @@ In templates, include the CSRF token in every form:
</form>
```
-The CSRF token is tied to the user's session and validated on form submission. Requests without a valid CSRF token are rejected. When using the form module renderer, the CSRF token is added automatically.
+The CSRF token is tied to the user's session and validated on form submission. Requests without a
+valid CSRF token are rejected. When using the form module renderer, the CSRF token is added
+automatically.
## Validation rules by input type
@@ -142,7 +155,8 @@ class LinkForm(Form):
### Version strings
-Version strings are validated according to project-specific patterns. The general pattern allows semantic versioning with optional suffixes:
+Version strings are validated according to project-specific patterns. The general pattern allows
+semantic versioning with optional suffixes:
```python
VERSION_PATTERN = re.compile(r"^[0-9]+\.[0-9]+.*$")
@@ -150,23 +164,31 @@ VERSION_PATTERN = re.compile(r"^[0-9]+\.[0-9]+.*$")
### Committee and project names
-Committee and project names are validated against the set of known committees and projects from LDAP and the ASF project database. Unknown names are rejected.
+Committee and project names are validated against the set of known committees and projects from LDAP
+and the ASF project database. Unknown names are rejected.
### File names
-Release upload paths use [`safe.RelPath`](/ref/atr/models/safe.py), which rejects absolute paths, directory traversal, null bytes and most dotfiles. These rules apply to every upload method, including rsync and SVN imports. For file content checks, see [File handling](file-handling).
+Release upload paths use [`safe.RelPath`](/ref/atr/models/safe.py), which rejects absolute paths,
+directory traversal, null bytes and most dotfiles. These rules apply to every upload method,
+including rsync and SVN imports. For file content checks, see [File handling](file-handling).
## Data integrity validation
-Beyond input validation, ATR performs data integrity validation on database records using [`validate.py`](/ref/atr/validate.py). This catches inconsistencies that may have been introduced by bugs, migrations, or manual database edits.
+Beyond input validation, ATR performs data integrity validation on database records using
+[`validate.py`](/ref/atr/validate.py). This catches inconsistencies that may have been introduced by
+bugs, migrations, or manual database edits.
### Committee validation
-Committee records are not created through a form. They are synced from LDAP and Whimsy by [`_update_committees`](/ref/atr/datasources/apache.py) (_update_committees), so their fields have no Pydantic input layer, and the data integrity validators are the main place each field is confirmed.
+Committee records are not created through a form. They are synced from LDAP and Whimsy by
+[`_update_committees`](/ref/atr/datasources/apache.py) (_update_committees), so their fields have no
+Pydantic input layer, and the data integrity validators are the main place each field is confirmed.
The [`committee`](/ref/atr/validate.py) (committee) function checks:
-* `key` must be a valid committee key (the [`safe.CommitteeKey`](/ref/atr/models/safe.py) (CommitteeKey) character set)
+* `key` must be a valid committee key (the [`safe.CommitteeKey`](/ref/atr/models/safe.py)
+ (CommitteeKey) character set)
* `name` must be set, trimmed, and not prefixed with "Apache "
* `committee_members`, `committers`, and `release_managers` entries must each look like an ASF UID
* `child_committees` must be empty (not used)
@@ -186,11 +208,18 @@ Per-field coverage:
### Project validation
-Projects do have an input layer. [`AddProjectForm`](/ref/atr/shared/projects.py) (AddProjectForm) validates the key and display name at creation, and [`EditVersionSchemeForm`](/ref/atr/shared/projects.py) (EditVersionSchemeForm) rejects a `version_pattern` or `cycle_match` that is not a valid regex (and a `cycle_match` with no capture group). Calver projects describe their cycles with a `calver_format` date format instead of a regex; see [Calver cycle formats](#calver-cycle-formats) belo [...]
+Projects do have an input layer. [`AddProjectForm`](/ref/atr/shared/projects.py) (AddProjectForm)
+validates the key and display name at creation, and
+[`EditVersionSchemeForm`](/ref/atr/shared/projects.py) (EditVersionSchemeForm) rejects a
+`version_pattern` or `cycle_match` that is not a valid regex (and a `cycle_match` with no capture
+group). Calver projects describe their cycles with a `calver_format` date format instead of a regex;
+see [Calver cycle formats](#calver-cycle-formats) below. The data integrity validators mirror these
+and cover fields that have no form.
The [`project`](/ref/atr/validate.py) (project) function checks:
-* `key` must be a valid project key (the [`safe.ProjectKey`](/ref/atr/models/safe.py) (ProjectKey) character set)
+* `key` must be a valid project key (the [`safe.ProjectKey`](/ref/atr/models/safe.py) (ProjectKey)
+ character set)
* `category` must use comma-separated labels without colons
* `committee_key` must be set (project must be linked to a committee)
* `created` timestamp must be in the past
@@ -222,7 +251,8 @@ Per-field coverage:
#### Calver cycle formats
-Calver projects declare the shape of their version strings with a date format string rather than a regex. The format is a sequence of tokens with literal separators between them:
+Calver projects declare the shape of their version strings with a date format string rather than a
+regex. The format is a sequence of tokens with literal separators between them:
| Token | Matches | Role |
| --- | --- | --- |
@@ -231,7 +261,10 @@ Calver projects declare the shape of their version strings with a date format st
| `DD` / `D` | zero-padded or 1-2 digit day | ordering |
| `N` | a numeric serial (a patch ordinal within a calendar line) | ordering |
-Wrap the part of the version that names the cycle in parentheses. A format with no parentheses keeps a single release track; one with a parenthesised span splits releases into one cycle per matched value. Trailing tokens are optional, so one format covers mixed-granularity histories - `YYYYMMDD` matches both `20130710` and `201407`, reading the missing day as zero.
+Wrap the part of the version that names the cycle in parentheses. A format with no parentheses keeps
+a single release track; one with a parenthesised span splits releases into one cycle per matched
+value. Trailing tokens are optional, so one format covers mixed-granularity histories - `YYYYMMDD`
+matches both `20130710` and `201407`, reading the missing day as zero.
Examples:
@@ -264,53 +297,97 @@ async for divergence in validate.everything(data):
print(f"{divergence.source}: {divergence.divergence}")
```
-These validators are complementary to the live checks described below. Data integrity validation inspects stored records for drift or corruption. Business logic validation stops inconsistent actions before ATR accepts them.
+These validators are complementary to the live checks described below. Data integrity validation
+inspects stored records for drift or corruption. Business logic validation stops inconsistent
+actions before ATR accepts them.
## Business logic validation
-Field validation is only the first step. ATR also checks whether an action still makes sense in the wider state of the release. These rules compare data across releases, revisions, committees, queued tasks, stored policy, and message delivery settings. They live mainly in [`interaction.py`](/ref/atr/db/interaction.py), storage writers, [`mail.py`](/ref/atr/mail.py), and shared helpers in [`util.py`](/ref/atr/util.py).
+Field validation is only the first step. ATR also checks whether an action still makes sense in the
+wider state of the release. These rules compare data across releases, revisions, committees, queued
+tasks, stored policy, and message delivery settings. They live mainly in
+[`interaction.py`](/ref/atr/db/interaction.py), storage writers, [`mail.py`](/ref/atr/mail.py), and
+shared helpers in [`util.py`](/ref/atr/util.py).
### Vote initiation
-Before a vote can start, [`release_ready_to_start_vote`](/ref/atr/db/interaction.py) (release_ready_to_start_vote) checks that the release still has a latest revision and that the release is still attached to a committee. It also checks that the requested vote mode agrees with the stored project policy, so ATR does not let a user start a manual vote for a project configured for standard voting, or the reverse.
-
-That same validation step then checks the surrounding release state. The user must be a release manager for the project, meaning a PMC member or a designated committer release manager, or an ATR administrator. The latest revision must have no blocker results, and the release candidate draft must contain files. When ATR actually promotes the release into the voting phase, [`promote_to_candidate`](/ref/atr/storage/writers/release.py) (promote_to_candidate) adds a task state check and refus [...]
-
-The same writer atomically enforces that the transition can only happen from the expected latest revision, using a caller supplied expected revision and a latest revision subquery in the UPDATE statement as a compare-and-swap guard. This binds vote initiation to release phase, revision state, policy, committee membership, check results, file storage, and task execution rather than to form fields alone.
+Before a vote can start, [`release_ready_to_start_vote`](/ref/atr/db/interaction.py)
+(release_ready_to_start_vote) checks that the release still has a latest revision and that the
+release is still attached to a committee. It also checks that the requested vote mode agrees with
+the stored project policy, so ATR does not let a user start a manual vote for a project configured
+for standard voting, or the reverse.
+
+That same validation step then checks the surrounding release state. The user must be a release
+manager for the project, meaning a PMC member or a designated committer release manager, or an ATR
+administrator. The latest revision must have no blocker results, and the release candidate draft
+must contain files. When ATR actually promotes the release into the voting phase,
+[`promote_to_candidate`](/ref/atr/storage/writers/release.py) (promote_to_candidate) adds a task
+state check and refuses the transition while queued or active tasks still exist for that revision.
+
+The same writer atomically enforces that the transition can only happen from the expected latest
+revision, using a caller supplied expected revision and a latest revision subquery in the UPDATE
+statement as a compare-and-swap guard. This binds vote initiation to release phase, revision state,
+policy, committee membership, check results, file storage, and task execution rather than to form
+fields alone.
### Trusted Publishing
-Trusted Publishing settings are validated when they are stored and again when they are used. On write, [`validate_trusted_publishing_constraints`](/ref/atr/util.py) (validate_trusted_publishing_constraints) and [`policy.py`](/ref/atr/storage/writers/policy.py) normalize the configured repository name, branch, and workflow paths and reject incomplete or impossible combinations. A workflow path cannot be stored without a repository name. A branch cannot be stored without a repository name. [...]
-
-At request time, [`_trusted_project_checks`](/ref/atr/db/interaction.py) (_trusted_project_checks) and [`_trusted_project`](/ref/atr/db/interaction.py) (_trusted_project) compare the GitHub token claims with the stored policy. The repository must be under `apache`. The workflow reference must begin with that same repository, must include a git ref, and must resolve to a workflow path under `.github/workflows/`. ATR then looks up the project by repository name and by the phase specific wo [...]
+Trusted Publishing settings are validated when they are stored and again when they are used. On
+write, [`validate_trusted_publishing_constraints`](/ref/atr/util.py)
+(validate_trusted_publishing_constraints) and [`policy.py`](/ref/atr/storage/writers/policy.py)
+normalize the configured repository name, branch, and workflow paths and reject incomplete or
+impossible combinations. A workflow path cannot be stored without a repository name. A branch cannot
+be stored without a repository name. Repository names are stored without a slash. Every workflow
+path must begin with `.github/workflows/`.
+
+At request time, [`_trusted_project_checks`](/ref/atr/db/interaction.py) (_trusted_project_checks)
+and [`_trusted_project`](/ref/atr/db/interaction.py) (_trusted_project) compare the GitHub token
+claims with the stored policy. The repository must be under `apache`. The workflow reference must
+begin with that same repository, must include a git ref, and must resolve to a workflow path under
+`.github/workflows/`. ATR then looks up the project by repository name and by the phase specific
+workflow path that was stored for compose, vote, or finish. Distribution callbacks add one more
+contextual check in [`trusted_jwt_for_dist`](/ref/atr/db/interaction.py) (trusted_jwt_for_dist),
+which refuses the request unless the named release exists and is in the expected phase for the
+requested operation. The cryptographic validation of the token itself is described in
+[authentication security](authentication-security#github-actions-oidc-trusted-publishing).
### Email delivery
-Email validation in ATR also depends on context. [`validate_email_recipients`](/ref/atr/util.py) (validate_email_recipients) requires a primary recipient and rejects duplicate addresses across `To`, `Cc`, and `Bcc`. [`send`](/ref/atr/mail.py) (send) then requires the sender to use `@apache.org`, and [`_validate_recipient`](/ref/atr/mail.py) (_validate_recipient) rejects any envelope recipient outside `@apache.org` and its subdomains. This means that vote and release mail must go to ASF c [...]
+Email validation in ATR also depends on context. [`validate_email_recipients`](/ref/atr/util.py)
+(validate_email_recipients) requires a primary recipient and rejects duplicate addresses across
+`To`, `Cc`, and `Bcc`. [`send`](/ref/atr/mail.py) (send) then requires the sender to use
+`@apache.org`, and [`_validate_recipient`](/ref/atr/mail.py) (_validate_recipient) rejects any
+envelope recipient outside `@apache.org` and its subdomains. This means that vote and release mail
+must go to ASF controlled addresses even if the address itself would be syntactically valid.
## Output encoding
-ATR uses [Jinja2](https://jinja.palletsprojects.com/) for templating with auto-escaping enabled by default. All variables rendered in templates are automatically HTML-escaped:
+ATR uses [Jinja2](https://jinja.palletsprojects.com/) for templating with auto-escaping enabled by
+default. All variables rendered in templates are automatically HTML-escaped:
```html
<!-- This is safe; user_input is escaped -->
<p>Hello, {{ user_input }}</p>
```
-When HTML output is intentionally generated (e.g., via htpy), it must be explicitly marked safe using `markupsafe.Markup`:
+When HTML output is intentionally generated (e.g., via htpy), it must be explicitly marked safe
+using `markupsafe.Markup`:
```python
import markupsafe
safe_html = markupsafe.Markup("<strong>Bold</strong>")
```
-For Markdown rendering, ATR uses `markupsafe.Markup(cmarkgfm.github_flavored_markdown_to_html(markdown_text))`, which safely filters dangerous input before rendering.
+For Markdown rendering, ATR uses
+`markupsafe.Markup(cmarkgfm.github_flavored_markdown_to_html(markdown_text))`, which safely filters
+dangerous input before rendering.
Never mark user-controlled data as safe without proper sanitization.
## File upload security
-See [File handling](file-handling) for upload limits, format checks, archive quarantine and downloads.
+See [File handling](file-handling) for upload limits, format checks, archive quarantine and
+downloads.
## Injection prevention
@@ -343,9 +420,14 @@ Path traversal is prevented by:
* Validating that paths remain within expected directories
* Rejecting file names containing path separators
-For form fields that accept file or directory paths, always use `form.RelPath` (or `form.RelPathList` for multiple paths). These types automatically call [`to_relpath()`](/ref/atr/form.py) (to_relpath), which rejects path traversal sequences, absolute paths, and empty values at the Pydantic validation layer. This is the preferred approach because it prevents path traversal before the handler code runs.
+For form fields that accept file or directory paths, always use `form.RelPath` (or
+`form.RelPathList` for multiple paths). These types automatically call
+[`to_relpath()`](/ref/atr/form.py) (to_relpath), which rejects path traversal sequences, absolute
+paths, and empty values at the Pydantic validation layer. This is the preferred approach because it
+prevents path traversal before the handler code runs.
-For cases outside of form validation (e.g., URL route parameters), use [`form.to_relpath()`](/ref/atr/form.py) (to_relpath) directly, or validate manually:
+For cases outside of form validation (e.g., URL route parameters), use
+[`form.to_relpath()`](/ref/atr/form.py) (to_relpath) directly, or validate manually:
```python
import pathlib
@@ -359,7 +441,8 @@ if not user_path.resolve().is_relative_to(base.resolve()):
### Command injection
-ATR safeguards against command injection as much as possible. Where external commands are necessary (e.g., GPG operations), arguments are passed as lists, never as shell strings:
+ATR safeguards against command injection as much as possible. Where external commands are necessary
+(e.g., GPG operations), arguments are passed as lists, never as shell strings:
```python
import subprocess
@@ -374,10 +457,14 @@ subprocess.run(f"gpg --verify {signature_file} {data_file}", shell=True)
## Implementation references
* [`form.py`](/ref/atr/form.py) - Form definitions, validation, and rendering
-* [`db/interaction.py`](/ref/atr/db/interaction.py) - Contextual validation for vote initiation and Trusted Publishing
-* [`storage/writers/policy.py`](/ref/atr/storage/writers/policy.py) - Trusted Publishing policy validation and normalisation
-* [`storage/writers/release.py`](/ref/atr/storage/writers/release.py) - Release phase transition checks and task state guards
+* [`db/interaction.py`](/ref/atr/db/interaction.py) - Contextual validation for vote initiation and
+ Trusted Publishing
+* [`storage/writers/policy.py`](/ref/atr/storage/writers/policy.py) - Trusted Publishing policy
+ validation and normalisation
+* [`storage/writers/release.py`](/ref/atr/storage/writers/release.py) - Release phase transition
+ checks and task state guards
* [`validate.py`](/ref/atr/validate.py) - Data integrity validators
-* [`util.py`](/ref/atr/util.py) - Shared validation helpers including path handling, recipients, and Trusted Publishing
+* [`util.py`](/ref/atr/util.py) - Shared validation helpers including path handling, recipients, and
+ Trusted Publishing
* [`mail.py`](/ref/atr/mail.py) - Sender and recipient domain enforcement
* [`htm.py`](/ref/atr/htm.py) - HTML generation utilities
diff --git a/atr/docs/license-checks.md b/atr/docs/license-checks.md
index 27fd6a27..b42f7496 100644
--- a/atr/docs/license-checks.md
+++ b/atr/docs/license-checks.md
@@ -26,7 +26,8 @@ When you configure a release, you can choose which checks run on **source artifa
## Automatically excluded patterns
-These file patterns are automatically treated as "generated" and are ignored by **both** the RAT check and the lightweight check:
+These file patterns are automatically treated as "generated" and are ignored by **both** the RAT
+check and the lightweight check:
* `**/*.bundle.js`
* `**/*.chunk.js`
@@ -54,11 +55,12 @@ You can define your own exclusions by adding a `.rat-excludes` file to the archi
> [!IMPORTANT]
> If a `.rat-excludes` file exists, the **standard exclusions are ignored**.
-**Scan root behavior**:
-You can only have one `.rat-excludes` file. The folder it's in becomes the **scan root**.
+**Scan root behavior**: You can only have one `.rat-excludes` file. The folder it's in becomes the
+**scan root**.
* Everything you want checked must be inside this scan root (or subfolders).
-* Files outside this root might cause errors or get ignored in weird ways. It's best to just put `.rat-excludes` at the very top of your archive.
+* Files outside this root might cause errors or get ignored in weird ways. It's best to just put
+ `.rat-excludes` at the very top of your archive.
## Lightweight license check
@@ -66,7 +68,8 @@ This check looks at source files to see if they have valid license headers.
### Accepted headers
-ATR accepts the standard ASF source header or the [SPDX form permitted by ASF policy](https://www.apache.org/legal/src-headers.html#is-an-spdx-form-of-the-source-header-acceptable):
+ATR accepts the standard ASF source header or the
+[SPDX form permitted by ASF policy](https://www.apache.org/legal/src-headers.html#is-an-spdx-form-of-the-source-header-acceptable):
```text
SPDX-License-Identifier: Apache-2.0
@@ -74,7 +77,10 @@ SPDX-FileCopyrightText: See the NOTICE file distributed with this work for addit
SPDX-FileContributor: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements
```
-All three fields must appear within the first 4KB, each on one line, in any order. Common comment prefixes, differences in case, and extra spaces or tabs are accepted. The identifier line may end with an inline block closer (`*/`, `-->`, or `#>`). A bare identifier, other license identifiers, compound license expressions, and wrapped field values are not recognized by this check.
+All three fields must appear within the first 4KB, each on one line, in any order. Common comment
+prefixes, differences in case, and extra spaces or tabs are accepted. The identifier line may end
+with an inline block closer (`*/`, `-->`, or `#>`). A bare identifier, other license identifiers,
+compound license expressions, and wrapped field values are not recognized by this check.
### Content-based exclusions
@@ -85,12 +91,13 @@ Files are skipped (considered generated) if the first 4KB of the file contains o
### Included file types
-Unlike RAT, the lightweight check uses an allowlist of file extensions (e.g., `.js`, `.py`, `.java`, etc.). If a file extension isn't in the list, it gets ignored by default.
+Unlike RAT, the lightweight check uses an allowlist of file extensions (e.g., `.js`, `.py`, `.java`,
+etc.). If a file extension isn't in the list, it gets ignored by default.
## Project policy exclusions
-On top of file-based exclusions, you can configure exclusions right in the ATR web interface.
-When editing a project, look for the **License Check Exclusions** fields:
+On top of file-based exclusions, you can configure exclusions right in the ATR web interface. When
+editing a project, look for the **License Check Exclusions** fields:
* **RAT Exclusions**: newline-separated patterns to exclude from RAT checks.
* **Lightweight Exclusions**: newline-separated patterns to exclude from lightweight checks.
@@ -99,7 +106,9 @@ These settings are stored on the project, but individual patterns may be scoped
### Scoping lightweight excludes to one archive
-Lightweight source excludes use `.gitignore` syntax and match `/<archive-filename>/<path inside the archive>`. Use an unrooted pattern (no leading `/`) to apply to all source archives, or prefix with `/` and an archive filename glob to target one archive:
+Lightweight source excludes use `.gitignore` syntax and match
+`/<archive-filename>/<path inside the archive>`. Use an unrooted pattern (no leading `/`) to apply
+to all source archives, or prefix with `/` and an archive filename glob to target one archive:
```text
**/vendor/**
diff --git a/atr/docs/making-releases.md b/atr/docs/making-releases.md
new file mode 100644
index 00000000..97dcb5aa
--- /dev/null
+++ b/atr/docs/making-releases.md
@@ -0,0 +1,41 @@
+# 5. Making releases
+
+**Up**: [Documentation](.)
+
+**Prev**: `4.2.` [Trusted Publishing](trusted-publishing)
+
+**Next**: `5.1.` [Compose phase](compose-phase)
+
+**Pages**:
+
+* `5.1.` [Compose phase](compose-phase)
+* `5.2.` [Vote phase](vote-phase)
+* `5.3.` [Finish phase](finish-phase)
+* `5.4.` [Archiving and lifecycle](archiving-and-lifecycle)
+* `5.5.` [Podling releases](podling-releases)
+
+**Sections**:
+
+* [Releases](#releases)
+
+## Releases
+
+The ASF releases open source software under its
+[release policy](https://www.apache.org/legal/release-policy.html). The ATR platform helps PMCs
+release their project's artifacts through several stages:
+
+1. ***Candidate***. Guiding a ***Release Candidate*** through the phases of ASF Governance to make a
+ Release is the primary purpose of the ATR platform.
+ * ***Compose***. ***Release Artifacts*** are assembled and checked for compliance, and the
+ Release Manager iterates on them until the Candidate is ready. See
+ [Compose phase](compose-phase).
+ * ***Vote***. The PMC votes on the Candidate, which stays in ATR for the duration of the vote.
+ See [Vote phase](vote-phase).
+ * ***Finish***. The approved Release Artifacts are committed to `svn:dist:release`, and the
+ release is announced once they have reached the download servers. See
+ [Finish phase](finish-phase).
+2. ***Released***. Published releases are active and cataloged, and available both via a standard
+ catalog API and at the proper URLs on the CDN and download servers. Releases made through the
+ legacy methods that bypass ATR are also cataloged.
+3. ***Archived***. All cataloged releases may be archived using the ATR platform or by direct
+ removal from `svn:dist:release`. See [Archiving and lifecycle](archiving-and-lifecycle).
diff --git a/atr/docs/moving-to-atr.md b/atr/docs/moving-to-atr.md
index 5934fc0f..995321b1 100644
--- a/atr/docs/moving-to-atr.md
+++ b/atr/docs/moving-to-atr.md
@@ -1,4 +1,4 @@
-# 2.1. Moving from the current process
+# 2.1. Moving to ATR
**Up**: `2.` [Getting started](getting-started)
@@ -27,8 +27,9 @@ links to the relevant page.
* **Staging in `dist/dev`.** The candidate is held by ATR for the whole of the compose and vote
phases, and ATR is the staging location that voters download from. You can still
[import files](uploading-files#svn-import) from `dist/dev` if that suits you, but you do not need
- to use it. See [Where release candidates are staged](staging-and-voting#where-release-candidates-are-staged)
- and [The earlier dist/dev workflow](staging-and-voting#the-earlier-distdev-workflow).
+ to use it. See
+ [Where release candidates are staged](staging-and-voting#where-release-candidates-are-staged) and
+ [The earlier dist/dev workflow](staging-and-voting#the-earlier-distdev-workflow).
* **The vote email and tally.** ATR sends the vote email, linking to the candidate page and the
committee's `KEYS` file, and tallies the votes from the thread. The release manager should still
check the tally against the thread before resolving the vote. Projects can also choose to have
@@ -39,18 +40,18 @@ links to the relevant page.
[Promoting to release](promoting-to-release).
* **The announcement.** ATR sends the announcement email, and only once the artifacts have reached
the download servers.
-* **Removing superseded releases.** ATR can archive the prior release in the same cycle when the
- new one is announced, or you can archive a release from its page. See
- [Archiving and lifecycle](archiving-releases).
+* **Removing superseded releases.** ATR can archive the prior release in the same cycle when the new
+ one is announced, or you can archive a release from its page. See
+ [Archiving and lifecycle](archiving-and-lifecycle).
## What stays the same
-* The PMC still votes on each release, the vote thread is still on the project's mailing list,
- and whose votes are binding is still a matter of [ASF policy](https://www.apache.org/legal/release-policy.html#release-approval). Podlings still vote twice, as described in
- [Podling releases](podling-releases).
-* Each release manager still signs the artifacts with their own OpenPGP key, and the committee
- still publishes a single `KEYS` file at `svn:dist:release`. See [The KEYS file](#the-keys-file)
- below.
+* The PMC still votes on each release, the vote thread is still on the project's mailing list, and
+ whose votes are binding is still a matter of
+ [ASF policy](https://www.apache.org/legal/release-policy.html#release-approval). Podlings still
+ vote twice, as described in [Podling releases](podling-releases).
+* Each release manager still signs the artifacts with their own OpenPGP key, and the committee still
+ publishes a single `KEYS` file at `svn:dist:release`. See [The KEYS file](#the-keys-file) below.
* Published releases still live in `svn:dist:release`, are served from `downloads.apache.org`, and
are picked up by `archive.apache.org` automatically.
* Distributing to package platforms such as Maven Central, PyPI, or Docker Hub is still up to the
@@ -59,17 +60,18 @@ links to the relevant page.
there without ATR is added to the [Release catalog](release-catalog), and removing a release's
files archives it.
-One thing does change for release managers: a PMC member can designate a committer who is not on
-the PMC as a release manager. See [Release managers](release-manager-setup).
+One thing does change for release managers: a PMC member can designate a committer who is not on the
+PMC as a release manager. See [Release manager setup](release-manager-setup).
## Before your first release
Work through [Getting started](getting-started) first, which covers MFA, your signing key, and
upload credentials. In addition, as a PMC coming from the traditional process, check the following.
-* **Your seeded projects.** ATR seeds each committee's projects from DOAP files and observed
- release activity, so your projects are probably already there. Check that the list reflects your
- true number of projects. See [Creating and maintaining projects](projects#creating-and-maintaining-projects).
+* **Your seeded projects.** ATR seeds each committee's projects from DOAP files and observed release
+ activity, so your projects are probably already there. Check that the list reflects your true
+ number of projects. See
+ [Creating and maintaining projects](projects#creating-and-maintaining-projects).
* **Your catalog.** The [Release catalog](release-catalog) was built from the files in the
distribution area and archive, and can attach releases to the wrong project or read a version
wrongly. Review your committee's pages and tell us what needs correcting, as described in
@@ -80,22 +82,39 @@ upload credentials. In addition, as a PMC coming from the traditional process, c
* **Scripts that fetch from SVN.** If your project has scripts that download a candidate from
`dist/dev` to check it, point them at ATR instead. See
[Verifying artifacts during a vote](staging-and-voting#verifying-artifacts-during-a-vote).
-* **Your vote email template.** If you have your own template, it should link to the ATR
- candidate page rather than to a copy in `dist/dev`. See
+* **Your vote email template.** If you have your own template, it should link to the ATR candidate
+ page rather than to a copy in `dist/dev`. See
[What to link in a vote announcement](staging-and-voting#what-to-link-in-a-vote-announcement).
-* **Release scripts that move files to `dist/release`.** These are no longer needed, and should
- not run alongside ATR's own publication. Check where your project's files should land, set by
- the download path suffix described in [Promoting to release](promoting-to-release#publishing-to-asf-distribution-area).
+* **Release scripts that move files to `dist/release`.** These are no longer needed, and should not
+ run alongside ATR's own publication. Check where your project's files should land, set by the
+ download path suffix described in
+ [Promoting to release](promoting-to-release#publishing-to-asf-distribution-area).
## The KEYS file
-Signing releases is done with individual keys, as described in [Signing artifacts](signing-artifacts). Separately, each committee publishes a single [`KEYS` file](https://infra.apache.org/release-signing.html#keys-policy) listing the public keys that its release managers sign with. The file lives at `https://dist.apache.org/repos/dist/release/<committee>/KEYS`, is managed independently of any individual release, and is what downstream users fetch to verify release signatures. When you up [...]
-
-Committee members choose how the file is kept in step with ATR, using the KEYS file management setting on the committee's page. There are three modes:
-
-* **Automatically update the committee's KEYS file.** ATR owns the file. Whenever the committee's keys change in ATR, ATR regenerates the `KEYS` file and commits it to SVN. This is the simplest option if the committee manages its keys in ATR.
-* **Automatically import changes to the KEYS file made in SVN.** SVN owns the file, and this is the default. ATR watches the committee's `KEYS` file in SVN and imports updates to it, but never writes back. In this mode the committee's keys are read-only in ATR, so uploads, associations, and deletions for the committee are refused; make the change in SVN instead.
-* **Manually upload KEYS files in ATR.** ATR holds the keys, but commits to SVN only on an explicit request. The committee page offers two actions: import keys from an uploaded `KEYS` file, or regenerate the published file from the keys ATR already holds. Either publishes the result to SVN. Other key changes are not published until then, so the file in SVN can lag what ATR holds.
+Signing releases is done with individual keys, as described in
+[Signing artifacts](signing-artifacts). Separately, each committee publishes a single
+[`KEYS` file](https://infra.apache.org/release-signing.html#keys-policy) listing the public keys
+that its release managers sign with. The file lives at
+`https://dist.apache.org/repos/dist/release/<committee>/KEYS`, is managed independently of any
+individual release, and is what downstream users fetch to verify release signatures. When you upload
+your key to ATR and associate it with a committee, it becomes part of the set that ATR holds for
+that committee's `KEYS` file.
+
+Committee members choose how the file is kept in step with ATR, using the KEYS file management
+setting on the committee's page. There are three modes:
+
+* **Automatically update the committee's KEYS file.** ATR owns the file. Whenever the committee's
+ keys change in ATR, ATR regenerates the `KEYS` file and commits it to SVN. This is the simplest
+ option if the committee manages its keys in ATR.
+* **Automatically import changes to the KEYS file made in SVN.** SVN owns the file, and this is the
+ default. ATR watches the committee's `KEYS` file in SVN and imports updates to it, but never
+ writes back. In this mode the committee's keys are read-only in ATR, so uploads, associations, and
+ deletions for the committee are refused; make the change in SVN instead.
+* **Manually upload KEYS files in ATR.** ATR holds the keys, but commits to SVN only on an explicit
+ request. The committee page offers two actions: import keys from an uploaded `KEYS` file, or
+ regenerate the published file from the keys ATR already holds. Either publishes the result to SVN.
+ Other key changes are not published until then, so the file in SVN can lag what ATR holds.
| | The keys are managed... | ATR commits the file to SVN... | ATR imports changes from SVN... |
| --- | --- | --- | --- |
@@ -103,6 +122,13 @@ Committee members choose how the file is kept in step with ATR, using the KEYS f
| Automatically import (default) | in SVN | never | when the file is updated |
| Manually upload | in ATR | when you upload or regenerate | no |
-Changing the mode does not, of itself, delete any keys from ATR. Switching to the import mode starts an import of the current file in SVN, however, which can remove keys from the committee that the file does not contain. A key that has signed artifacts catalogued by ATR is never removed this way: it stays associated with the committee, marked on the committee page as missing from SVN, until it reappears in the file or the situation is resolved by hand. Deleting the `KEYS` file in SVN doe [...]
+Changing the mode does not, of itself, delete any keys from ATR. Switching to the import mode starts
+an import of the current file in SVN, however, which can remove keys from the committee that the
+file does not contain. A key that has signed artifacts catalogued by ATR is never removed this way:
+it stays associated with the committee, marked on the committee page as missing from SVN, until it
+reappears in the file or the situation is resolved by hand. Deleting the `KEYS` file in SVN does not
+remove any keys either. Switching to either of the other two modes does not publish anything; the
+file in SVN changes only on the triggers described above.
-Whichever mode is chosen, the public keys of any keypairs used to sign a release must be present in the committee's `KEYS` file before you publish signed artifacts.
+Whichever mode is chosen, the public keys of any keypairs used to sign a release must be present in
+the committee's `KEYS` file before you publish signed artifacts.
diff --git a/atr/docs/overview-of-the-code.md b/atr/docs/overview-of-the-code.md
index 18d148a1..fb82fd26 100644
--- a/atr/docs/overview-of-the-code.md
+++ b/atr/docs/overview-of-the-code.md
@@ -18,64 +18,159 @@
## Introduction
-This page is a high level view of the ATR code. References to symbols in this section are given without their `atr.` prefix, for brevity, and are linked to the respective source code. You should understand e.g. [`server.app`](/ref/atr/server.py) (app) to mean `atr.server.app`.
+This page is a high level view of the ATR code. References to symbols in this section are given
+without their `atr.` prefix, for brevity, and are linked to the respective source code. You should
+understand e.g. [`server.app`](/ref/atr/server.py) (app) to mean `atr.server.app`.
## Hypercorn and ASGI
-ATR is an [ASFQuart](https://github.com/apache/infrastructure-asfquart) application, running in [Hypercorn](https://hypercorn.readthedocs.io/en/latest/index.html). The entry point for Hypercorn is [`server.app`](/ref/atr/server.py) (app), which is then called with a few standard arguments [as per the ASGI specification](https://asgi.readthedocs.io/en/latest/specs/main.html#overview). We create the `app` object using the following code:
+ATR is an [ASFQuart](https://github.com/apache/infrastructure-asfquart) application, running in
+[Hypercorn](https://hypercorn.readthedocs.io/en/latest/index.html). The entry point for Hypercorn is
+[`server.app`](/ref/atr/server.py) (app), which is then called with a few standard arguments
+[as per the ASGI specification](https://asgi.readthedocs.io/en/latest/specs/main.html#overview). We
+create the `app` object using the following code:
```python
app = create_app(config.get())
```
-The [`server.create_app`](/ref/atr/server.py) (create_app) function performs a lot of setup, and if you're interested in how the server works then you can read it and the functions it calls to understand the process further. In general, however, when developing ATR we do not make modifications at the ASFQuart, Quart, and Hypercorn levels very often.
+The [`server.create_app`](/ref/atr/server.py) (create_app) function performs a lot of setup, and if
+you're interested in how the server works then you can read it and the functions it calls to
+understand the process further. In general, however, when developing ATR we do not make
+modifications at the ASFQuart, Quart, and Hypercorn levels very often.
## Routes and database
-Users request ATR pages over HTTPS, and the ATR server processes those requests in route handlers. Most of those handlers are in [`get`](/ref/atr/get/) and [`post`](/ref/atr/post/), with some helper code in [`shared`](/ref/atr/shared/). What each handler does varies, of course, from handler to handler, but most perform at least one access to the ATR SQLite database.
-
-The path of the SQLite database is configured in [`config.AppConfig.SQLITE_DB_PATH`](/ref/atr/config.py) (SQLITE_DB_PATH) by default, and will usually appear as `state/atr.db` with related `shm` and `wal` files. We do not expect ATR to have so many users that we need to scale beyond SQLite.
-
-We use [SQLModel](https://sqlmodel.tiangolo.com/), an ORM utilising [Pydantic](https://docs.pydantic.dev/latest/) and [SQLAlchemy](https://www.sqlalchemy.org/), to create Python models for the ATR database. The core models file is [`models.sql`](/ref/atr/models/sql.py). The most important individual SQLite models in this module are [`Committee`](/ref/atr/models/sql.py) (Committee), [`Project`](/ref/atr/models/sql.py) (Project), and [`Release`](/ref/atr/models/sql.py) (Release).
-
-It is technically possible to interact with SQLite directly, but we do not do that in the ATR source. We use various interfaces in [`db`](/ref/atr/db/__init__.py) for reads, and interfaces in [`storage`](/ref/atr/storage/) for writes. We plan to move the `db` code into `storage` too eventually, because `storage` is designed to have read components and write components. There is also a legacy [`db.interaction`](/ref/atr/db/interaction.py) module which we plan to migrate into `storage`.
-
-These interfaces, including route handlers in [`get`](/ref/atr/get/), [`post`](/ref/atr/post/), and [`shared`](/ref/atr/shared/), along with [`models.sql`](/ref/atr/models/sql.py) and [`storage`](/ref/atr/storage/), are where the majority of activity happens when developing ATR.
+Users request ATR pages over HTTPS, and the ATR server processes those requests in route handlers.
+Most of those handlers are in [`get`](/ref/atr/get/) and [`post`](/ref/atr/post/), with some helper
+code in [`shared`](/ref/atr/shared/). What each handler does varies, of course, from handler to
+handler, but most perform at least one access to the ATR SQLite database.
+
+The path of the SQLite database is configured in
+[`config.AppConfig.SQLITE_DB_PATH`](/ref/atr/config.py) (SQLITE_DB_PATH) by default, and will
+usually appear as `state/atr.db` with related `shm` and `wal` files. We do not expect ATR to have so
+many users that we need to scale beyond SQLite.
+
+We use [SQLModel](https://sqlmodel.tiangolo.com/), an ORM utilising
+[Pydantic](https://docs.pydantic.dev/latest/) and [SQLAlchemy](https://www.sqlalchemy.org/), to
+create Python models for the ATR database. The core models file is
+[`models.sql`](/ref/atr/models/sql.py). The most important individual SQLite models in this module
+are [`Committee`](/ref/atr/models/sql.py) (Committee), [`Project`](/ref/atr/models/sql.py)
+(Project), and [`Release`](/ref/atr/models/sql.py) (Release).
+
+It is technically possible to interact with SQLite directly, but we do not do that in the ATR
+source. We use various interfaces in [`db`](/ref/atr/db/__init__.py) for reads, and interfaces in
+[`storage`](/ref/atr/storage/) for writes. We plan to move the `db` code into `storage` too
+eventually, because `storage` is designed to have read components and write components. There is
+also a legacy [`db.interaction`](/ref/atr/db/interaction.py) module which we plan to migrate into
+`storage`.
+
+These interfaces, including route handlers in [`get`](/ref/atr/get/), [`post`](/ref/atr/post/), and
+[`shared`](/ref/atr/shared/), along with [`models.sql`](/ref/atr/models/sql.py) and
+[`storage`](/ref/atr/storage/), are where the majority of activity happens when developing ATR.
## User interface
-ATR provides a web interface for users to interact with the platform, and the implementation of that interface is split across several modules. The web interface uses server-side rendering almost entirely, where HTML is generated on the server and sent to the browser.
-
-The template system in ATR is [Jinja2](https://jinja.palletsprojects.com/), always accessed through the ATR [`template`](/ref/atr/template.py) module. Template files in Jinja2 syntax are stored in [`templates/`](/ref/atr/templates/), and route handlers render them using the asynchronous [`template.render`](/ref/atr/template.py) (render) function.
-
-Template rendering can be slow if templates are loaded from disk on every request. To address this, we use [`preload`](/ref/atr/preload.py) to load all templates into memory before the server starts serving requests. The [`preload.setup_template_preloading`](/ref/atr/preload.py) (setup_template_preloading) function registers a startup hook that finds and caches every template file.
-
-The ATR user interface includes many HTML forms. We use [Pydantic](https://docs.pydantic.dev/latest/) for form handling, accessed through the ATR [`form`](/ref/atr/form.py) module. The [`form.Form`](/ref/atr/form.py) (Form) base class extends `pydantic.BaseModel` to provide form-specific functionality. Each form field is defined using Pydantic type annotations along with the [`form.label`](/ref/atr/form.py) (label) function for metadata like labels and documentation. Validation happens a [...]
-
-In addition to templates, we sometimes need to generate HTML programmatically in Python. For this we use [htpy](https://htpy.dev/), another third party library, for building HTML using Python syntax. The ATR [`htm`](/ref/atr/htm.py) module extends htpy with a [`Block`](/ref/atr/htm.py) (Block) class that makes it easier to build complex HTML structures incrementally. Using htpy means that we get type checking for our HTML generation, and can compose HTML elements just like any other Pyth [...]
-
-Refer to the [full user interface development guide](user-interface) for more information about this topic.
+ATR provides a web interface for users to interact with the platform, and the implementation of that
+interface is split across several modules. The web interface uses server-side rendering almost
+entirely, where HTML is generated on the server and sent to the browser.
+
+The template system in ATR is [Jinja2](https://jinja.palletsprojects.com/), always accessed through
+the ATR [`template`](/ref/atr/template.py) module. Template files in Jinja2 syntax are stored in
+[`templates/`](/ref/atr/templates/), and route handlers render them using the asynchronous
+[`template.render`](/ref/atr/template.py) (render) function.
+
+Template rendering can be slow if templates are loaded from disk on every request. To address this,
+we use [`preload`](/ref/atr/preload.py) to load all templates into memory before the server starts
+serving requests. The [`preload.setup_template_preloading`](/ref/atr/preload.py)
+(setup_template_preloading) function registers a startup hook that finds and caches every template
+file.
+
+The ATR user interface includes many HTML forms. We use
+[Pydantic](https://docs.pydantic.dev/latest/) for form handling, accessed through the ATR
+[`form`](/ref/atr/form.py) module. The [`form.Form`](/ref/atr/form.py) (Form) base class extends
+`pydantic.BaseModel` to provide form-specific functionality. Each form field is defined using
+Pydantic type annotations along with the [`form.label`](/ref/atr/form.py) (label) function for
+metadata like labels and documentation. Validation happens automatically through Pydantic's
+validation system, and custom validators can be added using Pydantic's `@model_validator` decorator.
+Forms are rendered in templates, but the ATR `form` module also provides programmatic rendering
+through the [`form.render`](/ref/atr/form.py) (render) function that generates HTML styled with
+Bootstrap.
+
+In addition to templates, we sometimes need to generate HTML programmatically in Python. For this we
+use [htpy](https://htpy.dev/), another third party library, for building HTML using Python syntax.
+The ATR [`htm`](/ref/atr/htm.py) module extends htpy with a [`Block`](/ref/atr/htm.py) (Block) class
+that makes it easier to build complex HTML structures incrementally. Using htpy means that we get
+type checking for our HTML generation, and can compose HTML elements just like any other Python
+objects. The generated HTML can be embedded in Jinja2 templates or returned directly from route
+handlers.
+
+Refer to the [full user interface development guide](user-interface) for more information about this
+topic.
## Scheduling and tasks
-Many operations in ATR are too slow to run during an HTTP request, so we run them asynchronously in background worker processes. The task scheduling system in ATR is built from three components: a task queue stored in the SQLite database, a worker manager that spawns and monitors worker processes, and the worker processes themselves that claim and execute tasks.
-
-The task queue is stored in a table defined by the [`Task`](/ref/atr/models/sql.py) (Task) model in [`models.sql`](/ref/atr/models/sql.py). Each task has a status, a type, arguments encoded as JSON, and metadata such as when it was added and which user created it. When route handlers need to perform slow operations, they create a new `Task` row with status `QUEUED` and commit it to the database.
-
-The ATR [`manager`](/ref/atr/manager.py) module provides the [`WorkerManager`](/ref/atr/manager.py) (WorkerManager) class, which maintains a pool of worker processes. When the ATR server starts, the manager spawns a configurable number of worker processes and monitors them continuously. The manager checks every few seconds whether workers are still running, whether any tasks have exceeded their time limits, and whether the worker pool needs to be replenished. If a worker process exits af [...]
-
-The ATR [`worker`](/ref/atr/worker.py) module implements the workers. Each worker process runs in a loop. It claims the oldest queued task from the database, executes it, records the result, and then claims the next task atomically using an `UPDATE ... WHERE` statement. After a worker has processed a fixed number of tasks, it exits voluntarily to help to avoid memory leaks. The manager then spawns a fresh worker to replace it. Task execution happens in the [`_task_process`](/ref/atr/work [...]
-
-Tasks themselves are defined in the ATR [`tasks`](/ref/atr/tasks/) directory. The [`tasks`](/ref/atr/tasks/__init__.py) module contains functions for queueing tasks and resolving task types to their handler functions. Task types include operations such as importing keys, generating SBOMs, sending messages, and importing files from SVN. The most common category of task is automated checks on release artifacts. These checks are implemented in [`tasks/checks/`](/ref/atr/tasks/checks/), and [...]
+Many operations in ATR are too slow to run during an HTTP request, so we run them asynchronously in
+background worker processes. The task scheduling system in ATR is built from three components: a
+task queue stored in the SQLite database, a worker manager that spawns and monitors worker
+processes, and the worker processes themselves that claim and execute tasks.
+
+The task queue is stored in a table defined by the [`Task`](/ref/atr/models/sql.py) (Task) model in
+[`models.sql`](/ref/atr/models/sql.py). Each task has a status, a type, arguments encoded as JSON,
+and metadata such as when it was added and which user created it. When route handlers need to
+perform slow operations, they create a new `Task` row with status `QUEUED` and commit it to the
+database.
+
+The ATR [`manager`](/ref/atr/manager.py) module provides the [`WorkerManager`](/ref/atr/manager.py)
+(WorkerManager) class, which maintains a pool of worker processes. When the ATR server starts, the
+manager spawns a configurable number of worker processes and monitors them continuously. The manager
+checks every few seconds whether workers are still running, whether any tasks have exceeded their
+time limits, and whether the worker pool needs to be replenished. If a worker process exits after
+completing its tasks, the manager spawns a new one automatically. If a task runs for too long, the
+manager terminates it and marks the task as failed. Worker processes are represented by
+[`WorkerProcess`](/ref/atr/manager.py) (WorkerProcess) objects.
+
+The ATR [`worker`](/ref/atr/worker.py) module implements the workers. Each worker process runs in a
+loop. It claims the oldest queued task from the database, executes it, records the result, and then
+claims the next task atomically using an `UPDATE ... WHERE` statement. After a worker has processed
+a fixed number of tasks, it exits voluntarily to help to avoid memory leaks. The manager then spawns
+a fresh worker to replace it. Task execution happens in the [`_task_process`](/ref/atr/worker.py)
+(_task_process) function, which resolves the task type to a handler function and calls it with the
+appropriate arguments.
+
+Tasks themselves are defined in the ATR [`tasks`](/ref/atr/tasks/) directory. The
+[`tasks`](/ref/atr/tasks/__init__.py) module contains functions for queueing tasks and resolving
+task types to their handler functions. Task types include operations such as importing keys,
+generating SBOMs, sending messages, and importing files from SVN. The most common category of task
+is automated checks on release artifacts. These checks are implemented in
+[`tasks/checks/`](/ref/atr/tasks/checks/), and include verifying file hashes, checking digital
+signatures, validating licenses, running Apache RAT, and checking archive integrity.
## API
-The ATR API provides programmatic access to most ATR functionality. API endpoints are defined in [`api`](/ref/atr/api/__init__.py), and their URL paths are prefixed with `/api/`. The API uses [OpenAPI](https://www.openapis.org/) for documentation, which is automatically generated from the endpoint definitions and served at `/api/docs`. Users send requests with a [JWT](https://en.wikipedia.org/wiki/JSON_Web_Token) created from a [PAT](https://en.wikipedia.org/wiki/Personal_access_token). [...]
-
-API request and response models are defined in [`models.api`](/ref/atr/models/api.py) using Pydantic. Each endpoint has an associated request model that validates incoming data, and a response model that validates outgoing data. The API returns JSON in all cases, with appropriate HTTP status codes.
+The ATR API provides programmatic access to most ATR functionality. API endpoints are defined in
+[`api`](/ref/atr/api/__init__.py), and their URL paths are prefixed with `/api/`. The API uses
+[OpenAPI](https://www.openapis.org/) for documentation, which is automatically generated from the
+endpoint definitions and served at `/api/docs`. Users send requests with a
+[JWT](https://en.wikipedia.org/wiki/JSON_Web_Token) created from a
+[PAT](https://en.wikipedia.org/wiki/Personal_access_token). The [`jwtoken`](/ref/atr/jwtoken.py)
+module handles issuing and verifying these tokens. API endpoints that require authentication declare
+a header auth scheme on their `@api.typed` route, which verifies the JWT via
+[`jwtoken.authenticate`](/ref/atr/jwtoken.py).
+
+API request and response models are defined in [`models.api`](/ref/atr/models/api.py) using
+Pydantic. Each endpoint has an associated request model that validates incoming data, and a response
+model that validates outgoing data. The API returns JSON in all cases, with appropriate HTTP status
+codes.
## Other important interfaces
-ATR uses ASF OAuth for user login, and then determines what actions each user can perform based on their committee memberships. The ATR [`principal`](/ref/atr/principal.py) module handles authorization by checking whether users are members of relevant committees. It queries and caches LDAP to get committee membership information. The [`Authorisation`](/ref/atr/principal.py) (Authorisation) class provides methods to check whether a user is a member of a committee or a project participant, [...]
+ATR uses ASF OAuth for user login, and then determines what actions each user can perform based on
+their committee memberships. The ATR [`principal`](/ref/atr/principal.py) module handles
+authorization by checking whether users are members of relevant committees. It queries and caches
+LDAP to get committee membership information. The [`Authorisation`](/ref/atr/principal.py)
+(Authorisation) class provides methods to check whether a user is a member of a committee or a
+project participant, which can result in different levels of access.
-The server configuration in [`config`](/ref/atr/config.py) determines a lot of global state, and the [`util`](/ref/atr/util.py) module contains lots of useful code which is used throughout ATR.
+The server configuration in [`config`](/ref/atr/config.py) determines a lot of global state, and the
+[`util`](/ref/atr/util.py) module contains lots of useful code which is used throughout ATR.
diff --git a/atr/docs/podling-releases.md b/atr/docs/podling-releases.md
index 5b184cd1..17c2b6ab 100644
--- a/atr/docs/podling-releases.md
+++ b/atr/docs/podling-releases.md
@@ -1,8 +1,8 @@
# 5.5. Podling releases
-**Up**: `5.` [Making releases](release-process-description)
+**Up**: `5.` [Making releases](making-releases)
-**Prev**: `5.4.` [Archiving and lifecycle](archiving-releases)
+**Prev**: `5.4.` [Archiving and lifecycle](archiving-and-lifecycle)
**Next**: `6.` [Release catalog](release-catalog)
@@ -15,19 +15,20 @@
## Overview
-A ***Podling*** is a project in the Apache Incubator, and its committee is a ***PPMC***. A
-podling release goes through the same compose, vote, and finish phases as any other release, but
-[incubation policy](https://incubator.apache.org/policy/incubation.html#releases) adds some requirements. The main one is that a podling release must be approved
-twice: first by the podling's own PPMC, and then by the Incubator PMC. ATR runs these as two
-rounds of voting on the same candidate.
+A ***Podling*** is a project in the Apache Incubator, and its committee is a ***PPMC***. A podling
+release goes through the same compose, vote, and finish phases as any other release, but
+[incubation policy](https://incubator.apache.org/policy/incubation.html#releases) adds some
+requirements. The main one is that a podling release must be approved twice: first by the podling's
+own PPMC, and then by the Incubator PMC. ATR runs these as two rounds of voting on the same
+candidate.
ATR knows whether a committee is a podling from the ASF's own records, so there is nothing for you
to configure. The differences described on this page apply automatically.
## Composing a podling release
-Two of ATR's [checks](checks) apply extra rules to a podling, and both report a ***blocker*** if
-the rule is not met, so the candidate cannot proceed to a vote until it is fixed:
+Two of ATR's [checks](checks) apply extra rules to a podling, and both report a ***blocker*** if the
+rule is not met, so the candidate cannot proceed to a vote until it is fixed:
* Every artifact file name must include the word `incubating`.
* Every source archive must have a `DISCLAIMER` or `DISCLAIMER-WIP` file in its root directory.
@@ -36,16 +37,16 @@ Expedited releases are not available to podlings.
## The two rounds of voting
-You start a podling vote in the same way as any other, from the compose page. The differences
-are these:
+You start a podling vote in the same way as any other, from the compose page. The differences are
+these:
* **First round.** The vote is held by the PPMC, on the podling's own mailing list. It cannot be
- held on the podling's `private@` list. When you start the vote, you also choose the list that
- the second round will be sent to, which is `general@incubator.apache.org`.
-* **Moving to the second round.** When you resolve the first round as passed, ATR does not move
- the release on to the finish phase. Instead it starts the second round straight away, sending a
- new vote email to the Incubator list. The second round is held on the same revision, with the
- same duration, using your project's vote email template.
+ held on the podling's `private@` list. When you start the vote, you also choose the list that the
+ second round will be sent to, which is `general@incubator.apache.org`.
+* **Moving to the second round.** When you resolve the first round as passed, ATR does not move the
+ release on to the finish phase. Instead it starts the second round straight away, sending a new
+ vote email to the Incubator list. The second round is held on the same revision, with the same
+ duration, using your project's vote email template.
* **Second round.** The vote is held by the Incubator PMC. When you resolve it as passed, the
release moves on to the finish phase, and ATR sends the result to the second round thread and
also, as a reply, to the first round thread.
@@ -60,15 +61,15 @@ Whose vote counts differs between the rounds, and ATR labels votes to match:
| First | The PPMC | "Formal" votes, from members of the PPMC | "Informal" |
| Second | The Incubator PMC | "Binding" votes, from members of the Incubator PMC | "Non-binding" |
-A PPMC member who is not also a member of the Incubator PMC therefore has a formal vote in the
-first round, but a non-binding vote in the second.
+A PPMC member who is not also a member of the Incubator PMC therefore has a formal vote in the first
+round, but a non-binding vote in the second.
Some options on the vote form behave differently for a podling:
-* If you ask ATR to publish the release automatically when the vote resolves, that choice is
- carried over to the second round, and publication happens once the second round passes.
-* Automatic vote resolution, which is offered in the Trusted [vote mode](project-configuration#vote),
- is not available for the first round.
+* If you ask ATR to publish the release automatically when the vote resolves, that choice is carried
+ over to the second round, and publication happens once the second round passes.
+* Automatic vote resolution, which is offered in the Trusted
+ [vote mode](project-configuration#vote), is not available for the first round.
* A podling release cannot use the Manual vote mode, in which a vote is held outside ATR and its
result recorded afterwards. It must go through the two rounds described here.
@@ -80,15 +81,15 @@ common to all votes.
Podling releases are published under the Incubator's area of the distribution repository, rather
than at the top level:
-* Published files go to `https://dist.apache.org/repos/dist/release/incubator/<committee>/`, and
- are served from `https://downloads.apache.org/incubator/<committee>/`.
+* Published files go to `https://dist.apache.org/repos/dist/release/incubator/<committee>/`, and are
+ served from `https://downloads.apache.org/incubator/<committee>/`.
* The committee's `KEYS` file lives in the same place, at
`https://downloads.apache.org/incubator/<committee>/KEYS`.
* An SVN import during the compose phase reads from
`https://dist.apache.org/repos/dist/dev/incubator/<committee>/`.
-[Promoting to release](promoting-to-release) describes publication and announcement, which
-otherwise work as they do for any other release.
+[Promoting to release](promoting-to-release) describes publication and announcement, which otherwise
+work as they do for any other release.
-In the [Release catalog](release-catalog), podlings are grouped together on a single Incubator
-page, rather than each having a card on the front page.
+In the [Release catalog](release-catalog), podlings are grouped together on a single Incubator page,
+rather than each having a card on the front page.
diff --git a/atr/docs/project-configuration.md b/atr/docs/project-configuration.md
index 5afac654..25009bd1 100644
--- a/atr/docs/project-configuration.md
+++ b/atr/docs/project-configuration.md
@@ -4,7 +4,7 @@
**Prev**: `3.` [Projects](projects)
-**Next**: `4.` [Release managers](release-manager-setup)
+**Next**: `4.` [Release manager setup](release-manager-setup)
**Sections**:
@@ -20,21 +20,29 @@
## Overview
-Each project in ATR has a project page, which you can reach from the "About this project" link on your [home page](/). The page is divided into tabs, and the settings on each tab are described in the sections below. The first tab, Releases, lists the project's releases and is not a settings tab, though it is where you set [cycle dates](#cycle-dates).
+Each project in ATR has a project page, which you can reach from the "About this project" link on
+your [home page](/). The page is divided into tabs, and the settings on each tab are described in
+the sections below. The first tab, Releases, lists the project's releases and is not a settings tab,
+though it is where you set [cycle dates](#cycle-dates).
Who can change a setting depends on the tab:
-* Members of the project's committee, and its release managers, can edit the Metadata and Security tabs, and the release policy tabs: Lifecycle, Trusted Publishing, Compose, Vote, and Finish.
-* Only members of the committee can change a project's categories and programming languages, or use **Export .asf.yaml**.
+* Members of the project's committee, and its release managers, can edit the Metadata and Security
+ tabs, and the release policy tabs: Lifecycle, Trusted Publishing, Compose, Vote, and Finish.
+* Only members of the committee can change a project's categories and programming languages, or use
+ **Export .asf.yaml**.
* Everybody else sees the same settings, but cannot change them.
-The release policy tabs are shown only for an active project, and a retired project cannot be edited at all.
+The release policy tabs are shown only for an active project, and a retired project cannot be edited
+at all.
-You can also manage most of these settings from your repository, as described under [Configuring a project with .asf.yaml](#configuring-a-project-with-asfyaml).
+You can also manage most of these settings from your repository, as described under
+[Configuring a project with .asf.yaml](#configuring-a-project-with-asfyaml).
## Metadata
-The Metadata tab describes the project to its users, and ATR uses several of its values in vote and announcement emails.
+The Metadata tab describes the project to its users, and ATR uses several of its values in vote and
+announcement emails.
* **Project name.** The display name, in title case. ATR adds the "Apache" prefix for you. Required.
* **Project description** and **Short description.** The description is required.
@@ -46,7 +54,8 @@ The Metadata tab describes the project to its users, and ATR uses several of its
* **Mailing lists page.** The page on the project website that lists its mailing lists.
* **Standards.** Any standards that the project implements, one per line.
-The tab also shows the project key and its committee, which cannot be changed here, and lets committee members add and remove the project's **Categories** and **Programming languages**.
+The tab also shows the project key and its committee, which cannot be changed here, and lets
+committee members add and remove the project's **Categories** and **Programming languages**.
If a required value is missing when you start a release, ATR asks you to complete it first.
@@ -54,22 +63,34 @@ If a required value is missing when you start a release, ATR asks you to complet
The Security tab records how security matters for the project are handled:
-* **Security contact.** Where vulnerability reports for the project should be sent. This is either `security@apache.org` or your committee's own security list.
+* **Security contact.** Where vulnerability reports for the project should be sent. This is either
+ `security@apache.org` or your committee's own security list.
* **Threat model.** The URL of the project's published, human readable threat model.
* **Threat model source.** The URL of the threat model's plain text source document.
## Lifecycle
-The Lifecycle tab sets the project's ***version scheme***, which tells ATR how the project numbers its releases and how those releases group into ***cycles***. A cycle is a line of releases that is maintained together, such as all `2.x` releases. Projects that maintain several release lines at once have several active cycles.
+The Lifecycle tab sets the project's ***version scheme***, which tells ATR how the project numbers
+its releases and how those releases group into ***cycles***. A cycle is a line of releases that is
+maintained together, such as all `2.x` releases. Projects that maintain several release lines at
+once have several active cycles.
* **Version method.** One of:
- * *Simple*, where ATR does not interpret version numbers, and orders releases by their release date.
+ * *Simple*, where ATR does not interpret version numbers, and orders releases by their release
+ date.
* *Semver*, where versions follow semantic versioning and are ordered accordingly.
* *Calver*, where versions are based on the calendar.
-* **Version pattern.** An optional regular expression that every release version must match. Leave it empty to accept any version.
-* **Cycle match.** For a semver project, a regular expression applied to the version, whose first capture group is the name of the cycle. For example, `(\d+)\..*` places version `2.0.1` in cycle `2`. Leave it empty to keep a single default cycle.
-* **Cycle format.** For a calver project, a date format describing the shape of the version. It uses the tokens `YYYY` or `YY`, `MM` or `M`, `DD` or `D`, and `N` for a serial number, with literal separators between them. Wrap the part that names the cycle in parentheses, for example `(YY.MM).N`. Leave it empty to keep a single default cycle.
-* **Branch template.** An optional naming hint for the source branch of each cycle. ATR does not currently enforce it.
+* **Version pattern.** An optional regular expression that every release version must match. Leave
+ it empty to accept any version.
+* **Cycle match.** For a semver project, a regular expression applied to the version, whose first
+ capture group is the name of the cycle. For example, `(\d+)\..*` places version `2.0.1` in cycle
+ `2`. Leave it empty to keep a single default cycle.
+* **Cycle format.** For a calver project, a date format describing the shape of the version. It uses
+ the tokens `YYYY` or `YY`, `MM` or `M`, `DD` or `D`, and `N` for a serial number, with literal
+ separators between them. Wrap the part that names the cycle in parentheses, for example
+ `(YY.MM).N`. Leave it empty to keep a single default cycle.
+* **Branch template.** An optional naming hint for the source branch of each cycle. ATR does not
+ currently enforce it.
### Cycle dates
@@ -80,57 +101,92 @@ Each cycle has its own dates, which you set from the cycle's entry on the Releas
* **End of life.** When the cycle is planned to be retired entirely.
* **Long-term support.** Marks the cycle as a long-term support line.
-ATR fills in the dates of the cycle's first release candidate, first release, and latest release itself. These dates feed the project's [lifecycle events](archiving-releases#lifecycle-events), which are published in the [Release catalog](release-catalog#machine-readable-data).
+ATR fills in the dates of the cycle's first release candidate, first release, and latest release
+itself. These dates feed the project's [lifecycle events](archiving-and-lifecycle#lifecycle-events),
+which are published in the [Release catalog](release-catalog#machine-readable-data).
## Trusted Publishing
-The Trusted Publishing tab names the GitHub repository, branch, and workflows that ATR should trust to act on the project's releases. See [Configuring repository and workflow paths](trusted-publishing#configuring-repository-and-workflow-paths).
+The Trusted Publishing tab names the GitHub repository, branch, and workflows that ATR should trust
+to act on the project's releases. See
+[Configuring repository and workflow paths](trusted-publishing#configuring-repository-and-workflow-paths).
## Compose
The Compose tab controls how ATR checks the files in a candidate:
-* **Source artifact license checker.** Whether source artifacts are checked with the lightweight license checks, with Apache RAT, or with both. Binary artifacts always get the lightweight checks.
-* **Lightweight source excludes** and **RAT source excludes.** Files to leave out of each license check.
-* **RAT excludes URL.** The URL of a `.rat-excludes` file that your project already maintains, which ATR fetches afresh for each revision it checks.
-* **Tagging spec.** Defines ***tags*** that apply to the files in a release, written in YAML as a tag name followed by a list of glob patterns for the files it covers. A tag names a distribution platform, and ATR will not let a release be announced until a distribution to each tagged platform has been recorded. For example, if you tag files as `mavencentral`, the release must be distributed to Maven Central before it can be announced. The platform tags are `artifacthub`, `dockerhub`, `ma [...]
-
-[Project policy inputs](checks#project-policy-inputs) explains how the checks use these settings, and [License checks](license-checks) gives the syntax for the exclusions.
+* **Source artifact license checker.** Whether source artifacts are checked with the lightweight
+ license checks, with Apache RAT, or with both. Binary artifacts always get the lightweight checks.
+* **Lightweight source excludes** and **RAT source excludes.** Files to leave out of each license
+ check.
+* **RAT excludes URL.** The URL of a `.rat-excludes` file that your project already maintains, which
+ ATR fetches afresh for each revision it checks.
+* **Tagging spec.** Defines ***tags*** that apply to the files in a release, written in YAML as a
+ tag name followed by a list of glob patterns for the files it covers. A tag names a distribution
+ platform, and ATR will not let a release be announced until a distribution to each tagged platform
+ has been recorded. For example, if you tag files as `mavencentral`, the release must be
+ distributed to Maven Central before it can be announced. The platform tags are `artifacthub`,
+ `dockerhub`, `mavencentral`, `npm`, and `pypi`.
+
+[Project policy inputs](checks#project-policy-inputs) explains how the checks use these settings,
+and [License checks](license-checks) gives the syntax for the exclusions.
## Vote
-The Vote tab sets the defaults for the project's votes. The release manager can still adjust most of them when starting a vote.
+The Vote tab sets the defaults for the project's votes. The release manager can still adjust most of
+them when starting a vote.
-* **Default vote recipient**, with optional CC and BCC recipients. The mailing list that vote emails go to.
+* **Default vote recipient**, with optional CC and BCC recipients. The mailing list that vote emails
+ go to.
* **Vote mode.** How votes are cast and counted:
- * *Email*. ATR sends the vote email, and votes are cast by replying to the thread. ATR tallies the replies when the vote is resolved.
- * *Trusted*. ATR sends the vote email, but votes are cast on the vote page in ATR and recorded there, with a receipt for each vote sent to the thread. Only in this mode can the vote be resolved automatically when it ends.
- * *Manual*. The vote is held entirely outside ATR. You give ATR the URL of the vote thread and record the result yourself. This mode is not available to podlings.
+ * *Email*. ATR sends the vote email, and votes are cast by replying to the thread. ATR tallies the
+ replies when the vote is resolved.
+ * *Trusted*. ATR sends the vote email, but votes are cast on the vote page in ATR and recorded
+ there, with a receipt for each vote sent to the thread. Only in this mode can the vote be
+ resolved automatically when it ends.
+ * *Manual*. The vote is held entirely outside ATR. You give ATR the URL of the vote thread and
+ record the result yourself. This mode is not available to podlings.
* **Minimum voting period.** The shortest time a vote may run, between 72 and 168 hours.
* **Release checklist.** Markdown text telling voters how to test a release candidate.
-* **Vote comment template.** Starting text for the comment that accompanies a vote, which each voter can edit.
-* **Start vote subject** and **Start vote template.** The subject and body of the email that starts a vote.
+* **Vote comment template.** Starting text for the comment that accompanies a vote, which each voter
+ can edit.
+* **Start vote subject** and **Start vote template.** The subject and body of the email that starts
+ a vote.
* **Finish vote template.** The body of the email that reports the result of a vote.
-Each email template also has a **template URL** field, as an alternative to composing the template in ATR. If you set one, ATR fetches the template from that URL whenever it shows the email form,
-so you can keep the text in your own repository, or reuse the same template for multiple projects easily. Whoever is sending the email can still edit it first. The URL must be on an `apache.org` host or `raw.githubusercontent.com`.
-If the fetch fails, ATR shows the default template with a warning, so check it carefully before sending. Emails that ATR sends without anyone reviewing them, such as an automatic vote resolution,
-use the default template in the same situation, and the API refuses to send rather than fall back.
+Each email template also has a **template URL** field, as an alternative to composing the template
+in ATR. If you set one, ATR fetches the template from that URL whenever it shows the email form, so
+you can keep the text in your own repository, or reuse the same template for multiple projects
+easily. Whoever is sending the email can still edit it first. The URL must be on an `apache.org`
+host or `raw.githubusercontent.com`. If the fetch fails, ATR shows the default template with a
+warning, so check it carefully before sending. Emails that ATR sends without anyone reviewing them,
+such as an automatic vote resolution, use the default template in the same situation, and the API
+refuses to send rather than fall back.
-The templates and the checklist can include variables, written in the form `{{VERSION}}`, which ATR replaces when it uses the text. Each template field on the tab lists the variables available to it.
+The templates and the checklist can include variables, written in the form `{{VERSION}}`, which ATR
+replaces when it uses the text. Each template field on the tab lists the variables available to it.
## Finish
The Finish tab sets the defaults for publishing and announcing a release:
-* **Default download path suffix.** Where the release is published beneath your committee's directory. It can use the tokens `{{PROJECT_KEY}}`, `{{VERSION}}`, and `{{MAJOR_VERSION}}`. See [Publishing to ASF Distribution Area](promoting-to-release#publishing-to-asf-distribution-area) for the default layout.
-* **Allow auto-archive.** Lets a new release archive the previous release in the same cycle when it is announced. See [Archiving the prior release automatically](archiving-releases#archiving-the-prior-release-automatically).
-* **Announce release subject** and **Announce release template.** The subject and body of the announcement email, which can use variables in the same way as the vote templates.
-* **Default announce recipient**, with optional CC and BCC recipients. The mailing list that announcements go to.
+* **Default download path suffix.** Where the release is published beneath your committee's
+ directory. It can use the tokens `{{PROJECT_KEY}}`, `{{VERSION}}`, and `{{MAJOR_VERSION}}`. See
+ [Publishing to ASF Distribution Area](promoting-to-release#publishing-to-asf-distribution-area)
+ for the default layout.
+* **Allow auto-archive.** Lets a new release archive the previous release in the same cycle when it
+ is announced. See
+ [Archiving the prior release automatically](archiving-and-lifecycle#archiving-the-prior-release-automatically).
+* **Announce release subject** and **Announce release template.** The subject and body of the
+ announcement email, which can use variables in the same way as the vote templates.
+* **Default announce recipient**, with optional CC and BCC recipients. The mailing list that
+ announcements go to.
## Configuring a project with .asf.yaml
-You can manage project metadata in ATR or in the `project` block of your repository's `.asf.yaml` file. Committee members can use **Export .asf.yaml** on the project page to get the current configuration as a starting point.
+You can manage project metadata in ATR or in the `project` block of your repository's `.asf.yaml`
+file. Committee members can use **Export .asf.yaml** on the project page to get the current
+configuration as a starting point.
For example, the Maven Filtering project has the following metadata:
@@ -142,12 +198,25 @@ project:
name: Apache Maven Filtering
```
-`key` is the project identifier used in ATR URLs and API requests. `committee` identifies the committee responsible for the project. `name` is the project's full display name and must start with `Apache` and a space. The web form adds this prefix automatically, but `.asf.yaml` synchronization does not.
+`key` is the project identifier used in ATR URLs and API requests. `committee` identifies the
+committee responsible for the project. `name` is the project's full display name and must start with
+`Apache` and a space. The web form adds this prefix automatically, but `.asf.yaml` synchronization
+does not.
-A name must be supplied when creating a project. When updating an existing project, omitting the name preserves its current value. If you use `doap:` to supply metadata, the name comes from the DOAP project's `<name>` element and must include the prefix there. A `name` supplied alongside `doap:` is ignored.
+A name must be supplied when creating a project. When updating an existing project, omitting the
+name preserves its current value. If you use `doap:` to supply metadata, the name comes from the
+DOAP project's `<name>` element and must include the prefix there. A `name` supplied alongside
+`doap:` is ignored.
-Synchronization is enabled by default and runs from the repository's default branch. When enabled, the next push imports the supplied values, overwriting manual changes to those fields in ATR. Correct the name in `.asf.yaml` or its linked DOAP file so that subsequent imports preserve the correction.
+Synchronization is enabled by default and runs from the repository's default branch. When enabled,
+the next push imports the supplied values, overwriting manual changes to those fields in ATR.
+Correct the name in `.asf.yaml` or its linked DOAP file so that subsequent imports preserve the
+correction.
-While the most recent update to a project came from `.asf.yaml`, ATR shows a notice on the project page to anyone who can edit it, and repeats it when they save a change there. The notice clears once somebody edits the project in ATR, and returns with the next push.
+While the most recent update to a project came from `.asf.yaml`, ATR shows a notice on the project
+page to anyone who can edit it, and repeats it when they save a change there. The notice clears once
+somebody edits the project in ATR, and returns with the next push.
-See the [asfyaml project metadata reference](https://github.com/apache/infrastructure-asfyaml#project) for the complete configuration format, release policy settings, and synchronization options.
+See the
+[asfyaml project metadata reference](https://github.com/apache/infrastructure-asfyaml#project) for
+the complete configuration format, release policy settings, and synchronization options.
diff --git a/atr/docs/projects.md b/atr/docs/projects.md
index 4c4a75b5..f8ce78d1 100644
--- a/atr/docs/projects.md
+++ b/atr/docs/projects.md
@@ -2,7 +2,7 @@
**Up**: [Documentation](.)
-**Prev**: `2.1.` [Moving from the current process](moving-to-atr)
+**Prev**: `2.1.` [Moving to ATR](moving-to-atr)
**Next**: `3.1.` [Project configuration](project-configuration)
@@ -24,55 +24,78 @@
## Introduction
-The Apache Trusted Releases (***ATR***) platform provides a standard and easy way for a Project Management Committee (***PMC***) or incubating project (***PPMC***)
-to manage their releases in order to easily follow the Apache Way of governance. Most ASF documentation and systems use the following
-interchangeable terms for PMCs: "Projects", Top Level Project (TLP), and "Podlings". For the ATR we felt it was important to make a distinction
-between the people involved in the PMC and the software produced. The platform provides a way for a committee to manage their project's software
-releases.
-
-ATR models several kinds of component that correspond to organizational resources at the ASF, with some refinements of our own. We studied the
-release patterns of PMCs with unusually demanding release models - Airflow, Maven, Commons, Sling, and others - before designing this system. The
+The Apache Trusted Releases (***ATR***) platform provides a standard and easy way for a Project
+Management Committee (***PMC***) or incubating project (***PPMC***) to manage their releases in
+order to easily follow the Apache Way of governance. Most ASF documentation and systems use the
+following interchangeable terms for PMCs: "Projects", Top Level Project (TLP), and "Podlings". For
+the ATR we felt it was important to make a distinction between the people involved in the PMC and
+the software produced. The platform provides a way for a committee to manage their project's
+software releases.
+
+ATR models several kinds of component that correspond to organizational resources at the ASF, with
+some refinements of our own. We studied the release patterns of PMCs with unusually demanding
+release models - Airflow, Maven, Commons, Sling, and others - before designing this system. The
sections below define the major terminology as it is used in ATR.
## Committee
-A ***Committee*** in ATR is a PMC (Project Management Committee), or a PPMC (Podling Project Management Committee). The concept of a committee is
-important in ATR because both its members and all release managers have elevated permissions compared to non-member and non-release-manager
-committers. PMC members have [***binding release votes***](https://www.apache.org/legal/release-policy.html#release-approval) and can be ***Release Managers***; designated committers may be explicitly allowed to be
-Release Managers too. Committee status is determined outside of the ATR system, by either the Board of Directors for PMCs or by the Incubator PMC
-for PPMCs.
+A ***Committee*** in ATR is a PMC (Project Management Committee), or a PPMC (Podling Project
+Management Committee). The concept of a committee is important in ATR because both its members and
+all release managers have elevated permissions compared to non-member and non-release-manager
+committers. PMC members have
+[***binding release votes***](https://www.apache.org/legal/release-policy.html#release-approval) and
+can be ***Release Managers***; designated committers may be explicitly allowed to be Release
+Managers too. Committee status is determined outside of the ATR system, by either the Board of
+Directors for PMCs or by the Incubator PMC for PPMCs.
* Committees in ATR have one or more ***Projects***.
-* The ***Roster*** shows the committers and PMC Members of the committee, and allows for designation of committers as Release Managers.
+* The ***Roster*** shows the committers and PMC Members of the committee, and allows for designation
+ of committers as Release Managers.
* ***Permissions*** shows whether the committee is allowed to build release artifacts in ***CI***.
-* Each committee has a list of ***Signing Keys*** - the members' ***OpenPGP public keys*** - which may be used to sign artifacts.
+* Each committee has a list of ***Signing Keys*** - the members' ***OpenPGP public keys*** - which
+ may be used to sign artifacts.
## Project
-A ***Project*** in ATR produces the software, or bundle of software, that a committee votes on. If your committee bundles several kinds of software
-together for a single vote, that still counts as only one project in ATR: you pick one version number for the bundled release, though of course your
-constituent software still has its own individual version numbers, and we plan for ATR to be made aware of those too.
+A ***Project*** in ATR produces the software, or bundle of software, that a committee votes on. If
+your committee bundles several kinds of software together for a single vote, that still counts as
+only one project in ATR: you pick one version number for the bundled release, though of course your
+constituent software still has its own individual version numbers, and we plan for ATR to be made
+aware of those too.
-We make a deliberate distinction between the committee and its software project(s). While most PMCs have a single project, some have several, and in
-some cases a large number. ***Projects*** typically each have different repositories and release cycles within a PMC, and are often called
-sub-projects; some have active releases on multiple versions at once. ATR can handle all of this structural diversity, so when using ATR it is
-important for PMCs to acknowledge their *true number of projects*.
+We make a deliberate distinction between the committee and its software project(s). While most PMCs
+have a single project, some have several, and in some cases a large number. ***Projects*** typically
+each have different repositories and release cycles within a PMC, and are often called sub-projects;
+some have active releases on multiple versions at once. ATR can handle all of this structural
+diversity, so when using ATR it is important for PMCs to acknowledge their *true number of
+projects*.
* Projects in ATR have one or more ***Releases***.
-* Each project has [***Metadata***](project-configuration#metadata), which includes descriptions and various URLs; a download page URL is required.
+* Each project has [***Metadata***](project-configuration#metadata), which includes descriptions and
+ various URLs; a download page URL is required.
* There are [***Security***](project-configuration#security) settings for each project.
-* The project has a [***Lifecycle***](project-configuration#lifecycle) which can follow several version schemas and allow multiple active branches.
-* There are project [***Compose***](project-configuration#compose), [***Vote***](project-configuration#vote), and [***Finish***](project-configuration#finish) policies.
-* [***Lifecycle events***](archiving-releases#lifecycle-events) are generated for project releases.
+* The project has a [***Lifecycle***](project-configuration#lifecycle) which can follow several
+ version schemas and allow multiple active branches.
+* There are project [***Compose***](project-configuration#compose),
+ [***Vote***](project-configuration#vote), and [***Finish***](project-configuration#finish)
+ policies.
+* [***Lifecycle events***](archiving-and-lifecycle#lifecycle-events) are generated for project
+ releases.
* See [Trusted Publishing](trusted-publishing).
-Projects are initially defined based on ***DOAP files*** and observed release activity. Once a PMC uses ATR, projects are defined both within the
-platform and via [`.asf.yaml`](https://github.com/apache/infrastructure-asfyaml#atrsync). See [Project configuration](project-configuration) for the metadata fields and naming requirements. The tooling team
-will work with PMCs to properly update their projects.
+Projects are initially defined based on ***DOAP files*** and observed release activity. Once a PMC
+uses ATR, projects are defined both within the platform and via
+[`.asf.yaml`](https://github.com/apache/infrastructure-asfyaml#atrsync). See
+[Project configuration](project-configuration) for the metadata fields and naming requirements. The
+tooling team will work with PMCs to properly update their projects.
## Release
-A ***Release*** in ATR is a specific version of software or bundle of software produced by a project. As mentioned in the project section above, bundled software must have an overall version number that may be different from the version numbers of the constituent software in the bundle. Also, we allow the release of more than one release concurrently, and we allow the release of prior versions (e.g. security patch level versions) after later versions.
+A ***Release*** in ATR is a specific version of software or bundle of software produced by a
+project. As mentioned in the project section above, bundled software must have an overall version
+number that may be different from the version numbers of the constituent software in the bundle.
+Also, we allow the release of more than one release concurrently, and we allow the release of prior
+versions (e.g. security patch level versions) after later versions.
* Releases in ATR have one or more ***Versions***.
* While a Release Candidate there may be multiple ***Revisions*** of the release.
@@ -80,13 +103,23 @@ A ***Release*** in ATR is a specific version of software or bundle of software p
## Revision
-A ***Revision*** is a snapshot of a release during the process of it being prepared by the release manager or release managers. Revisions can only be created before voting, in the ***Compose*** phase. In this phase it is possible, subject to certain constraints, to add files, move files, edit files, and delete files, and each such modification produces a new revision. This helps release managers to audit each other's activity, restore more easily after mistakes, and pin to a specific set [...]
+A ***Revision*** is a snapshot of a release during the process of it being prepared by the release
+manager or release managers. Revisions can only be created before voting, in the ***Compose***
+phase. In this phase it is possible, subject to certain constraints, to add files, move files, edit
+files, and delete files, and each such modification produces a new revision. This helps release
+managers to audit each other's activity, restore more easily after mistakes, and pin to a specific
+set for voting and final release without incurring races.
-Revisions in ATR have one or more artifacts. See [Revisions](uploading-files#revisions) for how to view the revision history of a release and return to an earlier revision.
+Revisions in ATR have one or more artifacts. See [Revisions](uploading-files#revisions) for how to
+view the revision history of a release and return to an earlier revision.
## Artifact
-An ***Artifact*** is a file that has been uploaded by a release manager to a revision, and will constitute part of the release to be voted on, distributed, and officially announced. ATR will automatically check artifacts for adherence to as many ASF policies as we can automate checking for. It provides them for download during all phases before final release, and then will publish them through official channels during final release.
+An ***Artifact*** is a file that has been uploaded by a release manager to a revision, and will
+constitute part of the release to be voted on, distributed, and officially announced. ATR will
+automatically check artifacts for adherence to as many ASF policies as we can automate checking for.
+It provides them for download during all phases before final release, and then will publish them
+through official channels during final release.
* Each release has one or more ***Artifacts*** one of which must be a ***Source*** artifact.
* Every artifact must have a detached ***Signature*** and ***Checksum***.
@@ -95,36 +128,43 @@ An ***Artifact*** is a file that has been uploaded by a release manager to a rev
## Creating and maintaining projects
-When a PMC first uses ATR, its projects are seeded from ***DOAP files*** and observed release activity, so the list is
-usually already populated. Your first step is to check that list against your PMC's
-[release catalog](https://release-catalog.apache.org) and confirm that it reflects your *true number of projects*.
-
-If a project is missing, a committee member can add it using the ***Create project*** button under their committee in
-the Committee directory, which opens the ***Add project*** form. You supply two
-things: a project name in title case, to which ATR adds the "Apache" prefix for you, and a project key in lower case.
-The key must be your committee key, or your committee key followed by a hyphen and a suffix - for example `example` or
-`example-components` for the `example` committee. The key is what identifies the project in ATR URLs and API requests.
-A key that starts with an existing project's key followed by a hyphen creates a sub-project of that project, and ATR
-copies settings such as the description and release policy from the existing project once, when the new one is created.
-
-Once a project exists, you maintain its metadata either in ATR or in the `project` block of your repository's
-`.asf.yaml` file. See [Project configuration](project-configuration) for the fields, the naming rules, and how
-synchronisation with `.asf.yaml` behaves. Structural corrections that ATR does not yet let you make yourself, such as
-renaming, moving, or removing a project, are handled by the tooling team, so reach out to us for those.
+When a PMC first uses ATR, its projects are seeded from ***DOAP files*** and observed release
+activity, so the list is usually already populated. Your first step is to check that list against
+your PMC's [release catalog](https://release-catalog.apache.org) and confirm that it reflects your
+*true number of projects*.
+
+If a project is missing, a committee member can add it using the ***Create project*** button under
+their committee in the Committee directory, which opens the ***Add project*** form. You supply two
+things: a project name in title case, to which ATR adds the "Apache" prefix for you, and a project
+key in lower case. The key must be your committee key, or your committee key followed by a hyphen
+and a suffix - for example `example` or `example-components` for the `example` committee. The key is
+what identifies the project in ATR URLs and API requests. A key that starts with an existing
+project's key followed by a hyphen creates a sub-project of that project, and ATR copies settings
+such as the description and release policy from the existing project once, when the new one is
+created.
+
+Once a project exists, you maintain its metadata either in ATR or in the `project` block of your
+repository's `.asf.yaml` file. See [Project configuration](project-configuration) for the fields,
+the naming rules, and how synchronisation with `.asf.yaml` behaves. Structural corrections that ATR
+does not yet let you make yourself, such as renaming, moving, or removing a project, are handled by
+the tooling team, so reach out to us for those.
## Maintaining committee keys
-Release artifacts are signed with individual keys, as described in [Release managers](release-manager-setup) and
-[Signing artifacts](signing-artifacts). Separately, each committee publishes a single `KEYS` file that gathers the
-public keys of everyone who signs its releases, so that end users can verify those signatures. A key must be present in
-the committee's `KEYS` file before you publish signatures made with it.
+Release artifacts are signed with individual keys, as described in
+[Release manager setup](release-manager-setup) and [Signing artifacts](signing-artifacts).
+Separately, each committee publishes a single `KEYS` file that gathers the public keys of everyone
+who signs its releases, so that end users can verify those signatures. A key must be present in the
+committee's `KEYS` file before you publish signatures made with it.
-Committee members manage the committee's ***Signing Keys*** at [`/keys`](/keys), and choose how the `KEYS` file itself is
-kept in step with ATR from the committee's page. There are three modes - ATR can own the file and regenerate it, ATR can
-import changes made to the file in SVN (the default), or the committee can upload and commit it manually. See
-[The KEYS file](moving-to-atr#the-keys-file) for what each mode does and when to use it.
+Committee members manage the committee's ***Signing Keys*** at [`/keys`](/keys), and choose how the
+`KEYS` file itself is kept in step with ATR from the committee's page. There are three modes - ATR
+can own the file and regenerate it, ATR can import changes made to the file in SVN (the default), or
+the committee can upload and commit it manually. See [The KEYS file](moving-to-atr#the-keys-file)
+for what each mode does and when to use it.
## Tutorial
-We offer an [ATR tutorial](/tutorial) for release managers, which walks through the compose, vote, and finish phases
-with screenshots. Its [Projects section](/tutorial#projects) covers creating and configuring a project.
+We offer an [ATR tutorial](/tutorial) for release managers, which walks through the compose, vote,
+and finish phases with screenshots. Its [Projects section](/tutorial#projects) covers creating and
+configuring a project.
diff --git a/atr/docs/promoting-to-release.md b/atr/docs/promoting-to-release.md
index 3927b09b..9f5075b5 100644
--- a/atr/docs/promoting-to-release.md
+++ b/atr/docs/promoting-to-release.md
@@ -4,7 +4,7 @@
**Prev**: `5.3.` [Finish phase](finish-phase)
-**Next**: `5.4.` [Archiving and lifecycle](archiving-releases)
+**Next**: `5.4.` [Archiving and lifecycle](archiving-and-lifecycle)
**Sections**:
@@ -15,31 +15,49 @@
## Overview
-SVN dist area is not an intrinsic part of the ATR release process until publication. The candidate is staged in ATR and voted on there, whatever method was used to upload the files, as described in [Staging and voting](staging-and-voting). When the vote passes, the release moves to the finish phase, in which ATR commits the approved artifacts to the canonical release area of the Apache distribution SVN repository:
+SVN dist area is not an intrinsic part of the ATR release process until publication. The candidate
+is staged in ATR and voted on there, whatever method was used to upload the files, as described in
+[Staging and voting](staging-and-voting). When the vote passes, the release moves to the finish
+phase, in which ATR commits the approved artifacts to the canonical release area of the Apache
+distribution SVN repository:
* TLP: `https://dist.apache.org/repos/dist/release/<committee>/`
* Podling: `https://dist.apache.org/repos/dist/release/incubator/<committee>/`
-Files committed there are served from `downloads.apache.org` and the download CDN, and are picked up by `archive.apache.org` automatically. No manual SVN step is needed to publish a release.
+Files committed there are served from `downloads.apache.org` and the download CDN, and are picked up
+by `archive.apache.org` automatically. No manual SVN step is needed to publish a release.
-**Podling note**: for a podling, prefix the committee path with `incubator/` in every path below, including the `downloads.apache.org` URL.
+**Podling note**: for a podling, prefix the committee path with `incubator/` in every path below,
+including the `downloads.apache.org` URL.
## Publishing to ASF Distribution Area
-Publication to [ASF Distribution Area](https://downloads.apache.org/) happens in the finish phase, once the vote has resolved successfully. There are two ways to trigger it:
+Publication to [ASF Distribution Area](https://downloads.apache.org/) happens in the finish phase,
+once the vote has resolved successfully. There are two ways to trigger it:
-* Automatically, by selecting "Automatically publish to SVN distribution area when this vote resolves" when starting the vote. This option is offered when a committee member starts a non-expedited vote in email or Trusted Vote mode.
+* Automatically, by selecting "Automatically publish to SVN distribution area when this vote
+ resolves" when starting the vote. This option is offered when a committee member starts a
+ non-expedited vote in email or Trusted Vote mode.
* Manually, by pressing the publish button on the finish page for the release.
-The finish page shows the destination, and the resulting SVN dist/ revision and download URL once publication completes.
+The finish page shows the destination, and the resulting SVN dist/ revision and download URL once
+publication completes.
-By default the files are placed in a per release subdirectory, `dist/release/<committee>/<project>-<version>/`, except for a committee's top level project, whose files go directly into `dist/release/<committee>/`. Projects can configure this layout with the download path suffix in their release policy, using the `{{PROJECT_KEY}}`, `{{VERSION}}`, and `{{MAJOR_VERSION}}` tokens, and the release manager can adjust the suffix when publishing manually.
+By default the files are placed in a per release subdirectory,
+`dist/release/<committee>/<project>-<version>/`, except for a committee's top level project, whose
+files go directly into `dist/release/<committee>/`. Projects can configure this layout with the
+download path suffix in their release policy, using the `{{PROJECT_KEY}}`, `{{VERSION}}`, and
+`{{MAJOR_VERSION}}` tokens, and the release manager can adjust the suffix when publishing manually.
-The public keys used to sign the release must be in the committee's `KEYS` file before you publish. See [The KEYS file](moving-to-atr#the-keys-file) for how that file is kept in step with ATR.
+The public keys used to sign the release must be in the committee's `KEYS` file before you publish.
+See [The KEYS file](moving-to-atr#the-keys-file) for how that file is kept in step with ATR.
## Announcing
-A release cannot be announced until it has been published to SVN. When you announce, ATR verifies that the published artifacts are reachable on the download servers, and asks you to try again later if they have not finished propagating. Once verified, ATR sends the announcement email and adds the release to the release catalog.
+A release cannot be announced until it has been published to SVN. When you announce, ATR verifies
+that the published artifacts are reachable on the download servers, and asks you to try again later
+if they have not finished propagating. Once verified, ATR sends the announcement email and adds the
+release to the release catalog.
You can also verify the publication yourself:
@@ -51,4 +69,8 @@ The files should soon become visible at `https://downloads.apache.org/<committee
## Removing superseded releases
-Once a release has been superseded, it should be archived, which removes its files from the distribution area. If enabled in the project settings, select "Auto archive prior release" to do this for the previous release in the same cycle when you announce the new release. See [Archiving and lifecycle](archiving-releases) for the policy behind this, the other ways to archive a release, and what archiving does.
+Once a release has been superseded, it should be archived, which removes its files from the
+distribution area. If enabled in the project settings, select "Auto archive prior release" to do
+this for the previous release in the same cycle when you announce the new release. See
+[Archiving and lifecycle](archiving-and-lifecycle) for the policy behind this, the other ways to
+archive a release, and what archiving does.
diff --git a/atr/docs/release-catalog.md b/atr/docs/release-catalog.md
index 2253dd05..3cdcb8a7 100644
--- a/atr/docs/release-catalog.md
+++ b/atr/docs/release-catalog.md
@@ -37,57 +37,55 @@ certified*** badge.
The catalog follows the same structure as the rest of ATR, described in [Projects](projects):
-* The front page shows a card for each committee, with a count of its current releases and the
- date of the latest one. You can search the cards by committee or project name.
-* A committee page lists the committee's projects. Where a committee has only one project, the
- front page links straight to the project instead.
+* The front page shows a card for each committee, with a count of its current releases and the date
+ of the latest one. You can search the cards by committee or project name.
+* A committee page lists the committee's projects. Where a committee has only one project, the front
+ page links straight to the project instead.
* A project page lists its current releases, and links to a separate archive page listing its
archived releases.
-* A release page lists the release's artifacts with their downloads, and links to the
- release's vote thread where ATR knows it.
+* A release page lists the release's artifacts with their downloads, and links to the release's vote
+ thread where ATR knows it.
-Podlings are grouped together on a single Incubator page, which lists current podlings and
-retired podlings separately. Retired projects are gathered on a single Attic page, which links to
-each project's archived releases.
+Podlings are grouped together on a single Incubator page, which lists current podlings and retired
+podlings separately. Retired projects are gathered on a single Attic page, which links to each
+project's archived releases.
## Machine readable data
Each page in the catalog has a JSON counterpart, so that tools can consume the same data:
-* `artifacts.json`, on each release, is the release manifest. It lists the release's artifacts,
- with their download, signature, checksum, and SBOM URLs. The release page links to it as
- "Metadata".
+* `artifacts.json`, on each release, is the release manifest. It lists the release's artifacts, with
+ their download, signature, checksum, and SBOM URLs. The release page links to it as "Metadata".
* `cle.json`, on each project and on each release that has lifecycle events, is the ***Common
Lifecycle Enumeration*** (***CLE***) document for that project or release. See
- [Lifecycle events](archiving-releases#lifecycle-events).
+ [Lifecycle events](archiving-and-lifecycle#lifecycle-events).
* `project_releases.json` and `podling_releases.json`, at the root of the site, summarise every
- project and podling with its releases. They mirror the split, and many of the fields, of the
- ASF's existing `projects.json` and `podlings.json` files.
+ project and podling with its releases. They mirror the split, and many of the fields, of the ASF's
+ existing `projects.json` and `podlings.json` files.
## Package URLs
Every release in the catalog has a ***Package URL*** (***PURL***) of the form
`pkg:software-id/apache.org/the+asf/<project_key>@<version>`. Replacing the `pkg:software-id/`
-prefix with `https://` gives a working link. A bare link resolves to the release's
-`artifacts.json`, and adding a query string, such as `?class=src&ext=tar.gz`, resolves to a single
-download. The catalog explains the full set of qualifiers at
-[the PURL prefix](https://apache.org/the+asf/).
+prefix with `https://` gives a working link. A bare link resolves to the release's `artifacts.json`,
+and adding a query string, such as `?class=src&ext=tar.gz`, resolves to a single download. The
+catalog explains the full set of qualifiers at [the PURL prefix](https://apache.org/the+asf/).
## How the catalog was built
The ASF has no single historical record of its releases, so the catalog was built from the files
-that were actually published. ATR read the complete file listings of the current distribution
-area and of archive.apache.org, and grouped each committee's files into projects, releases, and
+that were actually published. ATR read the complete file listings of the current distribution area
+and of archive.apache.org, and grouped each committee's files into projects, releases, and
artifacts. It paired each artifact with its signature, checksum, and SBOM where present, and took
release dates from the history of the distribution area. We then matched the results against the
-ASF's existing project records, such as DOAP files and `projects.json`, to name projects and
-assign them to committees.
+ASF's existing project records, such as DOAP files and `projects.json`, to name projects and assign
+them to committees.
-Directory layouts on the distribution servers vary a great deal between committees and over
-time, so this process is not perfect. A release may be attached to the wrong project, a project
-may be missing or split in two, or a version may have been read wrongly from a file name. Until a
-committee has reviewed its catalog, each of its pages carries a notice saying that the information
-was assembled by ATR from the distribution archives and has not yet been reviewed.
+Directory layouts on the distribution servers vary a great deal between committees and over time, so
+this process is not perfect. A release may be attached to the wrong project, a project may be
+missing or split in two, or a version may have been read wrongly from a file name. Until a committee
+has reviewed its catalog, each of its pages carries a notice saying that the information was
+assembled by ATR from the distribution archives and has not yet been reviewed.
## Keeping the catalog up to date
@@ -95,11 +93,11 @@ Once built, the catalog is kept up to date automatically:
* When you announce a release through ATR, it is added to the catalog, as described in
[Promoting to release](promoting-to-release).
-* ATR watches `svn:dist:release`, so a release committed there directly, without ATR, is
- catalogued when the commit lands.
-* When a release is archived, whether through ATR or by removing its files from
- `svn:dist:release`, the catalog moves it to the project's archive. See
- [Archiving and lifecycle](archiving-releases).
+* ATR watches `svn:dist:release`, so a release committed there directly, without ATR, is catalogued
+ when the commit lands.
+* When a release is archived, whether through ATR or by removing its files from `svn:dist:release`,
+ the catalog moves it to the project's archive. See
+ [Archiving and lifecycle](archiving-and-lifecycle).
## Reviewing and correcting your catalog
@@ -110,9 +108,9 @@ We ask every PMC to review its catalog, starting from its committee page on
* each release is under the right project, with the right version,
* current releases and archived releases are shown as such.
-Correcting the structure of a catalog, such as renaming, moving, merging, or deleting projects,
-or moving a release to a different project, is done by the Tooling team. Contact us on
+Correcting the structure of a catalog, such as renaming, moving, merging, or deleting projects, or
+moving a release to a different project, is done by the Tooling team. Contact us on
[dev@tooling.apache.org](mailto:dev@tooling.apache.org) with what needs to change, or to tell us
that your catalog is correct. Once your PMC is satisfied, we mark the catalog as reviewed and the
-notice is removed from your pages. For larger-scale corrections or agent-led reviews, we can provide an
-export of your PMC's data as held by ATR.
+notice is removed from your pages. For larger-scale corrections or agent-led reviews, we can provide
+an export of your PMC's data as held by ATR.
diff --git a/atr/docs/release-manager-setup.md b/atr/docs/release-manager-setup.md
index 463d245e..a8b71e69 100644
--- a/atr/docs/release-manager-setup.md
+++ b/atr/docs/release-manager-setup.md
@@ -1,4 +1,4 @@
-# 4. Release managers
+# 4. Release manager setup
**Up**: [Documentation](.)
@@ -20,21 +20,39 @@
## Introduction
-A ***Release Manager*** guides a candidate release through the compose, vote, and finish phases described in [Making releases](release-process-description). Any PMC member can act as a release manager, and a PMC member can designate a committer as one from the committee's Roster, as described under [Committee](projects#committee). This is a change from legacy policy, under which only PMC members could manage releases.
+A ***Release Manager*** guides a candidate release through the compose, vote, and finish phases
+described in [Making releases](making-releases). Any PMC member can act as a release manager, and a
+PMC member can designate a committer as one from the committee's Roster, as described under
+[Committee](projects#committee). This is a change from legacy policy, under which only PMC members
+could manage releases.
-Before your first release you need to set up a small number of credentials. Which ones you need depends on how you sign your artifacts and how you move them into ATR, so this page describes each of them. If you have not already read it, [Getting started](getting-started) covers the wider prerequisites, such as registering for ASF multi-factor authentication.
+Before your first release you need to set up a small number of credentials. Which ones you need
+depends on how you sign your artifacts and how you move them into ATR, so this page describes each
+of them. If you have not already read it, [Getting started](getting-started) covers the wider
+prerequisites, such as registering for ASF multi-factor authentication.
## Signing keys
-Every release artifact must carry a detached signature, so as a release manager you need an ***OpenPGP*** key, sometimes called a ***GPG*** key. You sign your artifacts with the private half and register the public half with ATR. That lets ATR verify your signatures, and lets end users verify them later against your committee's `KEYS` file.
+Every release artifact must carry a detached signature, so as a release manager you need an
+***OpenPGP*** key, sometimes called a ***GPG*** key. You sign your artifacts with the private half
+and register the public half with ATR. That lets ATR verify your signatures, and lets end users
+verify them later against your committee's `KEYS` file.
-Add your public key on the [keys page](/keys). For a quick guide to generating a key and signing your files, see [Signing artifacts](signing-artifacts). Projects whose builds are reproducible can sign automatically during a GitHub Actions workflow rather than signing each file by hand; see [Trusted Publishing](trusted-publishing).
+Add your public key on the [keys page](/keys). For a quick guide to generating a key and signing
+your files, see [Signing artifacts](signing-artifacts). Projects whose builds are reproducible can
+sign automatically during a GitHub Actions workflow rather than signing each file by hand; see
+[Trusted Publishing](trusted-publishing).
-Keep your private key secure, and never upload it or store it on untrusted equipment. The email address in your key is publicly associated with the releases you sign, so treat it as a lasting public record.
+Keep your private key secure, and never upload it or store it on untrusted equipment. The email
+address in your key is publicly associated with the releases you sign, so treat it as a lasting
+public record.
### Required key settings
-ATR follows the ASF Infra [release signing guidance](https://infra.apache.org/release-signing.html), which is the full reference. ATR checks the settings below when it verifies each signature, and the keys page won't accept a key whose algorithm, size or user ID falls short. Where a signature was made by a subkey, it is the subkey that has to meet them.
+ATR follows the ASF Infra [release signing guidance](https://infra.apache.org/release-signing.html),
+which is the full reference. ATR checks the settings below when it verifies each signature, and the
+keys page won't accept a key whose algorithm, size or user ID falls short. Where a signature was
+made by a subkey, it is the subkey that has to meet them.
| Setting | Requirement |
| --- | --- |
@@ -48,34 +66,60 @@ ATR follows the ASF Infra [release signing guidance](https://infra.apache.org/re
ASF Infra also recommends the following, which ATR doesn't check:
* Protect your private key with a strong passphrase.
-* Use SHA-256 or SHA-512 as the signature digest, not SHA-1. Recent GnuPG releases do this by default. This is separate from the `.sha256` or `.sha512` checksum files, which ATR does check.
+* Use SHA-256 or SHA-512 as the signature digest, not SHA-1. Recent GnuPG releases do this by
+ default. This is separate from the `.sha256` or `.sha512` checksum files, which ATR does check.
* Generate a revocation certificate and keep it somewhere safe, apart from your private key.
## Ways to work with ATR
-ATR does not tie you to a single interface. You can compose a release in the web interface, script part of it against the API, and let a GitHub Actions workflow handle the upload, mixing the methods to suit each step. Whichever you use, the artifacts land in the same release candidate.
-
-* **Web interface.** Sign in with your ASF account and [upload artifacts through the browser](uploading-files#browser). No further credentials are needed.
-* **SVN import.** [Import files](uploading-files#svn-import) from your committee's `dist/dev` area, using a form in the web interface. No further credentials are needed.
-* **rsync over SSH.** [Upload over rsync](uploading-files#rsync), which suits large or scripted uploads. Uses an [SSH key](#ssh-keys).
-* **JSON API and command line.** The [command line client](uploading-files#command-line-client) drives ATR through its API. Uses a [personal access token](#personal-access-tokens), exchanged for a [JWT](#json-web-tokens).
-* **GitHub Actions.** Projects with reproducible builds can sign and [upload automatically from a workflow](uploading-files#github-actions), with no long-lived credential stored in the repository. See [Trusted Publishing](trusted-publishing).
-* **Maven plugin.** Projects that release through Maven can upload with the [ATR Maven Plugin](uploading-files#maven-plugin), for example during `mvn release:perform`. Uses a [personal access token](#personal-access-tokens), configured in your Maven `settings.xml`.
+ATR does not tie you to a single interface. You can compose a release in the web interface, script
+part of it against the API, and let a GitHub Actions workflow handle the upload, mixing the methods
+to suit each step. Whichever you use, the artifacts land in the same release candidate.
+
+* **Web interface.** Sign in with your ASF account and
+ [upload artifacts through the browser](uploading-files#browser). No further credentials are
+ needed.
+* **SVN import.** [Import files](uploading-files#svn-import) from your committee's `dist/dev` area,
+ using a form in the web interface. No further credentials are needed.
+* **rsync over SSH.** [Upload over rsync](uploading-files#rsync), which suits large or scripted
+ uploads. Uses an [SSH key](#ssh-keys).
+* **JSON API and command line.** The [command line client](uploading-files#command-line-client)
+ drives ATR through its API. Uses a [personal access token](#personal-access-tokens), exchanged for
+ a [JWT](#json-web-tokens).
+* **GitHub Actions.** Projects with reproducible builds can sign and
+ [upload automatically from a workflow](uploading-files#github-actions), with no long-lived
+ credential stored in the repository. See [Trusted Publishing](trusted-publishing).
+* **Maven plugin.** Projects that release through Maven can upload with the
+ [ATR Maven Plugin](uploading-files#maven-plugin), for example during `mvn release:perform`. Uses a
+ [personal access token](#personal-access-tokens), configured in your Maven `settings.xml`.
[Uploading files](uploading-files) gives the commands and setup for each of these.
## Access credentials
-Signing proves who produced an artifact. Getting that artifact into ATR, or driving ATR from the command line or the API, uses a separate set of credentials. The routes above each need one or more of the following.
+Signing proves who produced an artifact. Getting that artifact into ATR, or driving ATR from the
+command line or the API, uses a separate set of credentials. The routes above each need one or more
+of the following.
### SSH keys
-Some upload methods authenticate you over ***SSH*** rather than by token. For these, ATR identifies you by your SSH public key, which you add on the [keys page](/keys). This is a different key from your OpenPGP signing key, and is used only for access, not for signing.
+Some upload methods authenticate you over ***SSH*** rather than by token. For these, ATR identifies
+you by your SSH public key, which you add on the [keys page](/keys). This is a different key from
+your OpenPGP signing key, and is used only for access, not for signing.
### Personal access tokens
-A ***Personal Access Token*** (***PAT***) is a credential that identifies you to ATR's API and command-line tooling. Create one on the [tokens page](/tokens). A PAT expires 180 days after it is created, after which you need to create a new one. ATR stores only a hash of the token and never the token itself, so make a note of it when it is first shown to you. Treat a PAT like a password, and revoke it from the same page if it is ever exposed.
+A ***Personal Access Token*** (***PAT***) is a credential that identifies you to ATR's API and
+command-line tooling. Create one on the [tokens page](/tokens). A PAT expires 180 days after it is
+created, after which you need to create a new one. ATR stores only a hash of the token and never the
+token itself, so make a note of it when it is first shown to you. Treat a PAT like a password, and
+revoke it from the same page if it is ever exposed.
### JSON Web Tokens
-You do not use a PAT directly on each API request. Instead you exchange it for a short-lived ***JSON Web Token*** (***JWT***), which you then send as a bearer token on your API calls. A JWT expires after a short period, so you mint a fresh one from your PAT whenever you need it. Revoking the backing PAT immediately invalidates any JWT issued from it. The full authentication model, including how to exchange a PAT for a JWT, is documented in [Authentication security](authentication-security).
+You do not use a PAT directly on each API request. Instead you exchange it for a short-lived ***JSON
+Web Token*** (***JWT***), which you then send as a bearer token on your API calls. A JWT expires
+after a short period, so you mint a fresh one from your PAT whenever you need it. Revoking the
+backing PAT immediately invalidates any JWT issued from it. The full authentication model, including
+how to exchange a PAT for a JWT, is documented in
+[Authentication security](authentication-security).
diff --git a/atr/docs/release-process-description.md b/atr/docs/release-process-description.md
deleted file mode 100644
index 7c71ad63..00000000
--- a/atr/docs/release-process-description.md
+++ /dev/null
@@ -1,34 +0,0 @@
-# 5. Making releases
-
-**Up**: [Documentation](.)
-
-**Prev**: `4.2.` [Trusted Publishing](trusted-publishing)
-
-**Next**: `5.1.` [Compose phase](compose-phase)
-
-**Pages**:
-
-* `5.1.` [Compose phase](compose-phase)
-* `5.2.` [Vote phase](vote-phase)
-* `5.3.` [Finish phase](finish-phase)
-* `5.4.` [Archiving and lifecycle](archiving-releases)
-* `5.5.` [Podling releases](podling-releases)
-
-**Sections**:
-
-* [Releases](#releases)
-
-## Releases
-
-The ASF releases open source software under its [release policy](https://www.apache.org/legal/release-policy.html). The ATR platform helps PMCs release their project's artifacts through several stages:
-
-1. ***Candidate***. Guiding a ***Release Candidate*** through the phases of ASF Governance to make a Release is the primary purpose of the ATR platform.
- * ***Compose***. ***Release Artifacts*** are assembled and checked for compliance, and the Release Manager iterates on them until the
- Candidate is ready. See [Compose phase](compose-phase).
- * ***Vote***. The PMC votes on the Candidate, which stays in ATR for the duration of the vote. See [Vote phase](vote-phase).
- * ***Finish***. The approved Release Artifacts are committed to `svn:dist:release`, and the release is announced once they have reached
- the download servers. See [Finish phase](finish-phase).
-2. ***Released***. Published releases are active and cataloged, and available both via a standard catalog API and at the proper URLs on the CDN and download servers.
- Releases made through the legacy methods that bypass ATR are also cataloged.
-3. ***Archived***. All cataloged releases may be archived using the ATR platform or by direct removal from `svn:dist:release`.
- See [Archiving and lifecycle](archiving-releases).
diff --git a/atr/docs/resource-management.md b/atr/docs/resource-management.md
index 3edce546..d33348e9 100644
--- a/atr/docs/resource-management.md
+++ b/atr/docs/resource-management.md
@@ -17,60 +17,155 @@
## Introduction
-ATR answers web requests, which we want to be fast, and performs long jobs such as unpacking archives or scanning source trees for license headers. We don't want the long tasks to starve the resources of one another or of the fast web requests. This document describes how we try to prevent this from happening.
+ATR answers web requests, which we want to be fast, and performs long jobs such as unpacking
+archives or scanning source trees for license headers. We don't want the long tasks to starve the
+resources of one another or of the fast web requests. This document describes how we try to prevent
+this from happening.
-Any service can fail either by running out of resources (memory, disk, etc.), or by taking so long that the client gives up. Everything described on this page tries to prevent one of those two classes of failure. Some limits in ATR terminate the work directly, and some allow work to continue even though we stop waiting.
+Any service can fail either by running out of resources (memory, disk, etc.), or by taking so long
+that the client gives up. Everything described on this page tries to prevent one of those two
+classes of failure. Some limits in ATR terminate the work directly, and some allow work to continue
+even though we stop waiting.
-This page is intended to address requirement 15.1.3 of ASVS version 5.0.0, which asks to identify functionality that is time consuming or resource demanding and to say how we intend its availability to be defended.
+This page is intended to address requirement 15.1.3 of ASVS version 5.0.0, which asks to identify
+functionality that is time consuming or resource demanding and to say how we intend its availability
+to be defended.
-The five main places where ATR consumes resources are: 1. the task system, 2. web requests, 3. streamed responses of large bodies, 4. the SSH server (including rsync), and 5. the server's own background jobs.
+The five main places where ATR consumes resources are: 1. the task system, 2. web requests, 3.
+streamed responses of large bodies, 4. the SSH server (including rsync), and 5. the server's own
+background jobs.
## Worker pool
-The manager ([`manager`](/ref/atr/manager.py)) tracks four to eight workers, each of which works on 8 to 16 tasks before exiting. Workers claim the oldest known task. The queue is global: there is no user quota, fairness, etc. Workers arm a soft CPU limit of 300 processor seconds at the start of every task, so the budget is per task rather than per worker lifetime; children inherit the limit, each with its own fresh accounting. The limit is enforced by the kernel as an uncaught SIGXCPU, [...]
-
-Each worker also runs a watchdog thread, polling every 500ms, which kills the worker's own process group when the resident memory of its process tree exceeds 3 GB. As a second layer, the manager samples each tracked worker's tree on its two second cycle and kills the group of any worker exceeding that limit by 20%. It records a task failure only when the task identified before measurement is still active when the verdict is written, and keeps tracking a worker that survives the kill to r [...]
-
-After the per-type time limit, 300s by default, spent on a task, the manager fails it and then stops the worker in the background so that no other worker waits behind it. Stopping means SIGTERM to the worker's process group, then ten seconds, then SIGKILL to the group if any member other than a zombie is still alive, then polling the group for up to five seconds, and a logged error naming any member that outlives even that.
-
-A worker being stopped stays tracked, and is skipped by later checks, until it is seen to exit; it does not count towards the minimum pool size, so its replacement is spawned immediately. A stop which fails, or which leaves the group alive, makes the worker eligible to be stopped again rather than leaving it skipped. Workers handle SIGTERM on their event loop by cancelling their tasks, force exiting after a 15s grace so that work wedged in a thread cannot hold the process open. Server sh [...]
-
-The tracked pool of four to eight is not a cap on live processes, because workers orphaned by a server restart run on beside the pool. Every claim records the process number of the claiming worker and the creation time of that process, which together identify the claimant, because a process which took the number later must have been created later. Creation times are compared with a two second tolerance, because stepping the wall clock shifts the boot time from which the kernel derives them.
-
-A claim is returned to the queue only when its claimant is provably dead, and if the dead claimant left survivors in its process group they are killed first, with the claim returned once a later pass finds the group empty. A live claimant within its time limit is left to finish, which is the restart case. A live claimant over its limit has its task failed and its process group killed, with SIGKILL because the manager holds no handle on it, and its creation time is checked once more immed [...]
-
-A claim recorded before creation times were kept identifies its claimant by process number alone, which proves nothing, so it is returned to the queue as all untracked claims were before.
+The manager ([`manager`](/ref/atr/manager.py)) tracks four to eight workers, each of which works on
+8 to 16 tasks before exiting. Workers claim the oldest known task. The queue is global: there is no
+user quota, fairness, etc. Workers arm a soft CPU limit of 300 processor seconds at the start of
+every task, so the budget is per task rather than per worker lifetime; children inherit the limit,
+each with its own fresh accounting. The limit is enforced by the kernel as an uncaught SIGXCPU,
+which no code may handle or ignore, because on macOS it is delivered only once and the hard limit is
+not enforced.
+
+Each worker also runs a watchdog thread, polling every 500ms, which kills the worker's own process
+group when the resident memory of its process tree exceeds 3 GB. As a second layer, the manager
+samples each tracked worker's tree on its two second cycle and kills the group of any worker
+exceeding that limit by 20%. It records a task failure only when the task identified before
+measurement is still active when the verdict is written, and keeps tracking a worker that survives
+the kill to retry on later cycles.
+
+After the per-type time limit, 300s by default, spent on a task, the manager fails it and then stops
+the worker in the background so that no other worker waits behind it. Stopping means SIGTERM to the
+worker's process group, then ten seconds, then SIGKILL to the group if any member other than a
+zombie is still alive, then polling the group for up to five seconds, and a logged error naming any
+member that outlives even that.
+
+A worker being stopped stays tracked, and is skipped by later checks, until it is seen to exit; it
+does not count towards the minimum pool size, so its replacement is spawned immediately. A stop
+which fails, or which leaves the group alive, makes the worker eligible to be stopped again rather
+than leaving it skipped. Workers handle SIGTERM on their event loop by cancelling their tasks, force
+exiting after a 15s grace so that work wedged in a thread cannot hold the process open. Server
+shutdown stops all workers by the same route, concurrently.
+
+The tracked pool of four to eight is not a cap on live processes, because workers orphaned by a
+server restart run on beside the pool. Every claim records the process number of the claiming worker
+and the creation time of that process, which together identify the claimant, because a process which
+took the number later must have been created later. Creation times are compared with a two second
+tolerance, because stepping the wall clock shifts the boot time from which the kernel derives them.
+
+A claim is returned to the queue only when its claimant is provably dead, and if the dead claimant
+left survivors in its process group they are killed first, with the claim returned once a later pass
+finds the group empty. A live claimant within its time limit is left to finish, which is the restart
+case. A live claimant over its limit has its task failed and its process group killed, with SIGKILL
+because the manager holds no handle on it, and its creation time is checked once more immediately
+before the kill, because failing the task first can block for as long as the database busy timeout,
+within which the number could pass to an unrelated process.
+
+A claim recorded before creation times were kept identifies its claimant by process number alone,
+which proves nothing, so it is returned to the queue as all untracked claims were before.
## Heavy operations
-Archive extraction ([`archives`](/ref/atr/archives.py)) allows up to 2 GiB of extracted file content and 100,000 files per archive by default. See [File handling](file-handling) for the formats and remaining extraction limits. Extracted content is cached per release and content hash. Concurrent validations can extract the same archive, and SBOM generation extracts it again.
-
-RAT checks use capped JVM resources (64 MB heap, 32 MB metaspace), and are killed at 300s. Lightweight license checks allow 1 MB per license, and 4 KB per source file. SBOM tasks are divided into generation (extract, syft, 300s wait), quality score (sbomqs, 300s), tool score (untimed CycloneDX validator), OSV scan (1000 per batch at 60s, then a detail request per new vulnerability), augmentation (30s requests), and conversion (local). Augment and OSV rebuild whole revisions on change. Co [...]
-
-Signature and hash checks read whole artifacts; KEYS import parses keys, consults LDAP, may publish via SVN, and builds a revision; and metadata refresh scans every account and project. Other tasks with caps include mail (a 30s SMTP client timeout, not a task-level bound), distribution status (20 per run, every two minutes), and the CAP poller (1m to 6h backoff).
+Archive extraction ([`archives`](/ref/atr/archives.py)) allows up to 2 GiB of extracted file content
+and 100,000 files per archive by default. See [File handling](file-handling) for the formats and
+remaining extraction limits. Extracted content is cached per release and content hash. Concurrent
+validations can extract the same archive, and SBOM generation extracts it again.
+
+RAT checks use capped JVM resources (64 MB heap, 32 MB metaspace), and are killed at 300s.
+Lightweight license checks allow 1 MB per license, and 4 KB per source file. SBOM tasks are divided
+into generation (extract, syft, 300s wait), quality score (sbomqs, 300s), tool score (untimed
+CycloneDX validator), OSV scan (1000 per batch at 60s, then a detail request per new vulnerability),
+augmentation (30s requests), and conversion (local). Augment and OSV rebuild whole revisions on
+change. Comparison checks use a shallow clone (360s wait, unstoppable in its thread, delaying worker
+exit until the shutdown grace expires), and untimed rsync. SVN import uses a 600s export wait. The
+whole SVN wrapper is untimed, publishing included, and key administration uses it, unsupervised, in
+the application process. GitHub dispatch polls up to 600 times at 30s, plus a two minute status
+task.
+
+Signature and hash checks read whole artifacts; KEYS import parses keys, consults LDAP, may publish
+via SVN, and builds a revision; and metadata refresh scans every account and project. Other tasks
+with caps include mail (a 30s SMTP client timeout, not a task-level bound), distribution status (20
+per run, every two minutes), and the CAP poller (1m to 6h backoff).
## Requests and responses
-HTTP uploads allow 512 MiB per request by default. ATR allows one hour to receive bodies on the browser and two API upload routes, and 60 seconds elsewhere. Uploads build a revision before answering unless archives need quarantine, which defers revision creation to a worker. Creating a revision involves cloning the previous files with hard links, validating the new tree, hashing files and comparing inodes. JSON API uploads decode the entire base64 payload in memory, and the raw store end [...]
-
-Moves, deletions, hash generation, and SBOM draft actions also build revisions during requests. ZIP downloads list every file before streaming. Announcing checks publication during the request and queues local file cleanup as a background task.
-
-Vote tabulation fetches whole mail threads, fetching up to 100 messages at once, then buffers and sorts them. A 10,000 message limit applies after fetching. Request handlers do not have the CPU or memory limits applied to workers.
-
-Other heavy work is queued and pages poll. Recording a distribution means checking an external registry, which may not list the package yet. When that happens, the standard API endpoint returns an error and gives up, while the workflow endpoint stores the distribution as pending, reports success to the caller, and leaves a scheduled task to retry the check later. Slow bodies get a logged 408. After a handler returns, transmission has 60s before the connection closes. Handlers are unbound [...]
-
-The SSH server, in the application process, allows, per minute, 100 connections per address and ten authentications per user. Accepted commands run rsync as a child; only the rsync wait is capped at 90 minutes, after which that child is killed. Post-rsync processing is outside that timeout. The child's stderr is piped but not drained, and this may stall sessions. Uploads make rsync skip, not reject, files over 2,000,000,000 bytes. After a successful rsync transfer, uploads either build a [...]
+HTTP uploads allow 512 MiB per request by default. ATR allows one hour to receive bodies on the
+browser and two API upload routes, and 60 seconds elsewhere. Uploads build a revision before
+answering unless archives need quarantine, which defers revision creation to a worker. Creating a
+revision involves cloning the previous files with hard links, validating the new tree, hashing files
+and comparing inodes. JSON API uploads decode the entire base64 payload in memory, and the raw store
+endpoint streams the body to a temporary file.
+
+Moves, deletions, hash generation, and SBOM draft actions also build revisions during requests. ZIP
+downloads list every file before streaming. Announcing checks publication during the request and
+queues local file cleanup as a background task.
+
+Vote tabulation fetches whole mail threads, fetching up to 100 messages at once, then buffers and
+sorts them. A 10,000 message limit applies after fetching. Request handlers do not have the CPU or
+memory limits applied to workers.
+
+Other heavy work is queued and pages poll. Recording a distribution means checking an external
+registry, which may not list the package yet. When that happens, the standard API endpoint returns
+an error and gives up, while the workflow endpoint stores the distribution as pending, reports
+success to the caller, and leaves a scheduled task to retry the check later. Slow bodies get a
+logged 408. After a handler returns, transmission has 60s before the connection closes. Handlers are
+unbounded. ZIPs are deliberately unlimited (committers only) but share that window with file
+downloads.
+
+The SSH server, in the application process, allows, per minute, 100 connections per address and ten
+authentications per user. Accepted commands run rsync as a child; only the rsync wait is capped at
+90 minutes, after which that child is killed. Post-rsync processing is outside that timeout. The
+child's stderr is piped but not drained, and this may stall sessions. Uploads make rsync skip, not
+reject, files over 2,000,000,000 bytes. After a successful rsync transfer, uploads either build a
+revision in process or queue quarantine validation; post-rsync revision failures may still leave
+rsync's successful exit status.
## Limits
-From [`config`](/ref/atr/config.py): `MAX_CONTENT_LENGTH` (512 MiB) caps declared or received bodies, `UPLOAD_BODY_TIMEOUT` (3600s), `MAX_EXTRACT_SIZE` (2 GiB), `MAX_SESSION_AGE` (72 hours), and `ACCOUNT_CHECK_INTERVAL` (300s). Request bodies over 1 MiB are written to the state temporary directory, and such writes are refused with a 503 if they would leave no more than 512 MiB of disk space plus the maximum body size free. Multipart part submissions and concurrent writers can temporarily [...]
+From [`config`](/ref/atr/config.py): `MAX_CONTENT_LENGTH` (512 MiB) caps declared or received
+bodies, `UPLOAD_BODY_TIMEOUT` (3600s), `MAX_EXTRACT_SIZE` (2 GiB), `MAX_SESSION_AGE` (72 hours), and
+`ACCOUNT_CHECK_INTERVAL` (300s). Request bodies over 1 MiB are written to the state temporary
+directory, and such writes are refused with a 503 if they would leave no more than 512 MiB of disk
+space plus the maximum body size free. Multipart part submissions and concurrent writers can
+temporarily push free space below that limit.
-As enforced, the defaults (100 a minute, 1000 an hour) apply per endpoint, keyed by web session user or client address, in process memory, and reset by restarts. Announce and vote start get five an hour, vote cast 60, and key, token, and similar endpoints ten. API wide 500 an hour and website token route limits are declared but appear to be unenforced. Sessions last 72 hours.
+As enforced, the defaults (100 a minute, 1000 an hour) apply per endpoint, keyed by web session user
+or client address, in process memory, and reset by restarts. Announce and vote start get five an
+hour, vote cast 60, and key, token, and similar endpoints ten. API wide 500 an hour and website
+token route limits are declared but appear to be unenforced. Sessions last 72 hours.
-Cached checks deduplicate on inputs hashes, and recurring tasks replace queued scheduled instances. Other caps include pagination at 1000 rows, offset at 1,000,000, file viewer at 512 KB, RAT reports at 100 per category, propagation probes at 50 artifacts, notifications at 1024 characters, ignore patterns at 128 characters without backtracking, and npm descriptors at 512 KB.
+Cached checks deduplicate on inputs hashes, and recurring tasks replace queued scheduled instances.
+Other caps include pagination at 1000 rows, offset at 1,000,000, file viewer at 512 KB, RAT reports
+at 100 per category, propagation probes at 50 artifacts, notifications at 1024 characters, ignore
+patterns at 128 characters without backtracking, and npm descriptors at 512 KB.
## Capacity
-Disk grows everywhere, for example through release trees, the extraction cache (freed with its release), attestable records, database, logs, audit records, SVN working copy, quarantine and staging areas, and temporary space. There is no disk gauge, and no storage quota. Hard links keep extra revisions nearly free. SQLite runs WAL, writers locking up front, one at a time, with a five second busy timeout and roughly 64 MB of cache per connection across processes.
+Disk grows everywhere, for example through release trees, the extraction cache (freed with its
+release), attestable records, database, logs, audit records, SVN working copy, quarantine and
+staging areas, and temporary space. There is no disk gauge, and no storage quota. Hard links keep
+extra revisions nearly free. SQLite runs WAL, writers locking up front, one at a time, with a five
+second busy timeout and roughly 64 MB of cache per connection across processes.
-A first start backfill extracts uncached unfinished release archives, blocking startup, failures only warned, and without retries. Maintenance schedules immediately, others at six to eight minutes (metadata daily, workflow and distribution every two minutes). Only maintenance schedules its successor first, so other failures break the succession until restart.
+A first start backfill extracts uncached unfinished release archives, blocking startup, failures
+only warned, and without retries. Maintenance schedules immediately, others at six to eight minutes
+(metadata daily, workflow and distribution every two minutes). Only maintenance schedules its
+successor first, so other failures break the succession until restart.
diff --git a/atr/docs/running-and-creating-tests.md b/atr/docs/running-and-creating-tests.md
index 0bc2e4e3..5d457ee9 100644
--- a/atr/docs/running-and-creating-tests.md
+++ b/atr/docs/running-and-creating-tests.md
@@ -15,23 +15,30 @@
## Running Playwright tests
-The Playwright browser tests in `playwright/test.py` serve as a consistency check when developing ATR. ATR also has unit tests in `tests/unit/` and pytest end-to-end tests in `tests/e2e/`.
+The Playwright browser tests in `playwright/test.py` serve as a consistency check when developing
+ATR. ATR also has unit tests in `tests/unit/` and pytest end-to-end tests in `tests/e2e/`.
-To run the tests, you will need Docker. Other OCI runtimes should work, but you will need to edit the test scripts accordingly.
+To run the tests, you will need Docker. Other OCI runtimes should work, but you will need to edit
+the test scripts accordingly.
### Using Docker Compose
-The simplest way to run the tests is using Docker Compose, which starts both ATR and the Playwright test container:
+The simplest way to run the tests is using Docker Compose, which starts both ATR and the Playwright
+test container:
```shell
sh tests/run-playwright.sh
```
-This uses [`tests/docker-compose.yml`](/ref/tests/docker-compose.yml) to orchestrate the test environment. The ATR server runs in one container and the Playwright tests run in another, connected via a Docker network. These tests are automatically run in our GitHub CI as part of [`.github/workflows/build.yml`](/ref/.github/workflows/build.yml).
+This uses [`tests/docker-compose.yml`](/ref/tests/docker-compose.yml) to orchestrate the test
+environment. The ATR server runs in one container and the Playwright tests run in another, connected
+via a Docker network. These tests are automatically run in our GitHub CI as part of
+[`.github/workflows/build.yml`](/ref/.github/workflows/build.yml).
### Using host networking
-If you already have ATR running locally with `make serve-local`, you can run the Playwright tests directly against it instead of using Docker Compose:
+If you already have ATR running locally with `make serve-local`, you can run the Playwright tests
+directly against it instead of using Docker Compose:
```shell
make build-playwright && make run-playwright
@@ -44,33 +51,62 @@ docker build -t atr-playwright -f tests/Dockerfile.playwright playwright
docker run --net=host -it atr-playwright python3 test.py --skip-slow
```
-In other words, we build [`tests/Dockerfile.playwright`](/ref/tests/Dockerfile.playwright), and then run [`playwright/test.py`](/ref/playwright/test.py) inside that container using host networking to access your locally running ATR instance. Replace `docker` with the name of your Docker-compatible OCI runtime to use an alternative runtime.
+In other words, we build [`tests/Dockerfile.playwright`](/ref/tests/Dockerfile.playwright), and then
+run [`playwright/test.py`](/ref/playwright/test.py) inside that container using host networking to
+access your locally running ATR instance. Replace `docker` with the name of your Docker-compatible
+OCI runtime to use an alternative runtime.
### Test duration
-The tests should, as of 14 Oct 2025, take about 40 to 50 seconds to run in Docker Compose, and 20 to 25 seconds to run on the host. The last line of the test output should be `Tests finished successfully`, and if the tests do not complete successfully there should be an obvious Python backtrace.
+The tests should, as of 14 Oct 2025, take about 40 to 50 seconds to run in Docker Compose, and 20 to
+25 seconds to run on the host. The last line of the test output should be
+`Tests finished successfully`, and if the tests do not complete successfully there should be an
+obvious Python backtrace.
## Creating Playwright tests
-Add tests for the Playwright script to `playwright/test.py`. Add unit tests to `tests/unit/` and feature-based end-to-end tests to `tests/e2e/` as appropriate.
+Add tests for the Playwright script to `playwright/test.py`. Add unit tests to `tests/unit/` and
+feature-based end-to-end tests to `tests/e2e/` as appropriate.
### How the tests work
-The browser tests use [Playwright](https://playwright.dev/), which is a cross-browser, cross-platform web testing framework. It's a bit like the older [PhantomJS](https://en.wikipedia.org/wiki/PhantomJS), now discontinued, which allows you to operate a browser through scripting. Playwright took the same concept and improved the user experience by adding better methods for polling browser state. Most interactions with a browser take some time to complete, and in PhantomJS the developer ha [...]
+The browser tests use [Playwright](https://playwright.dev/), which is a cross-browser,
+cross-platform web testing framework. It's a bit like the older
+[PhantomJS](https://en.wikipedia.org/wiki/PhantomJS), now discontinued, which allows you to operate
+a browser through scripting. Playwright took the same concept and improved the user experience by
+adding better methods for polling browser state. Most interactions with a browser take some time to
+complete, and in PhantomJS the developer had to do that manually. Playwright makes it easier, and
+has become somewhat of an industry standard for browser tests.
-We use the official Playwright OCI container, install a few dependencies (`apt-get` is available in the container), and then run `test.py`.
+We use the official Playwright OCI container, install a few dependencies (`apt-get` is available in
+the container), and then run `test.py`.
-The `test.py` script calls [`run_tests`](/ref/playwright/test.py) (run_tests) from its `main`, which sets up all the context, but the main action takes place in [`test_all`](/ref/playwright/test.py) (test_all). This function removes any state accidentally left over from a previous run, then runs tests of certain components. Because ATR is stateful, the order of the tests is important. When adding a test, please be careful to ensure that you use the correct state and that you try not to m [...]
+The `test.py` script calls [`run_tests`](/ref/playwright/test.py) (run_tests) from its `main`, which
+sets up all the context, but the main action takes place in [`test_all`](/ref/playwright/test.py)
+(test_all). This function removes any state accidentally left over from a previous run, then runs
+tests of certain components. Because ATR is stateful, the order of the tests is important. When
+adding a test, please be careful to ensure that you use the correct state and that you try not to
+modify that state in such a way that interferes with tests placed afterwards.
-We want to make it more clear which Playwright tests depend on which, and have more isolated tests. Reusing context, however, helps to speed up the tests.
+We want to make it more clear which Playwright tests depend on which, and have more isolated tests.
+Reusing context, however, helps to speed up the tests.
-The actual test cases themselves tend to use helpers such as [`go_to_path`](/ref/playwright/test.py) (go_to_path) and [`wait_for_path`](/ref/playwright/test.py) (wait_for_path), and then call [`logging.info`](https://docs.python.org/3/library/logging.html#logging.info) to print information to the console. Try to keep logging messages terse and informative.
+The actual test cases themselves tend to use helpers such as [`go_to_path`](/ref/playwright/test.py)
+(go_to_path) and [`wait_for_path`](/ref/playwright/test.py) (wait_for_path), and then call
+[`logging.info`](https://docs.python.org/3/library/logging.html#logging.info) to print information
+to the console. Try to keep logging messages terse and informative.
## Running end-to-end tests
-To run ATR end-to-end (e2e) tests, you must first have an OCI container runtime with Compose functionality, such as Docker or Podman, installed. You will also need a POSIX shell. You can then run `tests/run-e2e.sh` to run the entire e2e test suite.
+To run ATR end-to-end (e2e) tests, you must first have an OCI container runtime with Compose
+functionality, such as Docker or Podman, installed. You will also need a POSIX shell. You can then
+run `tests/run-e2e.sh` to run the entire e2e test suite.
-The e2e suite does not run on every commit. Instead, the `End-to-end tests` workflow runs it nightly against `main`, using `tests/run-e2e-ci.sh` to test the built image rather than the dev container. If it fails it opens an issue listing the failing tests, or comments on the one already open when those tests have changed, and the next run that passes closes it. The workflow can also be started manually from the Actions tab.
+The e2e suite does not run on every commit. Instead, the `End-to-end tests` workflow runs it nightly
+against `main`, using `tests/run-e2e-ci.sh` to test the built image rather than the dev container.
+If it fails it opens an issue listing the failing tests, or comments on the one already open when
+those tests have changed, and the next run that passes closes it. The workflow can also be started
+manually from the Actions tab.
### Running unit tests
@@ -80,11 +116,13 @@ Unit tests can be run separately from e2e tests:
sh tests/run-unit.sh
```
-Unit tests are located in `tests/unit/` and test individual functions without requiring a running ATR instance.
+Unit tests are located in `tests/unit/` and test individual functions without requiring a running
+ATR instance.
### Debugging e2e test failures
-When e2e tests fail, the test script will display suggestions for debugging. You can also use the following techniques:
+When e2e tests fail, the test script will display suggestions for debugging. You can also use the
+following techniques:
**View the ATR server logs:**
@@ -115,7 +153,8 @@ Once in a shell in the running container you can e.g. run `ls -al /opt/atr/state
### Resetting cached state
-The e2e tests use a persistent OCI container volume to store ATR state between runs. If you encounter errors due to stale or corrupted state, you need to reset this volume.
+The e2e tests use a persistent OCI container volume to store ATR state between runs. If you
+encounter errors due to stale or corrupted state, you need to reset this volume.
**Stop containers and remove the state volume:**
@@ -123,11 +162,13 @@ The e2e tests use a persistent OCI container volume to store ATR state between r
cd tests && docker compose down -v
```
-The `-v` flag removes the persistent state volume (`atr-dev-state`), which resets all ATR state including the database, logs, and any uploaded files.
+The `-v` flag removes the persistent state volume (`atr-dev-state`), which resets all ATR state
+including the database, logs, and any uploaded files.
**Force rebuild the container images:**
-If you have made changes to `Dockerfile.e2e` or any other dependencies, and the cached image is stale, run:
+If you have made changes to `Dockerfile.e2e` or any other dependencies, and the cached image is
+stale, run:
```shell
cd tests && docker compose build --no-cache atr-dev
@@ -155,7 +196,9 @@ You probably only need to do this if you're running out of disk space.
## Creating end-to-end tests
-The e2e tests use [pytest](https://docs.pytest.org/) with the [pytest-playwright](https://playwright.dev/python/docs/pytest) plugin. Tests are organized in `tests/e2e/` by feature area.
+The e2e tests use [pytest](https://docs.pytest.org/) with the
+[pytest-playwright](https://playwright.dev/python/docs/test-runners) plugin. Tests are organized in
+`tests/e2e/` by feature area.
### Test structure
@@ -174,7 +217,8 @@ tests/e2e/root/
### Writing fixtures
-Fixtures set up the state needed for tests. They are defined in `conftest.py` files using the `@pytest.fixture` decorator. Fixtures can be scoped to control how often they run:
+Fixtures set up the state needed for tests. They are defined in `conftest.py` files using the
+`@pytest.fixture` decorator. Fixtures can be scoped to control how often they run:
* `scope="function"` (default) - Runs for each test function
* `scope="module"` - Runs once per test module
@@ -193,7 +237,8 @@ def page_index(page: Page):
yield page
```
-For tests that require authenticated state or complex setup, use module-scoped fixtures to avoid repeating expensive operations:
+For tests that require authenticated state or complex setup, use module-scoped fixtures to avoid
+repeating expensive operations:
```python
@pytest.fixture(scope="module")
@@ -236,4 +281,5 @@ To add tests for a new feature:
3. Add `conftest.py` with fixtures for your feature
4. Add `test_*.py` files with your tests
-Tests run in the order pytest discovers them. If your tests depend on state created by other tests, consider using module-scoped fixtures to manage that state explicitly.
+Tests run in the order pytest discovers them. If your tests depend on state created by other tests,
+consider using module-scoped fixtures to manage that state explicitly.
diff --git a/atr/docs/running-the-server.md b/atr/docs/running-the-server.md
index d007eaa9..62aa66cf 100644
--- a/atr/docs/running-the-server.md
+++ b/atr/docs/running-the-server.md
@@ -15,7 +15,9 @@
## Quick start
-For step-by-step setup instructions, see **[DEVELOPMENT.md](https://github.com/apache/tooling-trusted-releases/blob/main/DEVELOPMENT.md)** in the repository root.
+For step-by-step setup instructions, see
+**[DEVELOPMENT.md](https://github.com/apache/tooling-trusted-releases/blob/main/DEVELOPMENT.md)** in
+the repository root.
That guide covers:
@@ -28,24 +30,32 @@ The rest of this page provides deeper technical context for how the server works
## Server architecture
-ATR is a Python application based on [ASFQuart](https://github.com/apache/infrastructure-asfquart), which is based on [Quart](https://github.com/pallets/quart). Quart is an asynchronous version of [Flask](https://github.com/pallets/flask). In addition to Python, we use small amounts of JavaScript and TypeScript for the front end.
+ATR is a Python application based on [ASFQuart](https://github.com/apache/infrastructure-asfquart),
+which is based on [Quart](https://github.com/pallets/quart). Quart is an asynchronous version of
+[Flask](https://github.com/pallets/flask). In addition to Python, we use small amounts of JavaScript
+and TypeScript for the front end.
-**Running in containers:** On ASF infrastructure, ATR runs in containers managed by Puppet. For development, we use Docker Compose with an Alpine Linux base image that includes external tools (CycloneDX, syft, Apache RAT) required for SBOM generation and license checking.
+**Running in containers:** On ASF infrastructure, ATR runs in containers managed by Puppet. For
+development, we use Docker Compose with an Alpine Linux base image that includes external tools
+(CycloneDX, syft, Apache RAT) required for SBOM generation and license checking.
-**Running directly:** For faster iteration, you can run ATR directly using uv and Hypercorn. This requires manually installing dependencies and generating TLS certificates with mkcert.
+**Running directly:** For faster iteration, you can run ATR directly using uv and Hypercorn. This
+requires manually installing dependencies and generating TLS certificates with mkcert.
**Trade-offs:**
* _Container_: isolated, includes all tools; slower startup, certificate trust setup
* _Direct_: fast iteration, auto-trusted certs; manual dependency setup
-**Important:** Do not run both methods simultaneously - they share the same state directory and will conflict.
+**Important:** Do not run both methods simultaneously - they share the same state directory and will
+conflict.
## Configuration details
### TLS requirements
-ATR requires TLS even for development because login is performed through the actual ASF OAuth server. This ensures development behavior aligns closely with production.
+ATR requires TLS even for development because login is performed through the actual ASF OAuth
+server. This ensures development behavior aligns closely with production.
The `make certs-local` target generates certificates using mkcert:
@@ -53,17 +63,20 @@ The `make certs-local` target generates certificates using mkcert:
mkcert localhost.apache.org 127.0.0.1 ::1
```
-We exclude `localhost` to avoid [DNS resolution issues noted in RFC 8252](https://datatracker.ietf.org/doc/html/rfc8252#section-8.3).
+We exclude `localhost` to avoid
+[DNS resolution issues noted in RFC 8252](https://datatracker.ietf.org/doc/html/rfc8252#section-8.3).
### Host configuration
-ATR serves on multiple hosts, but we recommend using `localhost.apache.org` consistently. This requires an `/etc/hosts` entry:
+ATR serves on multiple hosts, but we recommend using `localhost.apache.org` consistently. This
+requires an `/etc/hosts` entry:
```text
127.0.0.1 localhost.apache.org
```
-**Why this matters:** Logging into the site on one host does not log you in on another host. Pick one and use it consistently.
+**Why this matters:** Logging into the site on one host does not log you in on another host. Pick
+one and use it consistently.
### Environment variables
@@ -77,22 +90,26 @@ ATR serves on multiple hosts, but we recommend using `localhost.apache.org` cons
### Startup behavior
-On first startup, the server fetches committee and project information from the ASF website. This takes 1-2 minutes, during which no existing committees or projects will appear.
+On first startup, the server fetches committee and project information from the ASF website. This
+takes 1-2 minutes, during which no existing committees or projects will appear.
## Authentication and sessions
### ASF OAuth
-ATR uses ASF OAuth for user authentication. Even in development, you authenticate against the real ASF OAuth server. This is why TLS is required.
+ATR uses ASF OAuth for user authentication. Even in development, you authenticate against the real
+ASF OAuth server. This is why TLS is required.
### Session caching for developers
-Developers without LDAP credentials will be unable to perform rsync writes, and certain tasks may fail. To work around this in development:
+Developers without LDAP credentials will be unable to perform rsync writes, and certain tasks may
+fail. To work around this in development:
1. Visit `/user/cache`
2. Press the "Cache me!" button
-This writes your session information to the ATR state directory (`state/`), which is consulted instead of LDAP when present.
+This writes your session information to the ATR state directory (`state/`), which is consulted
+instead of LDAP when present.
To clear cached session data:
diff --git a/atr/docs/sbom-architecture.md b/atr/docs/sbom-architecture.md
index 44af10c0..6e2f152d 100644
--- a/atr/docs/sbom-architecture.md
+++ b/atr/docs/sbom-architecture.md
@@ -20,23 +20,48 @@
## Overview
-This page describes how ATR's SBOM support is put together, for developers working on ATR itself. For a release manager's view of what the SBOM features do and how to use them, see [SBOM workflows](sbom-workflows).
+This page describes how ATR's SBOM support is put together, for developers working on ATR itself.
+For a release manager's view of what the SBOM features do and how to use them, see
+[SBOM workflows](sbom-workflows).
-ATR works with SBOMs in the CycloneDX format, stored as `.cdx.json` files (and other suffixes) that sit beside the artifact they describe. A project-supplied SBOM is always preferred. Most of the SBOM logic lives in its own package, `atr/sbom/`, which the ATR server drives through a set of background tasks. Only the read-only report is currently exposed in the UI; see [Current status](#current-status).
+ATR works with SBOMs in the CycloneDX format, stored as `.cdx.json` files (and other suffixes) that
+sit beside the artifact they describe. A project-supplied SBOM is always preferred. Most of the SBOM
+logic lives in its own package, `atr/sbom/`, which the ATR server drives through a set of background
+tasks. Only the read-only report is currently exposed in the UI; see
+[Current status](#current-status).
## Current status
-Only the read-only SBOM report is currently reachable from the UI. A file that is a CycloneDX JSON SBOM gets a *View SBOM* button in a release's checks (`atr/get/checks.py`), which opens the report described below.
+Only the read-only SBOM report is currently reachable from the UI. A file that is a CycloneDX JSON
+SBOM gets a *View SBOM* button in a release's checks (`atr/get/checks.py`), which opens the report
+described below.
-The other workflows, generation, conversion, OSV scanning, and augmentation, are present in the code, as task handlers in `atr/tasks/sbom.py` and as routes in `atr/post/draft.py` and `atr/post/sbom.py`, but nothing in the UI triggers them, so they are dormant. The intention is to build these into external tooling rather than the server, which is what the package's own command line (below) is a step toward. The rest of this page describes the whole toolkit, dormant paths included, since t [...]
+The other workflows, generation, conversion, OSV scanning, and augmentation, are present in the
+code, as task handlers in `atr/tasks/sbom.py` and as routes in `atr/post/draft.py` and
+`atr/post/sbom.py`, but nothing in the UI triggers them, so they are dormant. The intention is to
+build these into external tooling rather than the server, which is what the package's own command
+line (below) is a step toward. The rest of this page describes the whole toolkit, dormant paths
+included, since the code is all present.
## The SBOM package
-`atr/sbom/` is its own package with its own command line, so the SBOM operations can be driven directly, not only through the server. The standalone entry point is `python -m atr.sbom` (`__main__.py` just calls `cli.main()`), and `cli.py`'s `setup_cli_logging` wires the shared logging up to stderr, so a bare CLI run produces the same diagnostics as the in-server code.
+`atr/sbom/` is its own package with its own command line, so the SBOM operations can be driven
+directly, not only through the server. The standalone entry point is `python -m atr.sbom`
+(`__main__.py` just calls `cli.main()`), and `cli.py`'s `setup_cli_logging` wires the shared logging
+up to stderr, so a bare CLI run produces the same diagnostics as the in-server code.
-That standalone use is why part of the package reads differently from the rest of the codebase. The modules on the CLI path refer to each other with relative, direct-name imports, for example `from .cyclonedx import validate_cli`, rather than the absolute, module-only style, `import atr.x as x`, that ATR uses everywhere else. The package also holds some server-only modules (`heatmap`, `observations`, `streaming`, and `maintenance`, used by the SBOM tasks and the catalog site, not by the [...]
+That standalone use is why part of the package reads differently from the rest of the codebase. The
+modules on the CLI path refer to each other with relative, direct-name imports, for example
+`from .cyclonedx import validate_cli`, rather than the absolute, module-only style,
+`import atr.x as x`, that ATR uses everywhere else. The package also holds some server-only modules
+(`heatmap`, `observations`, `streaming`, and `maintenance`, used by the SBOM tasks and the catalog
+site, not by the CLI). Those keep ATR's ordinary house style, since the standalone rationale does
+not apply to them.
-The package is not fully decoupled from ATR, though. Its core imports `atr.util` (in `utilities.py` and `osv.py`) alongside `atr.log` and `atr.loggers`, and its `heatmap` and `observations` modules also pull in `atr.metadata` and `atr.models.results`. It is standalone in the sense of having a working command line, not in the sense of having no ATR dependencies.
+The package is not fully decoupled from ATR, though. Its core imports `atr.util` (in `utilities.py`
+and `osv.py`) alongside `atr.log` and `atr.loggers`, and its `heatmap` and `observations` modules
+also pull in `atr.metadata` and `atr.models.results`. It is standalone in the sense of having a
+working command line, not in the sense of having no ATR dependencies.
## The SBOM CLI
@@ -49,55 +74,78 @@ python -m atr.sbom <command> <sbom-path>
The commands map onto the package's operations:
* `license` - list the license warnings (Category B) and errors (Category X).
-* `missing` and `where` - list, and locate within the document, the NTIA 2021 fields an SBOM is missing.
+* `missing` and `where` - list, and locate within the document, the NTIA 2021 fields an SBOM is
+ missing.
* `osv` - scan the components against OSV.
* `outdated` - report an SBOM written by a known-outdated tool.
-* `patch-ntia` and `patch-vuln` - emit the JSON patch that would add the missing NTIA metadata, or the OSV findings.
+* `patch-ntia` and `patch-vuln` - emit the JSON patch that would add the missing NTIA metadata, or
+ the OSV findings.
* `merge` - apply the NTIA patch and print the resulting document.
* `scores` - print the sbomqs score, before and after an NTIA merge.
-* `validate-cli` and `validate-py` - validate the document, through the CycloneDX CLI and through the CycloneDX Python library respectively.
+* `validate-cli` and `validate-py` - validate the document, through the CycloneDX CLI and through
+ the CycloneDX Python library respectively.
## Package modules
-Each command is a thin wrapper over a module that does the work, and the ATR server calls those same modules directly:
+Each command is a thin wrapper over a module that does the work, and the ATR server calls those same
+modules directly:
-* `cyclonedx.py` validates a document two ways: `validate_cli` shells out to the external `cyclonedx` binary, and `validate_py` uses the CycloneDX Python library.
+* `cyclonedx.py` validates a document two ways: `validate_cli` shells out to the external
+ `cyclonedx` binary, and `validate_py` uses the CycloneDX Python library.
* `conformance.py` checks a document against the NTIA 2021 minimum data fields.
* `licenses.py` places each declared license into an ASF policy category.
* `sbomqs.py` runs the sbomqs scorer.
* `osv.py` looks components up in OSV.
* `tool.py` detects an SBOM written by an outdated tool version.
-* `utilities.py` loads a file into a `Bundle`, builds the NTIA and vulnerability patches, applies them, and writes documents back out.
+* `utilities.py` loads a file into a `Bundle`, builds the NTIA and vulnerability patches, applies
+ them, and writes documents back out.
* `components.py` reads a document into the component breakdown the report renders.
-* `models/` holds the typed models the rest of the package passes around, including `bundle`, `conformance`, `licenses`, and `components`.
+* `models/` holds the typed models the rest of the package passes around, including `bundle`,
+ `conformance`, `licenses`, and `components`.
-The package also carries `maven.py`, which maps a date to the Maven plugin version current at that time, `spdx.py`, an SPDX license-expression parser, and a `constants` subpackage.
+The package also carries `maven.py`, which maps a date to the Maven plugin version current at that
+time, `spdx.py`, an SPDX license-expression parser, and a `constants` subpackage.
## External tools
The package, and the tasks around it, drive several external tools:
-* **syft** generates a CycloneDX SBOM from an artifact. This runs in the task layer (`atr/tasks/sbom.py`) under the sandbox, not in the package. Generation is currently dormant (see [Current status](#current-status)).
+* **syft** generates a CycloneDX SBOM from an artifact. This runs in the task layer
+ (`atr/tasks/sbom.py`) under the sandbox, not in the package. Generation is currently dormant (see
+ [Current status](#current-status)).
* the **CycloneDX CLI** (`cyclonedx`) validates documents, through `cyclonedx.py`'s `validate_cli`.
* **sbomqs** scores documents, through `sbomqs.py`.
* **OSV** supplies vulnerability data, through `osv.py`.
-The CycloneDX Python library is a direct dependency too, used for validation and for writing documents out.
+The CycloneDX Python library is a direct dependency too, used for validation and for writing
+documents out.
## How the server uses the package
The ATR server wraps the package's operations as background [tasks](tasks):
-* `atr/tasks/sbom.py` holds the task handlers. It runs syft for generation, and calls into `atr/sbom/` for conversion, scoring, scanning, and augmentation. The task types include `SBOM_GENERATE_CYCLONEDX`, `SBOM_CONVERT`, `SBOM_TOOL_SCORE`, `SBOM_QS_SCORE`, `SBOM_OSV_SCAN`, and `SBOM_AUGMENT`.
+* `atr/tasks/sbom.py` holds the task handlers. It runs syft for generation, and calls into
+ `atr/sbom/` for conversion, scoring, scanning, and augmentation. The task types include
+ `SBOM_GENERATE_CYCLONEDX`, `SBOM_CONVERT`, `SBOM_TOOL_SCORE`, `SBOM_QS_SCORE`, `SBOM_OSV_SCAN`,
+ and `SBOM_AUGMENT`.
* `atr/storage/writers/sbom.py` queues those tasks as the acting committee member.
-* `atr/post/draft.py` holds the generation and conversion routes (each would land its output as a new revision), and `atr/post/sbom.py` holds the report's scan and augment routes. None of these is currently triggered from the UI (see [Current status](#current-status)).
-* `atr/analysis.py` classifies files, with `is_cyclonedx_json` and `is_cyclonedx_xml` gating which operations apply to a given file.
+* `atr/post/draft.py` holds the generation and conversion routes (each would land its output as a
+ new revision), and `atr/post/sbom.py` holds the report's scan and augment routes. None of these is
+ currently triggered from the UI (see [Current status](#current-status)).
+* `atr/analysis.py` classifies files, with `is_cyclonedx_json` and `is_cyclonedx_xml` gating which
+ operations apply to a given file.
## The SBOM report
-`atr/get/sbom.py` builds the report programmatically with `atr/htm.py` rather than a template. The `quality` handler serves `/sbom/quality/<project>/<version>/<file>` and is reached from a file's check row (see `atr/get/checks.py` and `check-selected-path-table.html`).
+`atr/get/sbom.py` builds the report programmatically with `atr/htm.py` rather than a template. The
+`quality` handler serves `/sbom/quality/<project>/<version>/<file>` and is reached from a file's
+check row (see `atr/get/checks.py` and `check-selected-path-table.html`).
-The page reads the most recent `SBOM_TOOL_SCORE` task for the file at the release's latest revision, and reads the component breakdown straight from the SBOM through `atr/sbom/components.py`. It deliberately does not render a single headline score: it surfaces the component list, license categories, declared vulnerabilities, and the conformance, outdated-tool, and CycloneDX CLI findings, so a reader sees the underlying issues rather than a number.
+The page reads the most recent `SBOM_TOOL_SCORE` task for the file at the release's latest revision,
+and reads the component breakdown straight from the SBOM through `atr/sbom/components.py`. It
+deliberately does not render a single headline score: it surfaces the component list, license
+categories, declared vulnerabilities, and the conformance, outdated-tool, and CycloneDX CLI
+findings, so a reader sees the underlying issues rather than a number.
## Related documentation
diff --git a/atr/docs/sbom-workflows.md b/atr/docs/sbom-workflows.md
index 2288503f..0446b433 100644
--- a/atr/docs/sbom-workflows.md
+++ b/atr/docs/sbom-workflows.md
@@ -14,40 +14,70 @@
## Overview
-A Software Bill of Materials (SBOM) lists the components that make up a release artifact, so that consumers can see what they are pulling in and check it against known vulnerabilities and license policy. ATR works with SBOMs in the [CycloneDX](https://cyclonedx.org/) format, stored as JSON files with a `.cdx.json` extension.
+A Software Bill of Materials (SBOM) lists the components that make up a release artifact, so that
+consumers can see what they are pulling in and check it against known vulnerabilities and license
+policy. ATR works with SBOMs in the [CycloneDX](https://cyclonedx.org/) format, stored as JSON files
+with a `.cdx.json` extension.
-The best SBOM is one your own build produces, because it knows what actually went into the artifact. When your build produces a CycloneDX JSON SBOM, include it in your release alongside the artifact it describes, and ATR will check it and give you an SBOM report for that file, described below.
+The best SBOM is one your own build produces, because it knows what actually went into the artifact.
+When your build produces a CycloneDX JSON SBOM, include it in your release alongside the artifact it
+describes, and ATR will check it and give you an SBOM report for that file, described below.
-ATR reads the SBOMs you supply. Producing them, and converting them from other formats, is a job for your own build.
+ATR reads the SBOMs you supply. Producing them, and converting them from other formats, is a job for
+your own build.
## Reading the SBOM report
-While a release is being prepared, its checks list each file with its results. Any file that is a CycloneDX JSON SBOM carries a **View SBOM** button that opens its SBOM report. The report has two halves: what the SBOM says about the release (Content), and how well-formed the SBOM itself is (Quality). Some of it, the Licenses and Vulnerabilities below and the whole Quality section, appears only once ATR's SBOM checks have run for the file, so parts may be blank on a first look.
+While a release is being prepared, its checks list each file with its results. Any file that is a
+CycloneDX JSON SBOM carries a **View SBOM** button that opens its SBOM report. The report has two
+halves: what the SBOM says about the release (Content), and how well-formed the SBOM itself is
+(Quality). Some of it, the Licenses and Vulnerabilities below and the whole Quality section, appears
+only once ATR's SBOM checks have run for the file, so parts may be blank on a first look.
### Content
-**Components** lists what the SBOM declares is in the artifact, grouped by type, with each component's name, version, licenses, and package URL (PURL) where the SBOM records one. If the SBOM names an overall subject, the report says which component that is. An SBOM that declares no components is worth a second look, as it usually means the tool that wrote it could not see inside the artifact.
+**Components** lists what the SBOM declares is in the artifact, grouped by type, with each
+component's name, version, licenses, and package URL (PURL) where the SBOM records one. If the SBOM
+names an overall subject, the report says which component that is. An SBOM that declares no
+components is worth a second look, as it usually means the tool that wrote it could not see inside
+the artifact.
-**Licenses** places each declared license in a category of the [ASF third party license policy](https://www.apache.org/legal/resolved.html): Category A (permitted), Category B (permitted with conditions), or Category X (not permitted). The categories are read from the license strings the SBOM tool wrote into the file, and those strings can be wrong. A project can declare its license inaccurately in its build file, and an SBOM tool can map a license name to the wrong identifier. A license [...]
+**Licenses** places each declared license in a category of the
+[ASF third party license policy](https://www.apache.org/legal/resolved.html): Category A
+(permitted), Category B (permitted with conditions), or Category X (not permitted). The categories
+are read from the license strings the SBOM tool wrote into the file, and those strings can be wrong.
+A project can declare its license inaccurately in its build file, and an SBOM tool can map a license
+name to the wrong identifier. A license that ATR does not recognise is treated as Category X.
-So treat anything unexpected as something to check rather than a verdict. Look it up against the upstream project, then report a wrong declaration to that project, a wrong mapping to the SBOM tool, and a correctly spelled license that ATR fails to place, or places wrongly, to [ATR](https://github.com/apache/tooling-trusted-release/issues).
+So treat anything unexpected as something to check rather than a verdict. Look it up against the
+upstream project, then report a wrong declaration to that project, a wrong mapping to the SBOM tool,
+and a correctly spelled license that ATR fails to place, or places wrongly, to
+[ATR](https://github.com/apache/tooling-trusted-release/issues).
-Where a component offers a choice of licenses (an `OR` expression), ATR picks the friendliest category and shows the half it chose in colour, with the alternatives it set aside greyed out, so you can see what was on offer without the alternatives reading as a problem.
+Where a component offers a choice of licenses (an `OR` expression), ATR picks the friendliest
+category and shows the half it chose in colour, with the alternatives it set aside greyed out, so
+you can see what was on offer without the alternatives reading as a problem.
-**Vulnerabilities** shows the known vulnerabilities recorded in the SBOM. An SBOM does not carry these unless whatever produced it added them, so this section is empty when the SBOM records none.
+**Vulnerabilities** shows the known vulnerabilities recorded in the SBOM. An SBOM does not carry
+these unless whatever produced it added them, so this section is empty when the SBOM records none.
### Quality
The Quality section reports on the SBOM document rather than the release:
-* **Conformance** checks the SBOM against the NTIA 2021 minimum data fields and lists anything missing as warnings or errors.
+* **Conformance** checks the SBOM against the NTIA 2021 minimum data fields and lists anything
+ missing as warnings or errors.
* **Outdated tool** flags an SBOM written by a tool version known to have problems.
* **CycloneDX CLI validation** lists any structural or schema errors found in the file.
-The Quality section only has something to show once the checks behind it have run, so if it is empty, give it a moment and reload.
+The Quality section only has something to show once the checks behind it have run, so if it is
+empty, give it a moment and reload.
## Related documentation
-* [Checks](checks) covers the wider set of automated checks a release goes through, including how the SBOM report is reached.
-* [License checks](license-checks) explains the license checking that ATR applies to the release as a whole.
-* [SBOM architecture](sbom-architecture) describes how these workflows are built, for developers working on ATR itself.
+* [Checks](checks) covers the wider set of automated checks a release goes through, including how
+ the SBOM report is reached.
+* [License checks](license-checks) explains the license checking that ATR applies to the release as
+ a whole.
+* [SBOM architecture](sbom-architecture) describes how these workflows are built, for developers
+ working on ATR itself.
diff --git a/atr/docs/scope.md b/atr/docs/scope.md
index d69164e3..ddbb5df4 100644
--- a/atr/docs/scope.md
+++ b/atr/docs/scope.md
@@ -16,76 +16,97 @@
## What is ATR?
ATR is the Apache Trusted Releases platform. The Project Management Committees (PMCs) of
-[The Apache Software Foundation](https://www.apache.org/) (ASF) make official ASF software releases. These official ASF releases are endorsed as an
-"[act of the Foundation](https://www.apache.org/legal/release-policy.html#release-definition)". It is important that the foundation -
-its board, members, committees, and contributors - and the general public have confidence in these software releases.
-
-What sort of confidence in releases is required? All parties need to be certain that the software available for download is exactly
-as intended to be published by the PMC, and by the foundation. This may seem trivial, but software distribution platforms such as ATR
-now operate in extremely adversarial environments. In the years before ATR was launched,
-[supply chain attacks](https://en.wikipedia.org/wiki/Supply_chain_attack) on open source software became [far more frequent
-and more sophisticated](https://www.sonatype.com/state-of-the-software-supply-chain/2024/scale).
-
-The end goal of supply chain attacks is almost always to cause harm to users. Harms are wide-ranging and can include unwanted features,
-the extraction of money from the user, surveillance and exfiltration of data, and material damage. The exact methods of supply chain attacks
-vary, but the general principle is to modify some legitimate software between the time that it was written and the time that it was received
-by the end user, without the modification being noticed. If software is distributed to the end user through a distribution platform, and the
-distribution platform has security weaknesses, then exploiting those security weaknesses is attractive to attackers.
-
-**One goal of ATR is to deter and minimize the risk of a supply chain attack.** ATR does not ensure the quality of software received
-legitimately from PMCs. The foundation as a whole, of course, has the goal of establishing the highest quality of software to be produced,
-but that is not the responsibility of ATR as a platform. The responsibility of ATR is to ensure that the software it distributes to end
-users is the legitimate submission of each of our constituent PMCs. For end users of ASF software, the goal is that you receive software
-that was not modified by an attacker with the intent to cause you harm.
-
-**Another goal of ATR is to help assure that [release artifacts follow licensing policy.](https://www.apache.org/legal/release-policy.html#artifacts)**
-To help PMCs follow licensing rules and avoid end user surprise ATR provides several checks.
-When a Software Bill of Materials (SBOM) is provided dependency risks are also assessed.
+[The Apache Software Foundation](https://www.apache.org/) (ASF) make official ASF software releases.
+These official ASF releases are endorsed as an
+"[act of the Foundation](https://www.apache.org/legal/release-policy.html#release-definition)". It
+is important that the foundation - its board, members, committees, and contributors - and the
+general public have confidence in these software releases.
+
+What sort of confidence in releases is required? All parties need to be certain that the software
+available for download is exactly as intended to be published by the PMC, and by the foundation.
+This may seem trivial, but software distribution platforms such as ATR now operate in extremely
+adversarial environments. In the years before ATR was launched,
+[supply chain attacks](https://en.wikipedia.org/wiki/Supply_chain_attack) on open source software
+became
+[far more frequent and more sophisticated](https://www.sonatype.com/state-of-the-software-supply-chain/2024/scale).
+
+The end goal of supply chain attacks is almost always to cause harm to users. Harms are wide-ranging
+and can include unwanted features, the extraction of money from the user, surveillance and
+exfiltration of data, and material damage. The exact methods of supply chain attacks vary, but the
+general principle is to modify some legitimate software between the time that it was written and the
+time that it was received by the end user, without the modification being noticed. If software is
+distributed to the end user through a distribution platform, and the distribution platform has
+security weaknesses, then exploiting those security weaknesses is attractive to attackers.
+
+**One goal of ATR is to deter and minimize the risk of a supply chain attack.** ATR does not ensure
+the quality of software received legitimately from PMCs. The foundation as a whole, of course, has
+the goal of establishing the highest quality of software to be produced, but that is not the
+responsibility of ATR as a platform. The responsibility of ATR is to ensure that the software it
+distributes to end users is the legitimate submission of each of our constituent PMCs. For end users
+of ASF software, the goal is that you receive software that was not modified by an attacker with the
+intent to cause you harm.
+
+**Another goal of ATR is to help assure that
+[release artifacts follow licensing policy.](https://www.apache.org/legal/release-policy.html#artifacts)**
+To help PMCs follow licensing rules and avoid end user surprise ATR provides several checks. When a
+Software Bill of Materials (SBOM) is provided dependency risks are also assessed.
## Who are ATR users?
-There are two kinds of ATR user: our participants from our PMCs who use ATR to publish software, and ASF software end users who use ATR to
-obtain that software. This guide is primarily written for the former, our participants who are publishing their software. Skilled end users
-may be interested in reading this guide for the purpose of learning the purported security claims that we make, reviewing the implementation
-strategies that we picked to achieve them, and ascertaining the likelihood that those claims were achieved.
+There are two kinds of ATR user: our participants from our PMCs who use ATR to publish software, and
+ASF software end users who use ATR to obtain that software. This guide is primarily written for the
+former, our participants who are publishing their software. Skilled end users may be interested in
+reading this guide for the purpose of learning the purported security claims that we make, reviewing
+the implementation strategies that we picked to achieve them, and ascertaining the likelihood that
+those claims were achieved.
-In this guide, we document how ATR is situated in this complex security landscape. But we also document the day-to-day operation of ATR:
-which forms to use, which buttons to press, how to make the release process simple, convenient, and well understood, but always with the
-goal of producing software as it was intended to be.
+In this guide, we document how ATR is situated in this complex security landscape. But we also
+document the day-to-day operation of ATR: which forms to use, which buttons to press, how to make
+the release process simple, convenient, and well understood, but always with the goal of producing
+software as it was intended to be.
-For our end users ATR maintains a [catalog of all current and archived release artifacts](https://release-catalog.apache.org/).
+For our end users ATR maintains a
+[catalog of all current and archived release artifacts](https://release-catalog.apache.org/).
## What is ATR like to use?
-Security of ASF release processes is the primary goal of ATR, but outstanding usability is also necessary to achieve this goal. The ASF
-was organized as a Foundation in 1999, and has needed release procedures from the very start. ATR is the next step in the evolution of those
-procedures, but the release managers (RMs) responsible for releasing ASF software are accustomed to the existing procedures. Convenience
-is a visceral property with a disproportionate effect. If ATR were secure but less convenient, there would be less conspicuous motivation
-for RMs to migrate to the new platform. Migration always has a cost, and the benefits must outweigh that cost. If ATR is both more secure
-and more convenient than the old way of doing things, RMs are likely to migrate even if the one-time cost is relatively high. We aim to
-make ATR secure and convenient, and also to lower the cost of migration as much as possible.
-
-As such, we offer a choice of interfaces when using ATR. We have a web-based interface, a JSON API, a command-line interface (CLI),
-GitHub actions, and a Maven plugin. We try to make functionality as available as possible across the first three interfaces. The intention of
-having so many interfaces is that users can choose the ones which are most convenient for them at each step.
-
-Speaking of steps, what are the steps to release software on ATR? We have kept this as simple as possible. First, the project's participants
-compose a candidate release from existing files. Second, as per ASF policy, the PMC votes on that candidate release.
-Third, if the vote passes, the PMC officially publishes and announces the erstwhile candidate release as a finished, official release.
-That's the whole process for the majority of PMCs, but of course there are many details and considerations along the way, and some edge
-cases and alternatives as well.
+Security of ASF release processes is the primary goal of ATR, but outstanding usability is also
+necessary to achieve this goal. The ASF was organized as a Foundation in 1999, and has needed
+release procedures from the very start. ATR is the next step in the evolution of those procedures,
+but the release managers (RMs) responsible for releasing ASF software are accustomed to the existing
+procedures. Convenience is a visceral property with a disproportionate effect. If ATR were secure
+but less convenient, there would be less conspicuous motivation for RMs to migrate to the new
+platform. Migration always has a cost, and the benefits must outweigh that cost. If ATR is both more
+secure and more convenient than the old way of doing things, RMs are likely to migrate even if the
+one-time cost is relatively high. We aim to make ATR secure and convenient, and also to lower the
+cost of migration as much as possible.
+
+As such, we offer a choice of interfaces when using ATR. We have a web-based interface, a JSON API,
+a command-line interface (CLI), GitHub actions, and a Maven plugin. We try to make functionality as
+available as possible across the first three interfaces. The intention of having so many interfaces
+is that users can choose the ones which are most convenient for them at each step.
+
+Speaking of steps, what are the steps to release software on ATR? We have kept this as simple as
+possible. First, the project's participants compose a candidate release from existing files. Second,
+as per ASF policy, the PMC votes on that candidate release. Third, if the vote passes, the PMC
+officially publishes and announces the erstwhile candidate release as a finished, official release.
+That's the whole process for the majority of PMCs, but of course there are many details and
+considerations along the way, and some edge cases and alternatives as well.
## Who develops ATR?
-ATR is developed by the ASF Tooling Initiative launched in late 2024, and responsible for streamlining development, automating repetitive tasks,
-reducing technical debt, and enhancing collaboration throughout the ASF. The source code of ATR is developed in public as open source code,
-and ASF Tooling welcomes high quality contributions to the codebase from external contributors, whether from existing ASF contributors or
-members of the public. Because of the stringent security and usability requirements, Tooling accepts only very high quality contributions, and
-carefully reviews all submitted code. As a consequence, contributors must be well versed in the workings of ATR, and therefore this manual
-contains an extensive developer section to facilitate understanding.
-
-This manual is an integral part of ATR, and contributions to this manual are therefore treated like any of the rest of the code.
-We welcome all types of contribution, whether that be writing entire pages or correcting small typographical errors. The easiest path to
-contribution is to [create a pull request](https://github.com/apache/tooling-trusted-releases/compare) on
-[our GitHub repository](https://github.com/apache/tooling-trusted-releases). Read our [contribution guide](how-to-contribute) and
-[developer guide](developer-guide) for more details.
+ATR is developed by the ASF Tooling Initiative launched in late 2024, and responsible for
+streamlining development, automating repetitive tasks, reducing technical debt, and enhancing
+collaboration throughout the ASF. The source code of ATR is developed in public as open source code,
+and ASF Tooling welcomes high quality contributions to the codebase from external contributors,
+whether from existing ASF contributors or members of the public. Because of the stringent security
+and usability requirements, Tooling accepts only very high quality contributions, and carefully
+reviews all submitted code. As a consequence, contributors must be well versed in the workings of
+ATR, and therefore this manual contains an extensive developer section to facilitate understanding.
+
+This manual is an integral part of ATR, and contributions to this manual are therefore treated like
+any of the rest of the code. We welcome all types of contribution, whether that be writing entire
+pages or correcting small typographical errors. The easiest path to contribution is to
+[create a pull request](https://github.com/apache/tooling-trusted-releases/compare) on
+[our GitHub repository](https://github.com/apache/tooling-trusted-releases). Read our
+[contribution guide](how-to-contribute) and [developer guide](developer-guide) for more details.
diff --git a/atr/docs/sessions.md b/atr/docs/sessions.md
index 2d338c68..8c963a06 100644
--- a/atr/docs/sessions.md
+++ b/atr/docs/sessions.md
@@ -21,49 +21,44 @@
## Overview
ATR authenticates committers through ASF OAuth (see
-[Authentication security](authentication-security)). A successful login creates a
-*session*: a server-side record that identifies the user on later requests, so
-they do not re-authenticate on every page. This page describes what a session
-holds, how long it lasts, and how it is revoked.
+[Authentication security](authentication-security)). A successful login creates a *session*: a
+server-side record that identifies the user on later requests, so they do not re-authenticate on
+every page. This page describes what a session holds, how long it lasts, and how it is revoked.
-Sessions are managed in [`sessions.py`](/ref/atr/sessions.py). The session
-identifier itself travels in a cookie; the database stores only a hash of it,
-alongside the user's identity and roles as reported by OAuth at login.
+Sessions are managed in [`sessions.py`](/ref/atr/sessions.py). The session identifier itself travels
+in a cookie; the database stores only a hash of it, alongside the user's identity and roles as
+reported by OAuth at login.
## What a session stores
-Each session is a [`UserSession`](/ref/atr/models/sql.py) row. Its primary key,
-`sid_hash`, is a hash of the session identifier - the raw identifier is held only
-in the client's cookie, so the database never contains a value that could be
-replayed as a session id.
+Each session is a [`UserSession`](/ref/atr/models/sql.py) row. Its primary key, `sid_hash`, is a
+hash of the session identifier - the raw identifier is held only in the client's cookie, so the
+database never contains a value that could be replayed as a session id.
The remaining columns record the user's identity and authorisation context:
-* `uid`, `dn`, `fullname`, `email` - identity (email defaults to
- `<uid>@apache.org` when OAuth supplies none).
+* `uid`, `dn`, `fullname`, `email` - identity (email defaults to `<uid>@apache.org` when OAuth
+ supplies none).
* `is_member`, `is_chair`, `is_root`, `is_role`, `mfa` - role and account flags.
-* `member_committees` and `participant_committees` - the committees where the
- user is a PMC member or a committer.
+* `member_committees` and `participant_committees` - the committees where the user is a PMC member
+ or a committer.
* `ip_address` - the client address captured when the session was created.
-* `admin_uid` and `downgrade_admin_to_user` - support administrator impersonation
- and voluntary downgrade.
-* `last_account_check`, `cts`, `uts` - the time of the last account re-check, and
- the creation and last-update times.
+* `admin_uid` and `downgrade_admin_to_user` - support administrator impersonation and voluntary
+ downgrade.
+* `last_account_check`, `cts`, `uts` - the time of the last account re-check, and the creation and
+ last-update times.
-Before a session is written, `_prepare_session_data` maps the raw OAuth payload
-onto these fields - for example the OAuth `pmcs` key becomes `member_committees`
-and `projects` becomes `participant_committees` - and discards everything that is
-not a modelled field, including the OAuth `metadata` block. Only the fields above
-are persisted.
+Before a session is written, `_prepare_session_data` maps the raw OAuth payload onto these fields -
+for example the OAuth `pmcs` key becomes `member_committees` and `projects` becomes
+`participant_committees` - and discards everything that is not a modelled field, including the OAuth
+`metadata` block. Only the fields above are persisted.
## The session cookie
-The session cookie is configured in [`config.py`](/ref/atr/config.py) with
-hardened defaults:
+The session cookie is configured in [`config.py`](/ref/atr/config.py) with hardened defaults:
-* Name `__Host-session` - the `__Host-` prefix requires the cookie to be secure,
- host-scoped, and path `/`, so it cannot be scoped to a parent domain or set
- over plain HTTP.
+* Name `__Host-session` - the `__Host-` prefix requires the cookie to be secure, host-scoped, and
+ path `/`, so it cannot be scoped to a parent domain or set over plain HTTP.
* `Secure` - sent only over HTTPS.
* `HttpOnly` - not readable from JavaScript.
* `SameSite=Strict` - not sent on cross-site requests.
@@ -72,103 +67,89 @@ Only the identifier travels in the cookie; all other session state is server-sid
## Session lifecycle
-* **Creation.** On a successful OAuth login, `Store.create` prepares the OAuth
- data, records the client IP and the current time, and inserts the
- `UserSession` row.
-* **Validation.** On each request, `Store.validate` looks the session up by
- `sid_hash`. An expired session is deleted and treated as absent; otherwise its
- `uts` (last-update time) is refreshed, so activity slides the idle window
- forward.
-* **Caching.** Within a single request the resolved session is cached on
- `quart.g`, so repeated reads do not re-query the database; `invalidate_cache`
- clears it when the session changes.
+* **Creation.** On a successful OAuth login, `Store.create` prepares the OAuth data, records the
+ client IP and the current time, and inserts the `UserSession` row.
+* **Validation.** On each request, `Store.validate` looks the session up by `sid_hash`. An expired
+ session is deleted and treated as absent; otherwise its `uts` (last-update time) is refreshed, so
+ activity slides the idle window forward.
+* **Caching.** Within a single request the resolved session is cached on `quart.g`, so repeated
+ reads do not re-query the database; `invalidate_cache` clears it when the session changes.
## Timeouts and expiry
A session can expire in two independent ways:
-* **Idle timeout.** A session unused for more than three days
- (`_SESSION_IDLE_TIMEOUT`) is treated as expired. Because `validate` refreshes
- `uts` on every request, this is a sliding window measured from the last
- activity.
-* **Absolute maximum age.** When `MAX_SESSION_AGE` is greater than zero, a session
- older than that from its creation time (`cts`) expires regardless of activity.
- It defaults to 72 hours, and can be changed, or disabled entirely by setting it
- to zero.
+* **Idle timeout.** A session unused for more than three days (`_SESSION_IDLE_TIMEOUT`) is treated
+ as expired. Because `validate` refreshes `uts` on every request, this is a sliding window measured
+ from the last activity.
+* **Absolute maximum age.** When `MAX_SESSION_AGE` is greater than zero, a session older than that
+ from its creation time (`cts`) expires regardless of activity. It defaults to 72 hours, and can be
+ changed, or disabled entirely by setting it to zero.
-With the default configuration both limits are three days, so a session lasts at
-most 72 hours regardless of activity. The idle limit takes effect when
-`MAX_SESSION_AGE` is raised or disabled. When `validate` finds an expired session,
-it deletes the row.
+With the default configuration both limits are three days, so a session lasts at most 72 hours
+regardless of activity. The idle limit takes effect when `MAX_SESSION_AGE` is raised or disabled.
+When `validate` finds an expired session, it deletes the row.
## Concurrent sessions and revocation
-ATR does not limit the number of concurrent sessions per account. `Store.create`
-inserts a new row on every login, so a user signed in from several devices may
-hold many live sessions at once; there is no per-account ceiling.
-
-Unlimited concurrent sessions are safe here because revocation is always
-account-wide:
-
-* `revoke_by_uid` deletes every session belonging to a uid in one operation,
- matching both the session's `uid` and any `admin_uid`, so an administrator's
- impersonation sessions are revoked as well.
-* Credential revocation calls `terminate_current_users_sessions`, which revokes
- all of the user's sessions, so a compromised credential cannot leave a stray
- session behind.
-* If an account is found to be disabled or banned, `deleted_or_banned` revokes
- all of its sessions and clears the current one.
-
-Account status is re-checked during a session's life. `account_check` asks LDAP,
-through `is_active`, whether the account - and, for an impersonation session, the
-administrator's account - is still active, records the time in
-`last_account_check`, and tears the session down if the account is disabled or
-banned.
-
-Two situations relax this. If a live LDAP error occurs during the check,
-`account_check` logs a warning and leaves the session in place rather than failing
-the request. And when ATR runs without LDAP bind credentials outside production -
-as in local development - `is_active` treats every account as active, so the check
-never tears a session down.
+ATR does not limit the number of concurrent sessions per account. `Store.create` inserts a new row
+on every login, so a user signed in from several devices may hold many live sessions at once; there
+is no per-account ceiling.
+
+Unlimited concurrent sessions are safe here because revocation is always account-wide:
+
+* `revoke_by_uid` deletes every session belonging to a uid in one operation, matching both the
+ session's `uid` and any `admin_uid`, so an administrator's impersonation sessions are revoked as
+ well.
+* Credential revocation calls `terminate_current_users_sessions`, which revokes all of the user's
+ sessions, so a compromised credential cannot leave a stray session behind.
+* If an account is found to be disabled or banned, `deleted_or_banned` revokes all of its sessions
+ and clears the current one.
+
+Account status is re-checked during a session's life. `account_check` asks LDAP, through
+`is_active`, whether the account - and, for an impersonation session, the administrator's account -
+is still active, records the time in `last_account_check`, and tears the session down if the account
+is disabled or banned.
+
+Two situations relax this. If a live LDAP error occurs during the check, `account_check` logs a
+warning and leaves the session in place rather than failing the request. And when ATR runs without
+LDAP bind credentials outside production - as in local development - `is_active` treats every
+account as active, so the check never tears a session down.
## OAuth scope and least privilege
-The OAuth authorization request that begins a login is constructed by ASFQuart
-against `oauth.apache.org`; ATR does not build that request and does not set the
-OAuth `scope` parameter itself. Which claims the authorization server returns is
-therefore governed upstream - by ASFQuart and by ATR's client registration at
-`oauth.apache.org`.
+The OAuth authorization request that begins a login is constructed by ASFQuart against
+`oauth.apache.org`; ATR does not build that request and does not set the OAuth `scope` parameter
+itself. Which claims the authorization server returns is therefore governed upstream - by ASFQuart
+and by ATR's client registration at `oauth.apache.org`.
ATR applies least privilege to what it *retains*. As described under
-[What a session stores](#what-a-session-stores), `_prepare_session_data` keeps
-only the fields modelled on `UserSession` and drops the rest of the OAuth payload
-before anything is written. So even if the authorization server returns more than
-ATR needs, only those fields are persisted in a session.
+[What a session stores](#what-a-session-stores), `_prepare_session_data` keeps only the fields
+modelled on `UserSession` and drops the rest of the OAuth payload before anything is written. So
+even if the authorization server returns more than ATR needs, only those fields are persisted in a
+session.
## Flashing form errors
-When a form submission fails validation, ATR re-renders the form after the browser
-has been redirected back to it - a POST, then a redirect, then a GET - with the
-user's own input restored and the errors shown against the relevant fields. The
-data that survives that redirect is held in a session-scoped table rather than in
-the URL or the cookie.
-
-[`SessionFormError`](/ref/atr/models/sql.py) stores one payload per session and
-request path. The payload, built by `flash_error_data` in
-[`form.py`](/ref/atr/form.py), carries both the messages and the submitted input:
-each errored field keeps its label, its message, and the value that was entered,
-and every other submitted field keeps its value too, so nothing the user typed is
-lost on the way back.
-
-`form_error_put` writes that payload when a submission fails - through
-`flash_form_error` in [`blueprints/common.py`](/ref/atr/blueprints/common.py) and
-`form_error` in [`web.py`](/ref/atr/web.py) - and `form_error_pop` reads it back
-and deletes it when the form is next rendered, so it is shown once. The `sid_hash`
-foreign key cascades on delete, so a session's pending payload disappears when the
-session does.
-
-Alongside this, a short summary of the errors is shown immediately through Quart's
-own `flash`, which ATR also uses elsewhere for one-off success and error messages.
+When a form submission fails validation, ATR re-renders the form after the browser has been
+redirected back to it - a POST, then a redirect, then a GET - with the user's own input restored and
+the errors shown against the relevant fields. The data that survives that redirect is held in a
+session-scoped table rather than in the URL or the cookie.
+
+[`SessionFormError`](/ref/atr/models/sql.py) stores one payload per session and request path. The
+payload, built by `flash_error_data` in [`form.py`](/ref/atr/form.py), carries both the messages and
+the submitted input: each errored field keeps its label, its message, and the value that was
+entered, and every other submitted field keeps its value too, so nothing the user typed is lost on
+the way back.
+
+`form_error_put` writes that payload when a submission fails - through `flash_form_error` in
+[`blueprints/common.py`](/ref/atr/blueprints/common.py) and `form_error` in
+[`web.py`](/ref/atr/web.py) - and `form_error_pop` reads it back and deletes it when the form is
+next rendered, so it is shown once. The `sid_hash` foreign key cascades on delete, so a session's
+pending payload disappears when the session does.
+
+Alongside this, a short summary of the errors is shown immediately through Quart's own `flash`,
+which ATR also uses elsewhere for one-off success and error messages.
## Implementation references
diff --git a/atr/docs/signing-artifacts.md b/atr/docs/signing-artifacts.md
index 2e20d593..fb87adde 100644
--- a/atr/docs/signing-artifacts.md
+++ b/atr/docs/signing-artifacts.md
@@ -1,8 +1,8 @@
# 4.1. Signing artifacts
-**Up**: `4.` [Release managers](release-manager-setup)
+**Up**: `4.` [Release manager setup](release-manager-setup)
-**Prev**: `4.` [Release managers](release-manager-setup)
+**Prev**: `4.` [Release manager setup](release-manager-setup)
**Next**: `4.2.` [Trusted Publishing](trusted-publishing)
@@ -15,23 +15,37 @@
## Introduction
-The ASF Infrastructure team provide an [extensive guide to signing artifacts](https://infra.apache.org/release-signing.html) which should be followed.
+The ASF Infrastructure team provide an
+[extensive guide to signing artifacts](https://infra.apache.org/release-signing.html) which should
+be followed.
-For users who prefer a faster route to signing artifacts, such as novice release managers, this page provides a very quick guide. We sacrifice some security and comprehensiveness in the process, but this guide does not replace or supplant the ASF Infra guide above. Please refer to that for further detail.
+For users who prefer a faster route to signing artifacts, such as novice release managers, this page
+provides a very quick guide. We sacrifice some security and comprehensiveness in the process, but
+this guide does not replace or supplant the ASF Infra guide above. Please refer to that for further
+detail.
## How to sign artifacts
### Step 1: Install the requirements
-Install GnuPG 2.1 or higher in your package manager. The `gpg` and `gpgconf` commands must be available in your `PATH`, with those exact names. Some package managers install GnuPG 2 with the `gpg2` command, so double check this.
+Install GnuPG 2.1 or higher in your package manager. The `gpg` and `gpgconf` commands must be
+available in your `PATH`, with those exact names. Some package managers install GnuPG 2 with the
+`gpg2` command, so double check this.
-[Download the `gpgsign.sh` shell script](/static/sh/gpgsign.sh) that we make available as part of ATR. The rest of this guide will assume that it is available on your path as `gpgsign`, but you can call it using `sh gpgsign.sh` etc.
+[Download the `gpgsign.sh` shell script](/static/sh/gpgsign.sh) that we make available as part of
+ATR. The rest of this guide will assume that it is available on your path as `gpgsign`, but you can
+call it using `sh gpgsign.sh` etc.
### Step 2: Generate an OpenPGP keypair
-Choose where to write your OpenPGP keys. This can be anywhere, but you will need to keep your private key secure. This guide will put them in the home directory.
+Choose where to write your OpenPGP keys. This can be anywhere, but you will need to keep your
+private key secure. This guide will put them in the home directory.
-The email address in your key matters. ATR links a key to an ASF account through the email address in the key, so use your `@apache.org` address, or another address that you have linked to your account at [id.apache.org](https://id.apache.org/). If ATR cannot map the address to an ASF UID, the individual key upload page will not accept the key. The example below uses `example@apache.org`; substitute your own name and address.
+The email address in your key matters. ATR links a key to an ASF account through the email address
+in the key, so use your `@apache.org` address, or another address that you have linked to your
+account at [id.apache.org](https://id.apache.org/). If ATR cannot map the address to an ASF UID, the
+individual key upload page will not accept the key. The example below uses `example@apache.org`;
+substitute your own name and address.
```shell
gpgsign issue "Alice Example" example@apache.org ~/.public.asc ~/.private.asc
@@ -48,13 +62,18 @@ do
done
```
-This will create `.tar.gz.asc` files, which is standard. Supply an extra argument to `gpgsign sign` if you want to choose different filenames.
+This will create `.tar.gz.asc` files, which is standard. Supply an extra argument to `gpgsign sign`
+if you want to choose different filenames.
### Step 4: Upload your key to ATR
-Go to [add your OpenPGP key](/keys/add) on ATR and upload your _public_ key. Do not upload your private key. You must not reveal your private key to anyone, or store it on untrusted equipment.
+Go to [add your OpenPGP key](/keys/add) on ATR and upload your _public_ key. Do not upload your
+private key. You must not reveal your private key to anyone, or store it on untrusted equipment.
-The email address in your key is publically associated with releases you sign through your public key and your committee's public `KEYS` file. Treat this as a lasting public record. You can remove the key from ATR later, but that does not retract the signatures on releases that you have already published.
+The email address in your key is publically associated with releases you sign through your public
+key and your committee's public `KEYS` file. Treat this as a lasting public record. You can remove
+the key from ATR later, but that does not retract the signatures on releases that you have already
+published.
## Optional steps
@@ -62,14 +81,22 @@ That's all that you need to do, but you can also take the following step.
### Step 5: Verify the signatures (optional)
-Optionally, you can check the signatures that you just created. This can guard, for example, against having accidentally created empty signature files. ATR will also validate your signatures for you, but for example you can run:
+Optionally, you can check the signatures that you just created. This can guard, for example, against
+having accidentally created empty signature files. ATR will also validate your signatures for you,
+but for example you can run:
```shell
gpgsign verify ~/.public.asc example.tar.gz
```
-Assuming that the signature is at `example.tar.gz.asc`. Otherwise you can supply an extra argument for the signature file path.
+Assuming that the signature is at `example.tar.gz.asc`. Otherwise you can supply an extra argument
+for the signature file path.
## Security considerations
-For ease of use, this script creates a key without password protection. For enhanced security, please follow the [extensive guide to signing artifacts](https://infra.apache.org/release-signing.html) by ASF Infra. This script has not been audited, and has not been tested in a wide range of environments. There is one known potential race condition, and temporary directories are generated using an insecure pseudorandom value. These are limitations of the script to make it portable.
+For ease of use, this script creates a key without password protection. For enhanced security,
+please follow the
+[extensive guide to signing artifacts](https://infra.apache.org/release-signing.html) by ASF Infra.
+This script has not been audited, and has not been tested in a wide range of environments. There is
+one known potential race condition, and temporary directories are generated using an insecure
+pseudorandom value. These are limitations of the script to make it portable.
diff --git a/atr/docs/staging-and-voting.md b/atr/docs/staging-and-voting.md
index d9e7e1c0..d7c5e8dd 100644
--- a/atr/docs/staging-and-voting.md
+++ b/atr/docs/staging-and-voting.md
@@ -16,36 +16,69 @@
## Where release candidates are staged
-When you compose a release candidate in ATR, the candidate artifacts are held by ATR itself. They stay there for the whole of the compose and vote phases. Nothing is copied into the Apache distribution SVN repository until the vote has passed and you finish the release, which is covered in [Promoting to release](promoting-to-release).
+When you compose a release candidate in ATR, the candidate artifacts are held by ATR itself. They
+stay there for the whole of the compose and vote phases. Nothing is copied into the Apache
+distribution SVN repository until the vote has passed and you finish the release, which is covered
+in [Promoting to release](promoting-to-release).
-This means that ATR is the staging location for your candidate. Voters download the files from ATR, run whatever checks they want to run against them, and vote on that basis.
+This means that ATR is the staging location for your candidate. Voters download the files from ATR,
+run whatever checks they want to run against them, and vote on that basis.
-ASF release policy accommodates this. The policy [recommends](https://www.apache.org/legal/release-policy.html#stage) that projects use either the `dist/dev` tree or the staging features of `repository.apache.org` to host release candidates, and it describes `dist/dev` as a staging location intended for use before a release becomes official. That recommendation does not preclude other staging locations, and the policy does not require any particular one. ATR is a further place where cand [...]
+ASF release policy accommodates this. The policy
+[recommends](https://www.apache.org/legal/release-policy.html#stage) that projects use either the
+`dist/dev` tree or the staging features of `repository.apache.org` to host release candidates, and
+it describes `dist/dev` as a staging location intended for use before a release becomes official.
+That recommendation does not preclude other staging locations, and the policy does not require any
+particular one. ATR is a further place where candidates may be staged.
## What to link in a vote announcement
-The default ATR vote template links to two things: the release candidate page on ATR, which is where the downloads are, and the committee `KEYS` file. It deliberately does not link to any other source of the same artifacts.
+The default ATR vote template links to two things: the release candidate page on ATR, which is where
+the downloads are, and the committee `KEYS` file. It deliberately does not link to any other source
+of the same artifacts.
-We recommend that you keep it that way, and link only to the ATR release candidate page in your vote emails.
+We recommend that you keep it that way, and link only to the ATR release candidate page in your vote
+emails.
-The reason is that a vote is a vote on one identified set of files. ATR pins the candidate to a specific revision, so the files behind the link cannot change underneath the voters. If a vote email also points at a copy of the artifacts held somewhere else, then there are two sets of files in play and nothing guarantees that they stay identical. Voters may then be voting on different bytes to one another, and it becomes the release manager's job to keep the copies in step for the duration [...]
+The reason is that a vote is a vote on one identified set of files. ATR pins the candidate to a
+specific revision, so the files behind the link cannot change underneath the voters. If a vote email
+also points at a copy of the artifacts held somewhere else, then there are two sets of files in play
+and nothing guarantees that they stay identical. Voters may then be voting on different bytes to one
+another, and it becomes the release manager's job to keep the copies in step for the duration of the
+vote.
-If your project does choose to link to another source as well, mark those links clearly as informational. They should not be presented as a formal part of the vote. The artifacts that the vote is being held on are the ones on ATR.
+If your project does choose to link to another source as well, mark those links clearly as
+informational. They should not be presented as a formal part of the vote. The artifacts that the
+vote is being held on are the ones on ATR.
## Verifying artifacts during a vote
-Some projects may have scripts that download a candidate and run checks over it. If yours does, and it currently fetches the files from SVN, point it at ATR instead.
+Some projects may have scripts that download a candidate and run checks over it. If yours does, and
+it currently fetches the files from SVN, point it at ATR instead.
-The release candidate page gives you a one line `curl` command that fetches every file in the candidate into the current directory. If you would rather drive the downloads yourself, a plain list of the file URLs is available at `/download/urls/<project>/<version>`. Both that list and the script behind the `curl` command are public, so a voter who is not a committer can still use them.
+The release candidate page gives you a one line `curl` command that fetches every file in the
+candidate into the current directory. If you would rather drive the downloads yourself, a plain list
+of the file URLs is available at `/download/urls/<project>/<version>`. Both that list and the script
+behind the `curl` command are public, so a voter who is not a committer can still use them.
-ATR also runs its own [checks](checks) over every revision, and the results are visible on the candidate page. These are intended to cover as many mechanically checkable ASF policy requirements as possible, so in some cases they may already cover what a project's own script was written to check.
+ATR also runs its own [checks](checks) over every revision, and the results are visible on the
+candidate page. These are intended to cover as many mechanically checkable ASF policy requirements
+as possible, so in some cases they may already cover what a project's own script was written to
+check.
## How files reach ATR
-Files are added to a candidate during the compose phase, and there are many ways to do so. They are listed under [How files reach ATR](compose-phase#how-files-reach-atr) in the compose phase documentation.
+Files are added to a candidate during the compose phase, and there are many ways to do so. They are
+listed under [How files reach ATR](compose-phase#how-files-reach-atr) in the compose phase
+documentation.
## The earlier dist/dev workflow
-Before ATR published anything to SVN, we advised release managers to upload their candidate to `dist/dev`, copy the files into ATR, hold the vote, and then move the files from `dist/dev` to `dist/release` to publish. Under that workflow it was the release manager's responsibility to make sure that the files in `dist/dev` matched the ones in ATR for the duration of the vote.
+Before ATR published anything to SVN, we advised release managers to upload their candidate to
+`dist/dev`, copy the files into ATR, hold the vote, and then move the files from `dist/dev` to
+`dist/release` to publish. Under that workflow it was the release manager's responsibility to make
+sure that the files in `dist/dev` matched the ones in ATR for the duration of the vote.
-That workflow still works, but it is no longer necessary, because ATR now publishes the approved artifacts itself, directly to `dist/release`, after the vote passes. Unless you have a specific reason to keep using `dist/dev`, you do not need it when using ATR.
+That workflow still works, but it is no longer necessary, because ATR now publishes the approved
+artifacts itself, directly to `dist/release`, after the vote passes. Unless you have a specific
+reason to keep using `dist/dev`, you do not need it when using ATR.
diff --git a/atr/docs/storage-interface.md b/atr/docs/storage-interface.md
index 0f47ac54..7ca65a21 100644
--- a/atr/docs/storage-interface.md
+++ b/atr/docs/storage-interface.md
@@ -20,21 +20,42 @@
## Introduction
-All database writes, and some reads, in ATR go through the [`storage`](/ref/atr/storage/__init__.py) interface. This interface **enforces permissions**, **centralizes audit logging**, and **provides type-safe access** to the database. In other words, avoid calling [`db`](/ref/atr/db/__init__.py) directly in route handlers if possible.
-
-The storage interface recognizes several permission levels: general public (unauthenticated visitors), foundation committer (any ASF account), committee participant (committers and PMC members), release manager (PMC members and designated committer release managers for a project), committee member (PMC members only), and foundation admin (infrastructure administrators). Each level inherits from the previous one, so for example committee members can do everything release managers can do, [...]
-
-The storage interface does not make it impossible to bypass authorization, because you can always import `db` directly and write to the database. But it makes bypassing authorization an explicit choice that requires deliberate action, and it makes the safer path the easier path. This is a pragmatic approach to security: we cannot prevent all mistakes, but we can make it harder to make them accidentally.
-
-**Note:** In Test mode, authorization checks in the storage layer are completely skipped for the test committee [`release`](/ref/atr/storage/writers/release.py). This is an intentional exception for development and test environments only. See [Authorization security](authorization-security#test-mode) for the full security implications of this flag.
+All database writes, and some reads, in ATR go through the [`storage`](/ref/atr/storage/__init__.py)
+interface. This interface **enforces permissions**, **centralizes audit logging**, and **provides
+type-safe access** to the database. In other words, avoid calling [`db`](/ref/atr/db/__init__.py)
+directly in route handlers if possible.
+
+The storage interface recognizes several permission levels: general public (unauthenticated
+visitors), foundation committer (any ASF account), committee participant (committers and PMC
+members), release manager (PMC members and designated committer release managers for a project),
+committee member (PMC members only), and foundation admin (infrastructure administrators). Each
+level inherits from the previous one, so for example committee members can do everything release
+managers can do, plus additional operations.
+
+The storage interface does not make it impossible to bypass authorization, because you can always
+import `db` directly and write to the database. But it makes bypassing authorization an explicit
+choice that requires deliberate action, and it makes the safer path the easier path. This is a
+pragmatic approach to security: we cannot prevent all mistakes, but we can make it harder to make
+them accidentally.
+
+**Note:** In Test mode, authorization checks in the storage layer are completely skipped for the
+test committee [`release`](/ref/atr/storage/writers/release.py). This is an intentional exception
+for development and test environments only. See
+[Authorization security](authorization-security#test-mode) for the full security implications of
+this flag.
## How do we read from storage?
-Reading from storage is a work in progress. There are some existing methods, but most of the functionality is currently in `db` or `db.interaction`, and much work is required to migrate this to the storage interface. We have given this less priority because reads are generally safe, with the exception of a few components such as user tokens, which should be given greater migration priority.
+Reading from storage is a work in progress. There are some existing methods, but most of the
+functionality is currently in `db` or `db.interaction`, and much work is required to migrate this to
+the storage interface. We have given this less priority because reads are generally safe, with the
+exception of a few components such as user tokens, which should be given greater migration priority.
## How do we write to storage?
-To write to storage we open a write session, request specific permissions, use the exposed functionality, and then handle the outcome. Here is an actual example from [`post/start.py`](/ref/atr/post/start.py):
+To write to storage we open a write session, request specific permissions, use the exposed
+functionality, and then handle the outcome. Here is an actual example from
+[`post/start.py`](/ref/atr/post/start.py):
```python
async with storage.write(session) as write:
@@ -42,25 +63,69 @@ async with storage.write(session) as write:
new_release, _project = await wacp.release.start(project_name, version)
```
-The `wacp` object, short for `w`rite `a`s `c`ommittee `p`articipant, provides access to domain-specific writers: `announce`, `checks`, `distributions`, `keys`, `policy`, `project`, `release`, `sbom`, `ssh`, `tokens`, and `vote`.
-
-The write session takes an optional [`Committer`](/ref/atr/web.py) (Committer) or ASF UID, typically `session.uid` from the logged-in user. If you omit the UID, the session determines it automatically from the current request context. The write object checks LDAP memberships and raises [`storage.AccessError`](/ref/atr/storage/__init__.py) (AccessError) if the user is not authorized for the requested permission level.
-
-Because projects belong to committees, we provide [`write.as_project_committee_member(project_name)`](/ref/atr/storage/__init__.py) (as_project_committee_member) and [`write.as_project_committee_participant(project_name)`](/ref/atr/storage/__init__.py) (as_project_committee_participant), which look up the project's committee and authenticate the user as a member or participant of that committee. This is convenient when, for example, the URL provides a project name.
-
-Some storage writers perform additional authorization validation beyond what `as_project_committee_member` provides. The check ignores writer, for example, validates that the target project belongs to the committee for which the user is authorized. Therefore even if a caller mistakenly passes an incorrect project name, the writer will reject the operation.
-
-Some rules cannot be expressed at the committee level at all, because they depend on the specific release rather than on its committee. Expedited releases, marked by the [`expedited`](/ref/atr/models/sql.py:Release) flag, are confidential until they reach the `RELEASE` phase, and while a release is embargoed only committee members may write to it. A participant or a designated release manager is not necessarily a committee member, so the committee scoped factories cannot enforce this on [...]
-
-Instead, each writer method that mutates a release calls [`write.ensure_release_writable(release)`](/ref/atr/storage/__init__.py) (`ensure_release_writable`) against the release it has just loaded, which raises a generic 403 [`AccessError`](/ref/atr/storage/__init__.py) (`AccessError`) when the release is expedited and the actor is not a member of its committee. The check runs against the release actually being mutated, not a value supplied earlier in the request, so it cannot be bypasse [...]
-
-File and revision changes are all funnelled through [`create_revision_with_quarantine`](/ref/atr/storage/writers/revision.py) (`create_revision_with_quarantine`), so the check there covers every file mutation, and the remaining row level mutations carry the same check where they load the release. Member-tier and higher methods do not need the check, because a non-member can never obtain a member-tier writer in the first place.
-
-Creating an expedited release follows the same member-only rule from the other direction. The participant-tier `release.start` and the member-tier [`write.as_project_committee_member(project_name)`](/ref/atr/storage/__init__.py).`release.start_expedited(...)` both delegate to the module-level `_start_release` function, which is the only place that constructs a release carrying the `expedited` flag. The participant `start` always passes `expedited=False`; only `start_expedited` passes `ex [...]
-
-The `expedited` argument is not a privilege switch: before persisting the new release, `_start_release` calls `ensure_release_writable` on it, so an expedited (and therefore embargoed) release is refused unless the actor is a member of its committee, no matter which tier reached the function or whether a future caller passes the flag. The member factory enforces the same rule earlier, when it constructs the writer, and the writable check runs before any row is written, so a refused attem [...]
-
-Here is a more complete example from [`api/__init__.py`](/ref/atr/api/__init__.py) that shows the classic three step pattern:
+The `wacp` object, short for `w`rite `a`s `c`ommittee `p`articipant, provides access to
+domain-specific writers: `announce`, `checks`, `distributions`, `keys`, `policy`, `project`,
+`release`, `sbom`, `ssh`, `tokens`, and `vote`.
+
+The write session takes an optional [`Committer`](/ref/atr/web.py) (Committer) or ASF UID, typically
+`session.uid` from the logged-in user. If you omit the UID, the session determines it automatically
+from the current request context. The write object checks LDAP memberships and raises
+[`storage.AccessError`](/ref/atr/storage/__init__.py) (AccessError) if the user is not authorized
+for the requested permission level.
+
+Because projects belong to committees, we provide
+[`write.as_project_committee_member(project_name)`](/ref/atr/storage/__init__.py)
+(as_project_committee_member) and
+[`write.as_project_committee_participant(project_name)`](/ref/atr/storage/__init__.py)
+(as_project_committee_participant), which look up the project's committee and authenticate the user
+as a member or participant of that committee. This is convenient when, for example, the URL provides
+a project name.
+
+Some storage writers perform additional authorization validation beyond what
+`as_project_committee_member` provides. The check ignores writer, for example, validates that the
+target project belongs to the committee for which the user is authorized. Therefore even if a caller
+mistakenly passes an incorrect project name, the writer will reject the operation.
+
+Some rules cannot be expressed at the committee level at all, because they depend on the specific
+release rather than on its committee. Expedited releases, marked by the
+[`expedited`](/ref/atr/models/sql.py:Release) flag, are confidential until they reach the `RELEASE`
+phase, and while a release is embargoed only committee members may write to it. A participant or a
+designated release manager is not necessarily a committee member, so the committee scoped factories
+cannot enforce this on their own.
+
+Instead, each writer method that mutates a release calls
+[`write.ensure_release_writable(release)`](/ref/atr/storage/__init__.py) (`ensure_release_writable`)
+against the release it has just loaded, which raises a generic 403
+[`AccessError`](/ref/atr/storage/__init__.py) (`AccessError`) when the release is expedited and the
+actor is not a member of its committee. The check runs against the release actually being mutated,
+not a value supplied earlier in the request, so it cannot be bypassed by passing a stale or
+unrelated release.
+
+File and revision changes are all funnelled through
+[`create_revision_with_quarantine`](/ref/atr/storage/writers/revision.py)
+(`create_revision_with_quarantine`), so the check there covers every file mutation, and the
+remaining row level mutations carry the same check where they load the release. Member-tier and
+higher methods do not need the check, because a non-member can never obtain a member-tier writer in
+the first place.
+
+Creating an expedited release follows the same member-only rule from the other direction. The
+participant-tier `release.start` and the member-tier
+[`write.as_project_committee_member(project_name)`](/ref/atr/storage/__init__.py).`release.start_expedited(...)`
+both delegate to the module-level `_start_release` function, which is the only place that constructs
+a release carrying the `expedited` flag. The participant `start` always passes `expedited=False`;
+only `start_expedited` passes `expedited=True`, and `start_expedited` exists only on the member
+tier.
+
+The `expedited` argument is not a privilege switch: before persisting the new release,
+`_start_release` calls `ensure_release_writable` on it, so an expedited (and therefore embargoed)
+release is refused unless the actor is a member of its committee, no matter which tier reached the
+function or whether a future caller passes the flag. The member factory enforces the same rule
+earlier, when it constructs the writer, and the writable check runs before any row is written, so a
+refused attempt leaves no release behind. The flag is set only at creation, and no edit form or API
+exposes it afterwards, so it is immutable once chosen.
+
+Here is a more complete example from [`api/__init__.py`](/ref/atr/api/__init__.py) that shows the
+classic three step pattern:
```python
async with storage.write(asf_uid) as write:
@@ -74,11 +139,16 @@ async with storage.write(asf_uid) as write:
key = outcome.result_or_raise()
```
-In this case we decide to raise as soon as there is any error. We could also choose to display a warning, ignore the error, collect multiple outcomes for batch processing, or handle it in any other way appropriate for the situation.
+In this case we decide to raise as soon as there is any error. We could also choose to display a
+warning, ignore the error, collect multiple outcomes for batch processing, or handle it in any other
+way appropriate for the situation.
## How do we add new storage functionality?
-Add methods to classes in the [`storage/writers`](/ref/atr/storage/writers/) or [`storage/readers`](/ref/atr/storage/readers/) directories. Code to perform any action associated with public keys that involves writing to storage, for example, goes in [`storage/writers/keys.py`](/ref/atr/storage/writers/keys.py).
+Add methods to classes in the [`storage/writers`](/ref/atr/storage/writers/) or
+[`storage/readers`](/ref/atr/storage/readers/) directories. Code to perform any action associated
+with public keys that involves writing to storage, for example, goes in
+[`storage/writers/keys.py`](/ref/atr/storage/writers/keys.py).
Classes in writer and reader modules must be named to match the permission hierarchy:
@@ -131,19 +201,37 @@ class CommitteeMember(ReleaseManager):
...
```
-This hierarchy that this creates is: `GeneralPublic` → `FoundationCommitter` → `CommitteeParticipant` → `ReleaseManager` → `CommitteeMember`. You can add methods at any level. A method on `CommitteeMember` is only available to committee members, while a method on `ReleaseManager` is available to committee members and designated release managers.
+This hierarchy that this creates is: `GeneralPublic` → `FoundationCommitter` →
+`CommitteeParticipant` → `ReleaseManager` → `CommitteeMember`. You can add methods at any level. A
+method on `CommitteeMember` is only available to committee members, while a method on
+`ReleaseManager` is available to committee members and designated release managers.
-Use `__private_methods` for helper code that is not part of the public interface. Use `public_methods` for operations that should be available to callers at the appropriate permission level. Consider returning [`Outcome`](/ref/atr/storage/outcome.py) (Outcome) types to allow callers flexibility in error handling. Refer to the [section on using outcomes](#how-do-we-use-outcomes) for more details.
+Use `__private_methods` for helper code that is not part of the public interface. Use
+`public_methods` for operations that should be available to callers at the appropriate permission
+level. Consider returning [`Outcome`](/ref/atr/storage/outcome.py) (Outcome) types to allow callers
+flexibility in error handling. Refer to the [section on using outcomes](#how-do-we-use-outcomes) for
+more details.
-After adding a new writer module, register it in the appropriate `WriteAs*` classes in [`storage/__init__.py`](/ref/atr/storage/__init__.py). For example, when adding the `distributions` writer, it was necessary to add `self.distributions = writers.distributions.CommitteeMember(write, self, data, committee_key)` to the [`WriteAsCommitteeMember`](/ref/atr/storage/__init__.py) (WriteAsCommitteeMember) class.
+After adding a new writer module, register it in the appropriate `WriteAs*` classes in
+[`storage/__init__.py`](/ref/atr/storage/__init__.py). For example, when adding the `distributions`
+writer, it was necessary to add
+`self.distributions = writers.distributions.CommitteeMember(write, self, data, committee_key)` to
+the [`WriteAsCommitteeMember`](/ref/atr/storage/__init__.py) (WriteAsCommitteeMember) class.
## How do we use outcomes?
-Consider using **outcome types** from [`storage.outcome`](/ref/atr/storage/outcome.py) when returning results from writer methods. Outcomes let you represent both success and failure without raising exceptions, which gives callers flexibility in how they handle errors.
+Consider using **outcome types** from [`storage.outcome`](/ref/atr/storage/outcome.py) when
+returning results from writer methods. Outcomes let you represent both success and failure without
+raising exceptions, which gives callers flexibility in how they handle errors.
-An [`Outcome[T]`](/ref/atr/storage/outcome.py) (Outcome) is either a [`Result[T]`](/ref/atr/storage/outcome.py) (Result) wrapping a successful value, or an [`Error[T]`](/ref/atr/storage/outcome.py) (Error) wrapping an exception. You can check which it is with the `ok` property or pattern matching, extract the value with `result_or_raise()`, or extract the error with `error_or_raise()`.
+An [`Outcome[T]`](/ref/atr/storage/outcome.py) (Outcome) is either a
+[`Result[T]`](/ref/atr/storage/outcome.py) (Result) wrapping a successful value, or an
+[`Error[T]`](/ref/atr/storage/outcome.py) (Error) wrapping an exception. You can check which it is
+with the `ok` property or pattern matching, extract the value with `result_or_raise()`, or extract
+the error with `error_or_raise()`.
-Here is an example from [`post/keys.py`](/ref/atr/post/keys.py) that processes multiple keys and collects outcomes:
+Here is an example from [`post/keys.py`](/ref/atr/post/keys.py) that processes multiple keys and
+collects outcomes:
```python
async with storage.write() as write:
@@ -154,31 +242,79 @@ success_count = outcomes.result_count
error_count = outcomes.error_count
```
-The `ensure_associated` method returns an [`outcome.List`](/ref/atr/storage/outcome.py) (List), which is a collection of outcomes. Some keys might import successfully, and others might fail because they are malformed or already exist. The caller can inspect the list to see how many succeeded and how many failed, and present that information to the user.
+The `ensure_associated` method returns an [`outcome.List`](/ref/atr/storage/outcome.py) (List),
+which is a collection of outcomes. Some keys might import successfully, and others might fail
+because they are malformed or already exist. The caller can inspect the list to see how many
+succeeded and how many failed, and present that information to the user.
-The `outcome.List` class provides many useful methods: [`results()`](/ref/atr/storage/outcome.py) (results) to get only the successful values, [`errors()`](/ref/atr/storage/outcome.py) (errors) to get only the exceptions, [`result_count`](/ref/atr/storage/outcome.py) (result_count) and [`error_count`](/ref/atr/storage/outcome.py) (error_count) to count them, and [`results_or_raise()`](/ref/atr/storage/outcome.py) (results_or_raise) to extract all values or raise on the first error.
+The `outcome.List` class provides many useful methods: [`results()`](/ref/atr/storage/outcome.py)
+(results) to get only the successful values, [`errors()`](/ref/atr/storage/outcome.py) (errors) to
+get only the exceptions, [`result_count`](/ref/atr/storage/outcome.py) (result_count) and
+[`error_count`](/ref/atr/storage/outcome.py) (error_count) to count them, and
+[`results_or_raise()`](/ref/atr/storage/outcome.py) (results_or_raise) to extract all values or
+raise on the first error.
-Use outcomes when an operation might fail for some items but succeed for others, or when you want to give the caller control over error handling. Do not use them when failure should always raise an exception, such as authorization failures or database connection errors. Those should be raised immediately.
+Use outcomes when an operation might fail for some items but succeed for others, or when you want to
+give the caller control over error handling. Do not use them when failure should always raise an
+exception, such as authorization failures or database connection errors. Those should be raised
+immediately.
## What about audit logging?
-Storage write operations are logged to `<STATE_DIR>/audit/daily/YYYY-MM-DD.jsonl`, located by [`paths.get_audit_log_dir()`](/ref/atr/paths.py) (get_audit_log_dir), alongside authentication and submitted-key events. Each entry contains `event`, `level`, `logger`, and a UTC `timestamp` assigned at append time; storage entries use the logger `atr.storage.audit`. When you write a storage method that should be audited, call `self.__write_as.append_to_audit_log(**kwargs)` with whatever paramet [...]
-
-Audit logging must be done manually because the values to log are often those computed during method execution, not just those passed as arguments which could be logged automatically. When deleting a release, for example, we log `asf_uid` (instance attribute), `project_name` (argument), and `version` (argument), but when issuing a JWT from a PAT, we log `asf_uid` (instance attribute) and `pat_hash` (_computed_). Each operation logs what makes sense for that operation.
-
-When `<STATE_DIR>/audit/daily` is absent or empty, startup automatically backfills it from the three legacy logs before enabling audit writers or starting workers. The complete directory is prepared separately and published atomically, so a failed backfill cannot leave partially migrated daily logs. The original files remain unchanged and receive no further writes. Backfill includes every UTC day from the oldest entry through today, including zero-byte empty days; a fresh installation st [...]
-
-Live entries are appended in write order. Closing a completed day with [`daylog.close()`](/ref/atr/daylog.py) (close) sorts them by timestamp, logger, level, and the canonical JSON of the event, including ties and clock adjustments. A recurring task closes days on startup and at 00:05 UTC each day, then seals them in chronological order, including empty days. Startup before 00:05 UTC catches up older days but leaves yesterday until 00:05. Historical sealing proceeds one day per task atte [...]
-
-Sealing requires persistent storage mounted at `/opt/atr/sealing`, outside the state directory and its backups. ATR creates the restricted `keys/current.pem` there and publishes the initial public key as `audit/daily/root.der`. Each day's seal is stored alongside its log as `YYYY-MM-DD.seal.json`. Missing or inconsistent key state fails the task without starting a replacement chain.
-
-If `/opt/atr/sealing` is absent in production, the sealing task fails after closing eligible daily logs. ATR continues serving requests and writing audit entries. The failure is recorded in the task database and worker log. In development and tests, an absent directory allows daily closure but skips signing. ATR does not create this directory or verify that it is a persistent mount. The deployment configuration must provide that mount.
+Storage write operations are logged to `<STATE_DIR>/audit/daily/YYYY-MM-DD.jsonl`, located by
+[`paths.get_audit_log_dir()`](/ref/atr/paths.py) (get_audit_log_dir), alongside authentication and
+submitted-key events. Each entry contains `event`, `level`, `logger`, and a UTC `timestamp` assigned
+at append time; storage entries use the logger `atr.storage.audit`. When you write a storage method
+that should be audited, call `self.__write_as.append_to_audit_log(**kwargs)` with whatever
+parameters are relevant to that specific operation. The action name is extracted automatically from
+the call stack using [`log.caller_name()`](/ref/atr/log.py) (caller_name), so if the method is
+called [`i_am_a_teapot`](https://datatracker.ietf.org/doc/html/rfc2324), the audit log will show
+`i_am_a_teapot` without you having to pass the name explicitly.
+
+Audit logging must be done manually because the values to log are often those computed during method
+execution, not just those passed as arguments which could be logged automatically. When deleting a
+release, for example, we log `asf_uid` (instance attribute), `project_name` (argument), and
+`version` (argument), but when issuing a JWT from a PAT, we log `asf_uid` (instance attribute) and
+`pat_hash` (_computed_). Each operation logs what makes sense for that operation.
+
+When `<STATE_DIR>/audit/daily` is absent or empty, startup automatically backfills it from the three
+legacy logs before enabling audit writers or starting workers. The complete directory is prepared
+separately and published atomically, so a failed backfill cannot leave partially migrated daily
+logs. The original files remain unchanged and receive no further writes. Backfill includes every UTC
+day from the oldest entry through today, including zero-byte empty days; a fresh installation starts
+with today's empty file. Existing daily files are left untouched. Invalid historical records stop
+startup rather than being skipped. This happens during the normal deployment restart, which must
+stop the previous ATR instance before starting the new one against the same state directory.
+
+Live entries are appended in write order. Closing a completed day with
+[`daylog.close()`](/ref/atr/daylog.py) (close) sorts them by timestamp, logger, level, and the
+canonical JSON of the event, including ties and clock adjustments. A recurring task closes days on
+startup and at 00:05 UTC each day, then seals them in chronological order, including empty days.
+Startup before 00:05 UTC catches up older days but leaves yesterday until 00:05. Historical sealing
+proceeds one day per task attempt to stay within worker time limits. Signing runs outside the daily
+writer lock so live audit writes can continue.
+
+Sealing requires persistent storage mounted at `/opt/atr/sealing`, outside the state directory and
+its backups. ATR creates the restricted `keys/current.pem` there and publishes the initial public
+key as `audit/daily/root.der`. Each day's seal is stored alongside its log as
+`YYYY-MM-DD.seal.json`. Missing or inconsistent key state fails the task without starting a
+replacement chain.
+
+If `/opt/atr/sealing` is absent in production, the sealing task fails after closing eligible daily
+logs. ATR continues serving requests and writing audit entries. The failure is recorded in the task
+database and worker log. In development and tests, an absent directory allows daily closure but
+skips signing. ATR does not create this directory or verify that it is a persistent mount. The
+deployment configuration must provide that mount.
## How is the filesystem organized?
-The storage interface writes to the [database](database) and the filesystem. There is one shared state directory for all of ATR, configured by the `STATE_DIR` parameter in [atr/config.py]. By default this is `$PROJECT_ROOT/state`, where `PROJECT_ROOT` is another ATR configuration parameter.
+The storage interface writes to the [database](database) and the filesystem. There is one shared
+state directory for all of ATR, configured by the `STATE_DIR` parameter in [atr/config.py]. By
+default this is `$PROJECT_ROOT/state`, where `PROJECT_ROOT` is another ATR configuration parameter.
-Only a small number of subdirectories of the state directory are written to by the storage interface, and many of these locations are also configurable. These directories, and their configuration variables, are:
+Only a small number of subdirectories of the state directory are written to by the storage
+interface, and many of these locations are also configurable. These directories, and their
+configuration variables, are:
* `attestable`, configured by `ATTESTABLE_STORAGE_DIR`
* `finished`, configured by `FINISHED_STORAGE_DIR`
@@ -186,42 +322,69 @@ Only a small number of subdirectories of the state directory are written to by t
* `temporary`, which is unconfigurable
* `unfinished`, configured by `UNFINISHED_STORAGE_DIR`
-And the purposes of these directories is as follows. Note that "immutable" here means that existing files cannot be modified, but does not preclude new files from being added.
-
-* `attestable` [**immutable**] holds JSON files of data that ATR has automatically verified and which must now be held immutably. (We could store this data in the database, but the aim is to eventually write attestation files here, so this prepares for that approach.)
-* `finished` [**immutable**, except for moving to external archive] contains all of the files of a release as they were when announced. The files are arranged exactly as the release managers arranged them upon announcing the release, separated strictly into one directory per release. This therefore constitutes an historical record.
-* `subversion` [**mutable**] is designed to mirror two subdirectories, `dev` and `release`, of `https://dist.apache.org/repos/dist`. This is currently unused.
-* `temporary` [**mutable**] holds temporary files during operations where the data cannot be modified in place. One important example is when creating a staging directory of a new revision. A subdirectory with a random name is made in this directory, and then the files in the prior version are hard linked into it. The modifications take place in this staging area before the directory is finalised and moved to `unfinished`.
-* `unfinished` [**immutable**, except for moving to `finished`] contains all of the files in a release before it is announced. In other words, when the release managers compose a release, when the committee votes on the release, and when the release has been voted on but not yet announced, the files for that release are in this directory.
+And the purposes of these directories is as follows. Note that "immutable" here means that existing
+files cannot be modified, but does not preclude new files from being added.
+
+* `attestable` [**immutable**] holds JSON files of data that ATR has automatically verified and
+ which must now be held immutably. (We could store this data in the database, but the aim is to
+ eventually write attestation files here, so this prepares for that approach.)
+* `finished` [**immutable**, except for moving to external archive] contains all of the files of a
+ release as they were when announced. The files are arranged exactly as the release managers
+ arranged them upon announcing the release, separated strictly into one directory per release. This
+ therefore constitutes an historical record.
+* `subversion` [**mutable**] is designed to mirror two subdirectories, `dev` and `release`, of
+ `https://dist.apache.org/repos/dist`. This is currently unused.
+* `temporary` [**mutable**] holds temporary files during operations where the data cannot be
+ modified in place. One important example is when creating a staging directory of a new revision. A
+ subdirectory with a random name is made in this directory, and then the files in the prior version
+ are hard linked into it. The modifications take place in this staging area before the directory is
+ finalised and moved to `unfinished`.
+* `unfinished` [**immutable**, except for moving to `finished`] contains all of the files in a
+ release before it is announced. In other words, when the release managers compose a release, when
+ the committee votes on the release, and when the release has been voted on but not yet announced,
+ the files for that release are in this directory.
This list does not include any configuration files, logs, or log directories.
## How should the filesystem be backed up?
-Only the `attestable`, `finished`, and `unfinished` directories need to be backed up. The `subversion` directory is unused, and the `temporary` directory is for temporary staging.
+Only the `attestable`, `finished`, and `unfinished` directories need to be backed up. The
+`subversion` directory is unused, and the `temporary` directory is for temporary staging.
-The structure of the directories that need backing up is as follows. An ellipsis, `...`, means any number of further files or subdirectories containing subdirectories or files recursively.
+The structure of the directories that need backing up is as follows. An ellipsis, `...`, means any
+number of further files or subdirectories containing subdirectories or files recursively.
* `attestable/PROJECT/VERSION/REVISION.json`
* `finished/PROJECT/VERSION/...`
* `unfinished/PROJECT/VERSION/REVISION/`
-Because of the versioning scheme used for the `attestable`, `finished`, and `unfinished` directories, these can be incrementally updated by simple copying without deletion.
+Because of the versioning scheme used for the `attestable`, `finished`, and `unfinished`
+directories, these can be incrementally updated by simple copying without deletion.
-This list does not include any configuration files, logs, or log directories. All configuration files and the audit logs, at a minimum, should also be backed up.
+This list does not include any configuration files, logs, or log directories. All configuration
+files and the audit logs, at a minimum, should also be backed up.
## Outcome design patterns
-One common pattern when designing outcome types is about how to handle an **exception after a success**, and how to handle a **warning during success**:
+One common pattern when designing outcome types is about how to handle an **exception after a
+success**, and how to handle a **warning during success**:
-* An **exception after a success** is when an object is processed in multiple stages, and the first few stages succeed but then subsequently there is an exception.
-* A **warning during success** is when an object is processed in multiple stages, an exception is raised, but we determine that we can proceed to subsequent stages as long as we keep a note of the exception.
+* An **exception after a success** is when an object is processed in multiple stages, and the first
+ few stages succeed but then subsequently there is an exception.
+* A **warning during success** is when an object is processed in multiple stages, an exception is
+ raised, but we determine that we can proceed to subsequent stages as long as we keep a note of the
+ exception.
-Both of these workflows appear incompatible with outcomes. In outcomes, we can record _either_ a successful result, _or_ an exception. But in exception after success we want to record the successes up to the exception; and in a warning during a success we want to record the exception even though we return a success result.
+Both of these workflows appear incompatible with outcomes. In outcomes, we can record _either_ a
+successful result, _or_ an exception. But in exception after success we want to record the successes
+up to the exception; and in a warning during a success we want to record the exception even though
+we return a success result.
-The solution is similar in both cases: create a wrapper of the _primary type_ which can hold an instance of the _secondary type_.
+The solution is similar in both cases: create a wrapper of the _primary type_ which can hold an
+instance of the _secondary type_.
-In _exception after a success_ the primary type is an exception, and the secondary type is the result which was obtained up to that exception. The type will look like this:
+In _exception after a success_ the primary type is an exception, and the secondary type is the
+result which was obtained up to that exception. The type will look like this:
```python
class AfterSuccessError(Exception):
@@ -229,7 +392,9 @@ class AfterSuccessError(Exception):
self.result_before_error = result_before_error
```
-In _warning during success_, the primary type is the result, and the secondary type is the exception raised during successful processing which we consider a warning. This is the inverse of the above, and the types are therefore inverted too.
+In _warning during success_, the primary type is the result, and the secondary type is the exception
+raised during successful processing which we consider a warning. This is the inverse of the above,
+and the types are therefore inverted too.
```python
@dataclasses.dataclass
@@ -238,7 +403,10 @@ class Result:
warning: Exception | None
```
-This could just as easily be a Pydantic class or whatever is appropriate in the situation, as long as it can hold the warning. If the warning is generated during an additional or side task, we can use `Outcome[SideValue]` instead. We do this, for example, in the type representing a linked committee:
+This could just as easily be a Pydantic class or whatever is appropriate in the situation, as long
+as it can hold the warning. If the warning is generated during an additional or side task, we can
+use `Outcome[SideValue]` instead. We do this, for example, in the type representing a linked
+committee:
```python
@dataclasses.dataclass
@@ -247,4 +415,5 @@ class LinkedCommittee:
autogenerated_keys_file: Outcome[int]
```
-In this case, if the autogenerated keys file call succeeded without an error, the `Outcome` will be an `OutcomeResult[int]` where the `int` is the number of keys in the generated file.
+In this case, if the autogenerated keys file call succeeded without an error, the `Outcome` will be
+an `OutcomeResult[int]` where the `int` is the number of keys in the generated file.
diff --git a/atr/docs/tasks.md b/atr/docs/tasks.md
index cffcea47..5a074c40 100644
--- a/atr/docs/tasks.md
+++ b/atr/docs/tasks.md
@@ -13,13 +13,18 @@
## Introduction
-Tasks are computations run in the background in dedicated worker processes orchestrated by a manager.
+Tasks are computations run in the background in dedicated worker processes orchestrated by a
+manager.
## Checks
-One important subset of task in ATR is the check. Checks are run when a release manager adds or modifies files in a release candidate draft. The outputs of the checks alert the release manager to potential issues.
+One important subset of task in ATR is the check. Checks are run when a release manager adds or
+modifies files in a release candidate draft. The outputs of the checks alert the release manager to
+potential issues.
-There are several checks for correctness that are already built out, and this how-to provides pointers for developers wishing to add new checks for relevant pieces of a release. Currently as of `alpha-2` ATR has checks for the following:
+There are several checks for correctness that are already built out, and this how-to provides
+pointers for developers wishing to add new checks for relevant pieces of a release. Currently as of
+`alpha-2` ATR has checks for the following:
1. Correct hashing (`sql.TaskType.HASHING_CHECK`, `hashing.check`)
1. Compliant license (`sql.TaskType.LICENSE_FILES`, `license.files`)
@@ -34,18 +39,22 @@ There are several checks for correctness that are already built out, and this ho
### Adding a task check module
-In `atr/tasks/checks` you will find several modules that perform these check tasks, including `hashing.py`, `license.py`, etc. To write a new check task, add a module here that performs the checks needed.
+In `atr/tasks/checks` you will find several modules that perform these check tasks, including
+`hashing.py`, `license.py`, etc. To write a new check task, add a module here that performs the
+checks needed.
### Importing and using a check module
-In `atr/tasks/__init__.py` you will see imports for existing modules where you can add an import for new check task, for example:
+In `atr/tasks/__init__.py` you will see imports for existing modules where you can add an import for
+new check task, for example:
```python
import atr.tasks.checks.hashing as file_hash
import atr.tasks.checks.license as license
```
-And in the `resolve` function you will see where those modules are exercised where you can add a `case` statement for the new task:
+And in the `resolve` function you will see where those modules are exercised where you can add a
+`case` statement for the new task:
```python
def resolve(task_type: sql.TaskType) -> Callable[..., Awaitable[results.Results | None]]: # noqa: C901
@@ -60,7 +69,8 @@ def resolve(task_type: sql.TaskType) -> Callable[..., Awaitable[results.Results
### Defining a task type
-In `atr/models/sql.py` you will find the `TaskType` class where you can add a new mapping for the task:
+In `atr/models/sql.py` you will find the `TaskType` class where you can add a new mapping for the
+task:
```python
class TaskType(str, enum.Enum):
@@ -72,5 +82,6 @@ class TaskType(str, enum.Enum):
### Task arguments
-The arguments to a task should be defined in a class, which should reside in `atr/models/args.py`. This allows them to be imported
-from elsewhere in the system without importing the whole task module.
+The arguments to a task should be defined in a class, which should reside in `atr/models/args.py`.
+This allows them to be imported from elsewhere in the system without importing the whole task
+module.
diff --git a/atr/docs/tls-security-configuration.md b/atr/docs/tls-security-configuration.md
index 0686f8bd..e569a871 100644
--- a/atr/docs/tls-security-configuration.md
+++ b/atr/docs/tls-security-configuration.md
@@ -19,7 +19,9 @@
## Overview
-This server enforces modern TLS security settings aligned with current best practices. The configuration restricts TLS to strong protocol versions, modern cipher suites, secure elliptic curves, and additional protections such as OCSP stapling and disabled session tickets.
+This server enforces modern TLS security settings aligned with current best practices. The
+configuration restricts TLS to strong protocol versions, modern cipher suites, secure elliptic
+curves, and additional protections such as OCSP stapling and disabled session tickets.
```apache
SSLProtocol -all +TLSv1.2 +TLSv1.3
@@ -50,7 +52,8 @@ SSLProtocol -all +TLSv1.2 +TLSv1.3
SSLProxyProtocol -all +TLSv1.2 +TLSv1.3
```
-These directives restrict both client connections and upstream proxy connections to **TLS 1.2 and TLS 1.3 only**.
+These directives restrict both client connections and upstream proxy connections to **TLS 1.2 and
+TLS 1.3 only**.
Version | Status | Reason
--------------|----------|-----------------------------------------------------------
@@ -59,7 +62,8 @@ TLS 1.2 | Enabled | Widely supported secure protocol
TLS 1.1 / 1.0 | Disabled | Deprecated and vulnerable to known attacks
SSLv3 / SSLv2 | Disabled | Insecure and obsolete
-TLS 1.3 cipher suites are negotiated automatically by OpenSSL and are not controlled by the `SSLCipherSuite` directive.
+TLS 1.3 cipher suites are negotiated automatically by OpenSSL and are not controlled by the
+`SSLCipherSuite` directive.
---
@@ -127,7 +131,8 @@ These provide high-performance AES encryption using **Galois/Counter Mode (GCM)*
* ECDHE-ECDSA-CHACHA20-POLY1305
* ECDHE-RSA-CHACHA20-POLY1305
-ChaCha20 performs better than AES on systems without AES hardware acceleration (e.g., many mobile devices).
+ChaCha20 performs better than AES on systems without AES hardware acceleration (e.g., many mobile
+devices).
---
@@ -137,7 +142,8 @@ ChaCha20 performs better than AES on systems without AES hardware acceleration (
* DHE-RSA-AES256-GCM-SHA384
* DHE-RSA-CHACHA20-POLY1305
-These use **finite-field Diffie-Hellman** rather than elliptic curves and exist primarily for compatibility with older clients that cannot use ECDHE.
+These use **finite-field Diffie-Hellman** rather than elliptic curves and exist primarily for
+compatibility with older clients that cannot use ECDHE.
---
@@ -149,7 +155,8 @@ SSLHonorCipherOrder off
This allows the **client to choose the preferred cipher suite** from the server’s allowed list.
-This behavior is recommended when supporting modern clients because browsers typically select the most optimal cipher for the platform (for example, preferring ChaCha20 on mobile devices).
+This behavior is recommended when supporting modern clients because browsers typically select the
+most optimal cipher for the platform (for example, preferring ChaCha20 on mobile devices).
---
@@ -161,7 +168,8 @@ This behavior is recommended when supporting modern clients because browsers typ
SSLSessionTickets off
```
-Disabling session tickets prevents reuse of ticket encryption keys across long periods, which can otherwise weaken forward secrecy if ticket keys are compromised.
+Disabling session tickets prevents reuse of ticket encryption keys across long periods, which can
+otherwise weaken forward secrecy if ticket keys are compromised.
Session resumption still works using **session IDs**.
@@ -173,7 +181,8 @@ Session resumption still works using **session IDs**.
SSLCompression off
```
-TLS compression is disabled to prevent attacks such as **CRIME**, which exploit compression side channels.
+TLS compression is disabled to prevent attacks such as **CRIME**, which exploit compression side
+channels.
---
@@ -204,4 +213,5 @@ This configuration enforces modern TLS best practices:
* **OCSP stapling for certificate validation**
* Protection against legacy TLS vulnerabilities
-The result is a secure and performant TLS configuration suitable for modern browsers and API clients.
+The result is a secure and performant TLS configuration suitable for modern browsers and API
+clients.
diff --git a/atr/docs/trusted-publishing.md b/atr/docs/trusted-publishing.md
index 278bf2b8..517e42f7 100644
--- a/atr/docs/trusted-publishing.md
+++ b/atr/docs/trusted-publishing.md
@@ -1,10 +1,10 @@
# 4.2. Trusted Publishing
-**Up**: `4.` [Release managers](release-manager-setup)
+**Up**: `4.` [Release manager setup](release-manager-setup)
**Prev**: `4.1.` [Signing artifacts](signing-artifacts)
-**Next**: `5.` [Making releases](release-process-description)
+**Next**: `5.` [Making releases](making-releases)
**Sections**:
@@ -17,100 +17,185 @@
## Overview
-Trusted Publishing lets a project sign release artifacts automatically during a GitHub Actions workflow rather than requiring a release manager to sign each file locally. This is available to projects that can demonstrate reproducible builds, meaning that anyone can independently rebuild the artifacts from the same source and obtain identical results. The ASF uses Trusted Publishing to strengthen supply chain integrity for projects that meet this requirement.
+Trusted Publishing lets a project sign release artifacts automatically during a GitHub Actions
+workflow rather than requiring a release manager to sign each file locally. This is available to
+projects that can demonstrate reproducible builds, meaning that anyone can independently rebuild the
+artifacts from the same source and obtain identical results. The ASF uses Trusted Publishing to
+strengthen supply chain integrity for projects that meet this requirement.
-The process involves creating a dedicated GPG signing key for the project, storing it as a GitHub repository secret, and registering the public half with ATR. When ATR sees a signature made by a key that follows the automated release key naming convention, it accepts the signature in the same way that it would accept one from an individual committer's key.
+The process involves creating a dedicated GPG signing key for the project, storing it as a GitHub
+repository secret, and registering the public half with ATR. When ATR sees a signature made by a key
+that follows the automated release key naming convention, it accepts the signature in the same way
+that it would accept one from an individual committer's key.
## What reproducible means
-The ASF Security team describes a build as [reproducible](https://cwiki.apache.org/confluence/display/SECURITY/Reproducible+Builds) when the build process is so deterministic that building the same sources twice, by different people, results in a bit-by-bit identical artifact. When two builds on independently managed infrastructure produce the same bits, it improves confidence that nothing was injected into the artifact by a compromise of either one, which is what allows a signature made [...]
+The ASF Security team describes a build as
+[reproducible](https://cwiki.apache.org/confluence/display/SECURITY/Reproducible+Builds) when the
+build process is so deterministic that building the same sources twice, by different people, results
+in a bit-by-bit identical artifact. When two builds on independently managed infrastructure produce
+the same bits, it improves confidence that nothing was injected into the artifact by a compromise of
+either one, which is what allows a signature made in CI to be trusted.
-In practice, this means your artifacts must not contain anything that depends on the environment they were built in. Usernames, hostnames, timestamps, absolute file paths, tool versions, and CI build numbers are the usual culprits. The Security team's page has guidance for several ecosystems, including Maven, Python, Helm, and tarballs, for example setting `SOURCE_DATE_EPOCH` so that file timestamps are fixed.
+In practice, this means your artifacts must not contain anything that depends on the environment
+they were built in. Usernames, hostnames, timestamps, absolute file paths, tool versions, and CI
+build numbers are the usual culprits. The Security team's page has guidance for several ecosystems,
+including Maven, Python, Helm, and tarballs, for example setting `SOURCE_DATE_EPOCH` so that file
+timestamps are fixed.
-It is good practice for every ASF release to be reproducible, but for projects that want to build and sign artifacts in CI it is required. Being able to reproduce a build once is not quite enough. Your project has to show three things:
+It is good practice for every ASF release to be reproducible, but for projects that want to build
+and sign artifacts in CI it is required. Being able to reproduce a build once is not quite enough.
+Your project has to show three things:
1. Independent builds of the same source produce bit-by-bit identical artifacts.
2. The release process documents how and when artifacts are independently rebuilt and verified.
3. That process is followed in practice for every release.
-If you have questions about making your build reproducible, ask on the [security-discuss](https://security.apache.org/mailinglist/) mailing list, or in the `#security-discuss` channel on the [ASF Slack](https://infra.apache.org/slack.html).
+If you have questions about making your build reproducible, ask on the
+[security-discuss](https://security.apache.org/mailinglist/) mailing list, or in the
+`#security-discuss` channel on the [ASF Slack](https://infra.apache.org/slack.html).
## How to set up Trusted Publishing
-ATR Trusted Publishing is built on top of [Automated Release Signing](https://infra.apache.org/release-signing.html#automated-release-signing), which permits signing in CI provided that all signed artifacts can be built reproducibly, that CI deploys them to a staging area rather than straight to users, and that every artifact is rebuilt and compared on trusted hardware before it is published. ATR is the staging area in this model, and the vote is where the comparison happens. The steps b [...]
+ATR Trusted Publishing is built on top of
+[Automated Release Signing](https://infra.apache.org/release-signing.html#automated-release-signing),
+which permits signing in CI provided that all signed artifacts can be built reproducibly, that CI
+deploys them to a staging area rather than straight to users, and that every artifact is rebuilt and
+compared on trusted hardware before it is published. ATR is the staging area in this model, and the
+vote is where the comparison happens. The steps below take you from a reproducible build to a
+workflow that ATR will accept.
### Step 1: Get approval from the Security team
-Tell the ASF Security team that your project intends to request a CI signing key, and show them that your builds are reproducible, as described [above](#what-reproducible-means). Your request should highlight the change to your release process that makes sure artifacts are validated on trusted hardware before release, i.e. who rebuilds the artifacts, where, and how they compare the result against what CI produced. Infrastructure defines trusted hardware as secure hardware under the direc [...]
+Tell the ASF Security team that your project intends to request a CI signing key, and show them that
+your builds are reproducible, as described [above](#what-reproducible-means). Your request should
+highlight the change to your release process that makes sure artifacts are validated on trusted
+hardware before release, i.e. who rebuilds the artifacts, where, and how they compare the result
+against what CI produced. Infrastructure defines trusted hardware as secure hardware under the
+direct control of the release manager, so the rebuild can't happen on GitHub Actions. The Security
+team should approve your workflow before you put it into use.
### Step 2: Request a project signing key
-Open a Jira ticket with ASF Infrastructure asking for a signing key. Infrastructure generates the key and keeps the private half, and the public key is either sent to your project or added to your `KEYS` file for you. Infrastructure's [automated release signing](https://infra.apache.org/release-signing.html#automated-release-signing) documentation describes the key and how it is held.
+Open a Jira ticket with ASF Infrastructure asking for a signing key. Infrastructure generates the
+key and keeps the private half, and the public key is either sent to your project or added to your
+`KEYS` file for you. Infrastructure's
+[automated release signing](https://infra.apache.org/release-signing.html#automated-release-signing)
+documentation describes the key and how it is held.
-The key must follow a specific naming convention for ATR to recognise it as an automated release key, so it is worth asking for this in your ticket. The primary UID must contain "Automated Release Signing" or the deprecated "Services RM", ignoring case, and the email address must be `private@`_committee_`.apache.org`, where _committee_ is the name of your PMC. For example, the following UID would be valid for a project named Example:
+The key must follow a specific naming convention for ATR to recognise it as an automated release
+key, so it is worth asking for this in your ticket. The primary UID must contain "Automated Release
+Signing" or the deprecated "Services RM", ignoring case, and the email address must be
+`private@`_committee_`.apache.org`, where _committee_ is the name of your PMC. For example, the
+following UID would be valid for a project named Example:
```text
Example Automated Release Signing <pr...@example.apache.org>
```
-If the UID does not follow this pattern, ATR will not recognise the key as automated and your committee will not be eligible for Trusted Publishing.
+If the UID does not follow this pattern, ATR will not recognise the key as automated and your
+committee will not be eligible for Trusted Publishing.
### Step 3: Configure the GitHub repository
-Although your project never sees the private key, Infrastructure makes it available to your CI system. For GitHub Actions, ask Infrastructure to store it as a repository secret in your project's GitHub repository. Your workflows can then reference this secret to sign artifacts during the build. The public half stays with ATR and your `KEYS` file.
+Although your project never sees the private key, Infrastructure makes it available to your CI
+system. For GitHub Actions, ask Infrastructure to store it as a repository secret in your project's
+GitHub repository. Your workflows can then reference this secret to sign artifacts during the build.
+The public half stays with ATR and your `KEYS` file.
### Step 4: Add the public key to your `KEYS` file
-If Infrastructure has not already done so, add the public key to your committee's `KEYS` file. This is the same `KEYS` file that holds committer signing keys, and it is kept in step with ATR as described in [The KEYS file](moving-to-atr#the-keys-file). Import the updated `KEYS` file through ATR, or commit it in SVN if your committee's file is managed there, rather than adding this key with the individual OpenPGP key form. ATR will parse the UID from the key and, because it has no ASF UID [...]
+If Infrastructure has not already done so, add the public key to your committee's `KEYS` file. This
+is the same `KEYS` file that holds committer signing keys, and it is kept in step with ATR as
+described in [The KEYS file](moving-to-atr#the-keys-file). Import the updated `KEYS` file through
+ATR, or commit it in SVN if your committee's file is managed there, rather than adding this key with
+the individual OpenPGP key form. ATR will parse the UID from the key and, because it has no ASF UID
+tied to an individual, will match it by its email address during signature verification instead.
### Step 5: Check that your committee can use CI
-Once the key is in ATR, your committee becomes eligible for Trusted Publishing. You can check this on your committee's page in ATR, where the Permissions card should show _CI builds: Enabled_. If it still shows _Disabled_, the key is probably not linked to your committee, or its UID does not follow the naming convention in step 2. See [how ATR detects automated release keys](#how-atr-detects-automated-release-keys) for the exact rules.
+Once the key is in ATR, your committee becomes eligible for Trusted Publishing. You can check this
+on your committee's page in ATR, where the Permissions card should show _CI builds: Enabled_. If it
+still shows _Disabled_, the key is probably not linked to your committee, or its UID does not follow
+the naming convention in step 2. See
+[how ATR detects automated release keys](#how-atr-detects-automated-release-keys) for the exact
+rules.
-Eligibility alone does not let any workflow act on your releases. You also have to tell ATR which repository and which workflows it should trust, as described in [configuring repository and workflow paths](#configuring-repository-and-workflow-paths).
+Eligibility alone does not let any workflow act on your releases. You also have to tell ATR which
+repository and which workflows it should trust, as described in
+[configuring repository and workflow paths](#configuring-repository-and-workflow-paths).
### Step 6: Sign and upload artifacts in your workflow
-In your GitHub Actions workflow, sign your release artifacts using the private key from the repository secret. The resulting `.asc` signature files should be uploaded to ATR alongside the artifacts, the same way that manually signed artifacts would be. The ASF Tooling team provides [GitHub Actions](#github-actions-for-atr) to do the upload, and the later release steps, for you.
+In your GitHub Actions workflow, sign your release artifacts using the private key from the
+repository secret. The resulting `.asc` signature files should be uploaded to ATR alongside the
+artifacts, the same way that manually signed artifacts would be. The ASF Tooling team provides
+[GitHub Actions](#github-actions-for-atr) to do the upload, and the later release steps, for you.
### Step 7: Confirm reproducibility during the vote
-When the project starts a release vote, the artifacts must be independently rebuilt from source on trusted hardware and confirmed to be bit-by-bit identical to the ones uploaded to ATR, following the process your project documented in step 1. This has to happen before the release is published. This is the trust model behind Trusted Publishing: the automated signature proves that the artifacts came from a specific GitHub workflow, and the independent rebuild proves that the build output i [...]
+When the project starts a release vote, the artifacts must be independently rebuilt from source on
+trusted hardware and confirmed to be bit-by-bit identical to the ones uploaded to ATR, following the
+process your project documented in step 1. This has to happen before the release is published. This
+is the trust model behind Trusted Publishing: the automated signature proves that the artifacts came
+from a specific GitHub workflow, and the independent rebuild proves that the build output is
+genuine, matching what was built on the GitHub runners.
## Configuring repository and workflow paths
-For ATR to accept release operations that a GitHub Actions workflow performs on the project's behalf, it has to know which repository the workflow runs in, and which workflows are permitted to perform the operations of each phase of a release. You configure this in the project's release policy, under the Trusted Publishing tab of the project settings.
+For ATR to accept release operations that a GitHub Actions workflow performs on the project's
+behalf, it has to know which repository the workflow runs in, and which workflows are permitted to
+perform the operations of each phase of a release. You configure this in the project's release
+policy, under the Trusted Publishing tab of the project settings.
There are three groups of settings.
### Repository name
-The name of the project's GitHub repository, without the `apache/` prefix. For example, if the repository is `apache/example`, enter `example`. The name must not contain a slash. You have to set this before any workflow path will be accepted, because ATR matches the repository named in the GitHub token against this value.
+The name of the project's GitHub repository, without the `apache/` prefix. For example, if the
+repository is `apache/example`, enter `example`. The name must not contain a slash. You have to set
+this before any workflow path will be accepted, because ATR matches the repository named in the
+GitHub token against this value.
### Repository branch
-The branch that release builds run from, for example `main` or `2.5.x`. This is optional, but if you do set a branch you must also set a repository name.
+The branch that release builds run from, for example `main` or `2.5.x`. This is optional, but if you
+do set a branch you must also set a repository name.
### Workflow paths
-There is a separate field for each phase of a release: compose, vote, and finish. Each field lists the workflows that ATR will accept as performing that phase's operations. List one workflow path per line, and start each path with `.github/workflows/`. For example, the compose field might contain:
+There is a separate field for each phase of a release: compose, vote, and finish. Each field lists
+the workflows that ATR will accept as performing that phase's operations. List one workflow path per
+line, and start each path with `.github/workflows/`. For example, the compose field might contain:
```text
.github/workflows/release-compose.yml
.github/workflows/release-compose-rc.yml
```
-A field can hold more than one path, so you can list several workflows for a single phase. Any path that does not begin with `.github/workflows/` is rejected when you save the form.
+A field can hold more than one path, so you can list several workflows for a single phase. Any path
+that does not begin with `.github/workflows/` is rejected when you save the form.
-The three fields are kept separate so that a workflow is only trusted for the phase it is registered against. A workflow listed under compose can compose a candidate, but it cannot, for instance, finish a release unless it is also listed under finish.
+The three fields are kept separate so that a workflow is only trusted for the phase it is registered
+against. A workflow listed under compose can compose a candidate, but it cannot, for instance,
+finish a release unless it is also listed under finish.
### How ATR matches a workflow
-When a workflow calls one of the Trusted Publishing endpoints, GitHub sends ATR an OIDC token that names the repository, such as `apache/example`, and the workflow reference, such as `apache/example/.github/workflows/release-compose.yml@refs/heads/main`. ATR strips the `apache/` prefix and the trailing `@` git ref, then looks for a project whose release policy has a matching repository name and lists that workflow path under the phase being requested. If there is no match, the request is [...]
+When a workflow calls one of the Trusted Publishing endpoints, GitHub sends ATR an OIDC token that
+names the repository, such as `apache/example`, and the workflow reference, such as
+`apache/example/.github/workflows/release-compose.yml@refs/heads/main`. ATR strips the `apache/`
+prefix and the trailing `@` git ref, then looks for a project whose release policy has a matching
+repository name and lists that workflow path under the phase being requested. If there is no match,
+the request is refused. The committee must also be eligible for Trusted Publishing, as described
+below.
## GitHub Actions for ATR
-The ASF Tooling team maintains GitHub Actions in [apache/tooling-actions](https://github.com/apache/tooling-actions) that call ATR on your workflow's behalf. Each action requests a GitHub OIDC token, which ATR uses to identify the repository and workflow, so you don't need to store any ATR credentials in your repository.
+The ASF Tooling team maintains GitHub Actions in
+[apache/tooling-actions](https://github.com/apache/tooling-actions) that call ATR on your workflow's
+behalf. Each action requests a GitHub OIDC token, which ATR uses to identify the repository and
+workflow, so you don't need to store any ATR credentials in your repository.
| Action | What it does | Workflow path field |
| --- | --- | --- |
@@ -118,17 +203,26 @@ The ASF Tooling team maintains GitHub Actions in [apache/tooling-actions](https:
| [`release-on-atr`](https://github.com/apache/tooling-actions/tree/main/release-on-atr) | Resolves the vote, announces the release, or both | Vote to resolve, finish to announce |
| [`record-atr-distribution`](https://github.com/apache/tooling-actions/tree/main/record-atr-distribution) | Records a distribution made to an external platform such as PyPI (experimental) | Finish or compose |
-The workflow path field column shows which of the [workflow paths](#workflow-paths) your workflow has to be listed under for ATR to accept the call. A workflow that both resolves a vote and announces the release, for example, must be listed under both vote and finish.
+The workflow path field column shows which of the [workflow paths](#workflow-paths) your workflow
+has to be listed under for ATR to accept the call. A workflow that both resolves a vote and
+announces the release, for example, must be listed under both vote and finish.
There are a few things to be aware of when using these actions:
-* The actions are not tagged, so you must refer to each one by a full commit hash, e.g. `apache/tooling-actions/upload-to-atr@<commit>`, and not by `@main`.
-* The job must have the `id-token: write` permission, otherwise the action can't request an OIDC token.
+* The actions are not tagged, so you must refer to each one by a full commit hash, e.g.
+ `apache/tooling-actions/upload-to-atr@<commit>`, and not by `@main`.
+* The job must have the `id-token: write` permission, otherwise the action can't request an OIDC
+ token.
* The workflow must run on a GitHub-hosted runner. ATR rejects tokens from self-hosted runners.
-* The workflow must be triggered by a committer whose GitHub account is linked to their ASF account, as ATR records the release operations against that committer.
-* `upload-to-atr` uploads the `dist` directory by default, which you can change with the `src` input. It also sends ATR the commit that the artifacts were built from, which you can override with the `source-commit` input.
+* The workflow must be triggered by a committer whose GitHub account is linked to their ASF account,
+ as ATR records the release operations against that committer.
+* `upload-to-atr` uploads the `dist` directory by default, which you can change with the `src`
+ input. It also sends ATR the commit that the artifacts were built from, which you can override
+ with the `source-commit` input.
-Each action's README has the full list of inputs and some example workflows. When you create a draft release in ATR, the upload page also shows an example workflow already filled in with your project name.
+Each action's README has the full list of inputs and some example workflows. When you create a draft
+release in ATR, the upload page also shows an example workflow already filled in with your project
+name.
## How ATR detects automated release keys
@@ -136,12 +230,26 @@ ATR identifies automated release keys in two ways, at two different levels.
### Signature verification
-When ATR verifies an `.asc` signature file, it loads all public signing keys that are linked to the release committee and checks each one. For personal committer keys, the key has an ASF UID field in ATR behind the scenes that ties it to a specific ASF account. Automated project keys do not have an ASF UID because they belong to the project rather than to a person. Instead, ATR checks the key's primary UID against the automated release key naming convention: the UID must contain "Automat [...]
+When ATR verifies an `.asc` signature file, it loads all public signing keys that are linked to the
+release committee and checks each one. For personal committer keys, the key has an ASF UID field in
+ATR behind the scenes that ties it to a specific ASF account. Automated project keys do not have an
+ASF UID because they belong to the project rather than to a person. Instead, ATR checks the key's
+primary UID against the automated release key naming convention: the UID must contain "Automated
+Release Signing" or "Services RM" (ignoring case), and its email address must be exactly
+`private@`_committee_`.apache.org`. A key following the convention acts as a kind of committee key.
+A signature made by either kind of key, i.e. personal with an ASF UID or a committee key following
+the naming convention, will pass signature verification.
You can read more about [signature verification](checks#signature-verification) on the checks page.
### Committee eligibility
-Separately, ATR determines which committees are eligible for Trusted Publishing by querying for keys whose primary UID contains "Automated Release Signing" or "Services RM" (ignoring case) and whose email is exactly `private@`_committee_`.apache.org` for the committee that the key is linked to. A committee must have at least one such key before ATR will accept releases triggered by GitHub workflows for projects in that committee.
+Separately, ATR determines which committees are eligible for Trusted Publishing by querying for keys
+whose primary UID contains "Automated Release Signing" or "Services RM" (ignoring case) and whose
+email is exactly `private@`_committee_`.apache.org` for the committee that the key is linked to. A
+committee must have at least one such key before ATR will accept releases triggered by GitHub
+workflows for projects in that committee.
-Registering a correctly named key therefore does two things at once: it enables signature verification for artifacts signed by that key, and it marks the committee as eligible for Trusted Publishing.
+Registering a correctly named key therefore does two things at once: it enables signature
+verification for artifacts signed by that key, and it marks the committee as eligible for Trusted
+Publishing.
diff --git a/atr/docs/uploading-files.md b/atr/docs/uploading-files.md
index be693641..d9aa53a2 100644
--- a/atr/docs/uploading-files.md
+++ b/atr/docs/uploading-files.md
@@ -21,16 +21,20 @@
## Overview
-Once you have started a release, you add files to it during the [compose phase](compose-phase). ATR offers several ways to do so, and you can mix them within one release. Each accepted upload creates a new [revision](#revisions), and ATR runs its [checks](checks) against it. Archives may need [validation](#archive-validation) before the new revision is created.
+Once you have started a release, you add files to it during the [compose phase](compose-phase). ATR
+offers several ways to do so, and you can mix them within one release. Each accepted upload creates
+a new [revision](#revisions), and ATR runs its [checks](checks) against it. Archives may need
+[validation](#archive-validation) before the new revision is created.
Every artifact needs a detached signature and a checksum beside it, as described in
[Signing artifacts](signing-artifacts). Upload those alongside the artifact itself.
-You can also include documentation and SBOMs. Uploaded files must not be symbolic links. For selected formats, ATR also rejects empty files or contents that do not match the file extension.
+You can also include documentation and SBOMs. Uploaded files must not be symbolic links. For
+selected formats, ATR also rejects empty files or contents that do not match the file extension.
The upload page for a release, reached with the "Upload files" button on its compose page, covers
-the browser, SVN, rsync, and GitHub workflow routes, and shows the exact commands and paths for
-that release.
+the browser, SVN, rsync, and GitHub workflow routes, and shows the exact commands and paths for that
+release.
## Upload limits
@@ -40,17 +44,26 @@ that release.
| rsync | Files over 2 GB are skipped |
| SVN import | No fixed size limit on the imported files |
-If a browser upload is too large, send fewer files at a time or use rsync within its file size limit.
+If a browser upload is too large, send fewer files at a time or use rsync within its file size
+limit.
## Archive validation
-ATR unpacks new archives in supported formats, including `.tar.gz`, `.tgz` and `.zip`, before accepting them. Each archive can contain up to 2 GiB of unpacked files by default. See the [developer guide](file-handling#archive-quarantine) for the full format list and extraction limits.
+ATR unpacks new archives in supported formats, including `.tar.gz`, `.tgz` and `.zip`, before
+accepting them. Each archive can contain up to 2 GiB of unpacked files by default. See the
+[developer guide](file-handling#archive-quarantine) for the full format list and extraction limits.
-During validation, the upload is not yet part of a revision. The previous revision remains available. You cannot start a vote until validation finishes. The compose page refreshes automatically when validation completes.
+During validation, the upload is not yet part of a revision. The previous revision remains
+available. You cannot start a vote until validation finishes. The compose page refreshes
+automatically when validation completes.
-If archive validation fails, ATR discards the whole upload. Read the error on the compose page, fix the problem, then upload all the files again, including signatures and checksums. **Dismiss** only hides the failure notice.
+If archive validation fails, ATR discards the whole upload. Read the error on the compose page, fix
+the problem, then upload all the files again, including signatures and checksums. **Dismiss** only
+hides the failure notice.
-Once the upload is accepted, ATR runs the [release checks](checks). The files remain downloadable even if these checks report problems. Fix blockers before starting a vote. ATR does not scan uploads for malware.
+Once the upload is accepted, ATR runs the [release checks](checks). The files remain downloadable
+even if these checks report problems. Fix blockers before starting a vote. ATR does not scan uploads
+for malware.
## Browser
@@ -62,9 +75,9 @@ This is the route followed in the [Compose section of the tutorial](/tutorial#co
## rsync
-rsync suits large uploads, whole directory trees, and scripts. It authenticates with an SSH key,
-so first add your SSH public key to ATR on the [keys page](/keys). This is separate from your
-OpenPGP signing key, as explained under [SSH keys](release-manager-setup#ssh-keys).
+rsync suits large uploads, whole directory trees, and scripts. It authenticates with an SSH key, so
+first add your SSH public key to ATR on the [keys page](/keys). This is separate from your OpenPGP
+signing key, as explained under [SSH keys](release-manager-setup#ssh-keys).
The upload page shows the command for your release, which has this form:
@@ -75,8 +88,8 @@ rsync -av -e 'ssh -p 2222' ${YOUR_FILES}/ <asf-uid>@<atr-host>:/<project-key>/<v
Note that:
* ATR's SSH server listens on port 2222.
-* The destination must be the release directory itself, `/<project-key>/<version>/`. To place
- files in a subdirectory, create that subdirectory in the directory you upload from.
+* The destination must be the release directory itself, `/<project-key>/<version>/`. To place files
+ in a subdirectory, create that subdirectory in the directory you upload from.
* The options must be `-av`. ATR rejects other combinations.
* Each upload starts from the files already in the candidate, so files that you do not send are
kept. Add `--delete` to remove files from the candidate that are absent from your directory.
@@ -103,21 +116,22 @@ given in [The earlier dist/dev workflow](staging-and-voting#the-earlier-distdev-
The `atr` command line client, the
[Trusted Releases Client](https://github.com/apache/tooling-releases-client), can take a release
from start to announcement, including starting the release and uploading files to it. It
-authenticates with a [personal access token](release-manager-setup#personal-access-tokens), and
-it can also drive rsync for you once you have registered an [SSH key](release-manager-setup#ssh-keys).
+authenticates with a [personal access token](release-manager-setup#personal-access-tokens), and it
+can also drive rsync for you once you have registered an [SSH key](release-manager-setup#ssh-keys).
-The client's own [release process guide](https://github.com/apache/tooling-releases-client/blob/main/RELEASE-PROCESS.md)
+The client's own
+[release process guide](https://github.com/apache/tooling-releases-client/blob/main/RELEASE-PROCESS.md)
covers installation and follows a release from start to finish, and its
-[command reference](https://github.com/apache/tooling-releases-client/blob/main/COMMANDS.md)
-lists every command. The client and the API that it uses are not yet stable, so take care when
-relying on either in unattended scripts.
+[command reference](https://github.com/apache/tooling-releases-client/blob/main/COMMANDS.md) lists
+every command. The client and the API that it uses are not yet stable, so take care when relying on
+either in unattended scripts.
## Maven plugin
Projects that release with Maven can upload with the
-[ATR Maven Plugin](https://github.com/apache/tooling-atr-maven-plugin). It also authenticates
-with a [personal access token](release-manager-setup#personal-access-tokens), which you configure
-as a server in your Maven `settings.xml`.
+[ATR Maven Plugin](https://github.com/apache/tooling-atr-maven-plugin). It also authenticates with a
+[personal access token](release-manager-setup#personal-access-tokens), which you configure as a
+server in your Maven `settings.xml`.
You must start the release in ATR before the plugin can upload to it. The plugin can then upload
files as part of your release build, for example during `mvn release:perform`. The
@@ -126,16 +140,18 @@ your credentials and a release profile, and how to place files in subdirectories
## GitHub Actions
-Projects that are approved for reproducible builds can upload from a GitHub Actions workflow,
-with no long-lived credential stored in the repository. The upload page shows an example workflow
-for your release, and [Trusted Publishing](trusted-publishing) explains the approval and setup.
+Projects that are approved for reproducible builds can upload from a GitHub Actions workflow, with
+no long-lived credential stored in the repository. The upload page shows an example workflow for
+your release, and [Trusted Publishing](trusted-publishing) explains the approval and setup.
## Revisions
-Every change that ATR accepts during the compose phase, whether an upload, an import, or a deletion, creates a new [***Revision***](projects#revision) rather than altering the existing one. Revisions are numbered in sequence, starting from `00001`, and ATR runs its checks against each revision.
+Every change that ATR accepts during the compose phase, whether an upload, an import, or a deletion,
+creates a new [***Revision***](projects#revision) rather than altering the existing one. Revisions
+are numbered in sequence, starting from `00001`, and ATR runs its checks against each revision.
-Use the "Revisions" button on the compose page to see the history of a release. For each revision
-it shows:
+Use the "Revisions" button on the compose page to see the history of a release. For each revision it
+shows:
* who created it, and when,
* the files added, removed, and modified since the previous revision,
@@ -144,10 +160,10 @@ it shows:
You can also do two things from that page:
* **Return to an earlier revision.** "Create a new revision from this one" copies an earlier
- revision to a new latest revision. Nothing is lost, because the revisions in between remain in
- the history. This is available only during the compose phase.
-* **Tag a revision.** You can give a revision a tag as a memorable name for it. A tag is
- immutable: once set, it cannot be changed or removed.
+ revision to a new latest revision. Nothing is lost, because the revisions in between remain in the
+ history. This is available only during the compose phase.
+* **Tag a revision.** You can give a revision a tag as a memorable name for it. A tag is immutable:
+ once set, it cannot be changed or removed.
A vote is held on one specific revision, so the files under vote cannot change while the vote is
open. If a vote fails or is canceled, the candidate returns to the compose phase, where you can
diff --git a/atr/docs/user-interface.md b/atr/docs/user-interface.md
index a3cd1c73..70ef0ceb 100644
--- a/atr/docs/user-interface.md
+++ b/atr/docs/user-interface.md
@@ -17,13 +17,26 @@
## Introduction
-ATR uses server-side rendering almost exclusively: the server generates HTML and sends it to the browser, which displays it. We try to avoid client-side scripting, and in the rare cases where we need dynamic front end components we use plain TypeScript without recourse to any third party framework. (We have some JavaScript too, but we aim to use TypeScript only.) Sometimes we incur a full page load where perhaps it would be more ideal to update a fragment of the DOM in place, but page lo [...]
-
-The UI is built from three main pieces: [Jinja2](https://jinja.palletsprojects.com/) for templates, [WTForms](https://wtforms.readthedocs.io/) for HTML forms, and [htpy](https://htpy.dev/) for programmatic HTML generation. We style everything with [Bootstrap](https://getbootstrap.com/), which we customize slightly.
+ATR uses server-side rendering almost exclusively: the server generates HTML and sends it to the
+browser, which displays it. We try to avoid client-side scripting, and in the rare cases where we
+need dynamic front end components we use plain TypeScript without recourse to any third party
+framework. (We have some JavaScript too, but we aim to use TypeScript only.) Sometimes we incur a
+full page load where perhaps it would be more ideal to update a fragment of the DOM in place, but
+page loads are very fast in modern browsers, so this is less of an issue than it would have been a
+decade ago.
+
+The UI is built from three main pieces: [Jinja2](https://jinja.palletsprojects.com/) for templates,
+[WTForms](https://wtforms.readthedocs.io/) for HTML forms, and [htpy](https://htpy.dev/) for
+programmatic HTML generation. We style everything with [Bootstrap](https://getbootstrap.com/), which
+we customize slightly.
## Jinja2 templates
-Templates live in [`templates/`](/ref/atr/templates/). Each template is a Jinja2 file that defines HTML structure with placeholders for dynamic content. Route handlers render templates by calling [`template.render`](/ref/atr/template.py) (render), which is an alias for [`template.render_sync`](/ref/atr/template.py) (render_sync). The function is asynchronous and takes a template name plus keyword arguments for the template variables.
+Templates live in [`templates/`](/ref/atr/templates/). Each template is a Jinja2 file that defines
+HTML structure with placeholders for dynamic content. Route handlers render templates by calling
+[`template.render`](/ref/atr/template.py) (render), which is an alias for
+[`template.render_sync`](/ref/atr/template.py) (render_sync). The function is asynchronous and takes
+a template name plus keyword arguments for the template variables.
Here is an example from [`get/keys.py`](/ref/atr/get/keys.py) (add):
@@ -38,15 +51,31 @@ return await template.render(
)
```
-The template receives these variables and can access them directly. If you pass a variable called `form`, the template can use `{{ form }}` to render it. [Jinja2 has control structures](https://jinja.palletsprojects.com/en/stable/templates/#list-of-control-structures) like `{% for %}` and `{% if %}`, which you use when iterating over data or conditionally showing content.
+The template receives these variables and can access them directly. If you pass a variable called
+`form`, the template can use `{{ form }}` to render it.
+[Jinja2 has control structures](https://jinja.palletsprojects.com/en/stable/templates/#list-of-control-structures)
+like `{% for %}` and `{% if %}`, which you use when iterating over data or conditionally showing
+content.
-Templates are loaded into memory at server startup by [`preload.setup_template_preloading`](/ref/atr/preload.py) (setup_template_preloading). This means that changing a template requires restarting the server in development, which can be configured to happen automatically, but it also means that rendering is fast because we never do a disk read during request handling. The preloading scans [`templates/`](/ref/atr/templates/) recursively and caches every file.
+Templates are loaded into memory at server startup by
+[`preload.setup_template_preloading`](/ref/atr/preload.py) (setup_template_preloading). This means
+that changing a template requires restarting the server in development, which can be configured to
+happen automatically, but it also means that rendering is fast because we never do a disk read
+during request handling. The preloading scans [`templates/`](/ref/atr/templates/) recursively and
+caches every file.
-Template rendering happens in a thread pool to avoid blocking the async event loop. The function [`_render_in_thread`](/ref/atr/template.py) (_render_in_thread) uses `asyncio.to_thread` to execute Jinja2's synchronous `render` method.
+Template rendering happens in a thread pool to avoid blocking the async event loop. The function
+[`_render_in_thread`](/ref/atr/template.py) (_render_in_thread) uses `asyncio.to_thread` to execute
+Jinja2's synchronous `render` method.
## Forms
-HTML forms in ATR are handled by [Pydantic](https://docs.pydantic.dev/latest/) models accessed through our [`form`](/ref/atr/form.py) module. Each form is a class that inherits from [`form.Form`](/ref/atr/form.py) (Form), which itself inherits from `pydantic.BaseModel`. Form fields are defined as class attributes using Pydantic type annotations, with the [`form.label`](/ref/atr/form.py) (label) function providing field metadata like labels and documentation.
+HTML forms in ATR are handled by [Pydantic](https://docs.pydantic.dev/latest/) models accessed
+through our [`form`](/ref/atr/form.py) module. Each form is a class that inherits from
+[`form.Form`](/ref/atr/form.py) (Form), which itself inherits from `pydantic.BaseModel`. Form fields
+are defined as class attributes using Pydantic type annotations, with the
+[`form.label`](/ref/atr/form.py) (label) function providing field metadata like labels and
+documentation.
Here is a typical form definition from [`shared/keys.py`](/ref/atr/shared/keys.py):
@@ -71,7 +100,10 @@ class AddOpenPGPKeyForm(form.Form):
### Field types and labels
-The [`form.label`](/ref/atr/form.py) (label) function is used to add metadata to Pydantic fields. The first argument is the label text, the second (optional) argument is documentation text that appears below the field, and you can pass additional keyword arguments like `widget=form.Widget.TEXTAREA` to specify the HTML widget type.
+The [`form.label`](/ref/atr/form.py) (label) function is used to add metadata to Pydantic fields.
+The first argument is the label text, the second (optional) argument is documentation text that
+appears below the field, and you can pass additional keyword arguments like
+`widget=form.Widget.TEXTAREA` to specify the HTML widget type.
Fields use Pydantic type annotations to define their data type:
@@ -83,14 +115,17 @@ Fields use Pydantic type annotations to define their data type:
* `form.StrList` - multiple checkboxes that collect strings
* `form.File` - single file upload
* `form.FileList` - multiple file upload
-* `form.RelPath` - validated relative file path (rejects path traversal such as `..` and absolute paths via `to_relpath()`)
+* `form.RelPath` - validated relative file path (rejects path traversal such as `..` and absolute
+ paths via `to_relpath()`)
* `form.RelPathList` - list of validated relative file paths
* `form.Enum[EnumType]` - dropdown select from enum values
* `form.Set[EnumType]` - multiple checkboxes from enum values
Empty values for fields are allowed by default in most cases, but URL is an exception.
-The `widget` parameter in [`form.label`](/ref/atr/form.py) (label) lets you override the default widget for a field type. Available widgets include: `TEXTAREA`, `CHECKBOXES`, `SELECT`, `RADIO`, `HIDDEN`, and others from the `form.Widget` enum. Common reasons to override:
+The `widget` parameter in [`form.label`](/ref/atr/form.py) (label) lets you override the default
+widget for a field type. Available widgets include: `TEXTAREA`, `CHECKBOXES`, `SELECT`, `RADIO`,
+`HIDDEN`, and others from the `form.Widget` enum. Common reasons to override:
* HIDDEN: for values passed from the route, not entered by the user
* TEXTAREA: for multi-line text input
@@ -123,7 +158,9 @@ decision: Literal["+1", "0", "-1"] = form.label("Your vote", widget=form.Widget.
### Using forms in routes
-To use a form in a route, use the [`@post.committer()`](/ref/atr/blueprints/post.py) (committer) decorator to get the session and auth the user, and the [`@post.form()`](/ref/atr/blueprints/post.py) (form) decorator to parse and validate input data:
+To use a form in a route, use the [`@post.committer()`](/ref/atr/blueprints/post.py) (committer)
+decorator to get the session and auth the user, and the
+[`@post.form()`](/ref/atr/blueprints/post.py) (form) decorator to parse and validate input data:
```python
@post.committer("/keys/add")
@@ -148,13 +185,22 @@ async def add(session: web.Committer, add_openpgp_key_form: shared.keys.AddOpenP
return await session.redirect(get.keys.keys)
```
-The [`form.validate`](/ref/atr/form.py) (validate) function should only be called manually when the request comes from JavaScript, as in [`body_preview`](/ref/atr/post/voting.py) (body_preview). It takes the form class, the form data dictionary, and an optional context dictionary. If validation succeeds, it returns an instance of your form class with validated data. If validation fails, it raises a `pydantic.ValidationError`.
+The [`form.validate`](/ref/atr/form.py) (validate) function should only be called manually when the
+request comes from JavaScript, as in [`body_preview`](/ref/atr/post/voting.py) (body_preview). It
+takes the form class, the form data dictionary, and an optional context dictionary. If validation
+succeeds, it returns an instance of your form class with validated data. If validation fails, it
+raises a `pydantic.ValidationError`.
-The error handling uses [`form.flash_error_data`](/ref/atr/form.py) (flash_error_data) to prepare error information for display, and [`form.flash_error_summary`](/ref/atr/form.py) (flash_error_summary) to create a user-friendly summary of all validation errors.
+The error handling uses [`form.flash_error_data`](/ref/atr/form.py) (flash_error_data) to prepare
+error information for display, and [`form.flash_error_summary`](/ref/atr/form.py)
+(flash_error_summary) to create a user-friendly summary of all validation errors.
### Rendering forms
-The `form` module provides the [`form.render`](/ref/atr/form.py) (render) function (or [`form.render_block`](/ref/atr/form.py) (render_block) for use with [`htm.Block`](/ref/atr/htm.py) (Block)) that generates Bootstrap-styled HTML. This function creates a two-column layout with labels on the left and inputs on the right:
+The `form` module provides the [`form.render`](/ref/atr/form.py) (render) function (or
+[`form.render_block`](/ref/atr/form.py) (render_block) for use with [`htm.Block`](/ref/atr/htm.py)
+(Block)) that generates Bootstrap-styled HTML. This function creates a two-column layout with labels
+on the left and inputs on the right:
```python
form.render_block(
@@ -169,7 +215,10 @@ form.render_block(
)
```
-The `defaults` parameter accepts a dictionary to populate initial field values. For checkbox/radio groups and select dropdowns, you can pass a list of `(value, label)` tuples to dynamically provide choices. The `render` function returns htpy elements which you can embed in templates or return directly from route handlers.
+The `defaults` parameter accepts a dictionary to populate initial field values. For checkbox/radio
+groups and select dropdowns, you can pass a list of `(value, label)` tuples to dynamically provide
+choices. The `render` function returns htpy elements which you can embed in templates or return
+directly from route handlers.
Key rendering parameters:
@@ -183,7 +232,9 @@ Key rendering parameters:
## Programmatic HTML
-Sometimes you need to generate HTML in Python rather than in a template. For this we use [htpy](https://htpy.dev/), which provides a Python API for building HTML elements. You import `htpy` and then use it like this:
+Sometimes you need to generate HTML in Python rather than in a template. For this we use
+[htpy](https://htpy.dev/), which provides a Python API for building HTML elements. You import `htpy`
+and then use it like this:
```python
import htpy
@@ -194,15 +245,25 @@ element = htpy.div(".container")[
]
```
-The square brackets syntax is how htpy accepts children. The parentheses syntax is for attributes. If you want a div with an id, you write `htpy.div(id="content")`. If you want a div with a class, you can use CSS selector syntax like `htpy.div(".my-class")` or you can use `htpy.div(class_="my-class")`, remembering to use the underscore in `class_`.
+The square brackets syntax is how htpy accepts children. The parentheses syntax is for attributes.
+If you want a div with an id, you write `htpy.div(id="content")`. If you want a div with a class,
+you can use CSS selector syntax like `htpy.div(".my-class")` or you can use
+`htpy.div(class_="my-class")`, remembering to use the underscore in `class_`.
-You can nest elements arbitrarily, mix strings and elements, and pass lists of elements. Converting an htpy element to a string renders it as HTML. Templates can therefore render htpy elements directly by passing them as variables.
+You can nest elements arbitrarily, mix strings and elements, and pass lists of elements. Converting
+an htpy element to a string renders it as HTML. Templates can therefore render htpy elements
+directly by passing them as variables.
-The htpy library provides type annotations for HTML elements. It does not validate attribute names or values, so you can pass nonsensical attributes without error. We plan to fix this by adding stricter types in our `htm` wrapper. The main benefit to using `htpy` (via `htm`) is having a clean Python API for HTML generation rather than concatenating strings or using templating.
+The htpy library provides type annotations for HTML elements. It does not validate attribute names
+or values, so you can pass nonsensical attributes without error. We plan to fix this by adding
+stricter types in our `htm` wrapper. The main benefit to using `htpy` (via `htm`) is having a clean
+Python API for HTML generation rather than concatenating strings or using templating.
## The htm.Block class
-The ATR [`htm`](/ref/atr/htm.py) module extends htpy with a [`Block`](/ref/atr/htm.py) (Block) class that makes it easier to build complex HTML structures incrementally. You create a block, append elements to it, and then collect them into a final element. Here is the typical usage pattern:
+The ATR [`htm`](/ref/atr/htm.py) module extends htpy with a [`Block`](/ref/atr/htm.py) (Block) class
+that makes it easier to build complex HTML structures incrementally. You create a block, append
+elements to it, and then collect them into a final element. Here is the typical usage pattern:
```python
import atr.htm as htm
@@ -215,17 +276,34 @@ if release.released:
return div.collect()
```
-The block class provides properties for common HTML elements like `h1`, `h2`, `p`, `div`, `ul`, and so on. When you access these properties, you get back a [`BlockElementCallable`](/ref/atr/htm.py) (BlockElementCallable), which you can call to create an element with attributes or use square brackets to add grandchildren of the block. The element is automatically appended to the block's internal list of children.
+The block class provides properties for common HTML elements like `h1`, `h2`, `p`, `div`, `ul`, and
+so on. When you access these properties, you get back a [`BlockElementCallable`](/ref/atr/htm.py)
+(BlockElementCallable), which you can call to create an element with attributes or use square
+brackets to add grandchildren of the block. The element is automatically appended to the block's
+internal list of children.
-The `collect` method assembles all of the elements into a single htpy element. If you created the block with an outer element like `htm.Block(htpy.div(".container"))`, that element wraps all the children. If you created the block with no outer element, `collect` wraps everything in a div. You can also pass a `separator` argument to `collect`, which inserts a text separator between elements.
+The `collect` method assembles all of the elements into a single htpy element. If you created the
+block with an outer element like `htm.Block(htpy.div(".container"))`, that element wraps all the
+children. If you created the block with no outer element, `collect` wraps everything in a div. You
+can also pass a `separator` argument to `collect`, which inserts a text separator between elements.
-The block class is useful when you are building HTML in a loop or when you have conditional elements. Instead of managing a list of elements manually, you can let the block class do it for you: append elements as you go, and at the end call `collect` to get the final result. This is cleaner than concatenating strings or maintaining lists yourself.
+The block class is useful when you are building HTML in a loop or when you have conditional
+elements. Instead of managing a list of elements manually, you can let the block class do it for
+you: append elements as you go, and at the end call `collect` to get the final result. This is
+cleaner than concatenating strings or maintaining lists yourself.
-The block class also adds a `data-src` attribute to elements, which records which function created the element. If you see an element in the browser inspector with `data-src="atr.get.keys:keys"`, you know that it came from the `keys` function in `get/keys.py`. The source is extracted automatically using [`log.caller_name`](/ref/atr/log.py) (caller_name).
+The block class also adds a `data-src` attribute to elements, which records which function created
+the element. If you see an element in the browser inspector with `data-src="atr.get.keys:keys"`, you
+know that it came from the `keys` function in `get/keys.py`. The source is extracted automatically
+using [`log.caller_name`](/ref/atr/log.py) (caller_name).
## How a route renders UI
-A typical route that renders UI first authenticates the user, loads data from the database, builds HTML using htpy, and renders it using a template. GET and POST requests are handled by separate routes, with form validation automatically handled by the [`@post.form()`](/ref/atr/blueprints/post.py) (form) decorator. Here is a simplified example from [`get/keys.py`](/ref/atr/get/keys.py) (add):
+A typical route that renders UI first authenticates the user, loads data from the database, builds
+HTML using htpy, and renders it using a template. GET and POST requests are handled by separate
+routes, with form validation automatically handled by the
+[`@post.form()`](/ref/atr/blueprints/post.py) (form) decorator. Here is a simplified example from
+[`get/keys.py`](/ref/atr/get/keys.py) (add):
```python
@get.typed
@@ -264,12 +342,20 @@ async def add(session: web.Committer, _keys_add: Literal["keys/add"]) -> str:
)
```
-The route is decorated with [`@get.typed`](/ref/atr/blueprints/get.py) (typed), which handles authentication and provides a `session` object that is an instance of [`web.Committer`](/ref/atr/web.py) (Committer) with a range of useful properties and methods.
-[`@get.typed`](/ref/atr/blueprints/get.py) (typed) also validates `project_name` and `version_name` route params, and checks that the user is authorised to access the project (if a project name is required).
+The route is decorated with [`@get.typed`](/ref/atr/blueprints/get.py) (typed), which handles
+authentication and provides a `session` object that is an instance of
+[`web.Committer`](/ref/atr/web.py) (Committer) with a range of useful properties and methods.
+[`@get.typed`](/ref/atr/blueprints/get.py) (typed) also validates `project_name` and `version_name`
+route params, and checks that the user is authorised to access the project (if a project name is
+required).
-The function builds the UI using an [`htm.Block`](/ref/atr/htm.py) (Block) object, which provides a convenient API for incrementally building HTML. The form is rendered directly into the block using [`form.render_block()`](/ref/atr/form.py) (render_block), which generates all the necessary HTML with Bootstrap styling.
+The function builds the UI using an [`htm.Block`](/ref/atr/htm.py) (Block) object, which provides a
+convenient API for incrementally building HTML. The form is rendered directly into the block using
+[`form.render_block()`](/ref/atr/form.py) (render_block), which generates all the necessary HTML
+with Bootstrap styling.
-Finally, the route returns the rendered HTML using [`template.blank()`](/ref/atr/template.py) (blank), which renders a minimal template with just a title and content area.
+Finally, the route returns the rendered HTML using [`template.blank()`](/ref/atr/template.py)
+(blank), which renders a minimal template with just a title and content area.
Form submission is handled by a separate POST route:
@@ -291,6 +377,13 @@ async def add(session: web.Committer, add_openpgp_key_form: shared.keys.AddOpenP
return await session.redirect(get.keys.keys)
```
-The [`@post.form()`](/ref/atr/blueprints/post.py) (form) decorator handles form validation automatically. If validation fails, it flashes error messages and redirects back to the GET route. If validation succeeds, the validated form instance is injected into the route handler as a parameter.
+The [`@post.form()`](/ref/atr/blueprints/post.py) (form) decorator handles form validation
+automatically. If validation fails, it flashes error messages and redirects back to the GET route.
+If validation succeeds, the validated form instance is injected into the route handler as a
+parameter.
-Bootstrap CSS classes are applied automatically by the form rendering functions. The functions use classes like `form-control`, `form-select`, `btn-primary`, `is-invalid`, and `invalid-feedback`. We currently use Bootstrap 5. If you generate HTML manually with htpy, you can apply Bootstrap classes yourself by using the CSS selector syntax like `htpy.div(".container")` or the class attribute like `htpy.div(class_="container")`.
+Bootstrap CSS classes are applied automatically by the form rendering functions. The functions use
+classes like `form-control`, `form-select`, `btn-primary`, `is-invalid`, and `invalid-feedback`. We
+currently use Bootstrap 5. If you generate HTML manually with htpy, you can apply Bootstrap classes
+yourself by using the CSS selector syntax like `htpy.div(".container")` or the class attribute like
+`htpy.div(class_="container")`.
diff --git a/atr/docs/vote-phase.md b/atr/docs/vote-phase.md
index fd0b5588..ff35aa5e 100644
--- a/atr/docs/vote-phase.md
+++ b/atr/docs/vote-phase.md
@@ -1,6 +1,6 @@
# 5.2. Vote phase
-**Up**: `5.` [Making releases](release-process-description)
+**Up**: `5.` [Making releases](making-releases)
**Prev**: `5.1.4.` [SBOM workflows](sbom-workflows)
@@ -18,12 +18,12 @@
## Overview
-The ***vote*** phase is where the PMC decides, as an act of the Foundation, whether the
-***Release Candidate*** should become a release. Once the Release Manager is satisfied with the
-composed candidate they start a vote, and the PMC votes to approve it or not. The artifacts being
-voted on stay in ATR for the duration of the vote, so the vote email can link to them directly and
-every voter reviews the same thing. A vote may be canceled and restarted if a problem comes to
-light. Once a vote passes, the candidate is ready to publish in the [finish phase](finish-phase).
+The ***vote*** phase is where the PMC decides, as an act of the Foundation, whether the ***Release
+Candidate*** should become a release. Once the Release Manager is satisfied with the composed
+candidate they start a vote, and the PMC votes to approve it or not. The artifacts being voted on
+stay in ATR for the duration of the vote, so the vote email can link to them directly and every
+voter reviews the same thing. A vote may be canceled and restarted if a problem comes to light. Once
+a vote passes, the candidate is ready to publish in the [finish phase](finish-phase).
For a step by step walkthrough of this phase with screenshots, see the
[Vote section of the tutorial](/tutorial#vote). The tutorial follows a release by a top level
@@ -34,18 +34,18 @@ project, with the vote held on a mailing list. A podling release is voted on twi
Both the Release Manager and the wider PMC have a part to play in this phase:
-* The ***Release Manager*** starts the vote, links to the artifacts under vote, and, when the
- vote is over, tallies the result and resolves it.
-* PMC members review the candidate and cast their votes on the vote thread. Whose votes are
- binding is a matter of [ASF policy](https://www.apache.org/legal/release-policy.html#release-approval).
+* The ***Release Manager*** starts the vote, links to the artifacts under vote, and, when the vote
+ is over, tallies the result and resolves it.
+* PMC members review the candidate and cast their votes on the vote thread. Whose votes are binding
+ is a matter of [ASF policy](https://www.apache.org/legal/release-policy.html#release-approval).
## Casting and resolving the vote
ATR keeps the candidate and its artifacts staged for the whole of the vote, and tallies the votes
-from the vote thread on the mailing list. The tally is there to help, but the Release Manager
-must check it against the thread before relying on it. When the vote is complete the Release
-Manager resolves it: a passing vote moves the candidate on to the finish phase, and a failed or
-canceled vote returns it to compose so that it can be revised. When starting the vote, the Release
-Manager can also ask ATR to publish the release automatically once the vote resolves
-successfully, as described in [Promoting to release](promoting-to-release). See [Staging and voting](staging-and-voting) for how staging, vote emails, and
-resolution work in ATR.
+from the vote thread on the mailing list. The tally is there to help, but the Release Manager must
+check it against the thread before relying on it. When the vote is complete the Release Manager
+resolves it: a passing vote moves the candidate on to the finish phase, and a failed or canceled
+vote returns it to compose so that it can be revised. When starting the vote, the Release Manager
+can also ask ATR to publish the release automatically once the vote resolves successfully, as
+described in [Promoting to release](promoting-to-release). See
+[Staging and voting](staging-and-voting) for how staging, vote emails, and resolution work in ATR.
diff --git a/atr/get/docs.py b/atr/get/docs.py
index 923235cf..620a2967 100644
--- a/atr/get/docs.py
+++ b/atr/get/docs.py
@@ -17,7 +17,7 @@
import pathlib
from html.parser import HTMLParser
-from typing import Literal
+from typing import Final, Literal
import aiofiles
import aiofiles.os
@@ -29,8 +29,18 @@ import atr.config as config
import atr.htm as htm
import atr.models.safe as safe
import atr.template as template
+import atr.util as util
import atr.web as web
+# Pages that were removed or renamed, mapped to where their content lives now
+MOVED_PAGES: Final[dict[str, str]] = {
+ "archiving-releases": "archiving-and-lifecycle",
+ "introduction-to-atr": "scope",
+ "release-process-description": "making-releases",
+ "terminology": "glossary",
+ "user-guide": "index",
+}
+
class H1Parser(HTMLParser):
def __init__(self) -> None:
@@ -57,7 +67,10 @@ async def index(_session: web.Public, _docs: Literal["docs"], _: Literal[""]) ->
@get.typed
-async def page(_session: web.Public, _docs: Literal["docs"], path: safe.RelPath) -> str:
+async def page(_session: web.Public, _docs: Literal["docs"], path: safe.RelPath) -> str | web.WerkzeugResponse:
+ moved_to = MOVED_PAGES.get(str(path).removesuffix(".html"))
+ if moved_to is not None:
+ return quart.redirect(util.as_url(page, path=moved_to), code=301)
return await _serve_docs_page(str(path))
diff --git a/scripts/docs_check.py b/scripts/docs_check.py
index 908ae53b..b539e323 100755
--- a/scripts/docs_check.py
+++ b/scripts/docs_check.py
@@ -17,14 +17,26 @@
# specific language governing permissions and limitations
# under the License.
+import argparse
+import concurrent.futures
import pathlib
import re
import sys
+import urllib.parse
from typing import Final, NamedTuple
+import asfquart.base as base
+import requests
+import werkzeug.exceptions as exceptions
+import werkzeug.routing as routing
+
sys.path.insert(0, str(pathlib.Path(__file__).parent))
+sys.path.insert(0, str(pathlib.Path(__file__).parent.parent))
import docs_post_process as post_process
+import atr.blueprints.get as blueprints_get
+import atr.get.docs as docs
+
class Link(NamedTuple):
source_file: str
@@ -46,6 +58,12 @@ class RefLink(NamedTuple):
target: str
+class UrlLink(NamedTuple):
+ source_file: str
+ line_number: int
+ url: str
+
+
# TODO: Should think more about whether scripts should use the _ convention or not
# The rationale for using it is that then we can port to non-script code more easily
# But for scripts *per se*, it does not make sense
@@ -54,6 +72,40 @@ class RefLink(NamedTuple):
_LINK_PATTERN: Final = re.compile(r"\[([^\]]+)\]\(([^)]+)\)")
_HEADING_PATTERN: Final = re.compile(r"^#+\s+(.+)$")
_REF_LINK_PATTERN: Final = re.compile(r"\[([^\]]+)\]\(/ref/([^)]+)\)")
+_EXTERNAL_TIMEOUT: Final = 20
+_EXTERNAL_WORKERS: Final = 8
+_HEAD_REFUSED: Final = frozenset({"HTTP 403", "HTTP 405", "HTTP 501"})
+_SIGN_IN_REQUIRED: Final = frozenset({"HTTP 401", "HTTP 403"})
+
+
+def _check_external_url(url: str) -> str | None:
+ error = _request_url(url, "HEAD")
+ # Some servers refuse HEAD, so try GET before calling the link broken
+ if error in _HEAD_REFUSED:
+ error = _request_url(url, "GET")
+ # Pages behind a sign in, such as Slack archives, exist even though we can't see them
+ if error in _SIGN_IN_REQUIRED:
+ return None
+ return error
+
+
+def _extract_absolute_links(file_path: pathlib.Path) -> tuple[list[UrlLink], list[UrlLink]]:
+ content = file_path.read_text(encoding="utf-8")
+ app_links = []
+ external_links = []
+
+ for line_number, line in enumerate(content.splitlines(), start=1):
+ for match in _LINK_PATTERN.finditer(line):
+ target = match.group(2)
+ if target.startswith("/ref/"):
+ # These are checked against the source tree instead
+ continue
+ if target.startswith("/"):
+ app_links.append(UrlLink(file_path.name, line_number, target))
+ elif target.startswith("http://") or target.startswith("https://"):
+ external_links.append(UrlLink(file_path.name, line_number, target))
+
+ return app_links, external_links
def _extract_links(file_path: pathlib.Path) -> list[Link]:
@@ -167,7 +219,77 @@ def _validate_ref_links(project_root: pathlib.Path, all_ref_links: list[RefLink]
return errors
+def _request_url(url: str, method: str) -> str | None:
+ try:
+ with requests.request(
+ method,
+ url,
+ headers={"User-Agent": "atr-docs-check"},
+ timeout=_EXTERNAL_TIMEOUT,
+ allow_redirects=True,
+ stream=True,
+ ) as response:
+ if response.status_code >= 400:
+ return f"HTTP {response.status_code}"
+ return None
+ except requests.RequestException as e:
+ return str(e)
+
+
+def _validate_app_links(project_root: pathlib.Path, all_app_links: list[UrlLink]) -> list[str]:
+ errors = []
+ app = base.QuartApp("docs_check", token_file=None)
+ blueprints_get.register(app)
+ adapter = app.url_map.bind("localhost")
+
+ for link in all_app_links:
+ path = urllib.parse.urlsplit(link.url).path
+ if path.startswith("/static/"):
+ if not (project_root / "atr" / path.lstrip("/")).is_file():
+ errors.append(f"{link.source_file}:{link.line_number}: Link to non-existent static file '{link.url}'")
+ continue
+ try:
+ adapter.match(path, method="GET")
+ except routing.RequestRedirect:
+ # The route exists, it only differs by a trailing slash
+ continue
+ except exceptions.HTTPException:
+ errors.append(f"{link.source_file}:{link.line_number}: Link to non-existent route '{link.url}'")
+
+ return errors
+
+
+def _validate_external_links(all_external_links: list[UrlLink]) -> list[str]:
+ urls = sorted({link.url for link in all_external_links})
+ with concurrent.futures.ThreadPoolExecutor(max_workers=_EXTERNAL_WORKERS) as executor:
+ failures = dict(zip(urls, executor.map(_check_external_url, urls)))
+
+ errors = []
+ for link in all_external_links:
+ failure = failures[link.url]
+ if failure is not None:
+ errors.append(f"{link.source_file}:{link.line_number}: External link '{link.url}' failed: {failure}")
+ return errors
+
+
+def _validate_moved_pages(docs_dir: pathlib.Path) -> list[str]:
+ errors = []
+ existing_files = {f.stem for f in docs_dir.glob("*.md")}
+
+ for old_page, new_page in docs.MOVED_PAGES.items():
+ if old_page in existing_files:
+ errors.append(f"Moved page '{old_page}' still exists, so its redirect would hide it")
+ if new_page not in existing_files:
+ errors.append(f"Moved page '{old_page}' redirects to non-existent page '{new_page}'")
+
+ return errors
+
+
def main() -> None:
+ parser = argparse.ArgumentParser(description="Check links in the ATR documentation")
+ parser.add_argument("--external", action="store_true", help="also fetch every external link")
+ args = parser.parse_args()
+
docs_dir = pathlib.Path("atr/docs")
if not docs_dir.exists():
@@ -178,14 +300,21 @@ def main() -> None:
all_links = []
all_ref_links = []
+ all_app_links = []
+ all_external_links = []
for md_file in docs_dir.glob("*.md"):
- links = _extract_links(md_file)
- all_links.extend(links)
- ref_links = _extract_ref_links(md_file)
- all_ref_links.extend(ref_links)
+ all_links.extend(_extract_links(md_file))
+ all_ref_links.extend(_extract_ref_links(md_file))
+ app_links, external_links = _extract_absolute_links(md_file)
+ all_app_links.extend(app_links)
+ all_external_links.extend(external_links)
errors = _validate_links(docs_dir, all_links)
errors.extend(_validate_ref_links(project_root, all_ref_links))
+ errors.extend(_validate_app_links(project_root, all_app_links))
+ errors.extend(_validate_moved_pages(docs_dir))
+ if args.external:
+ errors.extend(_validate_external_links(all_external_links))
if errors:
print("Documentation link validation errors:\n", file=sys.stderr)
@@ -197,6 +326,11 @@ def main() -> None:
print(f"Validated {len(all_links)} links across {len(list(docs_dir.glob('*.md')))} files")
print(f"Validated {len(all_ref_links)} ref links")
+ print(f"Validated {len(all_app_links)} app links")
+ if args.external:
+ print(f"Validated {len(all_external_links)} external links")
+ else:
+ print(f"Skipped {len(all_external_links)} external links, use --external to check them")
print("All links are valid")
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tooling.apache.org
For additional commands, e-mail: commits-help@tooling.apache.org