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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions .github/workflows/cd-monorepo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -245,13 +245,16 @@ jobs:
echo "Releasing syft $VERSION"

# Artifacts live inside the package, so they must be committed before the
# build. Re-running the export writes nothing when they already exist.
- name: Freeze release artifacts
# build. The release fixture lets later releases test that they still read
# what this release writes, so it goes into the same commit and the tag.
# Re-running either script writes nothing when its files already exist.
- name: Freeze release artifacts and fixture
run: |
just export-release-artifacts
git add syft/migrations/history
uv run python scripts/generate_release_fixture.py
git add syft/migrations/history tests/migrations/p2p/fixtures
git diff --cached --quiet || \
git commit -m "Freeze syft v${{ env.VERSION }} release artifacts"
git commit -m "Freeze syft v${{ env.VERSION }} release artifacts and fixture"

- name: Build
run: just build
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/cd-syft-dataset.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,16 @@ jobs:
echo "Releasing syft-dataset $VERSION"

# Artifacts live inside the package, so they must be committed before the
# build. Re-running the export writes nothing when they already exist.
- name: Freeze release artifacts
# build. The release fixture lets later releases test that they still read
# what this release writes, so it goes into the same commit and the tag.
# Re-running either script writes nothing when its files already exist.
- name: Freeze release artifacts and fixture
run: |
uv run python packages/syft-datasets/scripts/export_release_artifact.py
git add packages/syft-datasets/src/syft_datasets/migrations/history
uv run python packages/syft-datasets/scripts/generate_release_fixture.py
git add packages/syft-datasets/src/syft_datasets/migrations/history packages/syft-datasets/tests/migrations/p2p/fixtures
git diff --cached --quiet || \
git commit -m "Freeze syft-dataset v${{ env.VERSION }} release artifacts"
git commit -m "Freeze syft-dataset v${{ env.VERSION }} release artifacts and fixture"

- name: Build package
working-directory: packages/syft-datasets
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/cd-syft-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,16 @@ jobs:
echo "Releasing syft-job $VERSION"

# Artifacts live inside the package, so they must be committed before the
# build. Re-running the export writes nothing when they already exist.
- name: Freeze release artifacts
# build. The release fixture lets later releases test that they still read
# what this release writes, so it goes into the same commit and the tag.
# Re-running either script writes nothing when its files already exist.
- name: Freeze release artifacts and fixture
run: |
uv run python packages/syft-job/scripts/export_release_artifact.py
git add packages/syft-job/src/syft_job/migrations/history
uv run python packages/syft-job/scripts/generate_release_fixture.py
git add packages/syft-job/src/syft_job/migrations/history packages/syft-job/tests/migrations/p2p/fixtures
git diff --cached --quiet || \
git commit -m "Freeze syft-job v${{ env.VERSION }} release artifacts"
git commit -m "Freeze syft-job v${{ env.VERSION }} release artifacts and fixture"

