Repository navigation
fix(install): verify local content in frozen mode - #3236
Wu Shuwen (dajiaohuang) wants to merge 13 commits into
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Verification misses unlocked local dependencies and symlink changes while incorrectly rejecting tolerated orphan entries.
4 open findings
What changed in this PR
Addresses #3194 by recording local-package source hashes and checking them before frozen-install deployment.
Changes:
- Records and verifies local source-content hashes.
- Adds lifecycle coverage for replay, content changes, and restoration.
- Documents frozen-mode checks and legacy-lock behavior.
| File | Description |
|---|---|
| tests/integration/test_frozen_local_path_lifecycle.py | Adds frozen local-package lifecycle coverage. |
| src/apm_cli/install/sources.py | Records local source-tree hashes. |
| src/apm_cli/install/service.py | Adds preflight local-content verification. |
| packages/apm-guide/.apm/skills/apm-usage/commands.md | Updates bundled install guidance. |
| docs/src/content/docs/reference/cli/install.md | Documents local-content and legacy-lock checks. |
🧠 Review effort: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Preserve current upstream behavior and README link corrections before scoped validation. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a
Address Copilot and panel findings on microsoft#3236 for accepted scope microsoft#3194. Require lock evidence through structural satisfaction, validate only reachable local declarations using existing anchored identity, and hash the contained dereferenced local-copy image before transforms. Add independent direct/transitive lifecycle regressions, legacy and orphan cases, and mutation-tested recording evidence without changing the global hashing policy. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a
APM Review Panel:
|
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a
Record the accepted behavior as a pending normative amendment, with real CLI refusal and recovery evidence. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a # Conflicts: # docs/src/content/docs/specs/openapm-v0.1.md
Only five existing local content_hash fields are added. Independent snapshots preserve 3083 tracked and managed files and all other lock semantics; root audit passes all ten checks. Fold the four-panel proposed amendment clarifications without claiming specification adoption. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a
Preserve upstream Copilot marketplace, unmatched-selection preservation, and SSH/cache changes. Resolve documentation overlap without changing the reviewed frozen-local implementation; retain proposed req-mf-022 revision 0.1.47 and label req-lk-023 as proposed 0.1.48. Canonical combined-tree audit confirms all five local hashes still match, so no lock refresh or managed-file regeneration is needed. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a
Preserve microsoft#3148 user-scope containment and conformance while retaining the proposed frozen-local amendment. No feature reimplementation or hash policy change. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a
Preserve microsoft#3190 concrete local target provenance, shared claims and conservative historical preservation. Resolve only the adjacent frozen/dry-run documentation rows; retain proposed req-lk-023 and current conformance contributions. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a


