Skip to content

perf(install): a plain install's attestation serves the first install --frozen (#4770) - #5423

Merged
Daniel Meppiel (danielmeppiel) merged 6 commits into
mainfrom
danielmeppiel-perf-frozen-attest
Nov 25, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 6 commits into
mainfrom
danielmeppiel-perf-frozen-attest

Conversation

@danielmeppiel

@danielmeppiel Daniel Meppiel (danielmeppiel) commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

Agent assessment

Self-reported assessment, not an independent review.

Assessed revision: 7a88c66ad48d6b2e696ee50b0fb436c8f3141422

Dimension Assessment Rationale
Change confidence 8.5/10 ↑ Rebased on main f68cebd. #5447, #5442 and #5452 kept; the PR diff vs main is additive.
↑ S93 input-mutation oracle: 0 survivors in replay, attested and attested-frozen modes; both positive controls flagged on 8225ec6.
↑ CI green at this head (46 pass); Copilot reviewed it with 0 open threads.
↓ The W3d delta walk at this head was pending when assessed.
Performance gain 8/10 ↑ Linux t10 frozen no-op CPU p50 0.970 s (base 1.142), paired wall 0.895; t50 paired 0.768.
↑ Windows paired 0.789 (t10) and 0.665 (t50). Output "same" in every cell.
↓ Linux t10 wall is 1.058 s; main's no-op fixed cost rose since the 0.857 s pre-rebase run.
↓ Windows t10 is 1.43 s. CI runs never hit by design.

Description

The first apm install --frozen after apm install (a developer's install-then-frozen path; CI runs never record or hit by design, verdict_record._NO_HIT_ENV) never took the attested fast path, because the attestation key holds argv. It paid the full proof: Linux tree-10 p50 0.93-1.16 s, tree-50 2.05 s (runs 45547721768, 45547807435, at 4287880), against the #4770 bar of <= 1 s.

This lets a plain install's attestation serve the first install --frozen, under W3d's argv-class ruling (AF1-AF5):

  • AF1, keying. An attested record keys its argv and the run's effective frozen disposition, which its single reader (InstallService.frozen_disposition) notes. Both are bound by the record's MAC. The class is one-way: a frozen run accepts a plain or frozen attestation, and a plain run accepts only a plain one. Output records (replay) stay argv-exact.
  • AF2/AF3, frozen refusals. On a frozen hit, the frozen preflight owner (InstallService.enforce_frozen) and the lock-only edge walk (_refuse_unproven_edges) run live before any other attested gate. That's after the claude, policy and target refusals, and decide_only skips none of them. verdict_attest.FROZEN_OWNERS classifies every frozen-only owner (the frozen owner row's modules and every frozen method of InstallService) as live or implied, with a reason. A closed-world test fails on any new unclassified owner.
  • AF4, parity. The fast render runs the frozen preflight at the full run's point, so --frozen prints what the full frozen pipeline prints. The direct-MCP trust notice was missing on the frozen fast path before this; that gap pre-dated this PR and is fixed here.
  • AF5. A frozen hit records nothing, so the plain attestation keeps serving later --frozen runs.
  • Consent (Copilot). The fast path's frozen preflight is speculative (InstallRequest.frozen_preflight(speculative=True), a preview). It reads a legacy approvals.yml and never migrates it; the full install owns that write.
  • Parity (only-apm cell). A fast render that falls back now forgets the once-per-command trust notices it printed into dropped output, so the full run prints them. The frozen preflight runs in try_apply before planning for every frozen fast run.

Equivalence

A converged plain install committed lock L from manifest M. With byte-identical M, L, governed trees, approvals, config, policy cache and build, and every deployed file and package copy re-hashed no-follow (A7), install --frozen replays L. Its verdict differs from the plain verdict only by the frozen refusals. Those are re-judged live (enforce_frozen, edges, services) or fixed by the keyed inputs, as FROZEN_OWNERS records for each owner.

Issue and approved scope

Issue: Refs #4770

Human scope-approval comment: the #4770 install-performance scope (review contact Daniel Meppiel (@danielmeppiel)); argv-class change ordered by the PERF VP (2026-11-25 05:44 CET) and ruled by W3d (row w3d:ruling:argv-class, AF1-AF5).