- name: Build package
working-directory: packages/syft-job
Expand Down
7 changes: 4 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ repos:
rev: 'v3.0.0-alpha.9-for-vscode'
hooks:
- id: prettier
# migrations/history/ holds release artifacts that CD writes and commits
# during a release, without pre-commit; they are frozen, never formatted.
exclude: (\.min\.(js|css)$|^ci/|^test_outputs/|^packages/syft-datasets/tests/migrations/(p2p|unit)/fixtures/|/migrations/history/)
# migrations/history/ and migrations/p2p/fixtures/ hold the release
# artifacts and fixtures that CD writes and commits during a release,
# without pre-commit; they are frozen, never formatted.
exclude: (\.min\.(js|css)$|^ci/|^test_outputs/|^packages/syft-datasets/tests/migrations/unit/fixtures/|/migrations/p2p/fixtures/|/migrations/history/)
7 changes: 6 additions & 1 deletion docs/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ Each package uploads with its own PyPI token, stored as a repository secret: `PY
- Merge the release branch into `dev` in a PR. Run `uv lock` on that PR and commit `uv.lock`; the bump commits change only `pyproject.toml` files.
- Create the GitHub Release: `gh release create vX.Y.Z --verify-tag --generate-notes --notes-start-tag v<previous>`.
- Rebuild the enclave image from the release tag, not from the branch, which already holds the next version. A verifier expects the enclave to run its own syft version, so clients of the new release reject an older image. From `packages/syft-enclave`, on a checkout of `vX.Y.Z`: `just build-push "X.Y.Z latest"` (needs `OM_DOCKER_LOGIN` and `OM_DOCKER_PW`), then update the image digest where the enclave is deployed (`just tinfoil-release X.Y.Z` for Tinfoil, `image_digest` in the Terraform variables for Confidential Space).
- Generate the release fixtures, each at its own tag, and commit them to `dev` in a PR: `scripts/generate_release_fixture.py` at `vX.Y.Z`, `packages/syft-job/scripts/generate_release_fixture.py` at `syft-job/vX.Y.Z`, `packages/syft-datasets/scripts/generate_release_fixture.py` at `syft-dataset/vX.Y.Z`. Later releases test that they still read these files. Do not run all three at `vX.Y.Z`: syft-job and syft-dataset were bumped earlier in the same run, so at that tag they name the next version.
- Add the release to `CHANGELOG.md`.

## Release artifacts
Expand All @@ -58,6 +57,12 @@ An export stops with an error if the protocol changed but the protocol version c

The drift check has one known limit. A new protocol generation adds object versions, and no artifact freezes those versions until the release of that generation. The drift check therefore cannot see a change to them. Frequent releases keep this period short.

## Release fixtures

A release fixture is a small sample of data exactly as one release wrote it: the version file and two sync messages for `syft`, a SyftBox with jobs for `syft-job`, and a SyftBox with a dataset for `syft-dataset`. The tests of every later release load each fixture (`test_older_protocol_compatibility.py`) and check that the code still reads it.

The release job writes the fixtures on every release, in the same commit as the artifacts, so each one is inside its release tag and reaches `dev` with the merge of the release branch. A second run writes nothing and reports success.

## Hotfixes

If a fix is needed after cutting the release branch, apply the hotfix directly to the release branch and re-release from there.
7 changes: 5 additions & 2 deletions packages/syft-datasets/scripts/generate_release_fixture.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Generate a p2p backward-compatibility fixture for a syft-dataset release.

Run on EVERY release, at the released commit:
The release job runs this on every release, at the released commit, and
commits the fixture with the release artifacts. To run it by hand:

git checkout syft-dataset/v<released version>
uv run python packages/syft-datasets/scripts/generate_release_fixture.py
Expand Down Expand Up @@ -116,7 +117,9 @@ def main() -> None:
)
if target.exists():
if not args.force:
raise SystemExit(f"{target} already exists; pass --force to regenerate.")
# Writing nothing then succeeds, so a release job can run this again.
print(f"Release fixture already present: {target}")
return
shutil.rmtree(target)

_build_fixture(target, args.protocol)
Expand Down
15 changes: 7 additions & 8 deletions packages/syft-job/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@ into a data owner's inbox, the data owner reviews, approves, and runs them.

## Releasing

On **every** release, the release job runs `export_release_artifact.py` before
the build. After the release, check out the `syft-job/v<version>` tag and run
the fixture script:
On **every** release, the release job runs both scripts before the build and
commits what they write:

```bash
uv run python scripts/export_release_artifact.py # run by the release job
uv run python scripts/generate_release_fixture.py # at the syft-job release tag
uv run python scripts/export_release_artifact.py
uv run python scripts/generate_release_fixture.py
```

`export_release_artifact.py` always writes
Expand All @@ -23,9 +22,9 @@ version. It refuses to run if the job protocol changed without bumping

`generate_release_fixture.py` writes a full SyftBox tree —
`tests/migrations/p2p/fixtures/syft_job-<version>-protocol<p>_syftbox/` — exactly
as this release serializes jobs to disk. Commit it: future releases loop over
these fixtures (`test_older_protocol_compatibility.py`) to prove they can still
read and round-trip older on-disk data.
as this release serializes jobs to disk. Future releases loop over these
fixtures (`test_older_protocol_compatibility.py`) to prove they can still read
and round-trip older on-disk data.

Tests check the code against these artifacts: released object versions are
frozen forever — changing one requires a new version plus migrations.
7 changes: 5 additions & 2 deletions packages/syft-job/scripts/generate_release_fixture.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Generate a p2p backward-compatibility fixture for the current syft-job release.

Run on EVERY release, at the released commit:
The release job runs this on every release, at the released commit, and
commits the fixture with the release artifacts. To run it by hand:

git checkout syft-job/v<released version>
uv run python packages/syft-job/scripts/generate_release_fixture.py
Expand Down Expand Up @@ -129,7 +130,9 @@ def main() -> None:
)
if target.exists():
if not args.force:
raise SystemExit(f"{target} already exists; pass --force to regenerate.")
# Writing nothing then succeeds, so a release job can run this again.
print(f"Release fixture already present: {target}")
return
shutil.rmtree(target)

_build_fixture(target)
Expand Down
11 changes: 5 additions & 6 deletions scripts/generate_release_fixture.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Generate a p2p backward-compatibility fixture for the current syft release.

Run on EVERY release, at the released commit:
The release job runs this on every release, at the released commit, and
commits the fixture with the release artifacts. To run it by hand:

git checkout v<released version>
uv run python scripts/generate_release_fixture.py
Expand All @@ -22,7 +23,6 @@
can still read and round-trip older serialized data.
"""

import sys
from pathlib import Path

from syft.migrations.registry import SYFT_CLIENT_PROTOCOL_VERSION
Expand Down Expand Up @@ -96,12 +96,11 @@ def build_events_message(
def main() -> None:
# Any fixture for this version (any protocol) means the version was
# already released; a released version's serialized form is frozen.
# Writing nothing then succeeds, so a release job can run this again.
existing = sorted(FIXTURES_DIR.glob(f"syft-{SYFT_VERSION}-protocol*"))
if existing:
sys.exit(
f"{existing[0]} already exists — fixtures are frozen once written. "
"Bump SYFT_VERSION before generating."
)
print(f"Release fixture already present: {existing[0]}")
return
target = FIXTURES_DIR / (
f"syft-{SYFT_VERSION}-protocol{SYFT_CLIENT_PROTOCOL_VERSION}"
)
Expand Down
Loading