Compare commits

..
Author SHA1 Message Date
agent
6796f861e0
docs(readme): keep manual-release bullet; do not resurrect auto-release on main paths
All checks were successful
ci / test (pull_request) Successful in 3m55s
ci / sdk (pull_request) Successful in 58s
2026-09-12 19:15:34 -04:00
Hermes apk-dev
2e738e2e99
fix(android): surface the outbox send state instead of denying it
The SDK has returned `SendState` and a per-row `ChatMessage.delivery` since
the local outbox landed, but the app still said "there is no outbox in v1"
and threw the state away.

- `WireViewModel.send()` returns `SendState`; `ChatScreen` no longer discards
  it. A `QUEUED` send raises a "local-only until the retry worker gets a
  circuit through" hint instead of pretending success.
- Outgoing rows render the TUI's delivery markers from `ChatMessage.delivery`
  (`✓` / `◷ queued` / `» sending` / `✗ failed: <reason>`), plus the TUI's
  `{n} queued` footer while the outbox still owns rows. Incoming rows stay
  unmarked; an unreadable state renders no marker rather than a tick.
- The empty-chat copy describes the outbox (8 attempts, backoff capped at
  30 min, local-only until it lands) instead of denying it exists.
- New pure `Delivery.kt` so the vocabulary is unit-testable without a device.

