Skip to content

docs: clarify apm_modules is derived - #2601

Merged
Daniel Meppiel (danielmeppiel) merged 6 commits into
microsoft:mainfrom
aryansk:docs/2064-apm-modules-derived
Oct 16, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 6 commits into
microsoft:mainfrom
aryansk:docs/2064-apm-modules-derived

Conversation

@aryansk

@aryansk Aryan Singh K. (aryansk) commented Aug 16, 2026 •

Copy link
Copy Markdown
Contributor

document(docs): clarify derived dependency content and its safe lifetime

Description

TL;DR

Clarify the purpose and version-control treatment of apm.yml, apm.lock.yaml, and apm_modules/. Installed content is regenerable, but native plugins and linked resources must remain available while their consumers use them. This completes only the approved documentation slice and preserves Aryan Singh K.'s original contribution.

Important

This PR does not implement automatic cleanup or complete the broader cleanup request in #2064.

Problem (WHY)

  • The original addition allowed removal "after the APM operation completes", without accounting for native agents that keep loading installed resources afterward.
  • [!] The new reference section needed to distinguish committed dependency intent and resolved state from installed content, and link the existing cleanup command.

The clarification concentrates on that non-obvious lifetime constraint rather than another installation tutorial: "Add what the agent lacks, omit what it knows".

Approach (WHAT)

  • Keep the manifest and lockfile committed; describe the installed directory as regenerable while package sources remain available.
  • State that project installs add the directory to .gitignore.
  • Put the live-plugin lifetime warning before CI and cleanup guidance.
  • Link apm deps clean without promising a new automatic cleanup flag.

Implementation (HOW)

File Change
reference/lockfile-spec.md Add the derived-directory explanation, native-consumer lifetime caution, frozen CI replay, and conditional cleanup guidance.
consumer/install-packages.md Link existing commit/lifetime guidance to the reference section.

Diagrams

The diagram shows the existing resource relationship documented here, not new runtime behavior: cleanup follows the end of every consumer's required lifetime.

flowchart LR
    subgraph Source["Committed state"]
        M["apm.yml: dependency intent"]
        L["apm.lock.yaml: resolved and managed state"]
    end
    subgraph Installed["Installed content"]
        D["apm_modules: regenerable"]
    end
    subgraph Lifetime["Required lifetime"]
        C["Native agents and other consumers"]
        F["All consumers finished"]
    end
    M --> D
    L --> D
    D --> C
    C --> F
    F --> X["Optional cleanup"]
Loading

Trade-offs

  • Documentation only: no runtime cleanup, new flag, lifecycle hooks, or README edits. Scenario Evidence tests are not applicable because runtime behavior is unchanged.
  • Link existing consumer, CI, and cleanup references instead of duplicating them. No future cleanup feature is promised.

Benefits

  1. One explicit distinction between the three project artifacts.
  2. One lifetime caution covering native plugins and linked package resources.
  3. Bidirectional navigation between consumer guidance and the new reference section.

Issue and approved scope

Issue: Related #2064

Human scope-approval comment: #2064 (comment)

Does this PR complete the issue, or what remains?

Only the documentation slice is complete. Automatic cleanup and any broader lifecycle design remain outside this PR; #2064 must remain open. The current scope record preserves the original approved fields and identifies Daniel Meppiel (@danielmeppiel) as review contact.

Type of change

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

Testing

  • Tested locally
  • All existing tests pass
  • Added tests for new functionality (if applicable)

Validation

Executed on ccf2fad385184f028b7a20f049dcecbcce2c9edd, integrating main f8e59dc43b (including the intervening documentation dependency updates). Full runtime tests were not run locally for this docs-only change. Remote CI is observed separately after push.

Exact local commands and outcomes

uv run --frozen --extra dev ruff check src/ tests/ scripts/lint_architecture_boundaries.py scripts/architecture_linter/ scripts/windows_native_symlink_probe_entry.py - passed:

All checks passed!

