Skip to content

fix(install): name GITHUB_HOST in the unrecognised-host hint; cover mixed-host install - #4665

Merged
Daniel Meppiel (danielmeppiel) merged 8 commits into
mainfrom
danielmeppiel-p1-2775-mixed-host-install
Nov 22, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 8 commits into
mainfrom
danielmeppiel-p1-2775-mixed-host-install

Conversation

@danielmeppiel

@danielmeppiel Daniel Meppiel (danielmeppiel) commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Mixed-host apm install (GHES via GITHUB_HOST plus explicit github.com/ packages) already keeps each package's host, subpath and ref on current main. I reproduced the issue's flow with the packaged CLI in the lifecycle world, where each repository exists on one host only. This PR:

  • adds installed-CLI lifecycle regression coverage for the supported mixed-host global flow: install, manifest/lock reload, frozen reinstall from a clean cache, update of a branch pin, uninstall, per-package hosts/subpaths/resolved commits, and per-host egress;
  • asserts host-specific credential selection with inert sentinels (GHES org token, and strict-mode GITHUB_APM_PAT, never leave GHES; the github.com token never reaches GHES);
  • fixes the one gap found: when a positional argument names an unrecognised host (no GITHUB_HOST), the hint named only GITLAB_HOST and object form. It now also says: "If this is GitHub Enterprise Server, set GITHUB_HOST=, write github.com/ before apm.yml entries for packages on GitHub, and re-run." When GITHUB_HOST already names a server, it instead says to keep it and add the second server's package as a git: + path: object entry, because switching would re-home existing shorthand. The lifecycle tests run every printed remedy (this one and the git: + path: object form) to green;
  • documents one practical mixed-host example (docs + apm-usage skill).

Dependency order: none.

Issue and approved scope

Issue: Fixes #2775

Human scope-approval comment: #2775 (comment)

Does this PR complete the issue, or what remains? It completes the record's done-when. Follow-up (out of this record, spec level): a GHES entry is written as shorthand because GITHUB_HOST is APM's declared implementation-default host (req-mf-009; CONFORMANCE.md). github.com entries written while GITHUB_HOST was unset are also shorthand. Shorthand therefore changes meaning when GITHUB_HOST changes: a reload without GITHUB_HOST re-homes the GHES entry to github.com (--frozen fails closed with zero egress; plain install fails and keeps state), and setting GITHUB_HOST re-homes earlier github.com shorthand to the server. The new hint names the re-qualify step; fixing the root cause needs a conformance-level decision on the implementation-default host.

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 evidence (local, macOS, binary driver = .venv/bin/apm 0.37.0 editable):

Command Result
APM_E2E_TESTS=1 APM_LIFECYCLE_DRIVER=binary APM_BINARY_PATH=$PWD/.venv/bin/apm pytest tests/lifecycle/scenarios/test_explicit_host_identity.py tests/unit/install/test_validation_error_handling.py tests/quality/test_lifecycle_bug_ledger.py -p no:xdist 38 passed
failing-before: test_unconfigured_ghes_host_is_refused_with_working_remedies and TestGenericHostAmbiguousSubpathHint::test_unrecognised_selfhosted_ambiguous_path_returns_hint on main fail on the missing GITHUB_HOST clause; other lifecycle tests pass on main (evidence)
uvx ruff@0.15.12 check / format --check (CI paths) clean
pylint --enable=R0801 ... 10.00/10
bash scripts/lint-auth-signals.sh clean
python scripts/check_complexity_ratchet.py --base-ref origin/main clean
python -m tests.quality.taxonomy --changed clean (2 modules)
python scripts/check_test_assertions.py clean
python scripts/lint_architecture_boundaries.py --root . exit 0
python .apm/skills/cut-release/scripts/changelog_fragments.py check + check-unreleased --base-ref origin/main valid; no new Unreleased bullets

Lifecycle evidence row:

promise: P-OWN-host-reference-coordinates -- each host-qualified package keeps its host, subpath and ref; GITHUB_HOST applies only to hostless shorthand (source: docs/src/content/docs/getting-started/authentication.md)
cell: OP=install,update,uninstall SRC=git PRIM=skill SCOPE=user LOCK=absent,consistent,stale FROZEN NET=ghes+github.com
instrument: target scenario -> tests/lifecycle/scenarios/test_explicit_host_identity.py (new: no mixed-host user-scope scenario existed)
oracles: [I1, I2, I5, I7, I8, I9, egress host isolation, credential carriers, exact changed set]
guard+mutation: n/a     ledger: 2775
hints executed: GITHUB_HOST + re-qualify -> installs; git:+path: object -> installs; configured server kept + object form for a second server -> installs, shorthand row unchanged; frozen tip without GITHUB_HOST -> fails, state kept

