# Checking your app against the zone before you release it — osy validate --zone, osy deploy --dry-run

> The zone an environment runs on builds every deploy with the platform release IT runs, which can be newer than the platform your project's CLI checks against. `osy validate --zone` and `osy deploy --dry-run` send the bundle `osy deploy` would send to that zone, which compiles it as the deploy would and answers what it says — in the same report as a local validate. Nothing is deployed, stored or recorded. A build system runs one before it cuts a release.

<!-- id: local-checking-against-the-zone · area: local · stability: preview · html: https://osysharp.com/reference/local/checking-against-the-zone/ -->

## Summary        {#summary}

A local `osy validate` checks your project with the compiler of the CLI you run. The zone your environment runs on builds
your deploy with **its own** platform release — and that can be newer than your CLI, with a compile check yours does not
have yet. Then validate passes on your machine and the deploy fails at the zone. `osy validate --zone <app>/<env>` closes
that gap: after the local checks pass, it has that zone build the project exactly as its deploy would, and adds what the
zone says to the same report. `osy deploy --dry-run` runs a deploy the same way and stops before anything changes.

## Signature      {#signature}

```console
osy validate [path] --zone <app>/<env> [--server <url>] [--migration <file>] [--json]
osy deploy [path] --env <slug> --dry-run [--app <slug>] [--server <url>] [--json]
```

## Description    {#description}

**Run it before you cut a release.** A build system that releases an app runs `osy validate --zone <app>/production` (or
`osy deploy --env production --dry-run`) first, so a release it cuts is one the zone will build. The zone may run a newer
platform than the one your project pins ([minPlatform — the oldest platform an app runs on](https://osysharp.com/reference/project/min-platform/)); no deploy is judged by the pinned version, so the
zone's check is the one that counts.

**What happens.** Your project is built on this machine into the same bundle `osy deploy` builds. The platform is asked
for a check and decides it as it would decide the deploy: you must be allowed to deploy the app into that environment,
and your organization's policy is applied as it would be to the deploy — the packages it allows, the build systems it
deploys through (`apps.buildFrom`), and a sign-in at most 12 hours old for the highest or a Production environment — each
refused here in the deploy's words. The platform answers which zone runs the environment and which release it runs, with
a short-lived grant for one check. The bundle goes straight to that zone, where a builder — the same kind of short-lived
process that builds a deploy, never the one serving your apps — compiles it with the zone's release, into the model the
environment serves now, exactly as the deploy's build would — and stops there.

**Nothing changes.** No version, deploy, upload or deployment is recorded; the environment's deployed version and its
deploy history are as they were; the zone keeps the bundle only until its builder answers, and touches no database. A
grant is good for one check: ask again to check again, as often as you like. A deploy token checks without being used
up, and a build system's single-use token signs in once for the check and the deploy after it
([Deploying from CI with a deploy token](https://osysharp.com/reference/local/deploying-with-a-deploy-token/)).

**The zone's words, in your report.** With `--zone`, each diagnostic the zone gives is added to `osy validate`'s report with
its file, line, code and message, and counts as a local one does: an error fails the run (exit `1`), with `--json` too. A
project that does not validate here is never sent; the report says the zone was not asked. With `--dry-run`, `osy deploy`
prints the zone's diagnostics and then one line — `Would deploy: shop-acme to production as the next version … built by
zone eu-1 on release 0.27.0` or `Would not deploy: …` — and exits `0` or `1`. It never asks for the deploy, never uploads
it, and never writes `osyrin.json`.

**Who may run it.** Whoever may deploy the app into that environment: its team, an organization owner, or a deploy token
for that app and environment ([Deploying from CI with a deploy token](https://osysharp.com/reference/local/deploying-with-a-deploy-token/)). `--zone` never opens a browser to sign in; with no
sign-in it says how to sign in or hand in `OSYRIN_TOKEN`.

**Limits.** The environment must already run the app: the zone that would build a first deploy is not known until it is
made, so a check of an environment with nothing deployed yet is refused and says so. An environment that needs an
approval for a deploy is checked only by a platform admin. A check builds on the release the environment runs now;
`--runtime` and `--onto-restore` are a deploy's own steps and are not checked. The bundle is sent in one request, up to
64 MB — the most a deploy sends in one request.

**One at a time, after the deploys.** One check of an app's environment runs at a time: a second asked for while one
runs is refused with `CHECK_IN_PROGRESS` — wait for the first. A check is built only on the zone's builders, never on a
runtime other apps share, and it gives way: a deploy's build stops it, and it is built again after. A zone that runs no
builders refuses checks and says so. The bundle must arrive within 10 minutes, or the check ends with
`CHECK_UPLOAD_TOO_SLOW`. If no builder takes it within 30 minutes the check ends with `CHECK_NOT_BUILT`; ask again. The
zone reports the first 200 diagnostics, errors first, and says how many there were in all; a long message is cut short
and ends with `…`.

**`<app>/<env>`.** The app's slug as Osyrin knows it and the environment's — `--zone shop-acme/production`. `--zone
production` alone checks the app this project's `osyrin.json` links to. The server is `--server`, else the one
`osyrin.json` names, else the one you signed in to last.

## Examples       {#examples}

```console
osy validate --zone shop-acme/production            # the zone's own checks, after the local ones
osy validate --zone production --json               # the app this project is linked to; one report for tooling
osy deploy --env production --dry-run               # what would deploy, and nothing else
OSYRIN_TOKEN=… osy validate --zone shop-acme/production --server https://osyrin.app   # in a build system, before it cuts a release
```

## See also       {#see-also}

[Deploying your app to an environment](https://osysharp.com/reference/local/deploying-your-app/) — `osy deploy`, which this check runs up to the build.

[Deploying an application to a cloud platform — the zone builds it](https://osysharp.com/reference/zones/deploying-an-application/) — why the zone builds a deploy, and with which release.

[Deploying from CI with a deploy token](https://osysharp.com/reference/local/deploying-with-a-deploy-token/) — the token a build system checks and deploys with.

[What a clean check means](https://osysharp.com/reference/local/what-a-clean-check-means/) — what a local `osy validate` checks, and what it cannot.
