Skip to content

armgit / AiSOC

Public Imported from GitHub
0

Open-source AI Security Operations Center: alert fusion, LLM-agent triage, MITRE ATT&CK investigation, and a replayable decision ledger for every agent step. Self-hostable, runs with no API keys, MIT licensed. Ships an MCP server for Claude, Cursor and Continue.

fix(release): the chart stable channel reads both version lines, and a dispatchable tool can repair it (#1440) (#1469)

Beenu Arorad63ec79cf433
diff --git a/.github/workflows/chart-channel.yml b/.github/workflows/chart-channel.yml
new file mode 100644
index 000000000..e293e3520
--- /dev/null
+++ b/.github/workflows/chart-channel.yml
@@ -0,0 +1,87 @@
+# Move the chart `stable` channel to a named, already-published chart version.
+#
+# This is the deliberate-human-action tool the channel guard in release.yml
+# points at. Until it existed, the only way `stable` could ever move was a
+# release tag push — so when v20.0.0 (#1440) carried the channel across an
+# application major that the guard should have refused, there was no way to
+# repair the position short of cutting another release. Dispatching this
+# workflow IS the operator decision the guard protects: it moves the channel
+# to exactly the version named, in either direction, and says what it did.
+#
+# It never republishes a chart *version* — `helm push` overwrites silently and
+# an overwritten version tag is unrecoverable — it only re-points the mutable
+# channel tag at an existing version's manifest, byte-identical, the same way
+# release.yml promotes on an ordinary release.
+name: Chart channel
+
+on:
+ workflow_dispatch:
+ inputs:
+ chart_version:
+ description: 'Published chart version to point `stable` at (e.g. 7.8.0). Must already exist in the registry.'
+ required: true
+ type: string
+
+permissions:
+ contents: read
+ packages: write
+
+jobs:
+ move:
+ name: Point `stable` at the named chart
+ runs-on: ubuntu-latest
+ timeout-minutes: 5
+ steps:
+ - name: Retag `stable`, byte-identical, with before/after evidence
+ env:
+ CHART_VERSION: ${{ inputs.chart_version }}
+ GH_TOKEN: ${{ github.token }}
+ run: |
+ set -uo pipefail
+ MEDIA="application/vnd.oci.image.manifest.v1+json"
+ reg_token=$(curl -fsS -u "x:${GH_TOKEN}" \
+ "https://ghcr.io/token?scope=repository:beenuar/charts/aisoc:pull,push&service=ghcr.io" \
+ | python3 -c 'import json,sys; print(json.load(sys.stdin)["token"])')
+
+ # chart tag -> "chartVersion (appVersion)", via the helm OCI config
+ # blob (Chart.yaml as JSON). Empty on a missing tag.
+ describe() {
+ local tag="$1" manifest digest
+ manifest=$(curl -fsS -H "Authorization: Bearer ${reg_token}" -H "Accept: ${MEDIA}" \
+ "https://ghcr.io/v2/beenuar/charts/aisoc/manifests/${tag}" 2>/dev/null || true)
+ [ -n "$manifest" ] || return 0
+ digest=$(printf '%s' "$manifest" | python3 -c 'import json,sys; print(json.load(sys.stdin)["config"]["digest"])' 2>/dev/null || true)
+ [ -n "$digest" ] || return 0
+ curl -fsSL -H "Authorization: Bearer ${reg_token}" \
+ "https://ghcr.io/v2/beenuar/charts/aisoc/blobs/${digest}" 2>/dev/null \
+ | python3 -c 'import json,sys; d=json.load(sys.stdin); print("{} (appVersion {})".format(d.get("version"), d.get("appVersion")))' \
+ 2>/dev/null || true
+ }
+
+ before=$(describe stable)
+ target=$(describe "${CHART_VERSION}")
+ if [ -z "$target" ]; then
+ echo "::error title=Helm::chart version ${CHART_VERSION} does not exist in the registry; nothing to point the channel at"
+ exit 1
+ fi
+ echo "stable before: ${before:-<none>}; moving to: ${target}"
+
+ # The same promote dance release.yml performs: GET the version tag's
+ # manifest, refuse it if its own annotation names something else,
+ # PUT the identical bytes under `stable`, read it back.
+ curl -fsS -H "Authorization: Bearer ${reg_token}" -H "Accept: ${MEDIA}" \
+ "https://ghcr.io/v2/beenuar/charts/aisoc/manifests/${CHART_VERSION}" -o /tmp/chart-manifest.json
+ source_version=$(python3 -c 'import json; print((json.load(open("/tmp/chart-manifest.json")).get("annotations") or {}).get("org.opencontainers.image.version",""))')
+ if [ "$source_version" != "$CHART_VERSION" ]; then
+ echo "::error title=Helm::the ${CHART_VERSION} tag's manifest names '${source_version:-<nothing>}'; refusing to move the channel onto it"
+ exit 1
+ fi
+ curl -fsS -X PUT -H "Authorization: Bearer ${reg_token}" -H "Content-Type: ${MEDIA}" \
+ --data-binary @/tmp/chart-manifest.json \
+ "https://ghcr.io/v2/beenuar/charts/aisoc/manifests/stable" > /dev/null
+ after=$(describe stable)
+ if [ "${after%% *}" != "$CHART_VERSION" ]; then
+ echo "::error title=Helm::stable was pushed but resolves to '${after:-<nothing>}', not ${CHART_VERSION}"
+ exit 1
+ fi
+ echo "::notice title=Helm::stable chart channel moved: ${before:-<none>} -> ${after}"
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index cba0d162d..7666604b2 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -1219,11 +1219,20 @@ jobs:
# image half was built, so `helm install` with no `--version` has always
# resolved to whatever the registry hands back.
#
- # The rule is the image rule, keyed on the *chart's* own major rather than
- # the application's: the break an operator is protected from here is a
- # values-schema break, and the chart versions independently of
- # `appVersion`. `helm push` cannot write a non-SemVer tag, so the channel
- # is a byte-identical manifest retag through the registry API.
+ # TWO version lines guard the channel, not one. The chart's own major
+ # announces a values-schema break. But the chart's values default every
+ # unpinned image tag to `Chart.AppVersion`, so the channel also carries
+ # operators across *application* majors — which is how v20.0.0 (chart
+ # 7.9.0, not a chart major) moved chart `stable` onto a breaking app
+ # release while every image `stable` tag correctly stayed on v19 (#1440).
+ # A channel is a property of history, so both majors are read from where
+ # the channel IS (the registry), never from the release in hand.
+ #
+ # The work is split across three steps so the *decision* is a pure block
+ # tests/test_release_channel_tags.py executes with each ladder of
+ # releases — the same lift-the-exact-block pattern as `image-tags`,
+ # because a copy of the logic would agree with itself while the
+ # workflow drifted.
#
# NOT `docker buildx imagetools create`. That tool composes image
# *indexes*: on v17.1.0, the first release to reach this far, it wrapped
@@ -1232,28 +1241,19 @@ jobs:
# be handed, and the verify below correctly refused it ("resolves to
# '<nothing>'"). A channel tag must serve the *same bytes* as the
# version tag: GET the manifest, PUT it under `stable`, unchanged.
- - name: Move the `stable` chart channel
- id: chart-channel
+ - name: Read where the chart channel is
+ id: chart-state
if: github.event_name == 'push'
env:
CHART_VERSION: ${{ steps.package.outputs.version }}
- PROMOTE_STABLE: ${{ inputs.promote_stable }}
GH_TOKEN: ${{ github.token }}
run: |
set -uo pipefail
- CHART=oci://ghcr.io/beenuar/charts/aisoc
- REF=ghcr.io/beenuar/charts/aisoc
MEDIA="application/vnd.oci.image.manifest.v1+json"
reg_token=$(curl -fsS -u "x:${GH_TOKEN}" \
"https://ghcr.io/token?scope=repository:beenuar/charts/aisoc:pull,push&service=ghcr.io" \
| python3 -c 'import json,sys; print(json.load(sys.stdin)["token"])')
- incoming_major="${CHART_VERSION%%.*}"
- is_major=false
- case "$CHART_VERSION" in
- *.0.0) is_major=true ;;
- esac
-
# Where the channel is now, read from the tag's OCI manifest.
#
# NOT `helm show chart --version stable`. `--version` takes a semver
@@ -1272,9 +1272,59 @@ jobs:
"https://ghcr.io/v2/beenuar/charts/aisoc/manifests/stable" 2>/dev/null \
| python3 -c 'import json,sys; print((json.load(sys.stdin).get("annotations") or {}).get("org.opencontainers.image.version",""))' \
2>/dev/null || true)
+
+ # A chart tag's appVersion, without pulling a tarball: the helm OCI
+ # *config blob* is Chart.yaml serialized as JSON, so it is manifest
+ # -> config.digest -> blob. Empty on any failure — the decide step
+ # owns the failure semantics, this step only reports facts.
+ app_major_of() {
+ local tag="$1" digest
+ digest=$(curl -fsS -H "Authorization: Bearer ${reg_token}" -H "Accept: ${MEDIA}" \
+ "https://ghcr.io/v2/beenuar/charts/aisoc/manifests/${tag}" 2>/dev/null \
+ | python3 -c 'import json,sys; print(json.load(sys.stdin)["config"]["digest"])' 2>/dev/null || true)
+ if [ -n "$digest" ]; then
+ curl -fsSL -H "Authorization: Bearer ${reg_token}" \
+ "https://ghcr.io/v2/beenuar/charts/aisoc/blobs/${digest}" 2>/dev/null \
+ | python3 -c 'import json,sys; v=(json.load(sys.stdin).get("appVersion") or "").lstrip("v"); print(v.split(".")[0] if v and v.split(".")[0].isdigit() else "")' \
+ 2>/dev/null || true
+ fi
+ }
+
+ channel_app_major=""
+ if [ -n "$current" ]; then
+ channel_app_major=$(app_major_of stable)
+ fi
+ incoming_app_major=$(app_major_of "${CHART_VERSION}")
+
+ echo "channel: chart '${current:-<none>}', app major '${channel_app_major:-<none>}'; incoming: chart ${CHART_VERSION}, app major '${incoming_app_major:-<none>}'"
+ {
+ echo "channel_chart_version=${current}"
+ echo "channel_app_major=${channel_app_major}"
+ echo "incoming_app_major=${incoming_app_major}"
+ } >> "$GITHUB_OUTPUT"
+
+ # The decision, pure over the facts above so the ladder tests can run
+ # this exact block. Everything here is a string comparison; no network.
+ - name: Decide whether the chart channel moves
+ id: chart-decide
+ if: github.event_name == 'push'
+ env:
+ CHART_VERSION: ${{ steps.package.outputs.version }}
+ PROMOTE_STABLE: ${{ inputs.promote_stable }}
+ CHANNEL_CHART_VERSION: ${{ steps.chart-state.outputs.channel_chart_version }}
+ CHANNEL_APP_MAJOR: ${{ steps.chart-state.outputs.channel_app_major }}
+ INCOMING_APP_MAJOR: ${{ steps.chart-state.outputs.incoming_app_major }}
+ run: |
+ set -uo pipefail
+ incoming_major="${CHART_VERSION%%.*}"
+ is_major=false
+ case "$CHART_VERSION" in
+ *.0.0) is_major=true ;;
+ esac
+
channel_major=""
- case "$current" in
- [0-9]*) channel_major="${current%%.*}" ;;
+ case "$CHANNEL_CHART_VERSION" in
+ [0-9]*) channel_major="${CHANNEL_CHART_VERSION%%.*}" ;;
esac
same_major=true
@@ -1282,38 +1332,71 @@ jobs:
same_major=false
fi
- if { [ "$is_major" != "true" ] && [ "$same_major" = "true" ]; } || [ "${PROMOTE_STABLE}" = "true" ]; then
- # GET the version tag's manifest and refuse to promote anything
- # whose own annotation does not name CHART_VERSION — then PUT the
- # identical bytes under `stable`.
- curl -fsS -H "Authorization: Bearer ${reg_token}" -H "Accept: ${MEDIA}" \
- "https://ghcr.io/v2/beenuar/charts/aisoc/manifests/${CHART_VERSION}" -o /tmp/chart-manifest.json
- source_version=$(python3 -c 'import json; print((json.load(open("/tmp/chart-manifest.json")).get("annotations") or {}).get("org.opencontainers.image.version",""))')
- if [ "$source_version" != "$CHART_VERSION" ]; then
- echo "::error title=Helm::the ${CHART_VERSION} tag's manifest names '${source_version:-<nothing>}'; refusing to promote it"
- exit 1
- fi
- curl -fsS -X PUT -H "Authorization: Bearer ${reg_token}" -H "Content-Type: ${MEDIA}" \
- --data-binary @/tmp/chart-manifest.json \
- "https://ghcr.io/v2/beenuar/charts/aisoc/manifests/stable" > /dev/null
- # Read the tag back and require it to name the version we just
- # pushed. `helm show chart --version stable` cannot do this for
- # the reason above, and a promotion nobody verified is how a
- # channel silently points at the wrong chart.
- moved_to=$(curl -fsS -H "Authorization: Bearer ${reg_token}" -H "Accept: ${MEDIA}" \
- "https://ghcr.io/v2/beenuar/charts/aisoc/manifests/stable" 2>/dev/null \
- | python3 -c 'import json,sys; print((json.load(sys.stdin).get("annotations") or {}).get("org.opencontainers.image.version",""))' \
- 2>/dev/null || true)
- if [ "$moved_to" != "$CHART_VERSION" ]; then
- echo "::error title=Helm::stable was pushed but resolves to '${moved_to:-<nothing>}', not ${CHART_VERSION}"
- exit 1
+ # The appVersion guard (#1440). An empty *channel* app major is the
+ # ordinary first-release state and allows movement, exactly like the
+ # chart-major read above. An empty *incoming* app major while the
+ # channel names one is different: refusing is recoverable (the next
+ # release or a deliberate promotion moves the channel), a wrong
+ # crossing is not, so that direction fails closed.
+ app_same_major=true
+ reason=""
+ if [ -n "$CHANNEL_APP_MAJOR" ]; then
+ if [ -z "$INCOMING_APP_MAJOR" ]; then
+ app_same_major=false
+ reason="the incoming chart's appVersion could not be read"
+ elif [ "$CHANNEL_APP_MAJOR" != "$INCOMING_APP_MAJOR" ]; then
+ app_same_major=false
+ reason="appVersion crosses v${CHANNEL_APP_MAJOR} -> v${INCOMING_APP_MAJOR}"
fi
- echo "::notice title=Helm::stable chart channel now resolves to ${CHART_VERSION}"
- echo "moved=true" >> "$GITHUB_OUTPUT"
+ fi
+
+ if { [ "$is_major" != "true" ] && [ "$same_major" = "true" ] && [ "$app_same_major" = "true" ]; } || [ "${PROMOTE_STABLE}" = "true" ]; then
+ echo "move=true" >> "$GITHUB_OUTPUT"
else
- echo "::notice title=Helm::stable chart channel left at ${current:-<none>}; chart ${CHART_VERSION} crosses a major. Dispatch with promote_stable: true to move it."
- echo "moved=false" >> "$GITHUB_OUTPUT"
+ echo "::notice title=Helm::stable chart channel left at ${CHANNEL_CHART_VERSION:-<none>}${reason:+ (${reason})}; dispatch chart-channel.yml (or release with promote_stable: true) to move it deliberately."
+ echo "move=false" >> "$GITHUB_OUTPUT"
+ fi
+
+ - name: Move the `stable` chart channel
+ id: chart-channel
+ if: github.event_name == 'push' && steps.chart-decide.outputs.move == 'true'
+ env:
+ CHART_VERSION: ${{ steps.package.outputs.version }}
+ GH_TOKEN: ${{ github.token }}
+ run: |
+ set -uo pipefail
+ MEDIA="application/vnd.oci.image.manifest.v1+json"
+ reg_token=$(curl -fsS -u "x:${GH_TOKEN}" \
+ "https://ghcr.io/token?scope=repository:beenuar/charts/aisoc:pull,push&service=ghcr.io" \
+ | python3 -c 'import json,sys; print(json.load(sys.stdin)["token"])')
+
+ # GET the version tag's manifest and refuse to promote anything
+ # whose own annotation does not name CHART_VERSION — then PUT the
+ # identical bytes under `stable`.
+ curl -fsS -H "Authorization: Bearer ${reg_token}" -H "Accept: ${MEDIA}" \
+ "https://ghcr.io/v2/beenuar/charts/aisoc/manifests/${CHART_VERSION}" -o /tmp/chart-manifest.json
+ source_version=$(python3 -c 'import json; print((json.load(open("/tmp/chart-manifest.json")).get("annotations") or {}).get("org.opencontainers.image.version",""))')
+ if [ "$source_version" != "$CHART_VERSION" ]; then
+ echo "::error title=Helm::the ${CHART_VERSION} tag's manifest names '${source_version:-<nothing>}'; refusing to promote it"
+ exit 1
+ fi
+ curl -fsS -X PUT -H "Authorization: Bearer ${reg_token}" -H "Content-Type: ${MEDIA}" \
+ --data-binary @/tmp/chart-manifest.json \
+ "https://ghcr.io/v2/beenuar/charts/aisoc/manifests/stable" > /dev/null
+ # Read the tag back and require it to name the version we just
+ # pushed. `helm show chart --version stable` cannot do this for
+ # the reason above, and a promotion nobody verified is how a
+ # channel silently points at the wrong chart.
+ moved_to=$(curl -fsS -H "Authorization: Bearer ${reg_token}" -H "Accept: ${MEDIA}" \
+ "https://ghcr.io/v2/beenuar/charts/aisoc/manifests/stable" 2>/dev/null \
+ | python3 -c 'import json,sys; print((json.load(sys.stdin).get("annotations") or {}).get("org.opencontainers.image.version",""))' \
+ 2>/dev/null || true)
+ if [ "$moved_to" != "$CHART_VERSION" ]; then
+ echo "::error title=Helm::stable was pushed but resolves to '${moved_to:-<nothing>}', not ${CHART_VERSION}"
+ exit 1
fi
+ echo "::notice title=Helm::stable chart channel now resolves to ${CHART_VERSION}"
+ echo "moved=true" >> "$GITHUB_OUTPUT"
- name: Explain a packaged-but-unpushed chart
diff --git a/tests/test_release_channel_tags.py b/tests/test_release_channel_tags.py
index 74e43dab8..7537722fd 100644
--- a/tests/test_release_channel_tags.py
+++ b/tests/test_release_channel_tags.py
@@ -198,3 +198,168 @@ class TestStableDoesNotCrossAMajorOnItsOwn:
end = run_ladder(["v1.0.0", "v1.1.0"], stable_major="")
assert end["stable"] == "v1.1.0"
+
+
+# ── The chart channel, graded on both version lines across a sequence ─────────
+#
+# #1440. The chart `stable` channel got the image rule keyed on the *chart's*
+# own major — and the chart's values default every unpinned image tag to
+# `Chart.AppVersion`, so chart 7.9.0 (not a chart major) carried the channel
+# onto app v20.0.0, a breaking application release, while every image `stable`
+# tag correctly stayed on v19. Same family as the v12/v13/v15 image crossings:
+# a channel is a property of history, and the history that matters here runs
+# along two version lines at once.
+#
+# These tests execute the workflow's own `chart-decide` block (pure shell over
+# facts the `chart-state` step reads from the registry) with ladders of
+# (chart version, app version) releases, carrying the channel's position
+# between releases exactly as the registry would.
+
+
+def _chart_decide_script() -> str:
+ workflow = yaml.safe_load(WORKFLOW.read_text(encoding="utf-8"))
+ steps = workflow["jobs"]["chart-publish"]["steps"]
+ step = next((s for s in steps if s.get("id") == "chart-decide"), None)
+ assert step is not None, "release.yml no longer has a `chart-decide` step to check"
+ return step["run"]
+
+
+def run_chart_decide(
+ *,
+ chart_version: str,
+ channel_chart_version: str = "",
+ channel_app_major: str = "",
+ incoming_app_major: str = "",
+ promote_stable: bool = False,
+) -> bool:
+ """Execute the workflow's own decision block; True when the channel moves."""
+ script = _chart_decide_script()
+ with tempfile.TemporaryDirectory() as tmp:
+ output = Path(tmp) / "gh-output"
+ output.touch()
+ env = {
+ **os.environ,
+ "CHART_VERSION": chart_version,
+ "PROMOTE_STABLE": "true" if promote_stable else "false",
+ "CHANNEL_CHART_VERSION": channel_chart_version,
+ "CHANNEL_APP_MAJOR": channel_app_major,
+ "INCOMING_APP_MAJOR": incoming_app_major,
+ "GITHUB_OUTPUT": str(output),
+ }
+ done = subprocess.run(["bash", "-c", script], env=env, capture_output=True, text=True)
+ assert done.returncode == 0, f"the workflow's chart-decide block failed: {done.stderr}"
+ body = output.read_text(encoding="utf-8")
+ moves = [line.split("=", 1)[1] for line in body.splitlines() if line.startswith("move=")]
+ assert len(moves) == 1, f"chart-decide emitted {len(moves)} move= lines: {body!r}"
+ return moves[0] == "true"
+
+
+def _app_major(app_version: str) -> str:
+ bare = app_version.lstrip("v")
+ return bare.split(".")[0] if bare else ""
+
+
+def run_chart_ladder(
+ releases: list[tuple[str, str]],
+ *,
+ start: tuple[str, str] = ("", ""),
+ promote_at: set[str] | None = None,
+ unreadable_incoming: set[str] | None = None,
+) -> dict[str, str]:
+ """Replay (chart version, app version) releases, carrying channel state.
+
+ Returns where the channel ends up on both version lines — the property a
+ single-release assertion cannot observe.
+ """
+ promote_at = promote_at or set()
+ unreadable_incoming = unreadable_incoming or set()
+ channel_chart, channel_app = start
+ for chart_version, app_version in releases:
+ incoming = "" if chart_version in unreadable_incoming else _app_major(app_version)
+ if run_chart_decide(
+ chart_version=chart_version,
+ channel_chart_version=channel_chart,
+ channel_app_major=channel_app,
+ incoming_app_major=incoming,
+ promote_stable=chart_version in promote_at,
+ ):
+ channel_chart, channel_app = chart_version, _app_major(app_version)
+ return {"chart": channel_chart, "app_major": channel_app}
+
+
+class TestChartStableDoesNotCrossAnAppMajorOnItsOwn:
+ def test_the_v20_crossing_replayed_is_refused(self) -> None:
+ """The exact defect: chart 7.9.0 is no chart major and shares chart
+ major 7 with the channel, but its appVersion crosses v19 -> v20."""
+ end = run_chart_ladder([("7.8.0", "v19.0.0"), ("7.9.0", "v20.0.0")])
+
+ assert end["chart"] == "7.8.0", (
+ f"the channel moved to {end['chart']}, carrying `--version stable` operators across "
+ "an application major with nobody deciding — the #1440 crossing again"
+ )
+
+ def test_it_stays_put_for_the_whole_of_the_new_app_major(self) -> None:
+ end = run_chart_ladder(
+ [("7.8.0", "v19.0.0"), ("7.9.0", "v20.0.0"), ("7.9.1", "v20.0.1"), ("7.10.0", "v20.1.0")],
+ )
+
+ assert end["chart"] == "7.8.0"
+ assert end["app_major"] == "19"
+
+ def test_a_deliberate_promotion_moves_it_and_the_ladder_resumes(self) -> None:
+ """The negative control: a guard that froze the channel forever would
+ pass the two tests above and make the channel useless."""
+ end = run_chart_ladder(
+ [("7.8.0", "v19.0.0"), ("7.9.0", "v20.0.0"), ("7.10.0", "v20.1.0")],
+ promote_at={"7.9.0"},
+ )
+
+ assert end["chart"] == "7.10.0", "the channel did not resume inside the promoted app major"
+ assert end["app_major"] == "20"
+
+ def test_the_positive_control_a_same_major_release_still_moves_it(self) -> None:
+ """Stuck-closed reads as working caution; a healthy ladder must flow."""
+ end = run_chart_ladder([("7.8.0", "v19.0.0"), ("7.8.1", "v19.0.1"), ("7.9.0", "v19.1.0")])
+
+ assert end["chart"] == "7.9.0"
+
+ def test_a_chart_major_is_still_refused_on_its_own_line(self) -> None:
+ """The original chart-major guard survives the appVersion addition."""
+ end = run_chart_ladder([("7.8.0", "v19.0.0"), ("8.0.0", "v19.1.0")])
+
+ assert end["chart"] == "7.8.0"
+
+ def test_a_first_ever_release_takes_the_channel(self) -> None:
+ """No `stable` tag yet is the ordinary first-release state, not a
+ different major."""
+ end = run_chart_ladder([("1.0.0", "v1.0.0"), ("1.1.0", "v1.1.0")])
+
+ assert end["chart"] == "1.1.0"
+
+ def test_an_unreadable_incoming_app_version_fails_closed(self) -> None:
+ """Refusing is recoverable (the next release moves the channel); a
+ wrong crossing is not."""
+ end = run_chart_ladder(
+ [("7.8.0", "v19.0.0"), ("7.8.1", "v19.0.1")],
+ unreadable_incoming={"7.8.1"},
+ )
+
+ assert end["chart"] == "7.8.0"
+
+ def test_but_not_before_the_first_promotion(self) -> None:
+ """An empty *channel* app major is first-release state: an unreadable
+ incoming appVersion must not brick the very first promotion."""
+ end = run_chart_ladder([("1.1.0", "v1.1.0")], unreadable_incoming={"1.1.0"})
+
+ assert end["chart"] == "1.1.0"
+
+ def test_promotion_overrides_an_unreadable_incoming_app_version(self) -> None:
+ """`promote_stable` is the human saying move it — it outranks every
+ guard, including the fail-closed one."""
+ end = run_chart_ladder(
+ [("7.8.0", "v19.0.0"), ("7.9.0", "v20.0.0")],
+ promote_at={"7.9.0"},
+ unreadable_incoming={"7.9.0"},
+ )
+
+ assert end["chart"] == "7.9.0"