Skip to content

fix(policy): judge the declared constraint, accept package release tags (supersedes #3381) - #3652

Merged
Daniel Meppiel (danielmeppiel) merged 6 commits into
mainfrom
lanef/supersede-3381
Nov 12, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 6 commits into
mainfrom
lanef/supersede-3381

Conversation

@danielmeppiel

Copy link
Copy Markdown
Collaborator

Description

fix(policy): judge the declared constraint, accept package release tags

Note

Rebuilt from #3381 by Kaustubh Arora (@Kaustubh1235) to ship in 0.36.0; original authorship credited via Co-authored-by on every commit. The contributor's CLA stayed pending for 6+ days, so the converged diff of #3381 (head 903968e) was re-applied onto current main as new commits. Supersedes #3381.

TL;DR

require_pinned_constraint now judges the constraint the author declared in apm.yml, not the tag the resolver selected, and it recognises a package's own release tags (pkg-a-v1.2.3, pkg-a--v1.2.3). A bounded range such as pkg-a#^1.0.0 therefore passes on fresh install, locked reinstall, update and audit alike, while branches, wildcards, open-upper ranges, missing refs and other packages' tags still fail.

Problem (WHY)

Approach (WHAT)

Concern Change
Declared vs resolved InstallContext.declared_direct_refs snapshots every manifest ref per direct dep before resolution; policy_gate and policy_target_check pass it to the check
Every declaration counts collect_declared_refs keeps all refs per unique key (including None); each is classified, so one bounded declaration never covers an unbounded one
Package release tags {name}-v{version} / {name}--v{version} count as pinned only for the dependency's own name, via the resolver's DEFAULT_TAG_PATTERNS, build_tag_regex and git_semver_package_name
Single owner ref_reuse.git_semver_package_name (was private) is the only package-name rule; a static architecture check forbids re-deriving it under policy/

Implementation (HOW)

File Change
src/apm_cli/policy/_constraint_pinning.py collect_declared_refs, _is_package_literal_tag, declared_ref= on classify_unbounded_reason, ref= on humanize_reason
src/apm_cli/policy/policy_checks.py _check_pinned_constraints / run_dependency_policy_checks accept declared_refs and classify each declaration
src/apm_cli/install/{context,pipeline}.py Snapshot declared refs at InstallContext construction
src/apm_cli/install/phases/policy_gate.py, policy_target_check.py Forward declared_refs
src/apm_cli/install/helpers/ref_reuse.py _git_semver_package_name -> public git_semver_package_name
src/apm_cli/policy/_help_text.py Help text names the package-qualified form and the declared-constraint rule
scripts/architecture_linter/checks/transport_network_and_runtime.py Owner-routing guard for the package-name rule
docs + packages/apm-guide + CHANGELOG.md Bounded-choice rule; corrects two places that claimed transitive coverage (direct-only since #1494)

Diagram

Where the policy check reads its input before and after this change.

flowchart LR
    M[apm.yml declared refs] --> S[collect_declared_refs snapshot]
    M --> R[resolve phase rewrites dep.reference to selected tag]
    S --> G[policy_gate / policy_target_check]
    R --> D[download, lockfile, drift]
    G --> C[classify each declared ref]
Loading

Trade-offs

Benefits

  1. ^1.0.0 resolving to pkg-a-v1.1.0 passes under enforcement: block instead of failing install.
  2. The documented pkg-a#pkg-a-v1.1.0 pin is accepted.
  3. Fresh install, frozen replay, repeat install, update and audit agree on dependencies.
  4. Declaration order can no longer launder an unbounded ref.

Validation

Lint (ruff 0.15.12 check + format on changed files): clean. Targeted tests and CI evidence are recorded in the review advisory comment on this PR.

Scenario evidence
Scenario Test
Package-qualified tags, prerelease/build, near-miss and other-package negatives tests/unit/policy/test_pinned_constraint_declared.py
Bounded declaration does not cover an unbounded one; declared None stays NO_REF tests/unit/policy/test_pinned_constraint_declared.py
Gate and target check forward declared refs tests/integration/policy/test_require_pinned_constraint_e2e.py::TestDeclaredRefsWiring
Real binary: fresh / frozen / repeat / update / audit, root and subdirectory, negative controls tests/integration/policy/test_require_pinned_constraint_declared_e2e.py
Package-name owner routing tests/integration/test_architecture_owner_rule_mutations.py

How to test

  • uv run pytest tests/unit/policy/test_pinned_constraint_declared.py -q
  • uv run pytest tests/integration/policy/test_require_pinned_constraint_e2e.py -q
  • APM_BINARY_PATH=.venv/bin/apm uv run pytest tests/integration/policy/test_require_pinned_constraint_declared_e2e.py -q

Issue and approved scope

Issue: Closes #3224

Human scope-approval comment: #3224 (comment)

This PR completes the accepted issue scope. Out-of-scope follow-ups from the #3381 panel (audit over devDependencies, consolidating deps/revision_pins.package_name) remain separate.

Type of change

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

Testing

  • Tested locally
  • All existing tests pass (CI is the authority; see advisory)
  • Added tests for new functionality (if applicable)

Spec conformance (OpenAPM v0.1)

  • Spec edit
  • Manifest edit
  • Test edit
  • CONFORMANCE.{md,json}
  • N/A -- this PR does not change OpenAPM-observable behaviour.

req-pl-007 flags "a bare branch name"; a dependency's own release tag in a layout the resolver selects from is a tag, not a branch, so recognising it is a classification repair under the existing rule. req-pl-008 is unchanged.

Supersedes #3381. Credit: Kaustubh Arora (@Kaustubh1235).

require_pinned_constraint judged the wrong string in two ways. The
resolve phase rewrites a direct dependency's in-memory reference to the
tag its semver range selected, and the install gate ran after that, so
pkg-a#^1.0.0 was judged as pkg-a-v1.1.0. The literal-tag classifier also
only knew v{version}, while the resolver selects from v{version},
{name}--v{version} and {name}-v{version}.

InstallContext now snapshots every manifest-declared ref of each direct
dependency before any rewrite; policy_gate and policy_target_check pass
that map to run_dependency_policy_checks, which classifies each
declaration instead of the rewritten reference, so a bounded
devDependencies declaration cannot hide an unbounded one. The classifier
accepts {name}-v{version} and {name}--v{version} for the dependency's
own package name only, taking the name from the resolver owner
ref_reuse.git_semver_package_name and the patterns from
DEFAULT_TAG_PATTERNS; a static architecture check guards that routing.

Unit, wiring and real-binary lifecycle tests cover fresh install, locked
replay, repeat install, update and audit, with negative branch, range
and other-package controls.

Rebuilt from #3381 by @Kaustubh1235 to ship in 0.36.0 (CLA pending).

Refs #3224

Co-authored-by: Kaustubh1235 <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Policy reference, schema, consumer governance and dependency guides, the
packaged apm-guide governance usage file and the CHANGELOG now say that
require_pinned_constraint judges each direct dependency's declared
constraint and counts a package's own release tags as pinned. Two places
that said transitive dependencies are classified are corrected; the
check is direct-only.

Rebuilt from #3381 by @Kaustubh1235 to ship in 0.36.0 (CLA pending).

Refs #3224

Co-authored-by: Kaustubh1235 <[email protected]>
Co-authored-by: Copilot App <[email protected]>
@danielmeppiel Daniel Meppiel (danielmeppiel) added this to the 0.36.0 milestone Nov 12, 2026
Copilot AI balanced review requested due to automatic review settings November 12, 2026 19:05
The entry ships through #3652, which rebuilds #3381; the changelog
convention ends each bullet with the merging PR number. Credit to the
original author is kept in the bullet.

Refs #3224

Co-authored-by: Kaustubh1235 <[email protected]>
Co-authored-by: Copilot App <[email protected]>

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 policy checks can incorrectly accept an unbounded replacement for a bounded dependency and reject valid pinned declarations whose repository names differ only in casing.

2 open issues
What changed in this PR

Fixes require_pinned_constraint to evaluate declared constraints rather than resolved tags, addressing #3224 and superseding #3381.

Changes:

  • Snapshots direct dependency declarations before resolution and forwards them to policy checks.
  • Recognizes package-qualified release tags using the resolver’s package-name rules.
  • Adds regression coverage and updates policy documentation, CLI help, and the changelog.
File Description
tests/​unit/​policy/​test_pinned_constraint_declared.py Tests declared refs, package tags, and duplicate declarations.
tests/​integration/​test_architecture_owner_rule_mutations.py Tests enforcement of shared package-name ownership.
tests/​integration/​policy/​test_require_pinned_constraint_e2e.py Verifies declared-ref forwarding to policy checks.
tests/​integration/​policy/​test_require_pinned_constraint_declared_e2e.py Covers install, replay, update, and audit scenarios.
src/​apm_cli/​policy/​policy_checks.py Checks each captured declaration and deduplicates diagnostics.
src/​apm_cli/​policy/​_help_text.py Explains declared constraints and package-qualified tags.
src/​apm_cli/​policy/​_constraint_pinning.py Adds declaration collection and package-tag classification.
src/​apm_cli/​install/​pipeline.py Captures direct refs before resolution.
src/​apm_cli/​install/​phases/​policy_target_check.py Forwards declared refs during target checks.
src/​apm_cli/​install/​phases/​policy_gate.py Forwards declared refs to the install gate.
src/​apm_cli/​install/​helpers/​ref_reuse.py Exposes the shared package-name helper.
src/​apm_cli/​install/​context.py Stores the declared-ref snapshot.
scripts/​architecture_linter/​checks/​transport_network_and_runtime.py Guards reuse of the package-name helper.
packages/​apm-guide/​.apm/​skills/​apm-usage/​governance.md Updates policy usage guidance.
docs/​src/​content/​docs/​reference/​policy-schema.md Clarifies direct-only checks and accepted tag forms.
docs/​src/​content/​docs/​enterprise/​policy-reference.md Documents declared-constraint behavior and direct-only scope.
docs/​src/​content/​docs/​consumer/​manage-dependencies.md Explains policy acceptance of ranges and package tags.
docs/​src/​content/​docs/​consumer/​governance-on-the-consumer-ramp.md Updates the consumer-facing policy summary.
CHANGELOG.md Records the fix and contributor credit.

Review effort: Balanced

Comment thread src/apm_cli/install/pipeline.py Resolved
Comment thread src/apm_cli/policy/policy_checks.py Resolved
Copilot review on #3652 found two gaps in the declared-ref snapshot.
It was taken from the raw manifest before replace: rules, and a
replacement keeps the original unique key, so a bounded original such
as acme/widget#^1.0.0 covered an unbounded fork ref; the docs say
policy uses the selected source and original refs are provenance only.
It also stored bare ref strings, so declarations sharing a
case-folded key (acme/Widget, acme/widget) were matched against the
resolved dep's package name instead of their own.

The pipeline now snapshots project_manifest_dependencies(), and
collect_declared_refs keeps a shallow copy of each declaration, which
the check classifies directly. classify_unbounded_reason and
humanize_reason no longer need ref overrides and return to their main
signatures. Regressions cover a replaced dep at unit and pipeline-wiring
level and the case-colliding declarations; each was mutation-checked.

apm-spec-waiver: classification repair under existing req-pl-007; declared-constraint snapshot, no new normative behaviour (#3224)

Refs #3224

Co-authored-by: Kaustubh1235 <[email protected]>
Co-authored-by: Copilot App <[email protected]>
The #3652 review panel (doc-writer, supply-chain-security-expert) found
that run_policy_checks still passed the raw manifest to the pinned
constraint check, so apm audit judged a bounded original while install
judged the unbounded ref a replace: rule selects; the docs promise the
two agree.

collect_manifest_declarations(manifest) is now the single owner of the
source-selected declaration snapshot; the install pipeline and
run_policy_checks both use it (this also keeps pipeline.py within its
LOC budget). Unit, wiring and a real-binary replace: scenario
(fork tag passes, fork branch is blocked at install and fails audit)
were each mutation-checked against both call sites. Policy reference and
the packaged governance guide note that a replace: rule is judged by the
ref it selects.

Refs #3224

Co-authored-by: Kaustubh1235 <[email protected]>
Co-authored-by: Copilot App <[email protected]>
@danielmeppiel

Copy link
Copy Markdown
Collaborator Author

APM Review Panel: ship_now

Closes the install/audit agreement gap on replace: rules so org-policy gates judge the ref a replacement selects, not the ref it replaces -- all three panel findings folded with real-binary e2e proof.

panel-mode=delta; personas=python-architect,test-coverage-expert,supply-chain-security-expert (adhoc: the PR changes what an org-policy gate accepts, including under replace: rules),performance-expert,doc-writer,apm-ceo

cc Sergio Sisternes (@sergio-sisternes-epam) -- a fresh advisory pass is ready for your review.

This PR rebuilds #3381 by Kaustubh Arora (@Kaustubh1235) (CLA pending 6+ days) on current main, credited via Co-authored-by on every commit. The baseline is the converged #3381 advisory at 903968e (all five panelists, zero required findings). This delta covers the rebuild, two Copilot findings on #3652, and the panel pass on top of them.

All five panelists returned zero required findings. The three recommended findings -- a missing real-binary e2e test for replace: (test-coverage-expert), an audit/install disagreement on replace: rules (supply-chain-security-expert), and the same gap echoed through the docs (doc-writer) -- came from one root cause: run_policy_checks did not judge the source-selected declarations. All three were folded in 0aaad3a. collect_manifest_declarations is now the single owner shared by the install pipeline and apm audit. A unit regression and a real-binary e2e test cover it, with mutation-break evidence: removing the audit wiring or reverting the pipeline to raw all_apm_deps both fail the branch case. policy-reference.md now says a replace: rule is judged by the ref it selects. python-architect and performance-expert found the snapshot ownership, shallow copies and O(N+R) cost sound.

The three deferrals carried from the #3381 panel -- audit over devDependencies-only packages, consolidating deps/revision_pins.package_name, and a lighter DEFAULT_TAG_PATTERNS import -- remain out of scope for #3224.

Aligned with: secure by default (a replace: rule can no longer launder an unbounded fork branch past the gate); governed by policy (install and audit share one declaration source, so they agree under replace: rules); portable by manifest (the declared constraint anchors the judgement; resolved tags and SHAs inform the lockfile only); OSS community driven (the original contributor is credited on every commit).

Panel summary

Persona B R N Takeaway
Python Architect 0 0 0 Fold aligns snapshot source with canonical project_manifest_dependencies; shallow copy is sound; no dead code remains.
Test Coverage Expert 0 1 0 Fold adds regression traps at unit + wiring tier for both Copilot findings; replace: scenario lacked real-binary e2e coverage (folded).
Supply Chain Security Expert 0 1 0 Fold is security-correct: replacement refs are judged, shallow copy is safe, no laundering path; audit path gap for replace: (folded).
Performance Expert 0 0 0 No perf regression: fold adds O(N+R) in-memory work (<0.1ms) to a pipeline dominated by network resolve/fetch.
Doc Writer 0 1 0 Docs, guide, help text and CHANGELOG accurate and succinct; install/audit agreement under replace: needed code or a clause (both folded).

B = blocking-severity findings, R = recommended, N = nits.
Counts are signal strength, not gates. The maintainer ships.

Top 5 follow-ups

  1. [Test Coverage Expert] Real-binary e2e test for replace: through the declared-constraint contract -- FOLDED in 0aaad3a with mutation-break coverage. -- Evidence outcome=missing on a governed-by-policy surface; now resolved.
  2. [Supply Chain Security Expert] apm audit now applies replace: rules to the pinned-constraint check via the shared collect_manifest_declarations -- FOLDED in 0aaad3a. -- Audit/install agreement is a core policy contract; the gap is closed.
  3. [Doc Writer] policy-reference.md and the packaged governance guide say a replace: rule is judged by the ref it selects -- FOLDED in 0aaad3a. -- Docs now match the code.
  4. [Supply Chain Security Expert] apm audit over devDependencies-only packages (deferred from fix(policy): judge the declared constraint, accept package release tags #3381, out of [BUG] require_pinned_constraint flags git semver ranges as bare branches: checks the resolved tag and rejects {name}-v{version} literal tags #3224 scope). -- Pre-existing gap, not a regression.
  5. [Python Architect] Consolidate deps/revision_pins.package_name (deferred from fix(policy): judge the declared constraint, accept package release tags #3381, out of [BUG] require_pinned_constraint flags git semver ranges as bare branches: checks the resolved tag and rejects {name}-v{version} literal tags #3224 scope). -- Abstraction hygiene; no user-facing risk.

Recommendation

Every panel finding was folded with test-proven evidence. At the final head 4b90dc3 (current main merged, including hotfix #3651), all CI checks are green and license/cla passes. Recommended next action: Sergio Sisternes (@sergio-sisternes-epam) completes the CODEOWNERS review; the deferred items can ride the backlog.

Folded in this run

Copilot signals reviewed

  • src/apm_cli/install/pipeline.py:542 -- LEGIT: snapshot taken before replace: rules let a bounded original cover an unbounded replacement ref (resolved in 8b470a2).
  • src/apm_cli/policy/policy_checks.py:1118 -- LEGIT: case-folded key shared by differently cased repos judged both tags against one package name (resolved in 8b470a2).

Deferred (out-of-scope follow-ups)

  • (panel) apm audit over devDependencies-only packages -- scope boundary: changes which dependency set audit evaluates; pre-existing on main, outside the declared-vs-resolved repair.
  • (panel) Consolidate deps/revision_pins.package_name -- scope boundary: pre-existing split in update/outdated, which this PR does not touch.
  • (panel) Lighter import for DEFAULT_TAG_PATTERNS -- scope boundary: import-graph refactor of resolver constants; current cost is one-time and noise-level.

Regression-trap evidence (mutation-break gate)

  • TestDeclaredRefsWiring::test_policy_gate_forwards_the_replacement_ref -- reverted the pipeline snapshot to raw all_apm_deps; test FAILED as expected; guard restored.
  • test_snapshot_is_not_rewritten_with_the_reference, test_check_still_fails_declared_branch_after_resolution -- dropped copy.copy in collect_declared_refs; tests FAILED as expected; guard restored.
  • test_each_declaration_keeps_its_own_package_name -- judged each declaration with the resolved dep's context; test FAILED as expected; guard restored.
  • test_audit_judges_a_replacement_by_its_selected_ref -- removed declared_refs from run_policy_checks; test FAILED as expected; guard restored.
  • test_replacement_is_judged_by_the_ref_it_selects (real binary) -- removed the audit wiring, then reverted the pipeline snapshot; the branch case FAILED each time; guards restored.

Lint contract

ruff check and ruff format --check (src, tests, architecture linter and probe scripts; ruff 0.15.12 per uv.lock), pylint R0801 (10.00/10), lint-auth-signals.sh and lint-architecture-boundaries.sh all silent on the merged head.

CI

All 23 checks green on 4b90dc3 (CI build/test shards, lifecycle smoke, Windows compatibility, CodeQL, Spec conformance, NOTICE Drift, Deploy Docs); license/cla success (after 2 CI fix iteration(s): pipeline LOC budget, and merging main for the #3651 hotfix).

Mergeability status

PR head SHA CEO stance iters folds defers Copilot rounds CI mergeable mergeStateStatus notes
#3652 4b90dc3 ship_now 2 7 3 1 green MERGEABLE BLOCKED awaiting CODEOWNERS review

Convergence

2 outer iteration(s); 1 Copilot round(s). Final panel stance: ship_now. Ready for maintainer review.


Full per-persona findings

Python Architect

No findings.

Test Coverage Expert

  • [recommended] No real-binary lifecycle test for replace: through the declared-constraint contract at tests/integration/policy/test_require_pinned_constraint_declared_e2e.py
    The wiring test mocks the runner, so it proves the snapshot is forwarded but not the end-to-end outcome through the real binary. (Folded in 0aaad3a.)
    Suggested: Parametrize a replace: scenario (fork branch rejected, fork tag passes) in the module-scoped monorepo fixture.
    Proof (missing at): tests/integration/policy/test_require_pinned_constraint_declared_e2e.py::test_replacement_is_judged_by_selected_source -- proves: a replace: rule with an unbounded fork ref is rejected even though the original dep had a bounded range [governed-by-policy,secure-by-default]

Supply Chain Security Expert

  • [recommended] run_policy_checks (apm audit) does not apply replace: rules to the pinned-constraint check at src/apm_cli/policy/policy_checks.py:1415
    Audit judged the original bounded ref while install judged the unbounded fork ref; a CI pipeline relying only on apm audit would not flag it. (Folded in 0aaad3a.)
    Suggested: Pass the source-selected declarations to run_dependency_policy_checks in run_policy_checks.
    Proof (passed): tests/integration/policy/test_require_pinned_constraint_e2e.py::TestDeclaredRefsWiring::test_policy_gate_forwards_the_replacement_ref -- proves: the install gate judges the replacement source ref, not the original bounded constraint [secure-by-default,governed-by-policy]

Performance Expert

No findings.

Doc Writer

  • [recommended] The install/audit agreement claim did not hold for a dependency redirected by a replace: rule at docs/src/content/docs/enterprise/policy-reference.md:191
    The approved scope promises consistency across audit, so fixing the code is preferred over weakening the docs. (Folded in 0aaad3a: code fix plus one clause.)
    Suggested: Use project_manifest_dependencies in run_policy_checks; add a clause that a replace: rule is judged by the ref it selects.
    Proof (missing at): tests/unit/policy/test_pinned_constraint_declared.py::audit path judges a replace: rule by its selected ref -- proves: apm audit and apm install give the same result for a dependency redirected by a replace: rule [governed-by-policy]

This panel is advisory. It does not block merge. Re-apply the
panel-review label after addressing feedback to re-run.


Generated by autopilot-pr-merge-worker. This comment is AI-generated and may contain errors.

@danielmeppiel
Daniel Meppiel (danielmeppiel) merged commit 9e0a4a8 into main Nov 12, 2026
26 checks passed
@danielmeppiel
Daniel Meppiel (danielmeppiel) deleted the lanef/supersede-3381 branch November 12, 2026 20:42
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 12, 2026
…tterns

Resolve policy_checks.py and policy-schema.md conflicts with #3652 by keeping both sides: source_deps (host-qualified allow/deny over effective direct + locked transitive sources) and declared_refs (authored constraint for require_pinned_constraint); both doc paragraphs kept.

Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 12, 2026
Main's pipeline.py reached exactly 1000 lines (#3652), so the CI merge
commit put it at 1002 with this PR's import and reporter call
(test_no_install_module_exceeds_loc_budget). The finally block's exit
sequence -- deactivate Copilot plugin registration, close the TUI, then
report failed-install residue -- now lives in
finalization.close_pipeline_attempt, beside close_install_contexts, in
the same order. pipeline.py is 999 lines, one under main.

Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 12, 2026
#3641)

* fix(install): name native target files a failed install leaves on disk

InstallTransaction restores apm.yml and apm_modules staging only; native
target integrations run outside it. A failure after integration now lists
every deployed path that apm.lock.yaml does not track, gives one next step
(remove the files, or re-run apm install with --force when skipped as not
managed by APM), and the FAILED summary no longer says "No install
transaction changes were committed" when such files remain.

Reporting only: no rollback, deletion, or ownership tracking of native
target files, and no InstallTransaction or resolution staging changes.

apm-spec-waiver: failure-output wording only; no install, lockfile or staging semantics change (#3525)

Fixes #3525

Co-authored-by: Copilot App <[email protected]>

* docs(changelog): note failed-install residue report (#3641)

Co-authored-by: Copilot App <[email protected]>

* fix(install): keep residue report from masking the install error

The residue report runs in the pipeline finally block while the original
failure propagates. A crash while rendering it must never replace that
error, so the call is suppressed and a regression test proves a raising
reporter still surfaces DirectDependencyError. Addresses panel
python-architect finding on src/apm_cli/install/pipeline.py.

Co-authored-by: Copilot <[email protected]>

* refactor(install): own the never-raise guard in failure_residue

The residue reporter now suppresses its own errors instead of the
pipeline wrapping the call, so the guard lives with the report owner and
pipeline.py stays within the 1000-line install module budget enforced by
test_architecture_invariants (CI Build & Test Shard 1 failed at 1001).

Co-authored-by: Copilot <[email protected]>

* fix(install): report only removable residue, scope-correct next step

Address Copilot review on the failed-install residue report:
- skill directory claims are dropped when their members are claimed, so
  the "remove these files" advice never targets a directory that may
  hold unrelated user files;
- user-scope (-g) residue renders home-rooted paths and suggests
  'apm install -g';
- file-backed target locators (cowork://) resolve through their owning
  target for display, and non-file locators (copilot-app-db://) are
  listed as entries, not files;
- lockfile claim membership routes through the canonical
  DeploymentLedgerCodec.legacy_deployed_file_claims owner.

Co-authored-by: Copilot <[email protected]>

* chore(changelog): place #3641 entry away from the section head

Avoids landing-order conflicts with other queued PRs.

Co-authored-by: Copilot App <[email protected]>

* refactor(install): keep the residue outcome check out of pipeline.py

After merging main, pipeline.py reached 1007 lines and failed the
1000-line install module budget (test_no_install_module_exceeds_loc_budget,
CI run 43279911187). The finished-vs-failed decision now lives in
failure_residue.record_install_outcome, which records it on the install
context; report_failed_install_residue returns early once the install
finished. pipeline.py keeps one import and one call (1000 lines). Two
regression traps cover the guard and the pipeline wiring.

Co-authored-by: Copilot App <[email protected]>

* refactor(install): move pipeline exit teardown into finalization

Main's pipeline.py reached exactly 1000 lines (#3652), so the CI merge
commit put it at 1002 with this PR's import and reporter call
(test_no_install_module_exceeds_loc_budget). The finally block's exit
sequence -- deactivate Copilot plugin registration, close the TUI, then
report failed-install residue -- now lives in
finalization.close_pipeline_attempt, beside close_install_contexts, in
the same order. pipeline.py is 999 lines, one under main.

Co-authored-by: Copilot App <[email protected]>

* test(install): trap the pipeline exit sequence order

close_pipeline_attempt must deactivate Copilot plugin registration,
close the TUI, then report residue. No test asserted those calls or
their order, so a later refactor could drop or reorder them silently.
Addresses the CEO follow-up from the delta panel on 11f286b.

Co-authored-by: Copilot App <[email protected]>

---------

Co-authored-by: danielmeppiel <[email protected]>
Co-authored-by: Copilot App <[email protected]>
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.

[BUG] require_pinned_constraint flags git semver ranges as bare branches: checks the resolved tag and rejects {name}-v{version} literal tags

2 participants