Skip to content

feat(registry): align object-form registry deps with git skills: - #2166

Merged
Daniel Meppiel (danielmeppiel) merged 9 commits into
microsoft:mainfrom
nadav-y:feat/registry-skills-subset
Aug 4, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 9 commits into
microsoft:mainfrom
nadav-y:feat/registry-skills-subset

Conversation

@nadav-y

@nadav-y Nadav Yogev (nadav-y) commented Jul 12, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Object-form git dependencies (- git: ...) have long supported a skills: array to install a subset of skills from a SKILL_BUNDLE package. The registry-longhand form (- id: owner/repo, registry:, version:) rejected the same field as an unknown key, with no way to narrow which skills get deployed. This aligns registry-longhand with git-longhand by reusing the same parse_skill_subset validator (non-empty, no path traversal, sorted+deduped).
  • Also fixes to_apm_yml_entry(), which had no branch for source == "registry": any registry dependency with a skill/target subset set (e.g. via apm install --skill ... --save) previously serialized as a malformed git: entry, and even an alias-only registry entry collapsed to a bare canonical string, silently dropping registry:/id:/version:.

Test plan

  • Added unit tests in tests/unit/test_reference_registry_shorthand.py::TestObjectFormRegistry covering: parsing skills:, empty-list rejection, path-traversal rejection, round-trip through to_apm_yml_entry(), and that alias-only registry entries no longer collapse to a plain string.
  • Full relevant suite passes (test_reference_registry_shorthand.py, test_skill_subset_persistence.py, and broader dependency/install/lockfile tests).
  • Verified end-to-end against a live registry: published a package with 4 skills, installed a consumer with skills: [skill-alpha, skill-beta], confirmed only 2 skills were deployed to .claude/skills/, and apm.lock.yaml's skill_subset matched exactly.

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.

Pull request overview

Aligns registry object-form dependency parsing/serialization with the existing git object-form behavior by allowing a skills: subset and ensuring registry deps round-trip correctly through to_apm_yml_entry(). This improves manifest fidelity when users install a subset of skills from a registry-hosted SKILL_BUNDLE and then persist it back to apm.yml.

Changes:

  • Accept skills: on registry longhand (id/registry/version) entries by reusing the shared parse_skill_subset validator.
  • Add a dedicated source == "registry" branch in DependencyReference.to_apm_yml_entry() so registry deps serialize as registry dict entries rather than malformed git entries.
  • Add unit tests covering registry skills: parsing, validation, and round-trip serialization.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
tests/unit/test_reference_registry_shorthand.py Adds unit tests for registry object-form skills: parsing/validation and to_apm_yml_entry() round-trips.
src/apm_cli/models/dependency/reference.py Adds skills: support to registry object-form parsing and adds a registry serialization branch in to_apm_yml_entry().

Nadav Yogev (nadav-y) added a commit to nadav-y/apm that referenced this pull request Jul 12, 2026
Copilot review on microsoft#2166 correctly flagged that the new source == "registry"
branch in to_apm_yml_entry() dropped target_subset: set_target_subset_for_entry()
sets ref.target_subset directly and calls to_apm_yml_entry(), so a registry
dependency's targets: write-back was silently lost.

Since the PR's premise is full parity with git-longhand (which already
supports both skills: and targets:), close the gap by adding targets:
parsing/validation to the registry object-form parser (same
parse_target_subset validator as git/local-path forms) and emitting it in
to_apm_yml_entry().

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@nadav-y

Copy link
Copy Markdown
Collaborator Author

Fixed the file-length CI failure: extracted _parse_registry_object_entry into a new sibling module models/dependency/registry_entry.py (matching the existing object_fields.py/subsets.py/identity.py/types.py pattern), scoped to just the registry object-form parsing this PR touches. reference.py was already at 2079 lines on main (the file driving the 2100-line cap); this PR's additions tipped it to 2124. Now back down to 2028.

@nadav-y

Copy link
Copy Markdown
Collaborator Author

Pushed d49e5784, fixing the must-fix bug from manual testing: apm install "owner/repo#version" --skill X was silently converting an existing registry-longhand dependency into a git-shaped entry.

Root cause: DependencyReference.parse() (the CLI positional parser) has no registry awareness — a bare string always parses with source=None. _resolve_package_references() serializes dep_ref.to_apm_yml_entry() for the --skill persistence path before the separate default-registry routing check runs, so the registry branch in to_apm_yml_entry() never fires for a freshly-parsed CLI arg — even when apm.yml already has that exact identity pinned to a registry.