Does this PR complete the issue, or what remains? #4770 closes once this and #5383 are on main and the frozen bar reads <= 1 s on both benches.

Type of change

  • Bug fix
  • New feature
  • Documentation
  • Maintenance / refactor

Testing

  • Tested locally (guarded: tests/integration/test_verdict_record.py -> 142 passed, 4 skipped; tests/integration/test_verdict_record_attested_world.py -> 11 passed; tests/unit/install/test_frozen*.py, test_service*.py, test_services*.py, test_fast_entry.py, test_diff_apply.py, test_architecture_invariants.py and tests/quality/test_quality_baselines.py pass; ruff, architecture linter, complexity ratchet, R0801, assertion-quality, tm006 and auth-signal checks clean)
  • All existing tests pass
  • Added tests for new functionality (if applicable)

Cells:

  • tests/integration/test_verdict_record.py: a plain attestation serves the first frozen; a frozen attestation never serves plain; a forged argv or disposition never serves; a changed manifest, lock, deployed byte or package copy misses for frozen (each with a positive control); every frozen-only owner is classified (closed world).
  • tests/integration/test_verdict_record.py also: a CI-implied frozen run accepts only a plain record; a frozen hit re-proves every declared edge from the lock.
  • tests/integration/test_verdict_record_attested_world.py (real CLI):
    • the first and second --frozen after install are attested hits that record nothing;
    • for converged (with a declared MCP server), manifest drift, lock-only edge, local dependency and after --only apm, --frozen prints, exits and leaves the lock exactly as the full frozen pipeline (APM_INSTALL_FAST_PATH=0) does;
    • the speculative preflight never migrates legacy consent;
    • an apm.yml MCP server the lock lacks is refused by the preflight before any fast decision.

Benches at 7a88c66 vs main f68cebd, RTT 30 ms, 3 runners x 5 pairs, output "same" in every cell:

install-frozen-noop tree-10 p50 wall / CPU tree-10 paired tree-50 p50 wall / CPU tree-50 paired
Linux 45626815760 1.058 s / 0.970 s (base 1.158 / 1.142) 0.895 2.059 s / 2.020 s (base 2.659) 0.768
Windows 45626830274 1.433 s / 1.406 s (base 1.832) 0.789 3.234 s / 3.141 s (base 4.877) 0.665

install-noop is unchanged on both OSes (paired 0.99-1.01). The Linux tree-10 CPU p50 meets #4770's <= 1 s bar. The Windows attested hit's fixed cost (~1.4 s at t10) is tracked as a follow-up.

S93 input-mutation oracle: 0 survivors at this head in replay, attested and attested-frozen modes on tree-10, tree-10-mcp and tree-10-claude-routed. The #5438 and #5434 positive controls are flagged on 8225ec6. Details: #5423 (comment).

Changelog

  • One fragment per section, changelog.d/5423.changed.md.
  • N/A -- internal-only change (CI, tests, refactor).

Spec conformance (OpenAPM v0.1)

  • N/A -- this PR does not change OpenAPM-observable behaviour.

Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 25, 2026
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@danielmeppiel
Daniel Meppiel (danielmeppiel) marked this pull request as ready for review November 25, 2026 05:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

A failed frozen preflight can suppress trust notices the user never saw, and valid-attestation regressions are missing for locked-edge and frozen-preflight refusals.

3 open issues
What changed in this PR

This PR extends the install attestation fast path so an unchanged apm install --frozen can reuse a prior plain install’s attestation. Existing CI environment exclusions still apply.

Changes:

  • Bind argv and effective frozen disposition to attestations, allowing one-way reuse by frozen installs.
  • Re-run frozen checks and render preflight notices without replacing the original attestation.
  • Add integrity, compatibility, and full-pipeline parity coverage.
File Description
tests/​integration/​test_verdict_record.py Tests attestation reuse, tampering rejection, and frozen-owner classification.
tests/​integration/​test_verdict_record_attested_world.py Checks repeated frozen hits and full-pipeline parity.
src/​apm_cli/​install/​verdict_write.py Records authenticated argv and frozen disposition.
src/​apm_cli/​install/​verdict_record.py Validates one-way attestation compatibility and tracks disposition.
src/​apm_cli/​install/​verdict_attest.py Runs frozen gates and preserves attestations after frozen hits.
src/​apm_cli/​install/​service.py Notes the effective frozen disposition through its existing owner.
src/​apm_cli/​install/​fast_output.py Adds frozen preflight notices to fast-path output.
src/​apm_cli/​install/​diff_apply.py Passes frozen disposition into attested gates.
changelog.d/​5423.changed.md Announces the install-to-frozen fast-path improvement.