Verified: `./gradlew :app:assembleDebug :app:testDebugUnitTest` → BUILD
SUCCESSFUL, 15 tests / 0 failures (10 new), APK contains the new copy and no
longer the "There is no outbox" string. Stacked on the SDK fix (PR #51).
2026-09-12 19:15:14 -04:00
agent
e30c9f1699
fix(sdk): surface Sent/Queued on send(), and build the SDK in CI
Node::send() became Result<OutboxStatus, String> in the local-outbox work,
which broke crates/onionwire-sdk — and nothing noticed, because the SDK is a
separate cargo workspace that root CI never compiles.

- Wire::send() returns WResult<SendState> (Sent | Queued)
- ChatMessage.delivery for outgoing rows
- New sdk job in ci.yml (own target volume; rustls workspace)
- Refresh SDK Cargo.lock + README (SQLCipher / outbox facts)

Rebased onto main after #50/#54: no src/node.rs changes (WAL checkpoint lives
in Store now). README at-rest claims kept from #55.
2026-09-12 19:15:14 -04:00
997b554bf1 Merge pull request 'ci(release): android-release cannot be woken by a CI-created tag — make it dispatch-only' (#63) from wt/t_95e0d607 into main
Reviewed-on: #63
2026-09-12 23:11:24 +00:00
7f8a1959df Merge branch 'main' into wt/t_95e0d607 2026-09-12 23:10:13 +00:00
2cf055c1e8
ci(release): android-release is dispatch-only; a CI-created tag cannot wake it
Neither decoupled trigger fires on Forgejo 10.0.3: a tag created by the CI
(API or git push) is an Actions-user push and is not dispatched back into
Actions, and reusable workflows need Forgejo >= 12. The release procedure is
therefore two dispatches: release.yml, then android-release with that tag.
2026-09-12 18:55:58 -04:00
7435ce42f5
ci(release): create the release tag with git push so the Android job fires
POST /tags sends no push event on this Forgejo (the v0.2.0 tag it created
produced no android-release run), so the tag is now created locally and
pushed, which does fire android-release.yml's `push: tags` trigger.
2026-09-12 18:49:14 -04:00
0c12abfa32 Merge pull request 'ci(release): manual, batched releases — no release on every merge' (#62) from wt/t_95e0d607 into main
Reviewed-on: #62
2026-09-12 22:29:20 +00:00
70ae597abc Merge branch 'main' into wt/t_95e0d607 2026-09-12 22:29:07 +00:00
6c9fd00b8a
ci(release): manual, batched releases — no release on merge
All checks were successful
ci / test (pull_request) Successful in 3m49s
Drop `push: branches: [main]` from both release workflows. release.yml now
runs only via workflow_dispatch, with bump (default minor), version, tag and
dry_run inputs; contradictory input is rejected instead of guessed at.

android-release.yml keeps the Android assets on the same tag by subscribing to
`push: tags: v*.*.*`: creating a tag over the API sends the same push
notification a git push does, so the core's tag wakes it. No workflow_call —
this Forgejo is 10.0.3, where reusable workflows are not supported.

docs/RELEASING.md is the policy and procedure.
2026-09-12 17:57:15 -04:00
5 changed files with 253 additions and 39 deletions

View file

@ -14,19 +14,21 @@ name: android-release
# First automated version with zero tags: v0.1.0. Afterwards, patch+1 from the
# latest v*.*.* tag UNLESS that tag's release is missing the Android assets —
# then join it (core owns tag creation). Never move or delete a tag.
#
# No automatic trigger, on purpose. Two candidate decoupled triggers were
# tried and both dead-end on Forgejo 10.0.3 (see docs/RELEASING.md):
# - `push: tags: ['v*.*.*']` — a tag created by release.yml (API or git push)
# does not fire it: pushes made with the CI's token are Actions-user events
# and Forgejo deliberately does not dispatch those back into Actions.
# Verified: the v0.2.0 and v0.2.1 tags produced no run, while hand-pushed
# tags did historically.
# - `workflow_call` from release.yml — reusable workflows only exist from
# Forgejo 12; this instance is 10.0.3.
# So a release is two dispatches: release.yml, then this one with `tag=<the
# tag the core just created>`. The core's run leaves the tag; this attaches
# the APK + AAR to it.
on:
push:
branches: [main]
paths:
- "android/app/**"
- "android/sdk/**"
- "android/*.gradle.kts"
- "android/gradle/**"
- "android/gradle.properties"
- "android/settings.gradle.kts"
- "scripts/build-android-local.sh"
- ".forgejo/workflows/android-release.yml"
workflow_dispatch:
inputs:
tag:

View file

@ -1,23 +1,33 @@
name: release
# Auto-tag and publish both Linux binaries when core paths land on main.
# Tag-push is intentionally NOT a trigger: this workflow creates the tag via
# the API, and a tag-push hook would start a second run of the same release.
# Rebuild an existing tag (or dry-run a build) with workflow_dispatch.
# Version: latest v*.*.* tag → patch+1; zero tags → v0.1.0.
# Manual, batched releases. There is deliberately NO push trigger: a merged
# PR does not mint a release. A maintainer dispatches this at a stopping point
# (a batch of work has landed and CI is green on main) — see docs/RELEASING.md.
# Tag-push is intentionally NOT a trigger here: this workflow creates the tag
# via the API, and a tag-push hook would start a second run of the same release.
# (A tag this workflow creates does not wake android-release.yml either — see
# docs/RELEASING.md: on this Forgejo, pushes made with the CI token are
# Actions-user events and are not dispatched back into Actions.)
# Version: explicit `version`, else `bump` off the newest v*.*.* tag
# (default minor — a batched release is usually a feature set); zero tags → v0.1.0.
on:
push:
branches: [main]
paths:
- "src/**"
- "crates/**"
- "Cargo.toml"
- "Cargo.lock"
- "scripts/release-body.md"
workflow_dispatch:
inputs:
bump:
description: Bump off the newest v*.*.* tag (ignored when version or tag is set)
required: false
type: choice
options:
- minor
- patch
- major
default: minor
version:
description: Explicit version MAJOR.MINOR.PATCH (or vMAJOR.MINOR.PATCH); overrides bump
required: false
type: string
tag:
description: Existing tag to (re)build and publish (empty = next version)
description: Existing tag to (re)build and publish (empty = create the next version)
required: false
type: string
dry_run:
@ -57,6 +67,8 @@ jobs:
REPO_API: ${{ github.server_url }}/api/v1/repos/${{ github.repository }}
EVENT_NAME: ${{ github.event_name }}
EVENT_SHA: ${{ github.sha }}
INPUT_BUMP: ${{ github.event.inputs.bump }}
INPUT_VERSION: ${{ github.event.inputs.version }}
INPUT_TAG: ${{ github.event.inputs.tag }}
INPUT_DRY_RUN: ${{ github.event.inputs.dry_run }}
run: |
@ -69,7 +81,7 @@ jobs:
true|True|TRUE|1|yes|YES) dry_run=true ;;
esac
fi
echo "event=$EVENT_NAME sha=$EVENT_SHA input_tag=${INPUT_TAG-} input_dry_run=${INPUT_DRY_RUN-} dry_run=$dry_run"
echo "event=$EVENT_NAME sha=$EVENT_SHA input_version=${INPUT_VERSION-} input_tag=${INPUT_TAG-} input_bump=${INPUT_BUMP-} input_dry_run=${INPUT_DRY_RUN-} dry_run=$dry_run"
api_curl() {
curl -sS --http1.1 --retry 5 --retry-all-errors --retry-delay 3 \
@ -78,6 +90,13 @@ jobs:
}
input_tag="${INPUT_TAG:-}"
version_input="${INPUT_VERSION:-}"
bump="${INPUT_BUMP:-minor}"
# Contradictory input is rejected, never guessed at.
if [ -n "$input_tag" ] && [ -n "$version_input" ]; then
echo "got both tag='$input_tag' and version='$version_input': tag rebuilds an existing tag, version mints a new one — pass one" >&2
exit 1
fi
if [ -n "$input_tag" ]; then
code=$(api_curl -o /tmp/tag.json -w '%{http_code}' \
"$REPO_API/tags/$input_tag")
@ -91,8 +110,33 @@ jobs:
created=false
echo "re-publish existing tag $tag at $sha (dry_run=$dry_run)"
else
if [ -n "$version_input" ]; then
tag=$(python3 -c "import re,sys; m=re.fullmatch(r'v?([0-9]+)\.([0-9]+)\.([0-9]+)', sys.argv[1].strip()); print('v' + '.'.join(m.groups()) if m else '')" "$version_input")
if [ -z "$tag" ]; then
echo "version must be MAJOR.MINOR.PATCH or vMAJOR.MINOR.PATCH, got '$version_input'" >&2
exit 1
fi
else
case "$bump" in
patch|minor|major) ;;
*) echo "bump must be patch|minor|major, got '$bump'" >&2; exit 1 ;;
esac
api_curl "$REPO_API/tags?limit=50" -o /tmp/tags.json
tag=$(python3 -c "import json,re; tags=json.load(open('/tmp/tags.json')); assert isinstance(tags, list), tags; semver=[]; [semver.append((int(m[1]), int(m[2]), int(m[3]))) for t in tags for m in [re.fullmatch(r'v([0-9]+)\.([0-9]+)\.([0-9]+)', t.get('name') or '')] if m]; print('v0.1.0' if not semver else 'v%d.%d.%d' % (max(semver)[0], max(semver)[1], max(semver)[2] + 1))")
latest=$(python3 -c "import json,re; tags=json.load(open('/tmp/tags.json')); assert isinstance(tags, list), tags; s=[tuple(int(x) for x in m.groups()) for t in tags for m in [re.fullmatch(r'v([0-9]+)\.([0-9]+)\.([0-9]+)', t.get('name') or '')] if m]; print('%d.%d.%d' % max(s) if s else '')")
if [ -z "$latest" ]; then
tag="v0.1.0"
else
major="${latest%%.*}"
rest="${latest#*.}"
minor="${rest%%.*}"
patch="${rest#*.}"
case "$bump" in
major) tag="v$((major + 1)).0.0" ;;
minor) tag="v$major.$((minor + 1)).0" ;;
patch) tag="v$major.$minor.$((patch + 1))" ;;
esac
fi
fi
sha="$EVENT_SHA"
created=false
if [ "$dry_run" = "true" ]; then