uv run --frozen --extra dev ruff format --check src/ tests/ scripts/lint_architecture_boundaries.py scripts/architecture_linter/ scripts/windows_native_symlink_probe_entry.py - passed:

1949 files already formatted

uv run --frozen --extra dev python -m pylint --disable=all --enable=R0801 --min-similarity-lines=10 --fail-on=R0801 src/apm_cli/ scripts/lint_architecture_boundaries.py scripts/architecture_linter/ scripts/windows_native_symlink_probe_entry.py - passed:

Your code has been rated at 10.00/10

bash scripts/lint-auth-signals.sh - passed, [+] auth-signal lint clean.

bash scripts/lint-architecture-boundaries.sh - passed, exit 0 with no output.

CI-equivalent Python scans for YAML file-I/O safety, raw str(relative_to) use, and the 2100-line covered-file limit - all passed, zero violations. These used the same regexes/exclusions as CI because macOS grep lacks -P.

cd docs && npm run build - passed: 126 pages built; all internal links valid.

[+] Checked 1081 relative link(s) across generated pages. No broken relative links found.

mmdc -i body-lifetime.mmd -o body-lifetime.png --quiet - passed, exit 0; diagram visually checked.

Exact-base/head canonical-owner detection - passed; only the two documentation paths changed, zero touched owners.

How to test

  • Run cd docs && npm ci && npm run build; expect the build and link checks to pass.
  • Open the lockfile reference and verify manifest intent, committed lockfile state, and regenerable installed content are distinct.
  • Verify cleanup is conditional on all native sessions and other consumers finishing, not merely apm install exiting.
  • Follow the consumer, CI, and apm deps clean links.

Spec conformance (OpenAPM v0.1)

If this PR changes behaviour that an OpenAPM v0.1 req-XXX covers,
confirm the three-step ritual in the
development guide:

  • Spec edit: docs/src/content/docs/specs/openapm-v0.1.md updated
    (new/changed <a id="req-XXX"></a> anchor + prose + Appendix C
    row).
  • Manifest edit: docs/src/content/docs/specs/manifests/openapm-v0.1.requirements.yml
    updated.
  • Test edit: a @pytest.mark.req("req-XXX") test under
    tests/spec_conformance/ added or extended.
  • CONFORMANCE.{md,json} regenerated via
    uv run --extra dev python -m tests.spec_conformance.gen_statement
    and committed.
  • N/A -- this PR does not change OpenAPM-observable behaviour.

Co-authored-by: Copilot [email protected]

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

Note

Copilot was unable to run its full agentic suite in this review.

Adds documentation clarifying that apm_modules/ is a derived, recreatable install directory and should typically be ignored in version control, positioning the lockfile as the durable source of truth.

Changes:

  • Documented that apm_modules/ is derived from apm.yml + apm.lock.yaml and can be regenerated via apm install
  • Added a recommended .gitignore entry for apm_modules/
  • Noted CI/ephemeral workflow guidance and current lack of an automatic post-install cleanup flag

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

@sergio-sisternes-epam Sergio Sisternes (sergio-sisternes-epam) added the panel-review Request an advisory PR review; consumed after review. Not human approval or a merge gate. label Aug 18, 2026
@sergio-sisternes-epam

Copy link
Copy Markdown
Collaborator

APM Review Panel: ship_with_followups

Docs-only PR correctly positions apm_modules/ as derived; doc-writer surfaced a factual contradiction with auto-add behavior that should be folded before merge.

cc Aryan Singh K. (@aryansk) Daniel Meppiel (@danielmeppiel) Sergio Sisternes (@sergio-sisternes-epam) -- a fresh advisory pass is ready for your review.