Review effort: Balanced

Comment thread src/apm_cli/install/fast_output.py Resolved
Comment thread src/apm_cli/install/verdict_attest.py Resolved
Comment thread changelog.d/5423.changed.md Resolved

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The speculative preflight can delete legacy approval files and persist personal-consent grants before journaling begins, leaving changes that a later decline cannot roll back.

3 open issues
1 previously missed issue

In code that hasn't changed since last review

Medium severity Assert fast-path completion and unchanged attestations

tests/​integration/​test_verdict_record_attested_world.py:194

This test can pass even if both frozen runs fall back to the full pipeline: attested hit is emitted before the gates, and a fallback can rewrite the attestation without emitting recorded. Assert the terminal fast-path decision and unchanged attestation bytes and modification times after each frozen run to protect both the performance behavior and the no-write guarantee.

1 resolved since last review

Review effort: Balanced

Comment thread src/apm_cli/install/verdict_attest.py Resolved
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 25, 2026
…; pin both frozen gates

Copilot #5423 round 1:
- enforce_frozen's MCP admission migrated a legacy approvals.yml into
  config.json; the fast path's preflight runs before its journal (and under
  decide), so that write could not roll back. A speculative request
  (InstallRequest.frozen_preflight(speculative=True), a preview) reads legacy
  consent and never migrates it; the full install keeps the migration.
  Cell red on 5b83654.
- Cells that fail when either frozen gate is removed (mutation-checked): the
  attested gates decline a frozen hit whose declared edge the lock lacks
  (positive control: plain, and a satisfiable edge); an MCP server apm.yml
  declares but the lock lacks is refused by the preflight before any fast
  decision (decide mode stops before the render).
- The release note is scoped to non-CI runs: CI / GITHUB_ACTIONS never record
  or hit (verdict_record._NO_HIT_ENV).

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

The attested path bypasses the verifier, so its owner classification incorrectly marks it as live rather than implied by the marketplace-edge decline in _refuse_unproven_edges.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Medium severity Attested hits incorrectly classify the verifier as live

src/​apm_cli/​install/​verdict_attest.py:146

This verifier is not called by enforce_frozen: its only call is in InstallService.run at service.py:336, which the attested path bypasses. The owner classification therefore incorrectly labels it as live on a hit. Classify it as implied by the marketplace-edge decline in _refuse_unproven_edges.

3 resolved since last review

Review effort: Balanced

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Two critical issues remain: full frozen installs fail on an unsupported install_mcp keyword, and the missing frozen_mcp_drift owner classification causes the new coverage test to fail.

2 open issues

Review effort: Balanced