Changelog

  • One fragment per section, changelog.d/<pr>.<section>.md, holding
    one line: user-visible effect first, 25 words or fewer, ending with
    (#PR); breaking changes only under upgrade notes; no Highlights; no
    new lines under ## [Unreleased]. See changelog.d/README.md and
    .github/instructions/changelog.instructions.md.
  • N/A -- internal-only change (CI, tests, refactor).

Spec conformance (OpenAPM v0.1)

  • Spec edit
  • Manifest edit
  • Test edit
  • CONFORMANCE.{md,json} regenerated
  • N/A -- this PR does not change OpenAPM-observable behaviour.

Lifecycle scenarios prove each host-qualified package keeps its host,
subpath and ref across install, reload, frozen reinstall, update and
removal, with per-host credential isolation. The unrecognised-host hint
now names GITHUB_HOST for GitHub Enterprise Server.

apm-spec-waiver: hint wording only; no normative manifest or lockfile behaviour changes

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

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.

🟡 Changes recommended

The removal scenario leaves the package in the model, and the host-configuration hint can redirect existing shorthand dependencies to another server.

2 open issues
What changed in this PR

This PR improves the unrecognised-host hint for GitHub Enterprise Server and adds regression coverage for the supported mixed-host install workflow.

Changes:

  • Names GITHUB_HOST and the public-package qualification step in the install hint.
  • Adds lifecycle coverage for host identity, credential isolation, reinstall, update, uninstall, and recovery guidance.
  • Documents mixed-host usage and records the fix in the changelog and bug ledger.
File Description
tests/​unit/​install/​test_validation_error_handling.py Checks the new GHES guidance.
tests/​lifecycle/​scenarios/​test_explicit_host_identity.py Exercises mixed-host lifecycle behavior and remedies.
tests/​fixtures/​lifecycle_bug_ledger/​bugs/​2775.json Links the issue to regression coverage.
src/​apm_cli/​install/​validation.py Adds GITHUB_HOST to the unrecognised-host hint.
packages/​apm-guide/​.apm/​skills/​apm-usage/​authentication.md Adds mixed-host usage and configuration guidance.
docs/​src/​content/​docs/​getting-started/​authentication.md Documents a mixed-host global install example.
changelog.d/​4665.fixed.md Records the improved install hint.

Review effort: Balanced

Comment thread src/apm_cli/install/validation.py Resolved
…hint (#2775)

When GITHUB_HOST already names a server, the hint recommends keeping it
and adding the second server's package as a git: + path: object entry,
since switching GITHUB_HOST re-homes existing shorthand entries. The
lifecycle removal step now passes the full spec so the scenario model
and the CLI select the same package.

apm-spec-waiver: hint wording only; no normative manifest or lockfile behaviour changes

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

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.

🟡 Changes recommended

The tag- and SHA-pinned test cases do not distinguish pin resolution from fetching main because both pins remain at the branch tip; advance those repositories before installation to make the assertions meaningful.

1 open issue
2 resolved since last review

Review effort: Balanced

…arios (#2775)

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

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.

🟡 Changes recommended

The lifecycle tests can miss cross-host credential leaks because reinstall/update omit the reverse-token assertion and anonymous github.com fixtures bypass credential resolution.

2 open issues
1 resolved since last review

Review effort: Balanced

…t step (#2775)

The shared host-isolation helper now also asserts the github.com token
never reaches GHES, and the strict-mode scenario resolves github.com
credentials first so the carrier check sees strict withholding.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

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.

🔵 Needs a closer look

Human assessment is needed because the non-strict scenario can pass without selecting the configured GitHub token, leaving credential-selection behavior untested.

No open issues 🎉

2 resolved since last review

Review effort: Balanced

@danielmeppiel
Daniel Meppiel (danielmeppiel) merged commit c969aba into main Nov 22, 2026
73 checks passed
@danielmeppiel
Daniel Meppiel (danielmeppiel) deleted the danielmeppiel-p1-2775-mixed-host-install branch November 22, 2026 15:21
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] Mixed-host apm install does not preserve explicit package hosts

2 participants