All nine panelists agree this PR is directionally correct and introduces no regressions. The only substantive tension is between the PR's current prose (which implies users must manually gitignore apm_modules/) and the existing corpus (consumer/install-packages.md line 134) which states APM auto-adds the entry on first install. This is not a style disagreement -- it is a factual contradiction between two documentation pages that will confuse readers. The doc-writer's remaining recommended findings (use 'package cache' for corpus consistency, reference 'apm deps clean' instead of raw rm -rf, and wrap the limitation disclosure in a callout) are low-cost edits that improve maintainability and accuracy without changing the section's structure. The supply-chain-security-expert's recommendation to add a single sentence about lockfile SHA verification is well-placed and closes a trust-model gap at near-zero editorial cost. None of these require design discussion or code changes; all can be addressed in the same PR cycle.

Aligned with: Portable by manifest -- PR reinforces that apm.yml + apm.lock.yaml are the portable, committable artifacts and apm_modules/ is ephemeral. Directly supports the manifest-as-source-of-truth principle. Pragmatic as npm -- answers the 'do I commit the vendor folder?' question every npm/pip user asks on day one.

Growth signal. Contributors are independently asking the node_modules question -- strong first-funnel signal. Track whether this section gets cross-linked from quickstart and the .gitignore template; if not, add a link in the first-package guide to reduce 'should I commit this?' drop-off.

Panel summary

Persona B R N Takeaway
Python Architect 0 0 0 Documentation-only PR accurately describes the apm_modules/ materialization model. Matches architectural reality. No concerns.
CLI Logging Expert 0 0 0 CLI commands referenced (apm install) are accurate and CI pattern is consistent with actual tool behavior.
DevX UX Expert 0 0 2 Mental model correct, well-aligned with npm/cargo conventions. Prose is clear and actionable. No blocking issues.
Supply Chain Security Expert 0 1 1 Correctly positions apm_modules/ as derived output and the lockfile as the integrity anchor. No security regressions.
OSS Growth Hacker 0 0 1 Solid friction-reducer answering the #1 question every Node/Python dev asks on first encounter with a new package manager.
Doc Writer 0 4 2 Section is accurate and well-placed; three issues to fold: auto-add contradiction, missing apm-deps-clean reference, and inline limitation prose.

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

Top 5 follow-ups

  1. [Doc Writer] Fix contradiction: note that APM auto-adds apm_modules/ to .gitignore on first install -- Factual accuracy between pages is non-negotiable for trust. (install-packages.md:134 already says this; the new section should be consistent or cross-reference it.)
  2. [Doc Writer] Replace manual rm -rf guidance with apm deps clean reference -- The command exists and is documented; omitting it teaches users a worse workflow and leaves the CLI surface undiscoverable.
  3. [Supply Chain Security Expert] Add one sentence stating apm install verifies content against lockfile commit-SHA -- Closes the trust-model explanation for CI readers who need to justify the reinstall pattern to security reviewers.
  4. [Doc Writer] Use 'package cache' instead of 'install cache/materialization directory' for corpus consistency -- Three other pages use 'package cache'; inconsistent terminology erodes the glossary contract.
  5. [Doc Writer] Wrap the no --clean flag limitation in a :::note[Planned] callout -- Inline limitation prose is hard to find-and-remove when the flag ships; a callout is a one-block delete.

Architecture

classDiagram
    direction LR
    class ApmManifest {
        <<SourceOfTruth>>
        +dependencies list
        +file apm.yml
    }
    class ApmLockfile {
        <<SourceOfTruth>>
        +resolved_graph dict
        +integrity_hashes dict
        +file apm.lock.yaml
    }
    class ApmModules {
        <<Derived>>
        +materialized_packages list
        +dir apm_modules/
    }
    ApmManifest --> ApmLockfile : resolves to
    ApmLockfile --> ApmModules : materializes via install
Loading
flowchart TD
    A[apm.yml\ncommitted manifest] --> B[apm install\nresolution]
    B --> C[apm.lock.yaml\ncommitted lockfile]
    C --> D[apm install\nmaterialization]
    D --> E[apm_modules/\nderived - gitignored]
    E -->|discardable| F[recreate via apm install]
Loading

Recommendation

