Skip to content

fix(install): forward --target to additive apm install (non-isolated)#36

Merged
danielmeppiel merged 1 commit into
mainfrom
fix/additive-install-target
May 7, 2026
Merged

fix(install): forward --target to additive apm install (non-isolated)#36
danielmeppiel merged 1 commit into
mainfrom
fix/additive-install-target

Conversation

@danielmeppiel
Copy link
Copy Markdown
Collaborator

Why

The Install with inline dependencies (additive) job in test-action.yml failed on the v1.7.0 tag run with:

[x] No harness detected
##[error]APM action failed: apm install microsoft/apm-sample-package failed with exit code 2

Failing job

Same v0.12.3 strict-detection root cause as #33, but in a second install code path that #33 didn't cover:

Path Code Status before Status after
Isolated (isolated: true) writes apm.yml then apm install Fixed in #33 (target lands in apm.yml) OK
Default with apm.yml apm install Project's apm.yml owns the signal OK (unchanged)
Default additive (apm.yml absent + inline deps) apm install <dep> per dep Broken: no --target forwarded Fixed here

The fixture in test-action.yml already passes target: copilot, but the action was discarding it for this path.

What

installDeps(dir, deps, target?) now appends --target <value> to every per-dep apm install call when target is set. The bare apm.yml-driven apm install path is intentionally left alone — the project's apm.yml is the source of truth there, and overriding it from the action input would be surprising.

The hoisted validatedTarget from #34 flows straight through, so the strict input validation already covers this path too.

Tests

New regression test forwards --target to additive apm install (non-isolated mode) captures every apm install invocation and asserts the call sequence:

['install', 'microsoft/apm-sample-package', '--target', 'copilot']

111/111 unit tests pass locally.

Release plan

After merge, cut v1.7.1 and let the workflow re-tag v1. The Install with inline dependencies (additive) job runs on push-to-main / tag, so it will validate end-to-end on the new tag.

Mirror of #33's fix for the second install path. Isolated mode writes
`target:` into the generated apm.yml; the non-isolated additive path
(`apm install <dep>` per inline dep, no apm.yml present) had no such
signal and so APM v0.12.3+ strict harness detection rejected with
exit code 2 ("No harness detected") on every workspace without an
on-disk marker like `.github/copilot-instructions.md`.

`installDeps` now accepts the validated target and appends
`--target <value>` to every `apm install <dep>` call. The bare
`apm install` (apm.yml-driven) path is intentionally left alone -
the project's apm.yml is the source of truth for that case, and
overriding it from the action input would be surprising.

Caught by test-action.yml's `Install with inline dependencies
(additive)` job on the v1.7.0 tag run.

Regression test asserts the per-dep call sequence is
`apm install <pkg> --target <value>`. 111/111 unit tests pass.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 7, 2026 10:34
@danielmeppiel danielmeppiel merged commit a70ef4b into main May 7, 2026
22 checks passed
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes the non-isolated “additive install” code path to forward the action’s validated target input to each apm install <dep> invocation, addressing APM v0.12.3+ strict harness detection failures when installing inline dependencies into a workspace that lacks harness markers.

Changes:

  • Forward validatedTarget into installDeps(...) and append --target <value> to each per-dependency apm install call.
  • Add a regression unit test asserting the exact apm install argument sequence for the non-isolated additive path.
  • Regenerate dist/index.js to reflect the source changes.
Show a summary per file
File Description
src/runner.ts Passes validated target into additive installs and appends --target to per-dep apm install calls.
src/__tests__/runner.test.ts Adds regression coverage for forwarding --target in non-isolated additive installs.
dist/index.js Built output updated to include the new forwarding behavior.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 2/3 changed files
  • Comments generated: 1

Comment thread src/runner.ts
Comment on lines 323 to 327
// Install extra inline deps additively
if (depsInput) {
const deps = parseDependencies(depsInput);
await installDeps(resolvedDir, deps);
await installDeps(resolvedDir, deps, validatedTarget);
}
danielmeppiel added a commit that referenced this pull request May 7, 2026
Patch release wrapping #36: completes the v0.12.3 strict-detection
fix for the non-isolated additive install path that v1.7.0 missed.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

2 participants