View file

@ -25,7 +25,7 @@ Arti onion services are still **experimental**. If the hidden service cannot com
### Option A — download a release binary
CI (`.forgejo/workflows/release.yml`) tags and publishes both Linux binaries on every `main` push that touches the core (`src/`, `crates/`, `Cargo.toml`, `Cargo.lock`, or `scripts/release-body.md`). Workflow-only edits do not mint a release — validate those with Actions → release → `dry_run=true`. aarch64 builds on the Pi runner; x86_64 builds on the amd64 runner. Both attach to the same [Forgejo release](https://forgejo.siriusdevops.com/sirius/onionwire/releases). `scripts/build-release-local.sh` remains the offline x86_64 fallback. This Forgejo does not serve `/releases/latest/download/…` (404); pin the tag.
CI (`.forgejo/workflows/release.yml`) does **not** release on a merge. Releases are manual and batched: a maintainer runs the workflow at a stopping point (Actions → release → Run workflow, `dry_run=true` first), which tags the next `v*.*.*` version and publishes both Linux binaries — aarch64 on the Pi runner, x86_64 on the amd64 runner — to one [Forgejo release](https://forgejo.siriusdevops.com/sirius/onionwire/releases), with the Android APK + AAR attached to that same tag. Policy and inputs: [docs/RELEASING.md](docs/RELEASING.md). `scripts/build-release-local.sh` remains the offline x86_64 fallback. This Forgejo does not serve `/releases/latest/download/…` (404); pin the tag.
**x86_64 (most PCs / VMs):**
@ -266,20 +266,38 @@ rationale, the 16 KB page-size check and the signing story are in
## Releases (maintainers)
A core change on `main` is enough. The release workflow computes the next
`v*.*.*` tag (patch+1, or `v0.1.0` if there are no tags), creates it via the
API, builds aarch64 on the Pi runner and x86_64 on the amd64 runner, and
publishes all four assets (`onionwire-<target>` + `.sha256`) to one release.
Do not push tags by hand — a tag-push trigger would start a second run.
Releases are **manual and batched**: no merge publishes anything, and neither
does a tag push. Cut one when a batch of work has reached a stopping point —
CI green on `main`, the feature set landed, no half-merged stack. Full policy
and procedure: [`docs/RELEASING.md`](docs/RELEASING.md) — it is two dispatches,
`release` (tag + Linux binaries) then `android-release` with that tag (APK +
AAR): on this Forgejo neither a tag push nor `workflow_call` can wake the
Android job.
Actions → release → Run workflow:
| Input | Meaning |
|---|---|
| `dry_run` | build + checksum both Linux binaries, no tag, no publish. Run this first. |
| `bump` | `patch` / `minor` / `major` off the newest `v*.*.*` tag. Default `minor`. |
| `version` | explicit `X.Y.Z` (or `vX.Y.Z`) — overrides `bump`. |
| `tag` | rebuild / re-publish an existing tag instead of minting one. |
Pass `tag` **or** `version`, not both; an unparseable version is rejected
rather than guessed at. The workflow computes the version, creates the tag over
the API (refusing to move an existing tag), builds aarch64 on the Pi runner and
x86_64 on the amd64 runner, and publishes all four assets (`onionwire-<target>`
+ `.sha256`) to one release. Then dispatch `android-release` with that tag to
attach the APK + AAR to the same release (it has no automatic trigger on this
Forgejo — see `docs/RELEASING.md`). If a build or the publish fails, the core
run deletes the tag it created. Do not push tags by hand —
`release.yml` has no tag-push trigger, so a hand-pushed tag would build
nothing.
```bash
# optional: keep Cargo.toml in sync with the tag the workflow will mint
# (the workflow does not edit Cargo.toml)
# rebuild / re-publish an existing tag, or dry-run a build with no tag:
# Actions → release → Run workflow → tag=vX.Y.Z and/or dry_run=true
# (dry_run is how you test release.yml without cutting a user-facing release)
# offline x86_64 fallback (idempotent — safe to re-run)
FORGEJO_TOKEN=<pat> scripts/build-release-local.sh vX.Y.Z
```
@ -287,7 +305,7 @@ FORGEJO_TOKEN=<pat> scripts/build-release-local.sh vX.Y.Z
Workflows (Forgejo Actions, `.forgejo/workflows/`):
- [`.forgejo/workflows/ci.yml`](.forgejo/workflows/ci.yml) — two jobs on the Pi runner (`docker` label), serialized by `onionwire-ci-pi`. `test`: `cargo test --locked` + `cargo clippy --all-targets -- -D warnings` at the repo root. `sdk`: the same for `crates/onionwire-sdk` (separate cargo workspace — own `Cargo.lock`, root crate by path, `rustls` instead of `native-tls` — so a root signature change cannot silently break the Android SDK). Both run on `main` and PRs when `src/`, `crates/`, `tests/`, `Cargo.toml`, `Cargo.lock`, or this workflow change (ignored Tor-live tests are not run). `workflow_dispatch` always runs the suite.
- [`.forgejo/workflows/release.yml`](.forgejo/workflows/release.yml) — on core paths to `main` (`src/`, `crates/`, `Cargo.toml`, `Cargo.lock`, `scripts/release-body.md`): next tag, aarch64 (`docker`) + x86_64 (`docker-amd64`), one release. `workflow_dispatch` rebuilds a tag or `dry_run`s. Concurrency group `onionwire-ci-pi` (same as `ci.yml`, `cancel-in-progress: false`) so cargo jobs do not overlap on the Pi. Amd64 dind is serialized by runner `capacity=1`.
- [`.forgejo/workflows/release.yml`](.forgejo/workflows/release.yml) — manual, batched release (`workflow_dispatch` only: `dry_run`, `bump`, `version`, `tag`): next tag, aarch64 (`docker`) + x86_64 (`docker-amd64`), one release, fail-closed tag delete on failure. Dispatch [`android-release.yml`](.forgejo/workflows/android-release.yml) with that tag to add the APK + AAR (no automatic trigger fires on this Forgejo; it is `workflow_dispatch` only). Concurrency group `onionwire-ci-pi` (same as `ci.yml`, `cancel-in-progress: false`) so cargo jobs do not overlap on the Pi. Amd64 dind is serialized by runner `capacity=1`.
Scripts:

View file

@ -12,3 +12,5 @@ Read these in order if you are evaluating the protocol without the Rust:
Operator / product docs stay in the [root README](../README.md). Android
build notes: [android/README.md](../android/README.md). SDK:
[crates/onionwire-sdk/README.md](../crates/onionwire-sdk/README.md).
Maintainers cutting a release: [RELEASING.md](RELEASING.md) — manual, batched
releases, not one per merge.

148
docs/RELEASING.md Normal file
View file

@ -0,0 +1,148 @@
# Releasing OnionWire
Policy and procedure for cutting a release. Read
[`README.md`](../README.md#releases-maintainers) for the short version.
## Policy: manual, batched releases
A merge does **not** publish anything. Neither does a tag push.
A release happens when a **batch of work has reached a stopping point**, chosen
by hand:
- CI is green on `main` (the `ci` workflow passed for the last push), and
- the feature set you mean to ship has landed — not a half-merged stack,
not a branch you are about to rewrite, and
- you are ready to answer user reports against the version you are about to
stamp.
Everything else about the pipeline is unchanged: both architectures, one
tagged release, `.sha256` for every asset, the fail-closed "delete the tag we
created if the build or publish fails", and the dry-run path.
## Procedure
1. **Confirm the stopping point.** `main` is the commit you want to release,
its CI run is green, and nothing you intend to include is still in an open
PR. The release workflow packages whatever `main`'s head is when the tag is
created.
2. **Dry-run it.** Actions → **release** → *Run workflow*, `dry_run=true`.
That builds and checksums both Linux binaries with no tag and no publish,
so it proves the pipeline without stamping a version. (A dry run does not
build the Android APK — there is no tag, so nothing wakes
`android-release`.)
3. **Cut the release.** Actions → **release** → *Run workflow* with
`dry_run=false` (the default) and the bump you want. The version must not
already be tagged.
4. **Watch it.** The run name is `release`; `scripts/watch-release-run.sh`
reports job status (it reads `action_run`/`action_run_job` on the Pi's
database, so it works for dispatched runs as well as any other).
5. **Attach the Android assets.** Dispatch `android-release` with the tag the
core run just created — see [Android](#android-apk--aar-on-the-same-tag).
The Linux binaries land first; the APK build is the long pole.
6. **Check the assets.** Open the release page (or
`GET /api/v1/repos/sirius/onionwire/releases/tags/<tag>`) and require a
non-zero `size` for every asset: the two Linux binaries + `.sha256`, the
APK + `.sha256`, the AAR + `.sha256`. A green run is not proof — the Pi
runner hairpins through Cloudflare and has uploaded 0-byte assets before.
## Inputs
| Input | Default | Meaning |
|---|---|---|
| `dry_run` | `false` | Build + checksum only. No tag, no publish. |
| `bump` | `minor` | `patch` / `minor` / `major` off the newest `v*.*.*` tag. |
| `version` | — | Explicit `X.Y.Z` or `vX.Y.Z`; overrides `bump`. |
| `tag` | — | Rebuild / re-publish an existing tag instead of minting a new one. |
Contradictory input is rejected, never guessed at:
- `tag` **and** `version` together → the run fails in the `version` job.
- `version` that is not `MAJOR.MINOR.PATCH` (optionally `v`-prefixed) → fails.
- `bump` outside `patch|minor|major` → fails.
## What the run does
`version` job (Pi runner):
1. Resolves the tag: the `tag` input, else the `version` input, else `bump`
applied to the newest `v*.*.*` tag (`v0.1.0` when the repo has no tags).
2. When minting a new version, creates the tag over the Forgejo API. If the
tag already exists on a different commit, the run **refuses to move it**
and fails. `201` means created; `409` means it was created concurrently and
this run joins it.
`aarch64` (Pi runner) and `x86_64` (amd64 runner) jobs build the binary in a
`rust:*-bookworm` container, strip it, refuse an empty binary, write the
`.sha256`, and upload it as an artifact.
`publish` job (Pi runner) downloads both artifacts, refuses any empty file,
and calls `scripts/publish-release.sh` to create-or-update the release with all
four Linux assets. If this job fails and the tag was created by *this* run, the
final step deletes the incomplete release and the tag. A failed `aarch64` or
`x86_64` job always fails `publish`, so nothing is published half-built.
## Android (APK + AAR) on the same tag
A release is **two dispatches**. After the core run has created the tag and
published the Linux binaries:
1. Actions → **android-release** → *Run workflow*, `tag=vX.Y.Z` (the tag the
core just created; leave `dry_run` false).
2. Check the release again — the APK + AAR + `.sha256` are attached to the
**same** tag. If the release did not exist yet it is created; if it exists
it is joined (`publish-release.sh` is create-or-update).
`android-release.yml` has no automatic trigger, and that is deliberate. Both
candidate decoupled triggers were tried on this instance and neither fires:
- **A tag created by `release.yml` does not wake `push: tags: ['v*.*.*']`.**
Tried both ways — the tag created through `POST /tags`, and the tag created
by a real `git push` from the version job. Neither produced an
`android-release` run: pushes made with the CI's token are Actions-user
events, and Forgejo deliberately does not dispatch those back into Actions
(`services/actions/notifier_helper.go`: a doer that `IsActions()` is ignored).
Historically, *hand-pushed* tags did fire tag-filtered workflows, which is why
the trigger looked plausible.
- **`workflow_call` is unavailable.** Reusable workflows only appear in the
Forgejo docs from v12 onward; this instance reports
`10.0.3+gitea-1.22.0` (`GET /api/v1/version`), so a caller job with
`uses: ./.forgejo/workflows/android-release.yml` would never run. The
`workflow_call` block is left declared for the day the instance is upgraded.
The Android build runs on the **amd64** runner (the Pi is aarch64 and cannot
produce an APK), then a second job on the Pi attaches the assets. It is the
long pole of a release — the Linux binaries land first.
## Rebuilding an existing tag
- **Both** Linux binaries: dispatch `release` with `tag=vX.Y.Z`. The tag's own
commit is built, its existing assets are replaced, and no new tag is created.
- **Android only**: dispatch `android-release` with `tag=vX.Y.Z`.
- The local `FORGEJO_TOKEN=<pat> scripts/build-release-local.sh vX.Y.Z`
fallback does the x86_64 build without CI.
Never move or delete a published `v*.*.*` tag by hand, and never create one by
hand: a hand-pushed tag starts nothing (`release.yml` has no tag-push trigger),
and `release.yml` will refuse to move a tag that exists on another commit.
## Version policy
`MAJOR.MINOR.PATCH` on the tag (`v`-prefixed). The default bump is `minor`: a
batched release is usually a feature set, and `patch`-incrementing it would
mislabel it. Use `patch` for a fix-only batch, `major` for a breaking wire or
store change. The tag is the version users see; `Cargo.toml` is **not** edited
by the workflow — keep it in sync by hand if the crate version matters to you.
The Android `versionCode` is derived by the Android workflow from
`major*10000 + minor*100 + patch`.
## What the workflows do not gate on
- **No "CI must be green" check inside the release job.** The operator checks
that by hand before dispatching. A release dispatched while CI is red will
build and publish anyway.
- No changelog generation: `scripts/release-body.md` is the template, with
`@TAG@` substituted.
- No approval gate, no environment protection, no automatic rollback beyond
the fail-closed tag delete described above.
- No notification on success: read the run and the release page.