Fix:

  • _resolve_package_references() now looks up the existing apm.yml entry for the identity up front; if it's source == "registry", propagates that onto the freshly-parsed dep_ref (and updates the probe-skip routing condition accordingly, since routes_unscoped_to_registry treats an already-known registry source as "not ambiguous").
  • merge_structured_entry_into_current_deps() gets a defense-in-depth guard: refuses to overwrite a registry-sourced entry with a non-registry-shaped structured entry, regardless of which caller produced it.
  • Extracted the repeated identity-lookup loop into get_existing_dep_ref_for_identity().

Verified live against the real registry: the exact repro command now correctly leaves apm.yml as {id, registry, version, skills} and the lockfile resolves source: registry from the actual registry URL, instead of failing ls-remote (or worse, silently succeeding against a same-named GitHub repo).

Also confirmed via a separate manual test: the other finding (apm install --skill X with no positional package filters the deploy for that run but doesn't persist to apm.yml/lockfile at all) reproduces identically for plain git/local dependencies — it's a pre-existing, general gap in the --skill CLI flag's persistence path, unrelated to registry-longhand. Tracking separately rather than folding into this PR.

@nadav-y

Copy link
Copy Markdown
Collaborator Author

Fixed the Spec conformance gate / Mode B detector failure: my previous commit's fix in src/apm_cli/install/package_resolution.py (a critical path per OpenAPM v0.1) landed real behavioral changes with no spec citation.

Since this is a genuine bug fix (not a no-op refactor), I did the proper three-step ritual rather than reaching for apm-spec-waiver::

  • Added req-mf-022 (Section 4.3.2, consumer MUST) to docs/src/content/docs/specs/openapm-v0.1.md: a consumer MUST NOT silently rewrite an existing id:-form (registry-sourced) manifest entry into a git:-form entry when persisting a CLI-driven update (e.g. an additive --skill pin) for the same identity; an update that would otherwise replace a registry-sourced entry with a non-registry-shaped one MUST be rejected with a diagnostic.
  • Added the matching Appendix C row, Section 4.9/11.3.2 enumerations, and a revision-history entry (statement count 98 → 99, 93 → 94 MUST).
  • Added the manifest entry in openapm-v0.1.requirements.yml.
  • Added @pytest.mark.req("req-mf-022") in tests/spec_conformance/test_manifest_reqs.py, driving the real merge_structured_entry_into_current_deps behavior (not just a spec-text grep).
  • Regenerated CONFORMANCE.{md,json}.

Verified locally: orphan_check reports 99 requirements aligned across anchors/manifest/Appendix C/markers, the full tests/spec_conformance/ suite passes (132 passed, 2 skipped — pre-existing unrelated waivers), and mode_b_detector.sh now short-circuits cleanly ("spec-concurrent edit detected; orphan_check owns this PR"). Pushed as 959bb649.

@nadav-y Nadav Yogev (nadav-y) added the panel-review Request an advisory PR review; consumed after review. Not human approval or a merge gate. label Jul 12, 2026
@nadav-y
Nadav Yogev (nadav-y) force-pushed the feat/registry-skills-subset branch from 959bb64 to f3bf2ce Compare July 20, 2026 12:25
Nadav Yogev (nadav-y) added a commit to nadav-y/apm that referenced this pull request Jul 20, 2026
Copilot review on microsoft#2166 correctly flagged that the new source == "registry"
branch in to_apm_yml_entry() dropped target_subset: set_target_subset_for_entry()
sets ref.target_subset directly and calls to_apm_yml_entry(), so a registry
dependency's targets: write-back was silently lost.

Since the PR's premise is full parity with git-longhand (which already
supports both skills: and targets:), close the gap by adding targets:
parsing/validation to the registry object-form parser (same
parse_target_subset validator as git/local-path forms) and emitting it in
to_apm_yml_entry().

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@nadav-y

Copy link
Copy Markdown
Collaborator Author

