chore: one-liner cap 8 MiB, review at 3 MiB

The SHA-256 pin already refuses any changed byte: the cap in install.sh
and install.ps1 only stops a sign-in portal's page before it is hashed,
so it can be generous. The size test now fails once install.py passes
3 MiB, so its growth is looked at, and checks both bootstraps accept the
same 8 MiB. The separate size test of the earlier commit is folded into
the one test_install.py already had.
This commit is contained in:
Abdessamad Derraz committed 2026-11-09 07:10:22 +01:00
1 parent faa5ca89d0
commit 8518205be1
4 files changed
+22 -65

No files matched your search

+16 -10
View File
@@ -4799,9 +4799,13 @@ class TheBoardSystemsAreNamedFromTheCode(unittest.TestCase):
class TheInstallerFitsTheOneLiners(unittest.TestCase):
"""install.sh and install.ps1 refuse an installer over 2 MiB, and
install.py grew from 596 KB to 1.1 MB in twelve days with nothing
holding it under that: past it, every one-line install would stop."""
"""install.sh and install.ps1 refuse an installer over their cap, 8 MiB:
the SHA-256 pin refuses any changed byte, and the cap only stops a page
served in its place. install.py grew from 596 KB to 1.1 MB in twelve
days: past REVIEW_BYTES its growth is looked at before it goes on."""
# The size past which install.py's growth is reviewed, well below the cap.
REVIEW_BYTES = 3 * 1024 ** 2
def _caps(self) -> dict[str, int]:
import re
@@ -4813,14 +4817,16 @@ class TheInstallerFitsTheOneLiners(unittest.TestCase):
return {"install.sh": int(re.search(r"^MAX_INSTALLER_BYTES=(\d+)$", shell, re.M)[1]),
"install.ps1": int(number) * units[unit or ""]}
def test_a_quarter_of_each_cap_stays_free(self):
def test_both_one_liners_accept_the_same_size(self):
self.assertEqual(set(self._caps().values()), {8 * 1024 ** 2})
def test_install_py_stays_below_the_review_size(self):
size = (REPO_ROOT / "install.py").stat().st_size
for script, cap in self._caps().items():
with self.subTest(script=script):
self.assertLessEqual(
size, cap * 3 // 4,
f"install.py is {size} bytes, past three quarters of the {cap} {script} "
"accepts: shrink it or raise the cap in both one-liners")
self.assertLess(self.REVIEW_BYTES, min(self._caps().values()))
self.assertLess(
size, self.REVIEW_BYTES,
f"install.py is {size} bytes, past the {self.REVIEW_BYTES} that call for a "
"look at its growth: shrink it, or raise REVIEW_BYTES once reviewed")
def test_the_refusal_names_a_cause_and_a_way_out(self):
for script in ("install.sh", "install.ps1"):