hex/tests/fixtures/release-protocol/decisions.json

581 lines
15 KiB
JSON

{
"description": "Client decisions. Run decide(input with manifest = manifests[input.manifest].manifest) and compare the whole result to expect.",
"cases": [
{
"name": "direct newer inside rollout",
"input": {
"app": "example",
"artifact": "desktop",
"channel": "stable",
"manifest": "base",
"install": {
"target": "macos-arm64",
"distribution": "direct",
"rollout_bucket": 24,
"version": "2.3.8"
}
},
"expect": {
"action": "install",
"reason": "newer",
"version": "2.4.0",
"target": {
"url": "/release/example/files/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/example-2.4.0-macos-arm64.zip",
"size": 1000,
"sha256": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
}
}
},
{
"name": "direct newer at the rollout boundary is deferred",
"input": {
"app": "example",
"artifact": "desktop",
"channel": "stable",
"manifest": "base",
"install": {
"target": "macos-arm64",
"distribution": "direct",
"rollout_bucket": 25,
"version": "2.3.8"
}
},
"expect": {
"action": "none",
"reason": "rollout_deferred"
}
},
{
"name": "below minimum bypasses rollout",
"input": {
"app": "example",
"artifact": "desktop",
"channel": "stable",
"manifest": "base",
"install": {
"target": "macos-arm64",
"distribution": "direct",
"rollout_bucket": 99,
"version": "1.9.0"
}
},
"expect": {
"action": "install",
"reason": "required",
"version": "2.4.0",
"target": {
"url": "/release/example/files/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/example-2.4.0-macos-arm64.zip",
"size": 1000,
"sha256": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
}
}
},
{
"name": "revoked version bypasses rollout",
"input": {
"app": "example",
"artifact": "desktop",
"channel": "stable",
"manifest": "base",
"install": {
"target": "macos-arm64",
"distribution": "direct",
"rollout_bucket": 99,
"version": "2.3.9"
}
},
"expect": {
"action": "install",
"reason": "revoked",
"version": "2.4.0",
"target": {
"url": "/release/example/files/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/example-2.4.0-macos-arm64.zip",
"size": 1000,
"sha256": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
}
}
},
{
"name": "same version is up to date",
"input": {
"app": "example",
"artifact": "desktop",
"channel": "stable",
"manifest": "base",
"install": {
"target": "macos-arm64",
"distribution": "direct",
"rollout_bucket": 0,
"version": "2.4.0"
}
},
"expect": {
"action": "none",
"reason": "up_to_date"
}
},
{
"name": "newer local prerelease is up to date",
"input": {
"app": "example",
"artifact": "desktop",
"channel": "stable",
"manifest": "base",
"install": {
"target": "macos-arm64",
"distribution": "direct",
"rollout_bucket": 0,
"version": "2.5.0-beta.1"
}
},
"expect": {
"action": "none",
"reason": "up_to_date"
}
},
{
"name": "a prerelease of the release version is older",
"input": {
"app": "example",
"artifact": "desktop",
"channel": "stable",
"manifest": "base",
"install": {
"target": "macos-arm64",
"distribution": "direct",
"rollout_bucket": 0,
"version": "2.4.0-beta.3"
}
},
"expect": {
"action": "install",
"reason": "newer",
"version": "2.4.0",
"target": {
"url": "/release/example/files/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/example-2.4.0-macos-arm64.zip",
"size": 1000,
"sha256": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
}
}
},
{
"name": "missing target",
"input": {
"app": "example",
"artifact": "desktop",
"channel": "stable",
"manifest": "base",
"install": {
"target": "windows-arm64",
"distribution": "direct",
"rollout_bucket": 0,
"version": "2.3.8"
}
},
"expect": {
"action": "none",
"reason": "no_target"
}
},
{
"name": "brew install notifies with its command",
"input": {
"app": "example",
"artifact": "desktop",
"channel": "stable",
"manifest": "base",
"install": {
"target": "macos-arm64",
"distribution": "brew",
"rollout_bucket": 0,
"version": "2.3.0"
}
},
"expect": {
"action": "notify",
"reason": "newer",
"version": "2.4.0",
"distribution": "brew",
"command": "brew upgrade --cask anomalyco/tap/example",
"notes_url": "https://anoma.ly/example/releases/2.4.0"
}
},
{
"name": "lagging npm at the installed version stays quiet",
"input": {
"app": "example",
"artifact": "desktop",
"channel": "stable",
"manifest": "base",
"install": {
"target": "macos-arm64",
"distribution": "npm",
"rollout_bucket": 0,
"version": "2.3.8"
}
},
"expect": {
"action": "none",
"reason": "up_to_date"
}
},
{
"name": "lagging npm offers the version npm has",
"input": {
"app": "example",
"artifact": "desktop",
"channel": "stable",
"manifest": "base",
"install": {
"target": "macos-arm64",
"distribution": "npm",
"rollout_bucket": 0,
"version": "2.3.0"
}
},
"expect": {
"action": "notify",
"reason": "newer",
"version": "2.3.8",
"distribution": "npm",
"command": "npm install -g @example/cli@latest",
"notes_url": "https://anoma.ly/example/releases/2.4.0"
}
},
{
"name": "managed installs respect rollout",
"input": {
"app": "example",
"artifact": "desktop",
"channel": "stable",
"manifest": "base",
"install": {
"target": "macos-arm64",
"distribution": "brew",
"rollout_bucket": 50,
"version": "2.3.0"
}
},
"expect": {
"action": "none",
"reason": "rollout_deferred"
}
},
{
"name": "pending distribution",
"input": {
"app": "example",
"artifact": "desktop",
"channel": "stable",
"manifest": "base",
"install": {
"target": "macos-arm64",
"distribution": "aur",
"rollout_bucket": 0,
"version": "2.3.0"
}
},
"expect": {
"action": "none",
"reason": "distribution_pending"
}
},
{
"name": "unlisted distribution",
"input": {
"app": "example",
"artifact": "desktop",
"channel": "stable",
"manifest": "base",
"install": {
"target": "macos-arm64",
"distribution": "winget",
"rollout_bucket": 0,
"version": "2.3.0"
}
},
"expect": {
"action": "none",
"reason": "distribution_unlisted"
}
},
{
"name": "unknown install method notifies without a command",
"input": {
"app": "example",
"artifact": "desktop",
"channel": "stable",
"manifest": "base",
"install": {
"target": "macos-arm64",
"distribution": "unknown",
"rollout_bucket": 0,
"version": "2.3.0"
}
},
"expect": {
"action": "notify",
"reason": "newer",
"version": "2.4.0",
"distribution": "unknown",
"notes_url": "https://anoma.ly/example/releases/2.4.0"
}
},
{
"name": "halted rollout defers everyone",
"input": {
"app": "example",
"artifact": "desktop",
"channel": "stable",
"manifest": "halted",
"install": {
"target": "macos-arm64",
"distribution": "direct",
"rollout_bucket": 0,
"version": "2.3.8"
}
},
"expect": {
"action": "none",
"reason": "rollout_deferred"
}
},
{
"name": "halted rollout still enforces the minimum",
"input": {
"app": "example",
"artifact": "desktop",
"channel": "stable",
"manifest": "halted",
"install": {
"target": "macos-arm64",
"distribution": "direct",
"rollout_bucket": 0,
"version": "1.0.0"
}
},
"expect": {
"action": "install",
"reason": "required",
"version": "2.4.0",
"target": {
"url": "/release/example/files/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/example-2.4.0-macos-arm64.zip",
"size": 1000,
"sha256": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
}
}
},
{
"name": "rollback reinstalls the older version over a revoked one",
"input": {
"app": "example",
"artifact": "desktop",
"channel": "stable",
"manifest": "rollback",
"install": {
"target": "macos-arm64",
"distribution": "direct",
"rollout_bucket": 99,
"version": "2.4.0"
}
},
"expect": {
"action": "install",
"reason": "revoked",
"version": "2.3.8",
"target": {
"url": "/release/example/files/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/example-2.4.0-macos-arm64.zip",
"size": 1000,
"sha256": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
}
}
},
{
"name": "rollback leaves the restored version alone",
"input": {
"app": "example",
"artifact": "desktop",
"channel": "stable",
"manifest": "rollback",
"install": {
"target": "macos-arm64",
"distribution": "direct",
"rollout_bucket": 0,
"version": "2.3.8"
}
},
"expect": {
"action": "none",
"reason": "up_to_date"
}
},
{
"name": "rollback never downgrades an unrevoked newer version",
"input": {
"app": "example",
"artifact": "desktop",
"channel": "stable",
"manifest": "rollback",
"install": {
"target": "macos-arm64",
"distribution": "direct",
"rollout_bucket": 0,
"version": "2.4.1"
}
},
"expect": {
"action": "none",
"reason": "up_to_date"
}
},
{
"name": "rollback through brew",
"input": {
"app": "example",
"artifact": "desktop",
"channel": "stable",
"manifest": "rollback",
"install": {
"target": "macos-arm64",
"distribution": "brew",
"rollout_bucket": 99,
"version": "2.4.0"
}
},
"expect": {
"action": "notify",
"reason": "revoked",
"version": "2.3.8",
"distribution": "brew",
"command": "brew upgrade --cask anomalyco/tap/example",
"notes_url": "https://anoma.ly/example/releases/2.3.8"
}
},
{
"name": "dev numeric prerelease ordering",
"input": {
"app": "example",
"artifact": "desktop",
"channel": "dev",
"manifest": "dev",
"install": {
"target": "macos-arm64",
"distribution": "direct",
"rollout_bucket": 99,
"version": "2.5.0-dev.9"
}
},
"expect": {
"action": "install",
"reason": "newer",
"version": "2.5.0-dev.10",
"target": {
"url": "/release/example/files/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/example-2.4.0-macos-arm64.zip",
"size": 1000,
"sha256": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
}
}
},
{
"name": "dev same prerelease",
"input": {
"app": "example",
"artifact": "desktop",
"channel": "dev",
"manifest": "dev",
"install": {
"target": "macos-arm64",
"distribution": "direct",
"rollout_bucket": 0,
"version": "2.5.0-dev.10"
}
},
"expect": {
"action": "none",
"reason": "up_to_date"
}
},
{
"name": "stable on the dev channel is newer than its prereleases",
"input": {
"app": "example",
"artifact": "desktop",
"channel": "dev",
"manifest": "dev",
"install": {
"target": "macos-arm64",
"distribution": "direct",
"rollout_bucket": 0,
"version": "2.5.0"
}
},
"expect": {
"action": "none",
"reason": "up_to_date"
}
},
{
"name": "unknown fields are ignored",
"input": {
"app": "example",
"artifact": "desktop",
"channel": "stable",
"manifest": "future-fields",
"install": {
"target": "macos-arm64",
"distribution": "direct",
"rollout_bucket": 0,
"version": "2.3.8"
}
},
"expect": {
"action": "install",
"reason": "newer",
"version": "2.4.0",
"target": {
"url": "/release/example/files/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/example-2.4.0-macos-arm64.zip",
"size": 1000,
"sha256": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
}
}
},
{
"name": "malformed manifest",
"input": {
"app": "example",
"artifact": "desktop",
"channel": "stable",
"manifest": "malformed",
"install": {
"target": "macos-arm64",
"distribution": "direct",
"rollout_bucket": 0,
"version": "2.3.8"
}
},
"expect": {
"action": "reject",
"reason": "malformed"
}
},
{
"name": "wrong channel",
"input": {
"app": "example",
"artifact": "desktop",
"channel": "beta",
"manifest": "base",
"install": {
"target": "macos-arm64",
"distribution": "direct",
"rollout_bucket": 0,
"version": "2.3.8"
}
},
"expect": {
"action": "reject",
"reason": "wrong_channel"
}
}
]
}