-
Notifications
You must be signed in to change notification settings - Fork 155
feat(policy): add custom_checks for arbitrary subprocess validation in apm-policy.yml #519
Copy link
Copy link
Open
Labels
area/audit-policyapm-policy.yml schema, custom_checks, install-time enforcement.apm-policy.yml schema, custom_checks, install-time enforcement.area/docs-sitedocs/src/content (Starlight), README, doc generation.docs/src/content (Starlight), README, doc generation.area/enterpriseAir-gapped/GHE configurability, registry proxy, rulesets, adoption playbook.Air-gapped/GHE configurability, registry proxy, rulesets, adoption playbook.enhancementDeprecated: use type/feature. Kept for issue history; will be removed in milestone 0.10.0.Deprecated: use type/feature. Kept for issue history; will be removed in milestone 0.10.0.status/needs-designDirection approved, design discussion required before code.Direction approved, design discussion required before code.status/triagedInitial agentic triage complete; pending maintainer ratification (silence = approval).Initial agentic triage complete; pending maintainer ratification (silence = approval).theme/governanceGoverned by policy. apm-policy, audit, enforcement, enterprise rollout.Governed by policy. apm-policy, audit, enforcement, enterprise rollout.type/featureNew capability, new flag, new primitive.New capability, new flag, new primitive.
Metadata
Metadata
Assignees
Labels
area/audit-policyapm-policy.yml schema, custom_checks, install-time enforcement.apm-policy.yml schema, custom_checks, install-time enforcement.area/docs-sitedocs/src/content (Starlight), README, doc generation.docs/src/content (Starlight), README, doc generation.area/enterpriseAir-gapped/GHE configurability, registry proxy, rulesets, adoption playbook.Air-gapped/GHE configurability, registry proxy, rulesets, adoption playbook.enhancementDeprecated: use type/feature. Kept for issue history; will be removed in milestone 0.10.0.Deprecated: use type/feature. Kept for issue history; will be removed in milestone 0.10.0.status/needs-designDirection approved, design discussion required before code.Direction approved, design discussion required before code.status/triagedInitial agentic triage complete; pending maintainer ratification (silence = approval).Initial agentic triage complete; pending maintainer ratification (silence = approval).theme/governanceGoverned by policy. apm-policy, audit, enforcement, enterprise rollout.Governed by policy. apm-policy, audit, enforcement, enterprise rollout.type/featureNew capability, new flag, new primitive.New capability, new flag, new primitive.
Type
Projects
Status
Todo
Why
APM's policy system (
apm-policy.yml) enforces governance over dependencies, MCP servers, compilation targets, and manifest fields. But enterprise teams need to enforce rules beyond what APM natively checks — readiness thresholds, quality evaluation, license compliance, custom org validators.Today there is no extension point. The check list is hardcoded in
run_policy_checks(). Adding acustom_checkssection lets governance teams plug in any tool via subprocess commands, keeping APM tool-agnostic (like npm never hardcodes ESLint).What
A new
custom_checksfield inapm-policy.ymlthat defines arbitrary subprocess commands. Each runs duringapm audit --ci --policy, returns pass/fail via exit code, and integrates into the existing JSON/SARIF audit output.Policy YAML format
Execution model
During
apm audit --ci --policy org:Result format
Uses existing
CheckResultmodel — no new output format:{ "name": "custom:agentrc-readiness", "passed": false, "message": "Repo must meet AI readiness level 3", "details": ["exit code 1: achieved level 2, required 3"] }How
~150 lines across 4 files:
schema.py—CustomCheckdataclass + field onApmPolicyparser.py— parsecustom_checksfrom YAMLpolicy_checks.py—_run_custom_checks()with subprocess + CheckResultDesign principles
on_failuredefaults to top-levelenforcementUse cases
agentrc readiness --json --fail-level 3./scripts/check-licenses.shgitleaks detect --no-banner -qtest -f README.md