Rebased onto latest main (64a7fb51) and resolved conflicts:

  • src/apm_cli/models/dependency/reference.py: import-block conflicts only (main added a new ProviderCoordinateMixin base class unrelated to this PR) — trivially merged, both changes coexist cleanly.
  • docs/src/content/docs/specs/openapm-v0.1.md / requirements manifest / CONFORMANCE.{md,json}: main independently landed its own req-mf-022 in the meantime (closes [BUG] apm install --skill <name> is a silent no-op when the skill is not in the plugin.json skills array #2116 — diagnosing a stale skills: subset matching zero available skills), a genuine ID collision with the citation I'd added for this PR. Renumbered mine to req-mf-023 and reconciled all the count sites (Appendix C, Section 1.3, revision history: 104 → 105, 99 → 100 MUST).

Re-verified after rebase: full relevant suite (3302 passed, same 2 pre-existing unrelated test_registry_import_error failures as before), orphan_check (105 requirements aligned), mode_b_detector.sh (short-circuits cleanly), and gh pr view now reports mergeable: MERGEABLE. Force-pushed as f3bf2ce7.

Nadav Yogev (nadav-y) added a commit to nadav-y/apm that referenced this pull request Jul 26, 2026
Copilot review on microsoft#2166 correctly flagged that the new source == "registry"
branch in to_apm_yml_entry() dropped target_subset: set_target_subset_for_entry()
sets ref.target_subset directly and calls to_apm_yml_entry(), so a registry
dependency's targets: write-back was silently lost.

Since the PR's premise is full parity with git-longhand (which already
supports both skills: and targets:), close the gap by adding targets:
parsing/validation to the registry object-form parser (same
parse_target_subset validator as git/local-path forms) and emitting it in
to_apm_yml_entry().

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@nadav-y
Nadav Yogev (nadav-y) force-pushed the feat/registry-skills-subset branch from f3bf2ce to 67ba729 Compare July 26, 2026 13:06
Nadav Yogev (nadav-y) added a commit to nadav-y/apm that referenced this pull request Aug 3, 2026
Copilot review on microsoft#2166 correctly flagged that the new source == "registry"
branch in to_apm_yml_entry() dropped target_subset: set_target_subset_for_entry()
sets ref.target_subset directly and calls to_apm_yml_entry(), so a registry
dependency's targets: write-back was silently lost.

Since the PR's premise is full parity with git-longhand (which already
supports both skills: and targets:), close the gap by adding targets:
parsing/validation to the registry object-form parser (same
parse_target_subset validator as git/local-path forms) and emitting it in
to_apm_yml_entry().

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@nadav-y
Nadav Yogev (nadav-y) force-pushed the feat/registry-skills-subset branch from 67ba729 to 64be936 Compare August 3, 2026 07:37
@nadav-y

Copy link
Copy Markdown
Collaborator Author

Rebased onto latest main (66 commits ahead) and resolved conflicts:

  • reference.py: a docstring-only conflict in to_apm_yml_entry() (main reworded the "all other deps" line for an unrelated case-preservation fix) — merged both descriptions.
  • install.py: main introduced a manifest_identities frozen-snapshot fix for a same-batch-duplicate-identity bug, independent of my try/except addition — kept both.
  • Spec files: main independently landed 3 more requirements in the meantime (107 → 108 total now). req-mf-023 was still free, so no renumbering needed this time — just count reconciliation.
  • New this round: rebasing pushed install.py back over the 2100-line file-length cap (main's own baseline had grown from 2088 toward the ceiling). Extracted the two small additions into package_resolution.py helpers (propagate_existing_registry_source, try_update_existing_dependency_entry) — install.py now sits at exactly 2100 lines (verified against the guardrail's own NR > max check, which passes at equality). This also required repointing one test's mock target (test_provenance_recorded_in_probe_skip_bypass) since the patched name moved modules.

