Skip to content

fix(policy): one host-bound identity for dependencies.require on every host - #4008

Merged
Daniel Meppiel (danielmeppiel) merged 7 commits into
mainfrom
danielmeppiel-scaling-potato
Nov 20, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 7 commits into
mainfrom
danielmeppiel-scaling-potato

Conversation

@danielmeppiel

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

Copy link
Copy Markdown
Collaborator

Description

TL;DR

On a non-default git host (GitLab, GHES, Gitea), no dependencies.require entry could pass both required-packages and required-packages-deployed. This PR gives both checks one host-bound identity, owned by DependencyPolicyIndex.find. A hostless entry names the default host and a host-qualified entry names its host. The lockfile row is addressed by the matched dependency's own unique key, and an entry that resolves to nothing fails instead of being skipped.

Important

Stacked on #3997 (danielmeppiel-docs-037-native), at the top of the 0.37 stack. The delivery manager picked this base because the PR shares files with #3290, #3989 and #3992. It amends OpenAPM req-pl-018 clause (g) as proposed version 0.1.67.

Problem (WHY)

  • required-packages built its lookup from the host-blind get_canonical_dependency_string() (group/sub/pkg), but required-packages-deployed used that name as a key into a lockfile keyed by host-qualified get_unique_key() (gitlab.example.com/group/sub/pkg). On a non-default host the lookup always missed.
  • With the host-qualified entry, required-packages failed and required-packages-deployed passed only because of if lock_name is None: continue.
  • Under GITHUB_HOST=ghes..., the hostless entry for a correctly declared and locked package also failed required-packages-deployed. This was found while writing the regression tests.
  • [!] required-executable-untrusted had the same split identity, so a deployed package was reported as "present but untrusted".

Result: with any dependencies.require, enforcement: block was unusable on a self-managed host. The repo rule is "Every durable decision ... has exactly ONE canonical owner". Here two checks derived the require identity in two different ways.

Approach (WHAT)

# Fix
1 identity.py (owner) gains effective_policy_host and required_package_policy_hosts(entry). require uses the same effective host as allow/deny, with no proxy exception, so a proxy-shaped URL on any host cannot satisfy a github.com entry.
2 DependencyPolicyIndex.find(entry) matches on path and host. The returned RequiredPackageMatch.locked_in(lock) reads the row by dependency.get_unique_key(); it is the only lock read in the required checks.
3 required-packages, -deployed, required-executable-untrusted and required-package-version all route through find. The two presence checks never skip an entry.
4 An unresolved entry whose path is declared on another host fails, and the check message (which apm audit --ci prints) names the entry to write: Declared on another host -- write 'group/sub/pkg' as 'gitlab.example.com/group/sub/pkg'.
5 Closed-world guard: contracts-tooling-policy-identity rejects a continue in the two presence checks, and any lock accessor other than locked_in (dependencies, get_dependency, has_dependency, get_unique_key, find_name) in the lock-reading checks. Three mutation tests prove the rejections.

