Skip to content

Beautiful, AI-native markdown IDE and LLM wiki

Valve review: artifact-presence inventory (partial-matrix), pins, De Morgan note (#3189)

mike-inkeep170d3864a09d
diff --git a/.github/scripts/release-cascade-shape.test.mjs b/.github/scripts/release-cascade-shape.test.mjs
index f83d7bcc9..39a07375d 100644
--- a/.github/scripts/release-cascade-shape.test.mjs
+++ b/.github/scripts/release-cascade-shape.test.mjs
@@ -44,6 +44,32 @@ function stepNames(source) {
const indexOfStep = (names, needle) => names.findIndex((n) => n.includes(needle));
+/**
+ * Step-level `if:` conditions (8-space indent) with YAML block-scalar
+ * folding resolved: an `if: >-` yields its joined continuation lines, not
+ * the literal `>-` — which would sail through every `not.toContain` check.
+ */
+function stepLevelIfConditions(source) {
+ const lines = source.split('\n');
+ const out = [];
+ for (let i = 0; i < lines.length; i++) {
+ const m = /^ {8}if: (.+)$/.exec(lines[i]);
+ if (!m) continue;
+ let cond = m[1].trim();
+ if (/^[>|][+-]?$/.test(cond)) {
+ const cont = [];
+ for (let j = i + 1; j < lines.length; j++) {
+ const cm = /^ {10,}(\S.*)$/.exec(lines[j]);
+ if (!cm) break;
+ cont.push(cm[1].trim());
+ }
+ cond = cont.join(' ');
+ }
+ out.push(cond);
+ }
+ return out;
+}
+
describe('the stable gate is upstream of everything that ships', () => {
const names = stepNames(desktopRelease);
@@ -87,7 +113,7 @@ describe('the stable gate is upstream of everything that ships', () => {
desktopRelease.indexOf('- name: Smoke the packaged DMG'),
);
const shipping = afterGate.slice(0, afterGate.indexOf('- name: Alert on a blocked release'));
- const stepIfs = [...shipping.matchAll(/^ {8}if: (.+)$/gm)].map((m) => m[1].trim());
+ const stepIfs = stepLevelIfConditions(shipping);
expect(stepIfs.length).toBeGreaterThan(0);
for (const condition of stepIfs) {
expect(condition, `step-level if opts out of success(): ${condition}`).not.toContain(
@@ -111,9 +137,10 @@ describe('the stable gate is upstream of everything that ships', () => {
desktopRelease.indexOf('- name: Smoke the packaged DMG'),
);
const shipping = afterGate.slice(0, afterGate.indexOf('- name: Alert on a blocked release'));
- // Step-level ifs only (8-space indent) — job-level predicates are the
- // required-platforms valve, pinned exactly in the fan-in DAG describe.
- const conditions = [...shipping.matchAll(/^ {8}if: (.+)$/gm)].map((m) => m[1].trim());
+ // Step-level ifs only (8-space indent, folding resolved) — job-level
+ // predicates are the required-platforms valve, pinned in the fan-in
+ // DAG describe.
+ const conditions = stepLevelIfConditions(shipping);
// One condition in this span is a gate, not shipping: the smoke gate's
// own channel scope. Everything else ships and must be success()-gated.
const shippingConditions = conditions.filter(
@@ -208,13 +235,23 @@ describe('the fan-in publication DAG gates every platform', () => {
"needs.build-linux.result == 'success' || !contains(needs.prepare.outputs.required, 'linux')",
);
expect(pa).not.toContain("contains(needs.prepare.outputs.required, 'mac')");
+ // The valve is DEAD without !cancelled(): a non-required platform's
+ // failure would skip these jobs via the implicit all-needs-success
+ // default, blocking exactly the release the override exists to save.
+ expect(pa).toContain('!cancelled()');
const fin = desktopRelease.slice(
desktopRelease.indexOf('\n finalize:'),
desktopRelease.indexOf('\n alert:'),
);
+ expect(fin).toContain('!cancelled()');
expect(fin).toContain("needs.publish-assets.result == 'success'");
expect(fin).toContain("needs.build-macos.result == 'success'");
- expect(desktopRelease).toContain("must include 'mac'");
+ // Fail-CLOSED shape, not just message presence: the mac guard must be
+ // the ::error:: + exit 1 pair (a downgrade to ::warning:: or a dropped
+ // exit would leave mac silently droppable).
+ expect(desktopRelease).toMatch(
+ /::error::DESKTOP_RELEASE_REQUIRED_PLATFORMS must include 'mac'[^"]*"\s*\n\s*exit 1/,
+ );
});
test('the alert pages on a blocked RELEASE, not on any failed job', () => {
diff --git a/.github/workflows/desktop-release.yml b/.github/workflows/desktop-release.yml
index 006b60adc..cfd875f4f 100644
--- a/.github/workflows/desktop-release.yml
+++ b/.github/workflows/desktop-release.yml
@@ -272,6 +272,9 @@ jobs:
exit 1
fi
echo "required=$REQUIRED" >> "$GITHUB_OUTPUT"
+ # De Morgan, deliberately: "NOT (windows present AND linux present)"
+ # — the warning fires when EITHER platform is missing from the set.
+ # An `&&` here would warn only when BOTH are dropped.
if [[ "$REQUIRED" != *windows* || "$REQUIRED" != *linux* ]]; then
echo "::warning::DEGRADED RELEASE MODE: required platforms = ${REQUIRED}. A non-required platform's build failure will NOT block publication. Remove the DESKTOP_RELEASE_REQUIRED_PLATFORMS variable once the platform is fixed."
echo "### ⚠️ Degraded release mode: required = ${REQUIRED}" >> "$GITHUB_STEP_SUMMARY"
@@ -1292,11 +1295,6 @@ jobs:
CHANNEL: ${{ needs.prepare.outputs.channel }}
VERSION: ${{ needs.prepare.outputs.version }}
REQUIRED: ${{ needs.prepare.outputs.required }}
- # A platform's asset group joins the expected inventory when it is
- # required OR its build succeeded anyway (a healthy non-required
- # platform still ships).
- WINDOWS_BUILT: ${{ needs.build-windows.result == 'success' }}
- LINUX_BUILT: ${{ needs.build-linux.result == 'success' }}
steps:
- name: Download all platform release assets
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v5.0.0
@@ -1321,10 +1319,17 @@ jobs:
- name: Define the expected asset inventory
run: |
set -euo pipefail
- # Per-platform groups. mac is unconditional (always required); the
- # windows/linux groups join when the platform is required OR its
- # build succeeded anyway — so a degraded cut still ships every
- # healthy platform, and the no-extras check below stays exact.
+ # Two lists with different jobs:
+ # EXPECTED_ASSETS — the MUST-HAVE set: the full group for every
+ # REQUIRED platform. Missing any of these blocks publication.
+ # ALLOWED_ASSETS — the full known-name universe across ALL
+ # platforms. The no-extras check validates present files against
+ # THIS list, so a healthy non-required platform's assets (even a
+ # partial set from one surviving matrix cell — each Linux arch
+ # uploads independently under fail-fast: false) still ship,
+ # while a stray builder-debug.yml still fails. Anything a
+ # non-required job uploaded already passed that job's own
+ # app-update/package-type asserts.
{
echo "EXPECTED_ASSETS<<OK_INVENTORY_EOF"
echo "OpenKnowledge-arm64.dmg"
@@ -1332,12 +1337,12 @@ jobs:
echo "OpenKnowledge-${VERSION}-arm64-mac.zip"
echo "OpenKnowledge-${VERSION}-arm64-mac.zip.blockmap"
echo "${CHANNEL}-mac.yml"
- if [[ "$REQUIRED" == *windows* || "$WINDOWS_BUILT" == "true" ]]; then
+ if [[ "$REQUIRED" == *windows* ]]; then
echo "OpenKnowledge-Setup-x64.exe"
echo "OpenKnowledge-Setup-arm64.exe"
echo "${CHANNEL}.yml"
fi
- if [[ "$REQUIRED" == *linux* || "$LINUX_BUILT" == "true" ]]; then
+ if [[ "$REQUIRED" == *linux* ]]; then
echo "OpenKnowledge-amd64.deb"
echo "OpenKnowledge-arm64.deb"
echo "OpenKnowledge-x86_64.rpm"
@@ -1348,6 +1353,22 @@ jobs:
# GITHUB_ENV's multiline syntax REQUIRES the closing delimiter
# line — without it the runner rejects the whole env file.
echo "OK_INVENTORY_EOF"
+ echo "ALLOWED_ASSETS<<OK_ALLOWED_EOF"
+ echo "OpenKnowledge-arm64.dmg"
+ echo "OpenKnowledge-arm64.dmg.blockmap"
+ echo "OpenKnowledge-${VERSION}-arm64-mac.zip"
+ echo "OpenKnowledge-${VERSION}-arm64-mac.zip.blockmap"
+ echo "${CHANNEL}-mac.yml"
+ echo "OpenKnowledge-Setup-x64.exe"
+ echo "OpenKnowledge-Setup-arm64.exe"
+ echo "${CHANNEL}.yml"
+ echo "OpenKnowledge-amd64.deb"
+ echo "OpenKnowledge-arm64.deb"
+ echo "OpenKnowledge-x86_64.rpm"
+ echo "OpenKnowledge-aarch64.rpm"
+ echo "${CHANNEL}-linux.yml"
+ echo "${CHANNEL}-linux-arm64.yml"
+ echo "OK_ALLOWED_EOF"
} >> "$GITHUB_ENV"
- name: Assert the complete cross-platform inventory
@@ -1366,19 +1387,22 @@ jobs:
fi
# Unexpected extras are an error too: a stray builder-debug.yml or
# half-renamed artifact reaching the Release would be served to
- # real update clients.
+ # real update clients. Present files are validated against the
+ # ALLOWED universe (all platforms), not the required subset, so a
+ # healthy non-required platform's assets pass while junk fails.
+ mapfile -t allowed <<<"$ALLOWED_ASSETS"
for f in release-assets/*; do
base="$(basename "$f")"
found=0
- for e in "${expected[@]}"; do
+ for e in "${allowed[@]}"; do
[[ "$base" == "$e" ]] && found=1 && break
done
if [[ "$found" -eq 0 ]]; then
- echo "::error::Unexpected file staged for release upload: ${base}. Add it to the expected inventory or fix the packaging job's upload globs."
+ echo "::error::Unexpected file staged for release upload: ${base}. Add it to the known-asset universe or fix the packaging job's upload globs."
exit 1
fi
done
- echo "All ${#expected[@]} expected assets staged, no extras."
+ echo "All ${#expected[@]} required assets staged; every staged file is a known asset."
# Idempotent by construction: `--clobber` replaces same-named assets, so
# a retry after a partial upload converges instead of duplicating or