Verified post-rebase: 3411 tests pass (only the same pre-existing, environment-specific test_pipeline_raises_direct_dependency_error failure — caused by this checkout's own .claude/+.github/copilot-instructions.md markers confusing an un-isolated test, unrelated to this PR), orphan_check reports 108 requirements aligned, mode_b_detector.sh short-circuits cleanly, and file-length guardrail shows zero violations. Force-pushed as 64be9362e; mergeable: MERGEABLE.

Daniel Meppiel (danielmeppiel) added a commit to nadav-y/apm that referenced this pull request Aug 4, 2026
Fold items from shepherd-driver run:
- CHANGELOG.md: add [Unreleased] entry for feat(registry) PR microsoft#2166
  describing skills:/targets: parity for registry object-form deps
- .apm/instructions/architecture.instructions.md: remove duplicate
  'Effective package target authorization' row and remove the stale
  mcp_integrator_install.py selector from 'Effective install target
  selection' (already owned by 'MCP target-selection precedence').
  Aligns with the same fix already landed on main in f87104f.
- .github/instructions/architecture.instructions.md: same fix.

Co-authored-by: Copilot <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit to nadav-y/apm that referenced this pull request Aug 4, 2026
…, CHANGELOG reword

- Add verbose_detail log in propagate_existing_registry_source success path so
  --verbose mode shows source-propagation decisions (cli-logging-expert finding)
- Reword CHANGELOG entry to lead with user benefit instead of internal method name
  to_apm_yml_entry() (devx-ux + oss-growth-hacker finding)
- Add skills:/targets: example to manifest-schema.md registry dep section so the
  feature is discoverable from the reference page (oss-growth-hacker + doc-writer)
- Add one-line note to install.md --skill flag: applies to both git-longhand and
  registry-longhand deps (devx-ux-expert finding)

Shepherd fold commit (panel pass, PR microsoft#2166).

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

Copy link
Copy Markdown
Collaborator

APM Review Panel: ship-with-follow-ups

High-quality community parity fix with no blocking findings -- ship with docs follow-up PR.

cc Nadav Yogev (@nadav-y) Daniel Meppiel (@danielmeppiel) Sergio Sisternes (@sergio-sisternes-epam) -- a fresh advisory pass is ready for your review.

Nine panelists reviewed this PR; zero genuine blocking findings emerged. The implementation is architecturally sound: clean module extraction, correct source-propagation semantics, and 292 new test lines covering the critical surfaces. Three panelists independently flagged the same docs gap (manifest-schema.md and install.md lack registry+skills examples) -- the shepherd folded those into the current commit so the feature is already discoverable from the reference page. The double-scan inefficiency noted by python-architect and performance-expert adds less than 15ms against seconds of network I/O, making it a nit rather than a required refactor. This is exactly the kind of community contribution we want to reward with fast merge and clear follow-up guidance.

Aligned with: parity: registry-longhand deps now support skills:/targets: subsets matching git-longhand, closing a first-class feature gap; zero-footgun: fixes silent registry-to-git source conversion that caused surprising behavior on apm install; spec-driven: adds req-mf-023 conformance requirement, strengthening the manifest contract; testability: 292 new test lines exercise the parser extraction and source-propagation semantics.

Growth signal. Story angle for next release notes: 'Registry deps are now first-class -- skills/targets subsets work without switching to git-longhand.' A follow-up docs PR adding manifest-schema.md examples converts this from an invisible fix into a discoverable feature that reinforces APM's parity promise.

Panel summary

Persona B R N Takeaway
Python Architect 0 1 2 Clean extraction + source-propagation fix; parameter-passing pattern is sound; one double-scan inefficiency in the hot path worth calling out.
CLI Logging Expert 0 0 1 Error path is well-surfaced; silent source propagation now has verbose breadcrumb (folded).
DevX UX Expert 0 0 1 Good parity fix; error message is well-crafted. CLI reference docs updated (folded).
Supply Chain Security Expert 0 0 2 No blocking security issues. Path traversal guards are correctly applied; registry-to-git conversion is properly gated.
OSS Growth Hacker 0 0 1 Strong parity fix removes a real footgun; CHANGELOG entry is solid; docs example folded.
Doc Writer 0 0 1 Spec req-mf-023 is valid and correctly added. Reference docs updated (folded).
Test Coverage Expert 0 1 0 Critical surfaces well-covered. One defense-in-depth error-routing path in install.py lacks a command-level assertion.
Performance Expert 0 0 2 Repeated O(n) manifest scans are algorithmically wasteful but add <15ms vs seconds of network I/O -- nit only.

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

Top 3 follow-ups

  1. [Python Architect] get_existing_dep_ref_for_identity called twice per package (propagate + skill merge) -- thread existing_ref to avoid redundant O(n) scan per install loop iteration.
  2. [Test Coverage Expert] Add command-level test exercising try_update_existing_dependency_entry error path through _resolve_package_references -- defense-in-depth error routing is untested at integration level; a regression here would surface only in production.
  3. [Performance Expert] _check_package_conflicts parses all entries then discards them; returning Dict[identity, DependencyReference] would eliminate all downstream re-scans -- follow-up code quality improvement.

Architecture

classDiagram
    direction LR
    class DependencyReference {
      <<Dataclass>>
      +repo_url str
      +source str or None
      +registry_name str or None
      +skill_subset list or None
      +target_subset list or None
      +to_apm_yml_entry() str or dict
      +to_canonical() str
      +get_identity() str
      +parse(s) DependencyReference
      +parse_from_dict(d) DependencyReference
      +_parse_registry_object_entry(d) DependencyReference
    }
    class parse_registry_object_entry {
      <<Pure Function>>
      +__call__(cls, entry) DependencyReference
    }
    class propagate_existing_registry_source {
      <<IO Boundary>>
      +__call__(dep_ref, current_deps, identity) bool
    }
    class get_existing_dep_ref_for_identity {
      <<Pure Function>>
      +__call__(current_deps, identity) Any or None
    }
    class try_update_existing_dependency_entry {
      <<Adapter>>
      +__call__(...) tuple bool str or None
    }
    class merge_structured_entry_into_current_deps {
      <<IO Boundary>>
      +__call__(current_deps, entry, identity, ...) None
    }
    DependencyReference ..> parse_registry_object_entry : delegates via classmethod
    propagate_existing_registry_source ..> get_existing_dep_ref_for_identity : calls
    propagate_existing_registry_source ..> DependencyReference : mutates .source .registry_name
    try_update_existing_dependency_entry ..> merge_structured_entry_into_current_deps : wraps
    merge_structured_entry_into_current_deps ..> DependencyReference : parses entries
Loading
Per-persona detailed findings

Python Architect:

  • (recommended) get_existing_dep_ref_for_identity is called twice per package in the install loop: once in propagate_existing_registry_source and again via apply_cli_skill_pin -> get_existing_skill_subset. Each call is O(n) parse work on current_deps. Threading the already-found existing_ref would halve parse overhead for skill-pinned packages. (src/apm_cli/commands/install.py:421 + package_resolution.py:163-189)
  • (nit) propagate_existing_registry_source uses Any for dep_ref types; a lightweight Protocol with source/registry_name fields would make the mutation contract self-documenting.
  • (nit) try_update_existing_dependency_entry catches only ValueError; unexpected TypeError/AttributeError from parse could propagate; currently shielded by the inner loop but worth noting.

CLI Logging Expert:

  • (nit) ValueError message in package_resolution.py:374 uses curly/smart quotes around {identity}; ASCII single-quotes are more grep-friendly in terminal contexts.

DevX UX Expert:

  • (nit) Error message says "use the object form" but does not name apm.yml as the file to edit; adding "in apm.yml" would close the loop for users unfamiliar with the project structure.

Supply Chain Security Expert:

  • (nit) registry_name field accepts arbitrary strings without pattern validation (registry_entry.py:48) -- pre-existing behavior, not a regression.
  • (nit) version field for registry deps has no character restriction (registry_entry.py:70) -- pre-existing behavior.

Test Coverage Expert:

  • (recommended) try_update_existing_dependency_entry error path through _resolve_package_references (install.py:499-503) is not exercised at command level. The underlying ValueError from merge_structured_entry_into_current_deps IS tested at unit level, but the routing from error to invalid_outcomes + user-visible diagnostic has no assertion. Suggested test: mock propagation to return False on a registry dep, then verify invalid_outcomes contains the expected message.

Performance Expert:

  • (nit) Redundant double-scan of current_deps for same identity per install loop iteration (install.py:421 + package_resolution.py:184). Adds <15ms at n=50; algorithmic nit.
  • (nit) _check_package_conflicts parses all entries into a Set[identity] then discards the parsed objects; returning Dict[identity, DependencyReference] would eliminate all downstream re-scans for a clean O(n) + O(m) total.

Nadav Yogev (nadav-y) and others added 7 commits August 4, 2026 09:57
…lls:

Object-form git dependencies (- git: ...) have long supported a skills:
array to install a subset of a SKILL_BUNDLE package. The registry-longhand
form (- id: owner/repo, registry:, version:) rejected the same field as
unknown, with no way to narrow which skills get deployed.

Reuses the existing parse_skill_subset validator so both forms share
identical validation (non-empty, no path traversal, sorted+deduped).

Also fixes to_apm_yml_entry(), which had no branch for source == "registry"
at all: any registry dependency with a skill/target subset set (e.g. via
apm install --skill ... --save) would previously serialize as a malformed
git: entry, and even an alias-only registry entry collapsed to a bare
canonical string, silently dropping registry:/id:/version:.

Verified end-to-end against a live registry: published a package with 4
skills, installed a consumer with skills: [a, b], confirmed only 2 were
deployed and apm.lock.yaml's skill_subset matched.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Copilot review on microsoft#2166 correctly flagged that the new source == "registry"
branch in to_apm_yml_entry() dropped target_subset: set_target_subset_for_entry()
sets ref.target_subset directly and calls to_apm_yml_entry(), so a registry
dependency's targets: write-back was silently lost.

Since the PR's premise is full parity with git-longhand (which already
supports both skills: and targets:), close the gap by adding targets:
parsing/validation to the registry object-form parser (same
parse_target_subset validator as git/local-path forms) and emitting it in
to_apm_yml_entry().

Co-Authored-By: Claude Sonnet 5 <[email protected]>
…le-length gate

CI's file-length guardrail failed: reference.py was already at 2079 lines on
main (the existing worst offender driving the 2100-line cap) and this PR's
additions tipped it to 2124.

Move _parse_registry_object_entry into a new sibling module
models/dependency/registry_entry.py, matching the existing pattern of
object_fields.py/subsets.py/identity.py/types.py -- reference.py delegates
via a thin classmethod wrapper. The new module takes the DependencyReference
class as a parameter instead of importing it, so there's no import cycle.

reference.py: 2124 -> 2028 lines. Scoped to only the registry object-form
parsing this PR touches; the rest of reference.py (git/URL shorthand
parsing, GitLab/ADO handling, virtual package detection) is untouched.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Repro: apm.yml already has an object-form registry dependency
(`- id: owner/repo`, `version: ...`). Running
`apm install "owner/repo#1.0.0" --skill some-skill` rewrote that entry into
a `git:`-shaped structured entry and then failed ls-remote (or worse,
silently succeeded if `owner/repo` also happened to resolve as a real
GitHub repo -- a dependency-confusion-shaped footgun).

Root cause: DependencyReference.parse() (the CLI positional parser) has no
registry awareness -- source is always None/"git" for a bare string. The
--skill code path in _resolve_package_references() calls
dep_ref.to_apm_yml_entry() before the (separate) default-registry routing
check runs, so the registry-aware branch in to_apm_yml_entry() never fires
for a freshly-parsed CLI arg, even when apm.yml already has this exact
identity pinned to a registry.

Fix:
- _resolve_package_references() now looks up the existing apm.yml entry for
  the parsed identity before doing anything else; if it's source=="registry",
  propagate source/registry_name onto the freshly-parsed dep_ref so
  to_apm_yml_entry() takes the registry branch, and route the probe-skip
  decision the same way (routes_unscoped_to_registry treats an already-
  known registry source as "not ambiguous", so the existing-registry fact
  has to be OR'd in explicitly).
- merge_structured_entry_into_current_deps() gets a defense-in-depth guard:
  refuse (ValueError, caught and reported as a normal invalid-package
  outcome) to overwrite a registry-sourced manifest entry with a non-
  registry-shaped structured entry, regardless of which upstream code path
  produced it.
- Extracted the repeated "parse current_deps entries, find the one matching
  this identity" loop into get_existing_dep_ref_for_identity() (used by the
  new check and by get_existing_skill_subset(), which had its own copy of
  the same loop).

Verified live against a real registry: the exact repro command now leaves
apm.yml as a proper id/registry/version dict with skills: added, and
apm.lock.yaml resolves it as source: registry from the actual registry URL.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
…rewrite

Spec-citation fold closing the Mode B silent-extension gate on
src/apm_cli/install/package_resolution.py (the --skill registry-to-git
silent-conversion fix).

Rebased onto latest main again (now at 107 normative statements, up from
104); req-mf-023 remains available (main's own concurrent additions used
req-lk-021, req-lk-022, req-sc-013, req-tg-008 instead).

Added req-mf-023 (Section 4.3.2, consumer MUST): a consumer MUST NOT
silently rewrite an existing id:-form (registry-sourced) manifest entry
into a git:-form entry when persisting a subsequent CLI-driven update
(e.g. an additive --skill pin) for the same dependency identity; the
existing entry's source MUST be honored, and an update that would
otherwise replace a registry-sourced entry with a non-registry-shaped
entry MUST be rejected with a diagnostic naming the identity.

Three-step ritual: spec anchor + Appendix C row + Section 4.9/11.3.2
enumerations + revision history row (counts: 107 -> 108, 102 -> 103 MUST);
manifest entry in openapm-v0.1.requirements.yml; @pytest.mark.req
("req-mf-023") test driving the real merge_structured_entry_into_current_deps
behavior. Regenerated CONFORMANCE.{md,json}. orphan_check passes (108
requirements aligned).

Co-Authored-By: Claude Sonnet 5 <[email protected]>
main's install.py grew from 2088 to (still under 2100) since the last
rebase, and this PR's --skill registry-preservation fix tipped it back
over. Extract the two small additions into package_resolution.py helpers:

- propagate_existing_registry_source(): the existing-entry lookup +
  source/registry_name propagation, replacing a 16-line inline block
  with a 3-line call.
- try_update_existing_dependency_entry(): wraps
  update_existing_dependency_entry_if_needed() and returns
  (updated, error) instead of raising, so the call site collapses from a
  try/except to a plain if-check.

install.py: 2119 -> 2100 lines (exactly at the cap; verified against the
CI guardrail's own NR > max check, which passes at equality).

Updated test_install_resolve_refs.py's
TestResolvePackageReferencesProbeSkipProvenance test: it patched
apm_cli.commands.install.update_existing_dependency_entry_if_needed,
which no longer exists in that module's namespace now that install.py
calls the new wrapper instead -- repointed the patch to
apm_cli.install.package_resolution.update_existing_dependency_entry_if_needed,
where the wrapper actually calls it from.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Fold items from shepherd-driver run:
- CHANGELOG.md: add [Unreleased] entry for feat(registry) PR microsoft#2166
  describing skills:/targets: parity for registry object-form deps
- .apm/instructions/architecture.instructions.md: remove duplicate
  'Effective package target authorization' row and remove the stale
  mcp_integrator_install.py selector from 'Effective install target
  selection' (already owned by 'MCP target-selection precedence').
  Aligns with the same fix already landed on main in f87104f.
- .github/instructions/architecture.instructions.md: same fix.

Co-authored-by: Copilot <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit to nadav-y/apm that referenced this pull request Aug 4, 2026
…, CHANGELOG reword

- Add verbose_detail log in propagate_existing_registry_source success path so
  --verbose mode shows source-propagation decisions (cli-logging-expert finding)
- Reword CHANGELOG entry to lead with user benefit instead of internal method name
  to_apm_yml_entry() (devx-ux + oss-growth-hacker finding)
- Add skills:/targets: example to manifest-schema.md registry dep section so the
  feature is discoverable from the reference page (oss-growth-hacker + doc-writer)
- Add one-line note to install.md --skill flag: applies to both git-longhand and
  registry-longhand deps (devx-ux-expert finding)

Shepherd fold commit (panel pass, PR microsoft#2166).

Co-authored-by: Copilot <[email protected]>
…, CHANGELOG reword

- Add verbose_detail log in propagate_existing_registry_source success path so
  --verbose mode shows source-propagation decisions (cli-logging-expert finding)
- Reword CHANGELOG entry to lead with user benefit instead of internal method name
  to_apm_yml_entry() (devx-ux + oss-growth-hacker finding)
- Add skills:/targets: example to manifest-schema.md registry dep section so the
  feature is discoverable from the reference page (oss-growth-hacker + doc-writer)
- Add one-line note to install.md --skill flag: applies to both git-longhand and
  registry-longhand deps (devx-ux-expert finding)

Shepherd fold commit (panel pass, PR microsoft#2166).

Co-authored-by: Copilot <[email protected]>
During the rebase conflict resolution the HTML anchor in section 4.3.2
was left as <a id="req-mf-023"> and req-mf-024 was not added to the
consumer-requirement enumeration lists in sections 4.9 and 11.3.2.
Fix all three, then verify orphan_check passes (111 reqs aligned).

Rebase conflict-resolution fixup (shepherd-driver, PR microsoft#2166).

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

Copy link
Copy Markdown
Collaborator

Shepherd-driver terminal state: advisory-with-deferred

Head: e24789810e4d46d21e5b2d2e7c7e048c7e7384dd | CI: green (17/17) | Mergeable: MERGEABLE | Gate: required-review only

All shepherd-driver work is complete. Summary:

Folded (committed):

  • Copilot review: 4 LEGIT items (missing targets: in registry object-form) -- pre-resolved by author in 48bd1e89a
  • CHANGELOG [Unreleased] entry with user-benefit framing (b6ed67f02)
  • install.py: verbose_detail log when registry source is preserved (31c838d4d)
  • manifest-schema.md: registry skills:/targets: example (31c838d4d)
  • install.md: --skill note updated for registry-longhand (31c838d4d)

Deferred (out-of-scope follow-ups):

  1. python-architect: double O(n) scan in package_resolution.py -- performance improvement, not a regression, deferred to a follow-up
  2. test-coverage-expert: command-level integration test for --skill with malformed registry object-form -- new test infra needed, deferred

Owner-touch gate (v2): owner-extension classification, reference.py touched (canonical owner: dependency identity/materialization path), dual-guardrail satisfied -- behavioral test, static guard, architecture test, and mutation-break all confirmed on exact head.

Spec: req-mf-024 (registry identity preservation) at spec line 574; req-mf-023 (VS Code OCI/Docker, from main 0.1.26) at line 679 -- no collision.

No auto-merge; awaiting required maintainer review.

@danielmeppiel
Daniel Meppiel (danielmeppiel) merged commit 98d2d9b into microsoft:main Aug 4, 2026
18 checks passed
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Aug 4, 2026
The CI file-length guardrail (2100 lines) failed on
src/apm_cli/commands/install.py at 2111 lines -- drift that landed on
main via #2166 and #2200, surfaced here because CI evaluates the merge
commit.

Move `_get_invocation_argv` and `_split_argv_at_double_dash` (plus the
explanatory block comment on Click's `--` swallowing) into the new
`apm_cli/install/argv.py`. `commands/mcp.py` already reached through
`commands/install.py` for both helpers, so they were never
install-specific; `commands/install.py` re-exports them so the
`_get_invocation_argv` test seam keeps working unchanged.

install.py: 2111 -> 2080 lines. Ratchet the architecture invariant
budget 2150 -> 2100 to match the CI guardrail.

Validation: lint mirror green (ruff check + format, pylint R0801,
auth-signals), architecture boundary lint clean, file-length guard
clean, 2084 tests pass across tests/unit/install/ and
tests/integration/test_architecture_authorities.py.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 11dbb707-3685-4a9e-80a4-19c73831232a
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Aug 5, 2026
* chore: release v0.28.0

Bump pyproject.toml and uv.lock to 0.28.0 and convert the [Unreleased]
CHANGELOG block into [0.28.0] - 2026-08-04 with one "so what" entry per
user-facing PR merged since v0.27.0. MINOR is warranted: registry
object-form dependencies gained new `skills:`/`targets:` manifest fields
(#2166) and two new xAI Grok targets landed (#2420), alongside the Kiro
agents primitive (#2440). Lint mirror is green locally (ruff check +
format, pylint R0801, auth-signals).

Post-merge: tag v0.28.0 to trigger the release workflow.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 11dbb707-3685-4a9e-80a4-19c73831232a

* refactor(install): extract argv boundary helpers to unblock length gate

The CI file-length guardrail (2100 lines) failed on
src/apm_cli/commands/install.py at 2111 lines -- drift that landed on
main via #2166 and #2200, surfaced here because CI evaluates the merge
commit.

Move `_get_invocation_argv` and `_split_argv_at_double_dash` (plus the
explanatory block comment on Click's `--` swallowing) into the new
`apm_cli/install/argv.py`. `commands/mcp.py` already reached through
`commands/install.py` for both helpers, so they were never
install-specific; `commands/install.py` re-exports them so the
`_get_invocation_argv` test seam keeps working unchanged.

install.py: 2111 -> 2080 lines. Ratchet the architecture invariant
budget 2150 -> 2100 to match the CI guardrail.

Validation: lint mirror green (ruff check + format, pylint R0801,
auth-signals), architecture boundary lint clean, file-length guard
clean, 2084 tests pass across tests/unit/install/ and
tests/integration/test_architecture_authorities.py.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 11dbb707-3685-4a9e-80a4-19c73831232a

---------

Co-authored-by: danielmeppiel <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 11dbb707-3685-4a9e-80a4-19c73831232a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

panel-review Request an advisory PR review; consumed after review. Not human approval or a merge gate.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants