Skip to content

fix(install): omit author from auto-bootstrapped apm.yml - #3630

Merged
Daniel Meppiel (danielmeppiel) merged 3 commits into
mainfrom
danielmeppiel-fix-3593-omit-bootstrap-author
Nov 12, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 3 commits into
mainfrom
danielmeppiel-fix-3593-omit-bootstrap-author

Conversation

@danielmeppiel

Copy link
Copy Markdown
Collaborator

Description

TL;DR

apm install <pkg> in a directory with no apm.yml bootstraps a manifest — and until now stamped author: <git config user.name> into it. The person who first runs install in a consuming project is not necessarily its author, so the field was misleading and leaked a personal identity. Auto-bootstrapped manifests now omit author; explicit apm init (interactive and --yes) is unchanged.

Problem (WHY)

  • Reported reproduction ([BUG] apm install auto-bootstrap stamps git user.name as apm.yml author #3593): with git config user.name = Jane Example, apm install --target copilot ../demo-pkg writes author: Jane Example into the new apm.yml.
  • All three bootstrap sites shared _get_default_config(), which always ran _auto_detect_author(): project-scope package install, -g package install, and -g --mcp (~/.apm/apm.yml).
  • The value lands in a file that is usually committed, so a consumer's identity ends up in project history without any prompt.

Approach (WHAT)

Path Before After
apm install <pkg> (no apm.yml) author: <git user.name> no author key
apm install -g <pkg> (no ~/.apm/apm.yml) author: <git user.name> no author key
apm install -g --mcp NAME (no ~/.apm/apm.yml) author: <git user.name> no author key
apm init / apm init --yes author: <git user.name> unchanged
Existing manifests untouched untouched

Implementation (HOW)

File Change
src/apm_cli/commands/_helpers.py New _get_bootstrap_config() returns name/version/description only (no git subprocess for author). _get_default_config() now builds on it and adds author, so apm init output is byte-identical. _create_minimal_apm_yml() writes author only when the key is present, keeping the existing field order.
src/apm_cli/commands/install.py Both bootstrap call sites (package install and user-scope --mcp) switch to _get_bootstrap_config().
tests/unit/test_install_command.py Two regression tests that configure a real Git identity via GIT_CONFIG_GLOBAL and assert no author reaches the manifest / MCP bootstrap config.
docs/.../reference/cli/install.md, packages/apm-guide/.../commands.md Auto-bootstrap bullet now states the manifest has no author field.
CHANGELOG.md Fixed entry.

Diagram

Legend: the install bootstrap now uses a config builder that never consults Git identity; apm init keeps the author-detecting path.

flowchart LR
    I["apm install PKG / -g --mcp<br/>(no apm.yml)"] --> B["_get_bootstrap_config()<br/>name, version, description"]
    N["apm init / init --yes"] --> D["_get_default_config()"]
    D --> B
    D --> A["_auto_detect_author()<br/>git config user.name"]
    B --> W["_create_minimal_apm_yml()<br/>writes author only if present"]
    D --> W
Loading

Trade-offs

  • Omit vs. placeholder. Omitting matches the record ("Omit the field") and the manifest schema, where author is optional; a placeholder like Developer would be equally misleading.
  • New helper vs. flag. A named _get_bootstrap_config() makes intent explicit at call sites and skips the Git subprocess entirely, rather than threading an include_author= flag through _get_default_config().
  • No retroactive cleanup. Existing manifests that already carry a stamped author are left alone (out of scope: rewriting existing manifests).

Benefits

  1. Auto-bootstrapped apm.yml no longer records the installer's Git identity.
  2. One fewer git subprocess per bootstrap.
  3. apm init output and its tests are unchanged (301 targeted tests pass).

Issue and approved scope

Issue: Fixes #3593

Human scope-approval comment: #3593 (comment)

This PR completes the issue: auto-bootstrapped manifests contain no author, a regression test covers a configured git user.name, apm init behavior/tests are unchanged, and docs + CHANGELOG are updated. Out of scope per the record: changing apm init defaults, new install prompts, rewriting existing manifests.

Note

Local preflight skipped by maintainer instruction (2026-11-12); CI is the gate.

Type of change

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

Testing

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

Scenario evidence

# Scenario (user promise) Principle(s) Test(s) proving it Type
1 apm install <pkg> with no manifest and a configured Git user creates apm.yml without author DevX, Secure by default tests/unit/test_install_command.py::TestInstallCommandAutoBootstrap::test_install_auto_created_apm_yml_omits_git_author unit (CLI runner)
2 apm install -g --mcp NAME with no ~/.apm/apm.yml bootstraps without author DevX, Secure by default tests/unit/test_install_command.py::TestInstallMcpFlag::test_global_mcp_bootstrap_config_omits_git_author unit (CLI runner)
3 apm init still detects author from Git DevX tests/unit/test_init_command.py, tests/unit/commands/test_helpers_coverage.py (unchanged, passing) unit
Validation output

Reproduced on HEAD before the fix (both new tests failed):

AssertionError: assert 'author' not in {'author': 'Jane Example', 'description': 'APM project for home', 'name': 'home', 'targets': ['claude'], ...}
2 failed, 132 deselected

After the fix:

$ .venv/bin/python -m pytest -p no:xdist -q tests/unit/test_install_command.py tests/unit/test_init_command.py \
    tests/unit/test_init_phase3w5.py tests/unit/test_init_command_selection.py tests/unit/commands/test_helpers_coverage.py
301 passed in 81.16s

Mutation-break: re-adding "author": _auto_detect_author() to _get_bootstrap_config() makes both regression tests fail (2 failed); reverting restores green.

Lint: ruff check + ruff format --check on changed files pass; full CI lint mirror run before the final push (see commit).

How to test

  • git config --global user.name "Jane Example" (or use GIT_CONFIG_GLOBAL with a temp file).
  • In an empty directory: apm install --target copilot <any-package>.
  • cat apm.yml — there is no author: line.
  • In another empty directory: apm init --yes — author: Jane Example is still written.

Spec conformance (OpenAPM v0.1)

  • 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]

