Repository navigation
perf(install): a fresh clone with a lockfile takes the full pipeline - #5414
Daniel Meppiel (danielmeppiel) wants to merge 5 commits into
Conversation
With no deployment receipts (a fresh checkout), the diff-apply fast path stages, re-verifies and commits the whole project, which costs more than the full pipeline (locked-warm t50 upper bound: W 0.885, L 0.919 paired). Decline before staging; the full pipeline is the reference behavior. Converged, incremental and no-op installs (receipts present) keep the fast path. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…peline, writing nothing first (W3d FC1, FC3) Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…rmalize receipt names in twin output Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the fresh-clone installation routing change.
No open issues 🎉
What changed in this PR
This PR routes locked installs without bound deployment receipts through APM's full install pipeline, avoiding whole-project staging costs on fresh clones while preserving the fast path for existing installations.
Changes:
- Decline the diff-apply path when receipts are absent and files or packages need deployment.
- Add clone scenarios covering pipeline selection, parity, and write-free fallback.
- Document the routing change and add a changelog entry.
| File | Description |
|---|---|
tests/lifecycle/scenarios/test_engine_parity.py |
Adds full-pipeline assertions for clones without bound receipts. |
tests/lifecycle/scenarios/_engine_parity.py |
Adds clone fixtures, decline cases, and receipt-path normalization. |
src/apm_cli/install/diff_apply.py |
Falls back before staging when deployment receipts are absent. |
docs/src/content/docs/reference/environment-variables.md |
Explains fresh-clone routing in the fast-path setting documentation. |
changelog.d/5414.fixed.md |
Records the fresh-clone install performance improvement. |
Review effort: Balanced
|
Closing: measured counterproductive on current main.
The motivating upper bound (fast path deleted: locked-warm W 0.885 / L 0.919) was measured on an older stack (e62f520). Since then, main's diff-apply engine has become far cheaper than the full pipeline for a whole-project diff, so routing fresh clones to the full pipeline is now a regression. The lifecycle cells and the differential (identical lockfile and project bytes for fast vs full) stay useful evidence for the v0.40 design doc. No re-scope is needed. |
Description
A fresh clone that commits its
apm.lock.yaml, installed on a machine with a warm cache, took the diff-apply fast path. That path staged, re-verified and committed the whole project (applied a verified diff (667 files)on tree-50). For a whole-project diff that costs more than the full pipeline.This PR declines to the full pipeline when the checkout has no bound deployment receipts (no
.apm-local/installationbound to a receipt file), right after_plan_files/_outcomesand before the policy/audit re-checks and_stage_all. Nothing has been written at that point, so the existingDeclinehand-off applies. Converged, incremental and no-op installs keep the fast path because their receipts are present. The existingwarm-lockedparity cell still expects the diff decision.This is routing only: the full pipeline is the reference path that every no-lockfile install already takes. What the fast path accepts and every check either path makes are unchanged. W3d design: OK with conditions FC1-FC3 (row
w3d:ruling:fresh-locked), addressed below.Measured upper bound (fast path deleted, plain stack, t50, 6 pairs, anon): install-locked-warm paired W 0.885 / L 0.919 (runs 45513481474 / 45513512058). Gate benches for this head vs main 1e4a208 are in the validation section.
Issue and approved scope
Issue: Refs #4939
Human scope-approval comment: none yet for this item. Ordered by the PERF lead chain under #4939 (locked-warm regression, VP-approved shape "no receipts -> full pipeline").
This does not complete #4939.
Type of change
Testing
Local runs (macOS, host_guard,
APM_BINARY_PATH=.venv/bin/apm):pytest tests/lifecycle/scenarios/test_engine_parity.py::test_a_clone_without_bound_receipts_takes_the_full_pipeline: 2 passed (clone-with-lock,clone-copied-identity). These cells check twin parity of exit code, output and full state, plus decision FULL.clone-with-lockcell withdiff_apply.pyreverted to main: FAILED withexpected a full decision, got 'applied a verified diff (2 files)'. That proves the cell catches a regression. Twin state parity held before the decision assert, so on main the fast and full results are identical for this shape.test_engine_parity_invariants.py::test_declined_fast_path_writes_nothing[clone-with-lock|clone-copied-identity]: passed. The engine decides FULL and writes nothing before the hand-off (W3d FC1, FC3).test_engine_parity.py::test_warm_locked_install_applies_the_diff: passed, so the fast path is still used when receipts are present.ruff check/ruff format --check(ruff 0.15.12) on changed files: clean.W3d FC2 (byte-identical differential of lockfile, receipts and project, L + W): CI run in flight, result to be added below.
Changelog
changelog.d/<pr>.<section>.md, holdingone line: user-visible effect first, 25 words or fewer, ending with
(#PR); breaking changes only under upgrade notes; no Highlights; nonew lines under
## [Unreleased]. Seechangelog.d/README.mdand.github/instructions/changelog.instructions.md.Spec conformance (OpenAPM v0.1)