Implementation (HOW)

  • src/apm_cli/models/dependency/identity.py: the host helpers above. DependencyReference.policy_host now delegates to effective_policy_host (same behaviour); reference.py gets smaller.
  • src/apm_cli/policy/matcher.py: the index stores host-aware match lists per normalized path. find, find_name, find_or_undeclared and expected_entry all share one _first lookup, and dependency_policy_name_matches routes through find. The legacy from_names set stays byte-exact.
  • src/apm_cli/policy/policy_checks.py: routes the four required checks through find and locked_in. Adds a shared _unresolved_required_subject and a message-level _wrong_host_hint, and splits deployed failures by cause. The version pin never reads a same-path row from another host.
  • scripts/architecture_linter/checks/contracts_dependency_policy.py and .apm/architecture/owners/contracts-tooling.json: the guard is extended, and the record names the new decision.
  • Spec: req-pl-018 clauses (a) and (g) (one effective host, including the declaring manifest's default_host:, which never rebinds a hostless require entry; violations routed through enforcement; never skipped), the Section 6.3.1 table and the 10.8 note, the 0.1.67 history row, the requirements-manifest note, a new req-pl-018 conformance test, and regenerated CONFORMANCE. Docs: reference/policy-schema.md and the apm-usage governance.md.

Diagrams

Both presence checks now resolve a require entry through one owner, then judge their own condition:

flowchart LR
    E["require entry"] --> F["DependencyPolicyIndex.find<br/>path + host"]
    F -->|"match"| M["required-packages: pass"]
    F -->|"match.lock_key"| L{"in apm.lock.yaml?"}
    L -->|"yes"| D["-deployed: pass"]
    L -->|"no"| X["-deployed: fail + repair hint"]
    F -->|"no match"| U["both fail + expected entry form"]
Loading

Trade-offs

  • Hostless require is now default-host only, while hostless allow/deny still match every host. This is deliberate and follows the accepted scope: require is a grant of presence, so binding it to one host avoids a same-path package on another server satisfying it. The upgrade note names the migration.
  • required-packages-deployed now fails an undeclared entry instead of skipping it. In --no-fail-fast audits an absent package is reported twice, once per check. That is the "no silent skip" contract.
  • No registry-proxy exception. A dependency written as an explicit proxy URL is required by its written (proxy) host, as for allow/deny. An env-configured proxy keeps the declared reference hostless, so its identity is unchanged. The panel preferred this fail-closed default to a proxy-shaped exception that any host could claim.
  • The executables check still skips truly undeclared entries. Its scope is trust, not presence, and that is unchanged. It now fails only when the entry names the wrong host.
  • I derived the lock key from the matched dependency instead of adding policy_host to LockedDependency. That keeps deps/lockfile.py out of the diff (fix(0.37): finish owner hardening for bundle MCP, audit copies, failed installs, MCP targets and plugin pins #3989 and fix(claude): install intact user plugins through Claude settings, owned by the lock #3290 also edit it), and reuses the lockfile's own key builder.

Validation

Commands and results (all run locally; final head 8e70a856)
Command Result
uv run --extra dev pytest -q tests/unit/policy/test_required_package_host_identity.py 12 passed; the original 9 on base: 8 failed, 1 passed (the version-pin case was already correct, as the reporter observed)
uv run --extra dev pytest -q tests/integration/policy/test_required_packages_host_identity_lifecycle.py 5 passed (real installs from gitlab.example.test and github.com); the original 3 on base: 3 failed
uv run --extra dev pytest -q -n 8 tests/unit/policy tests/spec_conformance/test_policy_reqs.py tests/integration/test_wave7_policy_registry_coverage.py tests/integration/test_deep_coverage_deps_policy.py tests/integration/test_policy_coverage.py tests/integration/test_architecture_policy_bytecode.py tests/unit/test_audit_policy_command.py tests/unit/models tests/unit/scripts/test_architecture_runner.py 2155 passed, 1 failed: test_load_raw_apm_yml_permission_denied fails identically on base because the sandbox runs as root
uv run --extra dev pytest -q -n 8 tests/integration/test_architecture_owner_rule_mutations.py -k "policy or identity" 55 passed
Mutation M1: put the continue skip back in -deployed 4 behavioural tests and the static guard fail
Mutation M2: make the require identity host-blind test_qualified_entry_does_not_match_another_host fails
Mutation M3: let the version pin read a same-path row from another host test_version_pin_never_reads_a_same_path_row_from_another_host fails
Mutation M4: drop the message-level hint test_reporter_repro_hostless_entry_fails_both_with_expected_form fails
ruff check + ruff format --check (CI-mirror paths) clean
pylint R0801 (CI-mirror paths) 10.00/10
bash scripts/lint-auth-signals.sh exit 0
bash scripts/lint-architecture-boundaries.sh exit 0
pytest tests/spec_conformance --collect-only + python -m tests.spec_conformance.gen_statement 656 collected; req-pl-018 is now bound to 4 tests, and the statement count is unchanged (148)

Scenario evidence

User promise Test Principle
Install from gitlab.example.test and github.com, then apm audit --ci --policy: the host-qualified entry, and the hostless or github.com/ entry for the default-host package, each pass both presence checks test_required_packages_host_identity_lifecycle.py::test_host_qualified_require_passes_both_presence_checks (real install via a git URL rewrite; lock row carries host:) Governance usable on any host
The hostless entry for the GitLab package, and a missing package, fail both checks; the message names the entry to write ...::test_unmatched_require_fails_both_presence_checks No silent skip; actionable
A project's default_host: never rebinds a hostless entry; a proxy-shaped URL cannot satisfy github.com test_manifest_default_host_never_rebinds_a_hostless_entry, test_proxy_shaped_reference_is_identified_by_its_written_host, tests/spec_conformance/test_policy_reqs.py::test_require_entry_is_one_host_bound_identity_on_manifest_and_lockfile Secure by default
The reporter's repro, the GHES default host, the default host, the wrong host, declared-but-unlocked, and the version pin tests/unit/policy/test_required_package_host_identity.py One identity, two checks
Neither check may regress to a skip or a host-blind lock lookup test_architecture_policy_bytecode.py::test_required_package_guard_rejects_skip_and_host_blind_lock_lookup Single canonical owner

How to test

Issue and approved scope

Issue: Fixes #3993

Human scope-approval comment: #3993 (comment) (eligibility record-present, review contact Daniel Meppiel (@danielmeppiel))

Does this PR complete the issue, or what remains? It completes the approved scope. The issue's "related observation" (audit judges direct declarations while install judges the resolved tree) is out of scope and unchanged.

Type of change

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

Testing

  • Tested locally
  • All existing tests pass (except environment-bound tests that fail identically on base: root permissions, gpg commit signing)
  • Added tests for new functionality (if applicable)

Changelog

  • One line in one section under ## [Unreleased] in CHANGELOG.md:
    user-visible effect first, 25 words or fewer, ending with (#PR);
    breaking changes only under upgrade notes; no Highlights; see
    .github/instructions/changelog.instructions.md.
  • N/A -- internal-only change (CI, tests, refactor).

Spec conformance (OpenAPM v0.1)

  • Spec edit: docs/src/content/docs/specs/openapm-v0.1.md updated (req-pl-018 clauses (a) and (g) revised in place, Section 6.3.1 table and 10.8 note aligned, 0.1.67 row).
  • Manifest edit: docs/public/specs/manifests/openapm-v0.1.requirements.yml req-pl-018 note updated.
  • Test edit: @pytest.mark.req("req-pl-018") test_policy_host_recognition_grammar_and_scope extended, and test_require_entry_is_one_host_bound_identity_on_manifest_and_lockfile added.
  • CONFORMANCE.{md,json} regenerated via uv run --extra dev python -m tests.spec_conformance.gen_statement (req-pl-018 is now bound to 4 tests; statement count unchanged).

Panels: apm-spec-guardian (fold_and_ship, average 8.0, F1 folded) and review panel (ship_with_followups; every in-scope finding folded).

Co-authored-by: Copilot [email protected]

Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 19, 2026
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Addresses the spec and code panels on #4008:
- drop the registry-proxy exception: require uses the same effective
  host as allow/deny, so a proxy-shaped URL on any host can no longer
  satisfy a github.com entry (supply-chain rec-1, spec panels)
- read lock rows only via RequiredPackageMatch.locked_in; the version
  pin never compares a same-path row from another host (architect
  rec-1/rec-2); guard now rejects any other lock accessor
- name the entry to write in the check message, which apm audit --ci
  prints; split deployed failures by cause (test-coverage rec-1,
  devx rec-1/rec-2)
- req-pl-018: effective host honours manifest default_host:, which
  never rebinds a hostless entry (OCI blocker); violation routed
  through enforcement; first match in declaration order; dotless
  hosts, portability, 9.2 classification, explicit count
- e2e covers the real github.com default host; conformance covers the
  lockfile side, no-skip, local paths and manifest default_host:
- CHANGELOG marked BREAKING with default-host wording (docs, devx)

Co-authored-by: copilot-swe-agent[bot] <[email protected]>

Copy link
Copy Markdown
Collaborator Author

APM Spec Guardian: fold_and_ship

Scope: editorial-patch (orchestrator judgment: the change is under 50 lines with no new anchor, but it revises the normative MUST req-pl-018, so it got the full panel rather than linter only); diff = +99/-17 lines across 3 file(s). Shocked-meter avg: 8.0/10 (round 2 of 2).

Recommendation: fold F1, then ship 0.1.67. In round 2, all four panels returned ship_with_followups with a shocked_meter of 8. No panel raised a new blocker. The only round-1 blocker, oci-blk-r1-1, is closed: the effective host ignored manifest default_host:, which made the Section 10.8 claim false. The round-2 folds are in the text at 6b5a4c5:

  • clause (g) takes the default_host: of the declaring manifest;
  • the dotless-host sentence exempts the implementation-default host;
  • the multi-match order is softened to "the order the check evaluates dependencies";
  • the 0.1.67 row discloses the allow/deny verdict change.

F1 is already folded at 8e70a85. The row's tie-break wording now matches clause (g).

The highest-signal follow-up is F2: how require identity interacts with source replacement (req-rpl-002). It is out of scope here and needs its own accepted issue. The panel is advisory and does not block merge.

Convergence

Panel Stance Shocked New B New R New N
Swagger / OpenAPI editor ship_with_followups 8/10 0 1 2
OCI distribution editor ship_with_followups 8/10 0 0 2
Package-manager registry-contract editor ship_with_followups 8/10 0 2 2
Web-platform architect ship_with_followups 8/10 0 1 2

B = new blocking findings, R = new recommended, N = new nits (round 2).
Counts are signal strength, not gates. The maintainer ships.

Convergent themes (flagged by 2+ panels)

  • T1 -- The 0.1.67 row must disclose that the shared effective-host change also changes host-qualified allow/deny verdicts. Folded. (supporting: sw-rec-r2-1, pkg-rec-r2-2, tag-nit-r2-2)
  • T2 -- The allow/deny half of the requirements-manifest note was stale; it now uses the three-tier effective host. Folded. (supporting: sw-nit-r2-1, oci-nit-r2-1, tag-nit-r2-1)
  • T3 -- The multi-match tie-break and the "evaluated dependency" set were undefined. The softened clause is folded, and F1 aligns the row. (supporting: sw-nit-r2-2, pkg-nit-r2-1, pkg-nit-r2-2)
  • T4 -- Identifying a dependency on a dotless host. The qualifier is folded; the optional diagnostic note is deferred. (supporting: tag-rec-r2-1, oci-nit-r2-2)
  • T5 -- Which host a shorthand dependency resolves to. The round-1 blocker on manifest default_host: is closed, and the round-2 refinement to use the declaring manifest is folded. (supporting: oci-blk-r1-1, pkg-rec-r1-1, tag-rec-r1-1, sw-rec-r1-4, pkg-rec-r2-1)

Fold now (1 item, folded at 8e70a85)

  1. [F1 / T3] Appendix D, 0.1.67 (proposed) row -- Replace "the first identified dependency in declaration order is the one identified" with "...in the order the check evaluates dependencies (declaration order within one manifest)...".
    Success criterion: grep -c 'first identified dependency in declaration order' returns 0. Done.

Defer to v0.1.1

Defer to v0.1.1 (4 items)
  • [F2 / standalone] req-pl-018 clause (g) x req-rpl-002 -- Open a scoped issue defining how a require entry identifies a dependency under source replacement: by its declared host or by the replacement host. The 0.1.67 row states that source replacement is unchanged.
  • [F3 / T3] req-pl-018 clause (g), multi-match tie-break -- Verify the cross-manifest evaluation order used at install and at audit. If it is deterministic, pin it in normative text; otherwise add an informative note.
  • [F4 / T4] req-pl-018 clause (g), dotless-host sentence -- Optional informative note: a diagnostic should name the cause when the candidate dependency is on a dotless non-default host.
  • [F5 / standalone] req-pl-018 clause (g) -- Informative note that different spellings of one require identity may each be reported.

Linter handoff: After F1, the stale phrase count is 0. Checks 1 (ASCII), 2 (forbidden tokens), 5 (anchor uniqueness), 6 (count unchanged at 148: 143 MUST, 5 SHOULD, as the row states), 7 (links) and 10 (changelog) pass. Checks 3, 4, 8 and 9 do not apply: no schema, fixture or mermaid changes. Two normative claims were verified against the reference implementation:

  • Shorthand under a manifest default_host: gets that host as policy_host, and host-qualified deny follows it.
  • APMPackage.from_apm_yml parses each manifest inside its own default_host: scope, so transitive shorthand uses the declaring manifest's host.

Check 11: 17 non-spec files (src/, tests/) are in this PR, and the code panel (autopilot-pr-review-worker) reviews them separately.


Full per-panel findings (round 2; round-1 findings folded at e03cad0)

Swagger / OpenAPI editor -- shocked_meter 8/10, confidence high

Summary: All round-1 findings are closed: one host-bound identity on both sides, a violation outcome that can be tested, and a conformance test covering both sides. The 0.1.67 row needed to disclose the allow/deny effect (folded).

New recommended findings (1)

  • [sw-rec-r2-1] Appendix D 0.1.67 row -- The shared effective-host change also flips host-qualified allow/deny verdicts under a manifest default_host:. Folded.

New nit findings (2)

  • [sw-nit-r2-1] The manifest note's allow/deny half was stale. Folded.
  • [sw-nit-r2-2] The declaration-order tie-break was undefined for transitive dependencies. Folded (softened).

OCI distribution editor -- shocked_meter 8/10, confidence high

Summary: The round-1 blocker is closed, so the Section 10.8 claim now holds under the literal text. Removing the proxy carve-out eliminates the hidden-upstream bypass. Only the source-replacement interplay (deferred) and nits remain.

New nit findings (2)

  • [oci-nit-r2-1] The manifest note's allow/deny half was stale. Folded.
  • [oci-nit-r2-2] Optional: the diagnostic could name the dotless-host cause. Deferred (F4).

Package-manager registry-contract editor -- shocked_meter 8/10, confidence high

Summary: require now has one host-bound identity, aligned with allow/deny, with a deterministic tie-break and violations routed through enforcement.

New recommended findings (2)

  • [pkg-rec-r2-1] clause (g) -- Which manifest supplies default_host: for a transitive shorthand dependency. Folded: the declaring manifest.
  • [pkg-rec-r2-2] 0.1.67 row -- List the allow/deny verdict classes this changes. Folded.

New nit findings (2)

  • [pkg-nit-r2-1] The "evaluated dependency" set was undefined. Folded (softened).
  • [pkg-nit-r2-2] Say that a later identified dependency is not evaluated. Folded.

Web-platform architect -- shocked_meter 8/10, confidence high

Summary: Every round-1 finding is closed cleanly, and removing the proxy carve-out simplifies the model. The dotless-host sentence needed a qualifier (folded).

New recommended findings (1)

  • [tag-rec-r2-1] clause (g) dotless-host sentence -- A dotless implementation-default host is identified by hostless entries, and the reference implementation passes such entries. Folded.

New nit findings (2)

  • [tag-nit-r2-1] The manifest note's allow/deny half was stale. Folded.
  • [tag-nit-r2-2] The row should list the allow/deny verdict change. Folded.

Preserved strengths confirmed (all panels)

  • req-pl-018 is revised in place, with an explicit count of 148 (143 MUST, 5 SHOULD).
  • A single effective-host grammar is shared by allow, deny and require, with no proxy exception.
  • The lockfile side reads the identified dependency's own lockfile identity, and an entry that identifies no dependency is a violation routed through enforcement, never skipped.
  • The new req-pl-018 conformance test covers both checks: host-qualified, hostless, absent, local-path and manifest default_host: cases.

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


Generated by apm-spec-guardian. This comment is AI-generated and may contain errors.

Copy link
Copy Markdown
Collaborator Author

APM Review Panel: ship_with_followups

dependencies.require now uses one host-bound identity, so a GitLab, GHES or Gitea package can satisfy policy. The deployed check also stops silently skipping entries it cannot resolve.

panel-mode=full; personas=python-architect,test-coverage-expert,doc-writer,supply-chain-security-expert,devx-ux-expert,apm-ceo

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

PR #4008 fixes a governance hole. dependencies.require compared packages by bare name, but the lockfile stores them by host-qualified key. Because of that mismatch, required-packages-deployed silently skipped any entry it could not resolve: if lock_name is None: continue. As a result, an org could require a package and still pass with it missing. The fix gives package identity a single owner in models/dependency/identity.py. Lock rows are read only through the matched dependency's own get_unique_key(). An architecture guard plus mutation tests stop the skip from coming back.

All five panelists agreed on the direction, and none raised a blocking-severity finding. The merge worker folded every in-scope finding at e03cad0, including:

  • the host-blind fallback in the version check;
  • a single lock accessor (RequiredPackageMatch.locked_in), enforced by a structural guard and three mutation tests;
  • the expected-form hint now reaching apm audit --ci output, asserted end to end;
  • an e2e run on the real github.com default host;
  • a neutral wrong-host reason;
  • deployed-check messages split by cause;
  • a BREAKING: CHANGELOG line.

The supply-chain fold removed the registry-proxy exception, so a proxy-shaped URL on any host can no longer satisfy a github.com require entry. require now uses the host as written, the same way allow/deny do. An environment-configured proxy leaves the declared reference hostless, so its identity does not change.

Dissent. None between panelists. As synthesizer, the CEO weighed the proxy-exception removal: hostless entries for dependencies written with an explicit proxy URL now fail. It sided with the security default and asked that this be documented, not reverted. test_proxy_shaped_reference_is_identified_by_its_written_host pins it, and the docs say any other host must be written in full.

Aligned with: Secure by default: an entry that cannot be resolved now fails, and a proxy-shaped URL cannot satisfy a github.com entry. Governed by policy: require means what the admin wrote, on the host they wrote it for, guarded in one owner. Multi-harness, multi-host: GitLab, GHES and Gitea packages pass host-qualified entries end to end. Portable by manifest: the lockfile format is unchanged, and the docs warn that hostless entries follow GITHUB_HOST. Pragmatic as npm: the failure names the exact entry to write.

Panel summary

Persona B R N Takeaway
Python Architect 0 2 1 Ownership is right. Folded the remaining host-blind version-check fallback and made the guard structural.
Test Coverage Expert 0 2 1 Tests fail on base. Folded: the hint is asserted in audit output, and the default host is covered end to end.
Doc Writer 0 1 2 Docs are accurate and concise. Folded the default-host wording in the upgrade note.
Supply Chain Security Expert 0 1 2 A net tightening. Folded the removal of the proxy exception and the portability note.
DevX UX Expert 0 3 0 The hint is actionable. Folded: neutral reason, deployed-check headline split by cause, BREAKING note.

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

Top 3 follow-ups

  1. [Supply Chain Security Expert] Confirm that the CHANGELOG and policy-schema.md cover users who write an explicit proxy URL, and pin the behavior with a test. -- Removing the proxy exception changes which hostless entries pass. Status: covered at e03cad0. The docs say any other host must be written with its host, and test_proxy_shaped_reference_is_identified_by_its_written_host pins it.
  2. [Doc Writer] After docs: zero-based redesign around the agent supply chain #3996 moves the enterprise policy-reference page, add a cross-reference from its require section to the host-binding rule. -- Deferred, not dropped. The page is not false today, and the delivery manager scoped doc edits to reference/policy-schema.md.
  3. [Test Coverage Expert] Run the full CI on this change once the 0.37 stack retargets main, before tagging. -- The stacked base only runs license/cla, so the evidence so far is the local CI mirror.

Recommendation

Recommend merging into the 0.37 stack. The PR closes a silent-pass hole in an org governance check, its tests fail on the base, every in-scope finding is folded, and the breaking change is documented. Before tagging, check that full CI is green once the stack reaches main. Track the enterprise policy-reference cross-reference against #3996.

(Architecture diagrams from python-architect are omitted here because they describe the pre-fold head c95ee08. The terminal delta pass covers the folded shape.)


Full per-persona findings (panel head c95ee08; disposition at e03cad0)

Python Architect

  • [recommended] _check_required_package_version still falls back to a host-blind raw-name lock lookup at src/apm_cli/policy/policy_checks.py:444. -- Folded: index.find_or_undeclared, plus test_version_pin_never_reads_a_same_path_row_from_another_host.
  • [recommended] The closed-world guard is an attribute-name heuristic that is easy to bypass, and the lock index is rebuilt in three checks, at scripts/architecture_linter/checks/contracts_dependency_policy.py:145. -- Folded: one locked_in accessor; the guard rejects dependencies, get_dependency, has_dependency, get_unique_key and find_name in lock checks; three mutation tests.
  • [nit] dependency_policy_name_matches was a test-only second implementation. -- Folded: it now routes through DependencyPolicyIndex.find.

Test Coverage Expert

  • [recommended] The expected-form hint never reached apm audit --ci output. -- Folded: the message carries "Declared on another host -- write 'X' as 'Y'", asserted by unit and e2e tests.
  • [recommended] No e2e covered a hostless entry on the real default host. -- Folded: the e2e installs github.com/contoso/pkg, and the hostless and github.com-qualified entries pass both checks.
  • [nit] The proxy and legacy paths were tested only on the manifest side. -- Moot/folded: the proxy exception was removed, and a test pins the written host.

Doc Writer

  • [recommended] The CHANGELOG named hosts by brand. -- Folded: it now names the default-host rule (GITHUB_HOST, else github.com).
  • [nit] The registry-proxy rule was not documented. -- Moot: the exception was removed.
  • [nit] The enterprise policy-reference require section is silent on host binding. -- Deferred to docs: zero-based redesign around the agent supply chain #3996.

Supply Chain Security Expert

  • [recommended] The registry-proxy exception let attacker.example/artifactory/x/acme/guardrails satisfy github.com/acme/guardrails, at src/apm_cli/models/dependency/identity.py:214. -- Folded: the exception was removed.
  • [nit] A hostless entry follows GITHUB_HOST. -- Folded: portability sentence in policy-schema.md and governance.md.
  • [nit] Ports are ignored for require matching. -- Folded: "Ports are ignored, as for deny."

DevX UX Expert

  • [recommended] The wrong-host reason hardcoded the hostless explanation. -- Folded: the reason is now neutral.
  • [recommended] The deployed-check headline said "absent from the lockfile" for undeclared entries. -- Folded: failures are counted by cause.
  • [recommended] The CHANGELOG line should be BREAKING and name apm install. -- Folded.

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-review-worker. This comment is AI-generated and may contain errors.

Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Addresses the spec and code panels on #4008:
- drop the registry-proxy exception: require uses the same effective
  host as allow/deny, so a proxy-shaped URL on any host can no longer
  satisfy a github.com entry (supply-chain rec-1, spec panels)
- read lock rows only via RequiredPackageMatch.locked_in; the version
  pin never compares a same-path row from another host (architect
  rec-1/rec-2); guard now rejects any other lock accessor
- name the entry to write in the check message, which apm audit --ci
  prints; split deployed failures by cause (test-coverage rec-1,
  devx rec-1/rec-2)
- req-pl-018: effective host honours manifest default_host:, which
  never rebinds a hostless entry (OCI blocker); violation routed
  through enforcement; first match in declaration order; dotless
  hosts, portability, 9.2 classification, explicit count
- e2e covers the real github.com default host; conformance covers the
  lockfile side, no-skip, local paths and manifest default_host:
- CHANGELOG marked BREAKING with default-host wording (docs, devx)

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Delta panel folds on #4008:
- the message names the declared host and the required host, asks to
  declare the package on the required host first, and offers the
  policy rewrite only for a trusted host, since the declared host may
  be a typosquat (supply-chain delta rec-1); it says the fix is the
  policy require entry, not apm.yml (devx delta rec-1)
- CHANGELOG: failure is under `enforcement: block`, and the command
  is `apm audit --ci` (docs delta rec-1)
- docs: explicit registry-proxy paths are identified by the proxy
  host; prefer PROXY_REGISTRY_URL with shorthand (supply-chain delta
  rec-2)
- refresh the stale version-check comment (architect delta)

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Addresses the spec and code panels on #4008:
- drop the registry-proxy exception: require uses the same effective
  host as allow/deny, so a proxy-shaped URL on any host can no longer
  satisfy a github.com entry (supply-chain rec-1, spec panels)
- read lock rows only via RequiredPackageMatch.locked_in; the version
  pin never compares a same-path row from another host (architect
  rec-1/rec-2); guard now rejects any other lock accessor
- name the entry to write in the check message, which apm audit --ci
  prints; split deployed failures by cause (test-coverage rec-1,
  devx rec-1/rec-2)
- req-pl-018: effective host honours manifest default_host:, which
  never rebinds a hostless entry (OCI blocker); violation routed
  through enforcement; first match in declaration order; dotless
  hosts, portability, 9.2 classification, explicit count
- e2e covers the real github.com default host; conformance covers the
  lockfile side, no-skip, local paths and manifest default_host:
- CHANGELOG marked BREAKING with default-host wording (docs, devx)

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Delta panel folds on #4008:
- the message names the declared host and the required host, asks to
  declare the package on the required host first, and offers the
  policy rewrite only for a trusted host, since the declared host may
  be a typosquat (supply-chain delta rec-1); it says the fix is the
  policy require entry, not apm.yml (devx delta rec-1)
- CHANGELOG: failure is under `enforcement: block`, and the command
  is `apm audit --ci` (docs delta rec-1)
- docs: explicit registry-proxy paths are identified by the proxy
  host; prefer PROXY_REGISTRY_URL with shorthand (supply-chain delta
  rec-2)
- refresh the stale version-check comment (architect delta)

Co-authored-by: copilot-swe-agent[bot] <[email protected]>

Copy link
Copy Markdown
Collaborator Author

APM Review Panel: ship_with_followups

Delta pass: dependencies.require now uses one host-bound identity on every host. All four delta wording and docs fixes are folded. The two deferred items predate this PR and fail closed, so they weaken no enforcement.

panel-mode=delta; personas=python-architect,test-coverage-expert,doc-writer,supply-chain-security-expert,devx-ux-expert,apm-ceo

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

Changes since the iteration-1 advisory. All five panelists checked every iteration-1 finding again and found each one resolved:

  • the version check is host-aware for declared dependencies;
  • locked_in is the single lock read, protected by a structural guard;
  • the proxy-shaped bypass is closed;
  • find_or_undeclared and locked_in do not fail open;
  • a manifest default_host: cannot rebind a hostless entry;
  • the CHANGELOG BREAKING line is present.

The delta raised six recommended findings and no blocking ones. Four are folded (3dc87b0; rebased head 3bc3715):

  • Wrong-host hint (supply-chain-security-expert). The hint used to tell admins to rewrite the org require entry to whatever host the manifest declared, which invites typosquats. It now names the declared host and the required host, asks you to declare the package on the required host first, and offers the policy rewrite only if that host is trusted. Unit and e2e tests assert the new text.
  • Wording names the file to edit (devx-ux-expert). The fix is in the policy require entry, not apm.yml.
  • BREAKING line (doc-writer). It is scoped to enforcement: block and names the correct command, apm audit --ci.
  • Proxy identity documented (supply-chain-security-expert). Explicit host/artifactory/... paths are identified by the proxy host. Prefer PROXY_REGISTRY_URL with plain shorthand.

Deferred, outside #3993's accepted scope (which excludes changing get_unique_key() or the lockfile format):

  1. Version check for names declared on no host (python-architect). It still uses the legacy host-blind raw lock lookup, so with GITHUB_HOST=ghe.corp a version-mismatch detail can point at a github.com row. required-packages and required-packages-deployed still fail that entry, so this affects message accuracy, not enforcement. The pre-existing test_required_version_retains_locked_only_mismatch_detail pins this behavior.
  2. Explicit proxy-URL dependencies (test-coverage-expert). DependencyReference.get_unique_key() returns a bare key, while a lock row written without registry_config is host-qualified. As a result, required-packages-deployed reports the dependency absent even when the entry names the proxy host. Base behaves the same, and the failure is closed (a false failure, never a false pass). The docs point users to the consistent PROXY_REGISTRY_URL path.

Evidence at 3bc3715 (rebased onto 246a2fe82d):

  • ruff check and format: clean. pylint R0801: 10.00. lint-auth-signals and lint-architecture-boundaries: 0.
  • Focused suites: 2182 passed, plus two environment or base failures that also fail on 246a2fe82d.
  • Lifecycle tests (real installs from gitlab.example.test and github.com, then apm audit --ci): 5 passed.
  • Mutations M1-M4 and the three static-guard mutations all fail as expected.

The stacked base runs only license/cla, so full CI has not run on this head yet.

Dissent. None. Every delta finding was rated recommended and was either folded or deferred with a stated scope boundary.

Aligned with:

  • Governed by policy: one host-bound identity across all four required checks, no skipped entries, and a hint that does not invite admins to trust an arbitrary host.
  • Secure by default: fail closed throughout. The proxy-shaped bypass is closed, default_host: cannot rebind entries, and both deferrals fail closed.
  • Multi-harness, multi-host: GHES, GitLab and other non-default hosts satisfy host-qualified entries.
  • Pragmatic as npm: the remediation says which file to change and the exact entry to write.

Panel summary

Persona B R N Takeaway
Python Architect 0 1 0 Iteration-1 findings resolved. One deferred leftover: the undeclared-name raw version fallback.
Test Coverage Expert 0 1 0 Iteration-1 findings resolved; e2e 5/5. The explicit-proxy-URL lockfile side is deferred (it is lockfile identity).
Doc Writer 0 1 0 Iteration-1 findings resolved. BREAKING line now scoped to enforcement: block and apm audit --ci (folded).
Supply Chain Security Expert 0 2 0 Bypass closed and no new fail-open path. Hint is no longer a typosquat lever, and proxy identity is documented (both folded).
DevX UX Expert 0 1 0 Iteration-1 findings resolved. The hint now points to the policy require entry (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] Run full CI on this head once the 0.37 stack retargets main. The stacked base runs only license/cla. -- Only the local CI mirror has validated this head, and it touches a governed-by-policy surface.
  2. [Test Coverage Expert] Open an issue: explicit proxy-URL dependencies get a bare get_unique_key() but a host-qualified lock row, so required-packages-deployed reports a false failure. -- This predates the PR and fails closed, but enterprises that use proxy paths will hit it. The fix is a lockfile identity change, which [BUG] On a non-default host, no form of a dependencies.require entry passes both required-packages and required-packages-deployed #3993 excludes.
  3. [Spec] Open an issue for F2: how source replacement (req-rpl-002) interacts with require identity. -- Mirror and replacement setups are where host identity is most ambiguous.
  4. [Python Architect] In a follow-up, make the version check host-aware for names declared on no host, and update test_required_version_retains_locked_only_mismatch_detail deliberately. -- The mismatch detail can point at the wrong row during triage.
  5. [Doc Writer] Add the enterprise policy-reference cross-link after docs: zero-based redesign around the agent supply chain #3996 moves the page.

Recommendation

Merge with the stack once full CI is green after the 0.37 stack retargets main. Every iteration-1 and delta finding is either folded or deferred with an explicit scope boundary, and both deferrals fail closed. The highest-signal item to track after merge is the explicit proxy-URL lockfile identity issue.


Full per-persona delta findings (reviewed at 746d783; folds at 3dc87b0)

Python Architect

  • [recommended] find_or_undeclared keeps a host-blind raw lock lookup for names declared on no host (src/apm_cli/policy/matcher.py:129). -- Deferred: the behavior is pinned by an existing test and outside scope. The stale comment was refreshed.

Test Coverage Expert

  • [recommended] The written-host rule for explicit proxy-URL dependencies is tested only on the manifest side, and the lockfile side shows a false failure (tests/unit/policy/test_required_package_host_identity.py:168). -- Deferred: this is lockfile identity and predates this PR. The docs steer users to PROXY_REGISTRY_URL.

Doc Writer

  • [recommended] The BREAKING line overstated the failure (CHANGELOG.md:12). -- Folded.

Supply Chain Security Expert

  • [recommended] The wrong-host hint invited rewriting the policy to the declared host, a typosquat lever (src/apm_cli/policy/policy_checks.py:269). -- Folded: the hint asks for the manifest fix first, and the policy rewrite applies only to a trusted host.
  • [recommended] Explicit proxy-path identity was undocumented (docs/src/content/docs/reference/policy-schema.md:165). -- Folded.

DevX UX Expert

  • [recommended] The required-packages hint did not name the policy require entry as the place to fix (src/apm_cli/policy/policy_checks.py:245). -- Folded.

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-review-worker. This comment is AI-generated and may contain errors.

Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Addresses the spec and code panels on #4008:
- drop the registry-proxy exception: require uses the same effective
  host as allow/deny, so a proxy-shaped URL on any host can no longer
  satisfy a github.com entry (supply-chain rec-1, spec panels)
- read lock rows only via RequiredPackageMatch.locked_in; the version
  pin never compares a same-path row from another host (architect
  rec-1/rec-2); guard now rejects any other lock accessor
- name the entry to write in the check message, which apm audit --ci
  prints; split deployed failures by cause (test-coverage rec-1,
  devx rec-1/rec-2)
- req-pl-018: effective host honours manifest default_host:, which
  never rebinds a hostless entry (OCI blocker); violation routed
  through enforcement; first match in declaration order; dotless
  hosts, portability, 9.2 classification, explicit count
- e2e covers the real github.com default host; conformance covers the
  lockfile side, no-skip, local paths and manifest default_host:
- CHANGELOG marked BREAKING with default-host wording (docs, devx)

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Delta panel folds on #4008:
- the message names the declared host and the required host, asks to
  declare the package on the required host first, and offers the
  policy rewrite only for a trusted host, since the declared host may
  be a typosquat (supply-chain delta rec-1); it says the fix is the
  policy require entry, not apm.yml (devx delta rec-1)
- CHANGELOG: failure is under `enforcement: block`, and the command
  is `apm audit --ci` (docs delta rec-1)
- docs: explicit registry-proxy paths are identified by the proxy
  host; prefer PROXY_REGISTRY_URL with shorthand (supply-chain delta
  rec-2)
- refresh the stale version-check comment (architect delta)

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
On a non-default host (GitLab, GHES, Gitea) no require entry could pass
both required-packages and required-packages-deployed: the manifest
side compared the host-blind canonical name while the lockfile is keyed
by host, and the deployed check skipped entries it could not resolve.

DependencyPolicyIndex.find now resolves a require entry to one declared
dependency by path AND host (hostless = default host; registry-proxy
hosts are transport), and the lockfile row is addressed by that
dependency's own unique key. Unresolved entries fail both checks with
the expected entry form; nothing is skipped. The policy-identity
architecture guard now forbids skips and host-blind lock lookups.

Fixes #3993

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Delta panel folds on #4008:
- the message names the declared host and the required host, asks to
  declare the package on the required host first, and offers the
  policy rewrite only for a trusted host, since the declared host may
  be a typosquat (supply-chain delta rec-1); it says the fix is the
  policy require entry, not apm.yml (devx delta rec-1)
- CHANGELOG: failure is under `enforcement: block`, and the command
  is `apm audit --ci` (docs delta rec-1)
- docs: explicit registry-proxy paths are identified by the proxy
  host; prefer PROXY_REGISTRY_URL with shorthand (supply-chain delta
  rec-2)
- refresh the stale version-check comment (architect delta)

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
After the stack restack, 0.1.66 is present in Appendix D, so the
row no longer calls the version reserved.

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
@danielmeppiel
Daniel Meppiel (danielmeppiel) changed the base branch from danielmeppiel-docs-037-native to danielmeppiel-native-hook-delivery November 20, 2026 01:51
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Base automatically changed from danielmeppiel-native-hook-delivery to main November 20, 2026 06:40
@danielmeppiel
Daniel Meppiel (danielmeppiel) merged commit e6358a9 into main Nov 20, 2026
1 check passed
@danielmeppiel
Daniel Meppiel (danielmeppiel) deleted the danielmeppiel-scaling-potato branch November 20, 2026 06:41
@danielmeppiel Daniel Meppiel (danielmeppiel) added this to the 0.37.0 milestone Nov 20, 2026
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] On a non-default host, no form of a dependencies.require entry passes both required-packages and required-packages-deployed

1 participant