When `apm install` creates apm.yml in a directory without one (project
scope, `-g`, and `-g --mcp`), it no longer stamps the local
`git config user.name` as `author`. The person who first runs install
is not necessarily the project's author. Explicit `apm init` keeps its
current author detection.

Fixes #3593

Co-authored-by: Copilot App <[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.

🟢 Approval recommended

No active review issues were identified for the changes to omit installer Git identity from automatically created manifests.

No open issues 🎉

What changed in this PR

Addresses #3593 by preventing apm install from recording the installer's Git identity in automatically created manifests, while preserving author detection for explicit apm init commands.

Changes:

  • Separates author-free bootstrap configuration from initialization defaults and makes manifest author output conditional.
  • Updates package and global MCP bootstrap paths to use the author-free configuration.
  • Adds regression coverage and documents the new behavior.
File Description
tests/​unit/​test_install_command.py Adds package and global MCP bootstrap tests with a configured Git identity.
src/​apm_cli/​commands/​install.py Switches install bootstrap paths to author-free defaults.
src/​apm_cli/​commands/​_helpers.py Adds bootstrap defaults and writes author only when supplied.
packages/​apm-guide/​.apm/​skills/​apm-usage/​commands.md Documents author omission in the usage guide.
docs/​src/​content/​docs/​reference/​cli/​install.md Clarifies author handling for auto-created manifests.

Review effort: Balanced

@danielmeppiel

Copy link
Copy Markdown
Collaborator Author

APM Review Panel: ship_now

Auto-bootstrap stops leaking local git identity into apm.yml, aligning install with npm convention and closing #3593 with full regression coverage.

panel-mode=lean; personas=devx-ux-expert,test-coverage-expert,apm-ceo

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

Both panelists returned clean with no findings. The devx-ux-expert confirmed the change matches npm's install-vs-init convention (npm install does not stamp author; npm init does), the doc surfaces are updated, and the refactor extracting _get_bootstrap_config from _get_default_config is clean with no UX regressions. The test-coverage-expert confirmed both bootstrap paths (project-scope and user-scope MCP) carry regression traps that assert author is absent even when git user.name is configured, and that apm init's author-write invariant is defended by existing tests.

Strategically this is a small but defensible move: it removes a friction point where collaborators opening a shared repo would see someone else's name baked into the manifest on first install, which undermined trust in the portable-by-manifest promise. The CHANGELOG entry is clear, the scope exactly matches the accepted issue brief, and the Copilot reviewer found no inline issues. No dissent to resolve.

Aligned with: Portable by manifest -- bootstrapped manifests no longer encode local identity, making them portable across contributors from first touch. Pragmatic as npm -- npm install creates package.json without author; npm init fills it in, and APM now mirrors that split. OSS / community-driven -- directly closes community-reported #3593 with a scoped fix and regression tests.

Panel summary

Persona B R N Takeaway
DevX UX Expert 0 0 0 Auto-bootstrap author omission aligns with npm convention; all canonical doc surfaces updated; clean DRY refactor; no UX regressions.
Test Coverage Expert 0 0 0 All bootstrap paths have regression traps with configured git user.name; apm init author-write invariant defended by existing tests. Ship.

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

Recommendation

Both panelists are clean, the scope matches the accepted brief exactly, regression tests defend both bootstrap paths, and docs + CHANGELOG are updated. No follow-ups to track. Ready for the CODEOWNERS reviewer to confirm and merge at their discretion.


Full per-persona findings

DevX UX Expert

No findings.

Test Coverage Expert

No findings.

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


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

@danielmeppiel

Copy link
Copy Markdown
Collaborator Author

Retriggering the CLA check (license/cla never reported at fad5e50); reopening immediately.

@danielmeppiel
Daniel Meppiel (danielmeppiel) merged commit cb759c1 into main Nov 12, 2026
71 of 73 checks passed
@danielmeppiel
Daniel Meppiel (danielmeppiel) deleted the danielmeppiel-fix-3593-omit-bootstrap-author branch November 12, 2026 15:10
Daniel Meppiel (danielmeppiel) added a commit to Bronyal-lzx/apm that referenced this pull request Nov 12, 2026
Bring PR microsoft#2944 up to date with main 90e76bf. Both overlapping
files merged keeping both intents: CHANGELOG.md keeps main's microsoft#3630
entry alongside this PR's microsoft#2944 entry under Unreleased/Fixed, and
test_architecture_owner_rule_mutations.py keeps main's updated
github_downloader intent plus this PR's user-hook-home-reference case.

Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 12, 2026
Resolve conflicts with #3633 (forwarded apm install options) and #3630 (bootstrap author), keeping the APM_HOME wording.

Co-authored-by: Copilot App <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] apm install auto-bootstrap stamps git user.name as apm.yml author

2 participants