Merge after folding the auto-add contradiction fix and the apm-deps-clean reference (first two followups). The remaining three are valuable but can land as a fast follow without blocking this contribution. The PR is a net positive for onboarding and answers a real first-funnel question.


Full per-persona findings

Python Architect

No findings.

CLI Logging Expert

No findings.

DevX UX Expert

  • [nit] Consider linking to a quickstart/init docs page that auto-generates the gitignore entry at docs/src/content/docs/reference/lockfile-spec.md
    Users should not have to remember to manually add the gitignore entry; linking to an init command or quickstart would complete the flow.

  • [nit] Reframe the 'no --clean flag' paragraph as an action rather than an absence at docs/src/content/docs/reference/lockfile-spec.md
    A more cargo-like framing: 'To remove materialized sources after use, run apm deps clean as a post-step.' States the action, not the absence of a flag.

Supply Chain Security Expert

  • [recommended] The CI reinstall paragraph should state that apm install verifies content against the lockfile commit-SHA at docs/src/content/docs/reference/lockfile-spec.md
    Without this, a reader could wonder whether re-fetching from a remote guarantees integrity. The lockfile is not merely a convenience cache key -- it is an integrity control.
    Suggested: Add: 'Because the lockfile pins each dependency to an exact commit SHA, apm install verifies that materialized content matches the recorded identity before deployment.'

  • [nit] Cleanup paragraph could note that cleanup should occur after all consuming tools have finished at docs/src/content/docs/reference/lockfile-spec.md
    Avoids a potential TOCTOU-style gap where a later pipeline step references a now-deleted dependency.

OSS Growth Hacker

  • [nit] Mention actions/cache keyed on lockfile hash for faster CI at docs/src/content/docs/reference/lockfile-spec.md
    CI users coming from npm/pnp expect a caching pattern. A one-liner referencing actions/cache with hashFiles('apm.lock.yaml') would complete the mental model and give them a copy-pasteable win.

Auth Expert -- inactive

PR #2601 touches only docs/src/content/docs/reference/lockfile-spec.md -- a documentation clarification about apm_modules being derived. No auth-related files or flows affected.

Doc Writer

  • [recommended] The new section omits that APM auto-adds apm_modules/ to .gitignore on first install at docs/src/content/docs/reference/lockfile-spec.md
    install-packages.md line 134 states 'APM adds the entry automatically on first install.' The new section implies users must add it manually, creating a contradiction. Either add 'APM adds this entry automatically on first install' or replace the snippet with a cross-reference to install-packages.md.

  • [recommended] Use 'package cache' instead of 'install cache/materialization directory' for corpus consistency at docs/src/content/docs/reference/lockfile-spec.md
    The rest of the docs corpus uses 'package cache' consistently (install-packages.md:133, troubleshooting/install-failures.md, package-anatomy.md).
    Suggested: Replace opening sentence with: 'apm_modules/ is the package cache -- installed dependency source, not a source of truth.'

  • [recommended] Link to apm deps clean instead of implying manual directory removal at docs/src/content/docs/reference/lockfile-spec.md
    reference/cli/deps.md:134 documents apm deps clean which removes apm_modules/ without touching apm.yml or apm.lock.yaml.
    Suggested: Replace 'remove the directory as a separate cleanup step' with 'run apm deps clean as a separate cleanup step'.

  • [recommended] Wrap the 'no --clean flag' limitation in a callout block for easier future removal at docs/src/content/docs/reference/lockfile-spec.md
    Inline prose about a temporary limitation is harder to remove when the flag ships. A :::note[Planned] callout makes future removal a one-block delete.

  • [nit] Add cross-link to integrations/ci-cd.md from the CI paragraph at docs/src/content/docs/reference/lockfile-spec.md
    The CI paragraph covers the same territory as integrations/ci-cd.md but does not link to it.

  • [nit] Add cross-link to consumer/install-packages.md at the gitignore recommendation at docs/src/content/docs/reference/lockfile-spec.md
    install-packages.md has the full 'what to commit' table; a cross-reference keeps the lockfile-spec page lean.

Test Coverage Expert -- inactive

documentation-only PR -- no runtime code paths to defend

Performance Expert -- inactive

documentation-only PR; no hot-path code changed and no performance claims in the diff

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

@sergio-sisternes-epam Sergio Sisternes (sergio-sisternes-epam) removed the panel-review Request an advisory PR review; consumed after review. Not human approval or a merge gate. label Aug 18, 2026
@sergio-sisternes-epam

Sergio Sisternes (sergio-sisternes-epam) commented Sep 17, 2026 •

Copy link
Copy Markdown
Collaborator

Thank you for contributing this pull request. APM starts with an
issue, not an implementation
(https://github.com/microsoft/apm/blob/main/CONTRIBUTING.md).

This PR closes #2064, which is still open, but that issue is not
currently labelled status/accepted. Maintainer acceptance on
#2064 was withdrawn on 2026-09-12. Please keep the user problem
on an issue so a maintainer can review and accept the bounded
scope first. This PR is labelled status/deferred until that
happens.

This is not merge approval, assignment, or a request for further
automated review.


Generated by autopilot-pr-triage-worker. This comment is AI-generated and may contain errors.

@sergio-sisternes-epam Sergio Sisternes (sergio-sisternes-epam) added triage/recommended Automated advice completed; not human scope approval. status/deferred Not invited for implementation now; no release commitment. type/docs Documentation change (prose, examples, generated reference). area/docs-site docs/src/content (Starlight), README, doc generation. area/lockfile Lockfile schema, per-file provenance, integrity hashes, drift detection. labels Sep 17, 2026
Preserve the original contributor commit and reconcile with current consumer documentation before the bounded microsoft#2064 docs review.

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

Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a
Preserve Copilot marketplace output, unmatched-skill handling and SSH resolution changes before documenting installed-content lifetime.

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

Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a
Address the prior docs panel and the renewed microsoft#2064 documentation scope: distinguish committed intent and resolved state from regenerable content, clarify native plugin lifetime, and link safe cleanup guidance without promising new flags.

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

Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a
Preserve the canonical Claude user-scope cleanup and related documentation without changing the approved docs-only PR scope.

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

Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a
Preserve newly landed changes without extending the approved documentation-only scope.

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

Copilot-Session: f79e464c-180e-4be3-9056-0773aa679a1a
@danielmeppiel

Copy link
Copy Markdown
Collaborator

APM Review Panel: ship_now

The docs distinguish manifest intent, locked state, and installed content without treating live plugin resources as disposable.

panel-mode=delta; personas=doc-writer,apm-ceo

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

This continues the earlier advisory, rather than repeating its full panel. The current doc-writer found no substantive issues. The reference now states that both apm.yml and apm.lock.yaml belong in version control, explains automatic project-install ignore handling, and links existing cleanup guidance. Regeneration depends on source availability; native plugins and other live consumers must finish before installed content is removed. The renewed human scope record covers this documentation-only slice. No runtime cleanup, new flag, or future feature is promised.

Aligned with: Portable by manifest: commit intent and resolved state. Pragmatic as npm: explain installed-content lifetime without implying it is always disposable. Community-driven: preserve Aryan Singh K. (@aryansk)'s original contribution and history.

Panel summary

Persona B R N Takeaway
Doc Writer 0 0 0 Accurate artifact roles, explicit live-consumer lifetime limits, and discoverable cleanup guidance.

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

Top 2 follow-ups

  1. [APM CEO] Completed: The PR body uses the repository template and relates to apm.yml + apm.lock.yaml + apm_modules left after installation #2064 without closing it. The broader issue remains open.
  2. [APM CEO] Completed: Actual technical workflows passed after the reviewed candidate was pushed; evidence and revision boundaries are below.

Recommendation

The CEO's content recommendation is ship_now. Its two mechanical prerequisites are now complete. No in-scope content follow-up remains. This is advisory, not merge authorization; existing reviewer ownership is unchanged.


Full per-persona findings

Doc Writer

No findings. The genuine affected-docs delta was retained across faithful main integration; a second broad panel was not run. Docs-sync's deterministic docs-only L0 classification was no_change.

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

Folded in this run

  • (Prior panel) Reconcile automatic .gitignore handling and add consumer/reference/CI cross-links -- resolved in d6588c7136.
  • (Prior panel) Link the existing apm deps clean reference and require all consumers to finish first -- resolved in d6588c7136.
  • (Prior panel) Explain frozen reinstall against locked state and source availability without promising blanket content-integrity verification -- resolved in d6588c7136.
  • (Prior panel, reconciled with renewed scope) Replace disposable-cache/planned-flag framing with installed dependency content and an explicit native-plugin lifetime caution -- resolved in d6588c7136.

The historical proposal to advertise a planned cleanup flag is not a deferred implementation commitment. Runtime cleanup and automatic closure of the broader issue are outside the renewed scope. README was not changed.

Copilot signals reviewed

Two classification rounds found no inline comments or review threads. The two existing Copilot overview reviews belong to the original head; no new Copilot review was requested or represented as current-head coverage.

Lint contract

All eight current local gates passed on ccf2fad385184f028b7a20f049dcecbcce2c9edd, integrated with f8e59dc43bc527c6ccd1a44709d2efbacd512134: Ruff check and format, pylint R0801, auth boundary, architecture boundary, YAML I/O safety, portable relative paths, and the 2100-line limit.

Ruff commands used uv run --frozen --extra dev ruff check and ruff format --check, each over src/ tests/ scripts/lint_architecture_boundaries.py scripts/architecture_linter/ scripts/windows_native_symlink_probe_entry.py. Both exited 0 without diagnostics. The macOS grep-based safety checks used equivalent deterministic Python scans with the CI exclusions.

cd docs && npm run build passed: 126 pages; 1081 relative links, none broken. No local full runtime pytest suite was run for this two-page docs-only change. Deterministic owner detection found zero touched runtime owners.

CI

On pushed head ccf2fad385184f028b7a20f049dcecbcce2c9edd, all five applicable technical workflows completed successfully: CI, technical readiness, CodeQL, NOTICE, and docs build. Zero CI recovery iterations. Normal PR documentation deployment was skipped.

Actual CodeQL uploads 1965967432 (Python) and 1965965034 (Actions) have zero results and no analysis error. They analyzed synthetic merge e554bcd92ff7c44fc14fa40a8d6d13462c80030e, whose parents are the tested base and pushed head. These uploads do not certify newer main bd672981210f7751381d88eba4d9d9354d2a44ea; that revision has a separate strict compatibility preview only.

Mergeability status

Live snapshot: 2026-10-16T08:54:28.127413+00:00.

PR head SHA CEO stance iters folds defers Copilot rounds CI mergeable mergeStateStatus notes
#2601 ccf2fad385 ship_now 2 4 0 2 green MERGEABLE Policy requirements outstanding Strict conflict-free preview against bd672981; reviewed patch unchanged and all #3190 content retained. Newer base not executed.

Convergence

2 outer iterations including retained recovery; 2 Copilot rounds. Final panel recommendation: ship_now.

Ready for maintainer review. No merge, queue operation, reviewer request, review approval, issue closure, or policy change was performed.


Generated by autopilot-pr-merge-worker. This comment is AI-generated and may contain errors.

@danielmeppiel
Daniel Meppiel (danielmeppiel) merged commit 77555d3 into microsoft:main Oct 16, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/docs-site docs/src/content (Starlight), README, doc generation. area/lockfile Lockfile schema, per-file provenance, integrity hashes, drift detection. status/deferred Not invited for implementation now; no release commitment. triage/recommended Automated advice completed; not human scope approval. type/docs Documentation change (prose, examples, generated reference).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants