Skip to content

ci(deps): guard install footprint — dependency denylist + +5% size ratchet#435

Open
sammy-vastai wants to merge 2 commits into
masterfrom
ci/footprint-budget
Open

ci(deps): guard install footprint — dependency denylist + +5% size ratchet#435
sammy-vastai wants to merge 2 commits into
masterfrom
ci/footprint-budget

Conversation

@sammy-vastai

Copy link
Copy Markdown
Contributor

Two CI guards so the install footprint can't quietly balloon again the way transformers added ~138 MiB via #424.

Stacked on #434 (chore/drop-unused-transformers-dep) — it must baseline the post-transformers slim closure, so it targets that branch. Rebase to master once #434 merges.

Layer 1 — dependency-closure denylist (tests/test_dependency_budget.py)

Parses poetry.lock (the full transitive closure — where the weight hides) and fails if any heavy ML/scientific package re-enters: transformers, tokenizers, numpy, torch, nltk, … No install, deterministic, platform-agnostic, runs in the existing pytest suite. This is the one that directly catches a repeat of #424.

Layer 2 — installed-footprint +5% ratchet (installer-ci.ymlfootprint-budget job)

Hermetic uv install of this PR's wheel on one canonical platform (linux x86_64), measures site-packages, and fails if it grew >5% over the committed baseline in tests/installer/footprint_baseline.env. On a real increase the dev either slims the PR or bumps the baseline deliberately — that one-line diff is the record that the growth was intentional. The job prints footprint / baseline / delta% / ceiling so re-baselining is trivial.

Backstop for the case Layer 1 misses: an existing dep ballooning without a new package name appearing.

Baseline

FOOTPRINT_BASELINE_BYTES=133476211 (~127 MiB), measured from a clean install of the slim closure (was ~276 MiB with the transformers cluster).

Validation

  • Layer 1: pytest test_dependency_budget.pypasses (and would fail if any FORBIDDEN name were present).
  • Layer 2: dry-ran the ratchet math against a real clean install → footprint: 127 MiB | baseline: 127 MiB | delta: 0% | ceiling(+5%): 133 MiB | WOULD PASS.
  • Added poetry.lock to the installer-ci trigger paths so lock-only dep changes are gated too.

Why measure site-packages (not all of ~/.vastai): the managed CPython + uv (~75% of the install) are fixed runtime that change on a Python-pin bump, not on a PR's deps — including them would add noise the 5% gate would trip on falsely.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds CI and test-suite guards to prevent the CLI’s Python dependency closure (and resulting install size) from regressing back toward heavyweight ML/scientific stacks.

Changes:

  • Introduces a transitive-dependency denylist test that parses poetry.lock and fails if forbidden heavy packages re-enter.
  • Adds an installer CI job that installs this PR’s wheel on Linux and enforces a “+5% max” site-packages footprint ratchet against a committed baseline.
  • Expands the installer workflow trigger paths to include poetry.lock changes.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
tests/test_dependency_budget.py New lockfile-parsing test to block forbidden heavy deps from re-entering the resolved closure.
tests/installer/footprint_baseline.env Adds the committed size baseline used by the footprint ratchet job.
.github/workflows/installer-ci.yml Adds a footprint-budget job and ensures lockfile-only changes trigger the installer CI workflow.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +42 to +48
def test_no_heavy_deps_in_closure():
intruders = sorted(_closure_names() & FORBIDDEN)
assert not intruders, (
f"heavy dependency re-entered the CLI closure: {intruders}. "
"A CLI should not pull an ML/scientific stack — slim the change, or if "
"this is genuinely required, remove it from FORBIDDEN with justification."
)
Comment thread tests/test_dependency_budget.py Outdated
Comment on lines +38 to +39
data = tomllib.loads(LOCK.read_text())
return {pkg["name"].lower() for pkg in data["package"]}
Comment on lines +93 to +101
run: |
. tests/installer/footprint_baseline.env
export PATH="$HOME/.local/bin:$PATH"
uv venv /tmp/fp --python 3.12 --quiet
uv pip install --python /tmp/fp/bin/python --quiet dist/vastai-*.whl
SITE="$(find /tmp/fp/lib -type d -name site-packages)"
BYTES="$(du -sb "$SITE" | cut -f1)"
CEIL=$(( FOOTPRINT_BASELINE_BYTES * 105 / 100 ))
PCT=$(( (BYTES - FOOTPRINT_BASELINE_BYTES) * 100 / FOOTPRINT_BASELINE_BYTES ))
Comment thread .github/workflows/installer-ci.yml Outdated
Comment on lines +90 to +91
- name: install uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh
@sammy-vastai sammy-vastai force-pushed the ci/footprint-budget branch from 573b61c to 1b5e220 Compare June 23, 2026 21:43
@sammy-vastai sammy-vastai changed the base branch from chore/drop-unused-transformers-dep to master June 23, 2026 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants