[BUG] fix(audit): trust lockfile claude_skill type when apm_modules not materialized#2329
Open
hugoguitton-lucca wants to merge 1 commit into
Conversation
…erialized config-consistency probed the on-disk package shape to exempt manifestless virtual Claude skills. In a setup-only CI job (install the CLI, then 'apm audit --ci' with no 'apm install'), apm_modules/ is never materialized, so detect_package_type returns INVALID, the exemption is denied, and the check hard-fails on valid claude_skill deps -- while the drift check gracefully skips the same cold cache. Fall back to the frozen lockfile classification when the package directory is absent, mirroring drift's cold-cache tolerance. The strict on-disk shape probe still runs once apm_modules/ is materialized, so mislabeled or malformed installed packages are still rejected. Fixes microsoft#2328
hugoguitton-lucca
requested review from
danielmeppiel and
sergio-sisternes-epam
as code owners
July 21, 2026 07:55
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes apm audit --ci failing config-consistency for valid virtual claude_skill dependencies when running in a “setup-only” CI topology (no prior apm install, so apm_modules/ is not materialized). The change keeps the strict on-disk shape probe when the package directory exists, but falls back to the lockfile’s package_type when it does not.
Changes:
- Update
_allows_missing_manifest()to tolerate a cold/absentapm_modules/by trusting the lockfile’sclaude_skillclassification when the package directory is missing. - Add a unit regression test covering the setup-only CI scenario (virtual skill locked, install tree absent) to ensure the missing-manifest problem is waived.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/apm_cli/integration/mcp_config_view.py |
Allows missing apm.yml for virtual claude_skill when the install dir is absent, while preserving strict on-disk detection when present. |
tests/unit/integration/test_mcp_config_view.py |
Adds a regression test for “no apm install / no apm_modules” to ensure config-consistency doesn’t hard-fail. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #2328.
apm audit --cifailed theconfig-consistencycheck for valid virtualclaude_skilldependencies whenever it ran without a priorapm install(a setup-only CI job that installs the CLI and audits, soapm_modules/is never materialized).#2214 fixed the case where the modules are materialized, but its
_allows_missing_manifestimplementation probes the on-disk shape viadetect_package_type(package_dir). Withapm_modules/absent, that returnsINVALID, the exemption is denied, and the check hard-fails — even thoughdriftin the same run gracefully skips the identical cold cache (drift skipped: install cache not populated).Fix
Mirror the
driftcheck's cold-cache tolerance: when the package directory is not materialized on disk, fall back to the frozen lockfile classification instead of hard-failing.apm_modules/is materialized, the strict on-disk shape probe still runs, so a mislabeled (non-virtual) or malformed (missingSKILL.md) installed package is still rejected.apm install— andapm install --frozen, which re-materializesapm_modules/— before auditing, sopackage_direxists and the guard never triggers).Tests
Added a unit regression that reproduces the setup-only CI topology (virtual
claude_skilllocked,apm_modules/not materialized) and asserts the missing manifest is waived:tests/unit/integration/test_mcp_config_view.py::test_manifestless_virtual_skill_skipped_when_modules_not_materializedtests/unit/integration/test_mcp_config_view.py: 18 passed (17 existing + 1 new). The existingtest_manifestless_virtual_package_without_skill_shape_records_problem(modules materialized but noSKILL.md) still fails as expected, confirming the strict probe is unchanged when the directory exists.Repro (before this PR)