Description
Normal installs record the existing content hash from the validated, dereferenced local-copy image before integration transforms. Frozen installs compare each selected direct or transitive local dependency against its existing lock evidence before lifecycle/pipeline work. Changed, added, or removed content and missing or legacy baseline evidence are refused without replacing managed content or rewriting the lockfile. Unchanged replay and ordinary non-frozen local development remain supported.
The bounded CI recovery adds proposed
req-lk-023, four real-CLI conformance cases, and five direct-localcontent_hashfields. The latest-main continuation required no re-seeding: all five hashes still match their canonical validated-copy images. The candidate root audit passes all 10 checks, preserving 3,099 tracked files and all 288 recorded managed paths, including file/directory modes and exact lock bytes. The actual latest-main combined-tree audit also passes without mutations. Every other lock semantic value equals integrated main; no broad root regeneration was run.Important
The specification change is proposed 0.1.48, not adopted; main's separate 0.1.47 amendment is preserved. Product-scope acceptance and automated review do not establish Section 9.3 qualified non-author approvals or the ensuing comment period. This assignment requires genuine human adoption evidence; applicable Section 9.2/9.5 obligations also remain. Cross-implementation local-hash canonicalization remains reserved for v0.2.
Issue and approved scope
Issue: #3194
Human scope-approval comment: #3194 (comment)
This PR implements the accepted scope, including explicit missing-baseline handling and real APMLifecycle regression evidence. It does not request merge approval or change the hash algorithm, lockfile format, or the project's own
.apm/deployment behavior.Type of change
Testing
Exact locally tested head:
fc5241d155bb8b9d80b02649ffe8732fce8f4075; integrated base:bd672981210f7751381d88eba4d9d9354d2a44ea. All six exact-head technical workflows passed: CI, Merge Gate, CodeQL, Docs, Spec, and NOTICE. This does not claim a complete local test-suite run.Latest main
6333b56a3c2e11e20d87f6f55070c4a06669d06dwas strictly merged into a non-committed preview and actually root-audited; all five canonical hashes and tracked/managed bytes and modes remained unchanged. Regenerated conformance stayed stable at 130 requirements. The preview was aborted to preserve the tested candidate; it is not claimed as the locally tested base. CodeQL uploads cover mergefaa14ea217cce30ea5d2f2f370502d698fef5e27(parents: testedbd672981and this published head), with no errors, warnings, or results. They do not prove that newer main6333b56awas scanned. No empty commit or scan-chasing push was made.Executed local commands and results
The YAML-I/O, 2,100-line, and portable-relative-path guards also passed. Fresh deterministic owner detection covers two canonical owners, with version-2 functional evidence bound to the exact head.
Scenario evidence and how to test
test_frozen_local_path_refuses_changed_snapshot_without_mutationcovers direct/transitive content changes, cold/existing consumers, unchanged replay, and recovery (secure-by-default).test_frozen_local_requires_selected_lock_evidencecovers missing entries and legacy baselines; the orphan and symlink-retarget cases protect selected-graph and materialization semantics (secure-by-default).test_frozen_local_content_preserves_prior_evidencecovers direct/transitive changed content and legacy baselines through the real CLI, including exact filesystem snapshots and restoration (secure-by-default).Historical mutation proof (not rerun in this continuation; all eight scoped source/test blobs are unchanged from
cd4cc0d): all four new conformance cases failed with the verifier/baseline guards removed, then passed after restoration. Earlier targeted mutations produced 7, 2, and 3 expected failures for the original production guards.The latest main integration preserves concrete local target provenance, shared sibling claims, conservative preservation of ambiguous historical/bundle paths, and the dry-run stale-cleanup caveat. No blanket historical deletion is authorized.
Trade-offs: missing-baseline legacy frozen installs now fail explicitly; review sources and use a normal install to establish trusted evidence. Verification uses the existing validated-copy/hash owners rather than changing the global hash policy or substituting transformed deployed-file hashes.
Spec conformance (OpenAPM v0.1)
If this PR changes behaviour that an OpenAPM v0.1
req-XXXcovers,confirm the three-step ritual in the
development guide:
docs/src/content/docs/specs/openapm-v0.1.mdupdated(new/changed
<a id="req-XXX"></a>anchor + prose + Appendix Crow).
docs/src/content/docs/specs/manifests/openapm-v0.1.requirements.ymlupdated.
The repository's current canonical manifest location is
docs/public/specs/manifests/openapm-v0.1.requirements.yml; that is the file updated here.@pytest.mark.req("req-XXX")test undertests/spec_conformance/added or extended.CONFORMANCE.{md,json}regenerated viauv run --extra dev python -m tests.spec_conformance.gen_statementand committed.
Requirement: proposed
req-lk-023. The genuine prior review by four spec-guardian reviewers plus the synthesizer returned an average 8.0/10 with no blocking findings. In-scope folds are implemented, including the runtime test index; the proposed-status annotation preserves the canonical Appendix C parser grammar. No internal-refactor or N/A waiver is used.The prior CEO stance remains ship_with_followups, not a new panel approval of this integration. Section 9.3 still lacks a spec-labeled issue, qualifying amendment approvals, and the ensuing 14-day period. A proposed draft merge is not itself a claim of adoption, but the stated sequence supplies no explicit early-merge exception. A maintainer must decide the non-adopting integration interpretation or complete that sequence; technical success is not ratification, platform admission, or merge permission.
Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com