Repository navigation
fix(manifest): preserve x-* extension keys and warn on unknown apm.yml keys - #3222
Conversation
…l keys (microsoft#3219) Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
🟡 Changes recommended
Extension-key validation conflicts with the OpenAPM grammar, known-key handling has false positives and negatives, and the changelog references the issue rather than the PR.
6 open findings
Do not whitelist unsupported source key · New Include tags in the known metadata keys · New Reject invalid vendor extension key formats · New Use the pull request number in the changelog · New Document the exact vendor extension grammar · New Use the exact vendor extension grammar in the guide · New
What changed in this PR
Preserves manifest vendor extensions through dependency locking and warns about unknown keys.
Changes:
- Adds extension collection, propagation, and lockfile serialization.
- Adds tests for parsing, warnings, and lockfile round-trips.
- Documents the behavior and updates the changelog.
| File | Description |
|---|---|
src/apm_cli/models/apm_package.py |
Collects extensions and warns on unknown keys. |
src/apm_cli/deps/installed_package.py |
Carries resolved package extensions. |
src/apm_cli/deps/lockfile.py |
Reads and writes extension metadata. |
src/apm_cli/install/sources.py |
Propagates extensions across install sources. |
tests/unit/test_manifest_extension_keys.py |
Tests parsing and lock behavior. |
docs/src/content/docs/reference/manifest-schema.md |
Documents manifest extensions. |
docs/src/content/docs/reference/lockfile-spec.md |
Documents the lockfile field. |
packages/apm-guide/.apm/skills/apm-usage/package-authoring.md |
Updates authoring guidance. |
CHANGELOG.md |
Records the fix. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Mohammed Alkindi (MohammedAlkindi)
left a comment
There was a problem hiding this comment.
I ran this head on Windows (Python 3.13.5) with foo: bar in a project's apm.yml. Two things in the warning:
_ascii_token(manifest_path) goes through ascii(), which escapes backslashes, so the path prints as C:\\Users\\...\\apm.yml. Keeping ascii() for the keys and rendering the path with .as_posix() would avoid that.
apm install ./sub --dry-run prints the warning twice, once from the prospective from_mapping call in commands/install.py and once from from_apm_yml. Plain install, audit --ci and compile --dry-run print it once.
…osoft#3219) Co-authored-by: Copilot <[email protected]>
…oft#3219) Co-authored-by: Copilot <[email protected]>
APM Review Panel:
|
| Persona | B | R | N | Takeaway |
|---|---|---|---|---|
| Python Architect | 0 | 2 | 0 | Known-key set and extension predicate need a single owner each; the lockfile round-trip via InstalledPackage and sources.py follows the existing pattern. |
| Test Coverage Expert | 0 | 1 | 0 | New tests cover preserve, round-trip, warn, and omit. Missing: invalid x- forms, plugin-synthesized manifests, dry-run double warning. |
| Doc Writer | 0 | 1 | 1 | Docs repeat the loose grammar; changelog references the issue, not the PR. |
Ship recommendation
needs_rework: fold items 1-3 (small, in scope), then this is ready for the CODEOWNER review. The panel is advisory; the maintainer decides.
Notes
Reviewed from the diff and existing review threads only; no code was executed. Existing reviewer reviewRequests (@danielmeppiel) are unchanged. No CODEOWNER comments were present that condition this review.
Generated by PR Review Panel for #3222 · copilot · auto · 38 AIC · ⌖ 0.532 AIC · ⊞ 10.1K · ◷
APM Review Panel:
|
Co-authored-by: Copilot App <[email protected]> Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a
APM Review Panel:
|
| Persona | B | R | N | Takeaway |
|---|---|---|---|---|
| Python Architect | 0 | 0 | 0 | Callback design retains the existing parser owner. |
| Test Coverage Expert | 0 | 0 | 0 | CLI and schema regression traps have executed mutation evidence. |
| CLI Logging Expert | 0 | 0 | 0 | Windows paths and duplicate dry-run output are corrected. |
| DevX UX Expert | 0 | 0 | 0 | Diagnostics remain readable and non-duplicative. |
| Supply Chain Security Expert | 0 | 0 | 0 | Earlier schema identity and name-constraint findings are resolved. |
| Doc Writer | 0 | 1 | 0 | Tracked PR-body correction was published and verified after this return. |
| Performance Expert | 0 | 0 | 0 | No new cache, I/O or algorithmic regression. |
B = blocking-severity findings, R = recommended, N = nits.
Counts describe the returned delta findings; the one tracked documentation recommendation is now addressed. No in-scope recommendation remains open.
Top 3 follow-ups
- [Spec OCI Editor] Complete Section 9.3 review and public comment before treating
.46andreq-ext-003as adopted. They remain explicitly proposed. - [Spec Package-Manager Editor] The actual extension-order concern is already resolved. Any broader YAML mapping-order convention is a separate scope decision; no new policy or follow-up issue was created here.
- [Spec Swagger Editor] A future whole-spec editorial sweep may standardize pre-existing informative
x-*shorthand. Existing references already point to the normative definition; this is outside [BUG] apm.yml silently drops x-* and unknown keys; they never reach apm.lock.yaml #3219.
Recommendation
The existing CEO stance is ship_now, with actual technical checks newly green at merge head 3b00a4fda171061a84028b50698a89665c124d01. GitHub reports the branch mergeable but still records an outstanding protection condition; the requested reviewer is unchanged. The maintainer must independently reconcile protection and review requirements before landing. This worker has not merged, waived checks, changed policy or requested reviews.
Full per-persona findings, folds and spec review
- Python Architect: no delta findings. Windows normalization, scoped callback and lazy console import close the earlier items.
- Test Coverage Expert: no delta findings. Real local CLI dry-run executes twice with one root warning each and no writes; synthesized plugin input exercises the producer path.
- CLI Logging Expert: no delta findings. Standalone warning fallback is retained, while prospective parse suppression is local.
- DevX UX Expert: no delta findings. Diagnostic and documentation semantics agree.
- Supply Chain Security Expert: no delta findings. The earlier
.41identity and unconstrained-name gaps are closed. Its overly broad "docs-only" summary is not used as runtime evidence; the other runtime reviewers and tests cover the callback/path changes. - Doc Writer: one carried recommendation to correct the PR conformance checklist. The published body now matches the verified artifact, documents
req-ext-003, names the canonical requirements-manifest path and distinguishes proposed from adopted status. - Performance Expert: no delta findings. Metadata scanning remains linear; no cache-key or filesystem-materialization redesign.
- Copilot: second and final fetch finds the same six legitimate original comments, all already resolved. No new comments or unresolved threads.
Fold commits: 4d688587aacf74c57097415be54f627bea03bb09 contains the warning/schema/docs/test folds; 8b128d4bf790595885d534aaec89af9ed95111d7 contains the final spec qualifier correction. Faithful main merges retain the contributor's original commits. The latest integration is 3b00a4fda171061a84028b50698a89665c124d01; original spec-fold attribution is unchanged.
Spec scope: editorial-patch; current spec/schema/manifest delta is +144/-14 across three files. Round 2:
| Panel | Score | New substantive findings | Editorial notes |
|---|---|---|---|
| Swagger editor | 8 | 0 | Pre-existing informative shorthand, outside scope. |
| OCI editor | 8 | 0 | Same pre-existing shorthand, outside scope. |
| Package-manager editor | 8 | 0 | One-word qualifier consistency, folded. |
| TAG architect | 8 | 0 | None. |
All nine round-1 folds are closed. The final narrow fold leaves the count at 129 statements (124 MUST, 5 SHOULD). The schema's true-end assertion rejects a trailing newline while leaving all extension values unconstrained.
Evidence qualifications: .41 publication was not established by this review; only its unchanged bytes are asserted. No global YAML-order requirement is introduced or needed to close the scoped order finding. Section 9.3 is not ratified by a panel, CI, this PR body or this advisory.
Owner evidence: real CLI lock proves parsed manifest -> installed dependency -> serialized lock -> lock reader propagation. Real CLI install --dry-run proves interpreted-manifest construction and install-scope consumption. Both selected tests passed at the exact head; the schema and semantic v2 verifiers passed.
This panel is advisory. The maintainer makes the landing decision.
Generated by autopilot-pr-merge-worker. This comment is AI-generated and may contain errors.
Address PR microsoft#3222 panel follow-ups and microsoft#3219 approved scope: render portable warning paths, suppress prospective dry-run duplicates, and cover actual plugin synthesis. Preserve schema identities through a distinct proposed .46 resource, align normative grammar, and retain opaque values and independent security requirements. New regression traps were mutation-tested before restoration. Co-authored-by: Copilot App <[email protected]> Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a
Co-authored-by: Copilot App <[email protected]> Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a
Co-authored-by: Copilot App <[email protected]> Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a
Co-authored-by: Copilot App <[email protected]> Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a
Preserve accepted microsoft#3100 changes alongside reviewed manifest extensions; refresh the GitHub mergeability state without rewriting contributor history. Co-authored-by: Copilot App <[email protected]> Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a
2bbda5f
into
microsoft:main
Refresh microsoft#3161 for independently landed microsoft#3222 and earlier microsoft#3100 before final exact-head lint and functional validation. Co-authored-by: Copilot App <[email protected]> Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a
Retain the scoped prune correction alongside the #3100 and #3222 changes. Co-authored-by: Copilot App <[email protected]> Copilot-Session: be82c181-49dd-4b8f-9e95-fca488acafe1
Faithfully preserve microsoft#3222 manifest extension/spec/schema/conformance changes alongside microsoft#3151 governed replay proof. Co-authored-by: Copilot App <[email protected]> Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a
Preserve microsoft#3237's docs-only clarification and earlier microsoft#3222/microsoft#3100 changes without altering microsoft#3151 scope. Co-authored-by: Copilot App <[email protected]> Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a
Preserve microsoft#3237 linked-resource lifetime clarification alongside microsoft#3222 and microsoft#3100. No implementation or scope change to microsoft#3161. Co-authored-by: Copilot App <[email protected]> Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a
…3251) Restore the release-gate integration suite (nightly + tag) to green: - runtime: route runtime setup/version/uninstall children through external_process_env so a frozen binary's bundled LD_LIBRARY_PATH / DYLD_* never leak into the setup script's python3 (ensurepip failed under the PyInstaller binary). - tests: align fixtures with contracts merged since v0.33.0 -- grok-bot skills_rel_root/supports on MagicMock targets (#3106), Cursor native flat hooks (#3149), frozen installs that never rewrite the lockfile (#2384), manifestless SKILL.md probe (#3064), unknown apm.yml key warning (#3222), resolved Claude config path (#3148), and the build-ID owner guard mutation case (#3113). - flakes: skip transient git maintenance files when snapshotting a bare fixture repo; widen multiprocess lock-test timeouts for slow runners. Co-authored-by: danielmeppiel <[email protected]> Co-authored-by: Copilot App <[email protected]> Copilot-Session: 761bf207-57da-41d0-bd3f-ffecbb97b83a


Description
TL;DR
Preserve top-level manifest keys matching
x-[a-z][a-z0-9-]*on the package model and each dependency's lock entry. Warn on other unknown top-level keys without failing solely because the key is unknown. Values remain opaque.Problem and approach
Previously, parsed manifests discarded vendor metadata and silently ignored other unknown keys. The accepted scope is issue #3219. Preserve metadata through the existing model and lock owners rather than adding a second parser.
Regression evidence follows the PROSE principle: "Grounding outputs in deterministic tool execution transforms probabilistic generation into verifiable action.".
Implementation
src/apm_cli/models/apm_package.pytags; normalize diagnostic paths before ASCII escaping.src/apm_cli/commands/install.pysrc/apm_cli/deps/{installed_package,lockfile}.py,src/apm_cli/install/sources.pyreq-ext-003; scope ordering to theextensionsmapping; preserve independent validation, policy and security failures..41bytes; add distinct proposed.46identity with name-only constraints.Trade-offs
Benefits
Issue and approved scope
Issue: #3219
Human scope-approval comment: #3219 (comment)
Does this PR complete the issue, or what remains? It completes the approved implementation scope. Extension-value validation and hard errors for unknown keys remain excluded.
Fixes #3219
Type of change
Testing
The full repository suite was not run locally. Exact-head technical CI is tracked in the consolidated review advisory, not inferred from local lint.
Validation
Validated head:
8b128d4bf790595885d534aaec89af9ed95111d7.Result: 362 passed, 2 skipped.
Canonical lint and boundary commands: all passed (exit 0)
CI-equivalent YAML I/O, 2100-line and portable-relative-path guards also passed using portable Python regex checks on macOS. All eleven spec-linter checks passed.
Scenario Evidence
Test paths below are under
tests/unit/test_manifest_extension_keys.pyunless specified.TestApmLockRecordsDependencyExtensions::test_lock_writes_dependency_extensionsTestApmLockRecordsDependencyExtensions::test_install_dry_run_warns_once_per_invocationTestParsedExtensions::test_windows_warning_path_is_portable_and_asciiwindows_compatTestParsedExtensions::test_synthesized_plugin_manifest_is_silentTestParsedExtensions::test_custom_warning_handler_preserves_extensionstests/spec_conformance/test_manifest_extension_reqs.py::test_extension_schema_checks_names_not_valuestests/spec_conformance/test_manifest_extension_reqs.py::test_extension_schema_preserves_previous_contractMutation checks removed path normalization, prospective suppression,
tagsrecognition, name constraints, callback routing and prior-schema compatibility. All ten selected cases failed without their guards; all guards were restored before final validation.How to test
x-team: platform; inspect its lock entry'sextensions.install ./sub --dry-run --no-policy; expect one warning and no manifest, lockfile or module writes.Spec conformance (OpenAPM v0.1)
If this PR changes behaviour that an OpenAPM v0.1
req-XXXcovers,confirm the three-step ritual in the
development guide:
docs/src/content/docs/specs/openapm-v0.1.mdupdated(new/changed
<a id="req-XXX"></a>anchor + prose + Appendix Crow).
docs/src/content/docs/specs/manifests/openapm-v0.1.requirements.ymlupdated.
@pytest.mark.req("req-XXX")test undertests/spec_conformance/added or extended.CONFORMANCE.{md,json}regenerated viauv run --extra dev python -m tests.spec_conformance.gen_statementand committed.
The template's manifest path is historical; the updated canonical file is
docs/public/specs/manifests/openapm-v0.1.requirements.yml. The generator command passed.req-ext-003brings the normative total to 129 (124 MUST, 5 SHOULD).Important
.46remains a proposed schema/spec amendment pending Section 9.3 approval and public comment. This PR preserves.41bytes and does not assert ratification or publication. Unknown-key rewrite preservation underreq-mf-006is unchanged.