portfolio-optimiser/scripts/make-handover-package.sh
Kjell Tore Guttormsen 605c02aa62 feat(5): overleveringspakka er KUN kjørbar Python — container-innpakningen fjernet
Operatørdirektiv 14.08 etter ekstern test: mottakeren skal få kjørbar Python, ikke en
Docker-innpakking. `Dockerfile` og `azure.yaml` er SLETTET fra treet.

Sømmen er valgt av den eksisterende invarianten, ikke av smak: pakka ER `git archive HEAD`,
så å ekskludere filene fra arkivet ville krevd en kurerings-mekanisme — den andre kopien av
«hva mottakeren får», fri til å drifte fra HEAD (kø-(p)). Fjerning holder arkivet ukurert og
gjør fraværet til en egenskap ved HEAD, som er det eneste en gate kan måle.

De to gatene som pinnet flaten er håndtert bevisst:
- 4e-rå-tekst-gaten (`--platform linux/amd64` + ÉN kopi av startkommandoen) er SLETTET, med
  et notat der den sto. En gate som pinner en fjernet flate kan bare bli grønn.
- handover-gatens `_REQUIRED_MEMBERS` er ikke bare fratatt de to navnene, men erstattet av en
  POSITIV fraværs-assert pluss en dokument-gate. Å kun slutte å KREVE dem ville gitt en gate
  som ikke kan skille «fjernet» fra «shippes fortsatt».

Startkommandoen har nå ÉN kopi igjen: DEPLOY.md-ens `python main.py`, som navngir inngangen
subprosess-testen faktisk kjører.
2026-08-14 14:09:35 +02:00

35 lines
1.7 KiB
Bash
Executable file

#!/usr/bin/env bash
# Build the external handover package (Fase 5): one archive a receiver deploys into their own
# Microsoft Foundry, without cloning this repository or having an account on our Forgejo.
#
# The archive is git's view of HEAD -- TRACKED FILES ONLY. That is deliberate and it is the whole
# exposure control: STATE.md is gitignored, *.local.md is gitignored, .env is gitignored, so they
# cannot enter the archive. A filter maintained here would be a second copy of that rule, and the
# second copy is the one that drifts (kø-(p)).
#
# What the receiver gets is therefore HEAD itself -- never a hand-curated selection. That also
# decided how the 14.08 directive ("runnable Python, no container wrapper") was carried out: the
# Dockerfile and azure.yaml were removed from the TREE, not filtered out here. A filter would have
# been a curation step deciding what a receiver sees, i.e. exactly the second copy this comment
# exists to forbid. Absence is asserted in tests/test_handover_package_loadbearing.py.
#
# Usage: scripts/make-handover-package.sh [dest-dir] (default: dist/)
# Gated by tests/test_handover_package_loadbearing.py.
set -euo pipefail
DEST="${1:-dist}"
mkdir -p "$DEST"
# Version from pyproject.toml -- the one place the build stamps it. Read, never hardcoded: a second
# copy here would go stale at the next bump exactly like the README wheel filename did (Fase 3).
VERSION=$(grep -m1 '^version = ' pyproject.toml | cut -d'"' -f2)
if [ -z "$VERSION" ]; then
echo "make-handover-package: could not read version from pyproject.toml" >&2
exit 1
fi
OUT="$DEST/portfolio-optimiser-foundry-$VERSION.zip"
git archive --format=zip --output "$OUT" HEAD
echo "$OUT"