Comment thread src/apm_cli/install/request.py Resolved
Comment thread src/apm_cli/install/verdict_attest.py Resolved
… --frozen (#4770)

The first apm install --frozen after apm install never took the attested
fast path (the key held argv), so CI's install-then-frozen path paid the full
proof (t10 0.93-1.16 s, t50 2.05 s). W3d ruling (argv-class, AF1-AF5):
- AF1: an attested record keys its argv and the run's effective frozen
  disposition (noted by InstallService.frozen_disposition, its single reader),
  MAC-bound. One-way: a frozen run accepts a plain or frozen attestation; a
  plain run only a plain one. Output replay stays argv-exact.
- AF2/AF3: on a frozen hit the frozen preflight owner (enforce_frozen) and the
  lock-only edge walk run live before any other gate; FROZEN_OWNERS classifies
  every frozen-only owner live or implied, closed by a test.
- AF4: the fast render runs the frozen preflight at the full run's point, so
  --frozen prints what the full frozen pipeline prints (the direct-MCP trust
  notice was missing on the frozen fast path; pre-existing, fixed here).
- AF5: a frozen hit records nothing, so the plain attestation keeps serving.
Red-first on ddd81de: plain attestation -> frozen hit, the changed-input
controls and the closed-world cell fail; the converged frozen differential
fails on the missing trust notice.

apm-spec-waiver: install fast-path keying is local verdict state, outside the OpenAPM spec

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
… before any fast decision

W3d R1: the full install and the fast path's frozen hit build the preflight
request through one builder (InstallRequest.frozen_preflight), with
allow_pending_mcp explicit at each call.
W3d R2 cells: a converged frozen hit answers with its declared MCP gate live;
after install --only apm (argv-exact, never served) --frozen is no hit and
answers as the full pipeline; a CI-implied frozen run with argv [install]
accepts a plain record and never a [install, --frozen]-keyed one.
The 'only apm' differential exposed a parity bug: when a fast render fails
and falls back, a once-per-command trust notice it printed into the dropped
output was never shown by the full run. held_output now forgets notices shown
into output it drops (mcp_config_view owns the set). The frozen preflight
owner now runs in try_apply before planning for every frozen fast run, so a
frozen refusal declines before any decision.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
…; pin both frozen gates

Copilot #5423 round 1:
- enforce_frozen's MCP admission migrated a legacy approvals.yml into
  config.json; the fast path's preflight runs before its journal (and under
  decide), so that write could not roll back. A speculative request
  (InstallRequest.frozen_preflight(speculative=True), a preview) reads legacy
  consent and never migrates it; the full install keeps the migration.
  Cell red on 5b83654.
- Cells that fail when either frozen gate is removed (mutation-checked): the
  attested gates decline a frozen hit whose declared edge the lock lacks
  (positive control: plain, and a satisfiable edge); an MCP server apm.yml
  declares but the lock lacks is refused by the preflight before any fast
  decision (decide mode stops before the render).
- The release note is scoped to non-CI runs: CI / GITHUB_ACTIONS never record
  or hit (verdict_record._NO_HIT_ENV).

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
…install_mcp; classify frozen_mcp_drift

main added install_mcp to the full install's frozen preflight request (skills-only
MCP omissions) and moved the frozen MCP drift reasons into frozen_mcp_drift. The
one builder (InstallRequest.frozen_preflight) now carries install_mcp, and the
closed-world FROZEN_OWNERS classifies frozen_mcp_drift as live (it runs inside
enforce_frozen).

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The lockfile assertion compares two current reads rather than a pre-gate snapshot, so it cannot detect gate-induced writes and leaves the frozen no-write invariant unchecked.

1 open issue
2 resolved since last review

Review effort: Balanced

…e-gate snapshot (Copilot)

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Security-sensitive attestation reuse skips frozen planning and assumes authenticated state covers frozen-only checks, requiring independent equivalence and exact-head CLI parity validation plus QL sign-off.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

Copy link
Copy Markdown
Collaborator Author

S93 input-mutation oracle (CI, research harness perf-research/oracle-v5)

The oracle traces every file, directory, absent-path probe and environment variable that a full (fast path off) install reads. It then mutates each one in a converged world and runs the fast path. A fast answer on a mutated input counts as a finding when the full pipeline, run on the same mutated state, exits differently, prints different output or writes anything. Modes: replay (output record, install), attested (fresh attested record, install), attested-frozen (a plain attestation, then install --frozen, the path this PR opens). New fixture: tree-10-claude-routed, a Claude target whose packages ship an always-on instruction, so the carrier logic in #5434 is in play.

Positive controls, on 8225ec6 (before #5447 and #5442): both FLAGGED.

This PR at 7a88c66 (run 45626787329): 0 survivors.

fixture replay attested attested-frozen
tree-10 0 (19 hit / 194 miss) 0 (3 / 210) 0 (3 / 222)
tree-10-mcp 0 (19 / 194) 0 (3 / 210) 0 (3 / 222)
tree-10-claude-routed never served (#5447) 0 (6 / 194) 0 (6 / 217)
tree-10-policy never served never served never served

Every attested-frozen hit printed, exited and wrote exactly what the full frozen pipeline did. The hits were a new root AGENTS.md or CLAUDE.md (no Claude target, or the Claude refusal declined after the record matched) and one test-only environment hook.

Control, main f68cebd (run 45625193194, run 45625620508): 0 findings. On main, --frozen is never served (attested miss (inputs changed: argv)), so the frozen cells above cover only the surface this PR adds.

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