Skip to content

test(axis): shared stub-first PATH helper with /usr/bin:/bin fallback (#493 review) - #498

Merged
toasterbook88 merged 2 commits into
mainfrom
fix/493-review
Oct 6, 2026
Merged

toasterbook88 merged 2 commits into
mainfrom
fix/493-review

Conversation

@toasterbook88

@toasterbook88 toasterbook88 commented Oct 6, 2026 •

Copy link
Copy Markdown
Owner

Rebuilt on main (471209c) after #493 merged. Test-only change, plus one committed E2E harness script.

Problem: #493 inlined dir:$PATH:/usr/bin:/bin in two fixtures, but the fixture's own interpreter (sh in runSampleShell, sleep in runMLXStopScript) is resolved by exec.Command from the parent PATH before cmd.Env applies. With an empty PATH, the fallback directories are never reached.

Change:

  • stubFirstDirs(dir): stubs, then inherited PATH entries (empty elements dropped, so the current directory never leaks in), then /run/current-system/sw/bin, /usr/bin, /bin.
  • stubFirstPATH(dir): the child PATH built from that list.
  • stubFirstCommand(dir, name, ...): resolves name from the same list and sets the child PATH. Used for sh and sleep.
  • hack/e2e-fixture-empty-path.sh: compiles the cmd/axis test binary and runs both fixture tests under env -i PATH=.

E2E evidence (empty PATH, compiled test binary):

  • main 471209c: exec: "sleep": executable file not found and exec: "sh": executable file not found, so both tests fail
  • this head: both pass

Local gates (go1.26.6): deadcode passes; go vet clean; gofmt -l . empty; staticcheck clean; verify-repo-truth and verify-public-boundary pass. hermetic-go-test.sh ./cmd/axis/... ./internal/facts/... is ok except the known pre-existing box failure TestProbeAdvisoryLockHeldDoesNotConfuseFileWithLock.

Not merging. This is for review only.

Copilot AI balanced review requested due to automatic review settings October 6, 2026 00:20

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.

Copilot review overview

🟡 Changes recommended

Both fixtures still fail before applying fallback paths when the inherited PATH is empty.

Review effort: Balanced
Findings: 2 Medium severity

Open (2)
What changed in this PR

Centralizes test-fixture PATH construction while preserving stub precedence and fallback tool locations.

Changes:

  • Adds shared stubFirstPATH.
  • Uses it for MLX stop and model observation fixtures.
File Description
cmd/​axis/​model_observation_test.go Adds helper and updates sample-shell environment.
cmd/​axis/​model_mlx_test.go Reuses helper for MLX stop tests.

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

Comment thread cmd/axis/model_mlx_test.go
Comment thread cmd/axis/model_observation_test.go Outdated
Base automatically changed from fix/hw-fixture-path-inherits to main October 6, 2026 00:27
Rebuilt on main after #493 (which inlined dir:$PATH:/usr/bin:/bin).
Addresses the #498 review threads: an empty-PATH fallback is useless if
exec.Command resolves the fixture's own sh/sleep from the parent PATH
before cmd.Env applies.

- stubFirstDirs(dir): stubs, inherited PATH entries (empty elements
  dropped), /run/current-system/sw/bin, /usr/bin, /bin.
- stubFirstPATH(dir): the child PATH built from that list.
- stubFirstCommand(dir, name, ...): resolves name from the same list
  and sets the child PATH; used for runSampleShell's sh and
  runMLXStopScript's sleep (the stop script already runs /bin/sh).
- hack/e2e-fixture-empty-path.sh: committed E2E harness that compiles
  the cmd/axis test binary and runs both fixture tests under
  `env -i PATH=`. On main (471209c) both fail with "sleep"/"sh":
  executable file not found; with this change both pass.
@toasterbook88
toasterbook88 merged commit 73068e7 into main Oct 6, 2026
6 checks passed
@toasterbook88
toasterbook88 deleted the fix/493-review branch October 6, 2026 01:35
toasterbook88 added a commit that referenced this pull request Oct 6, 2026
toasterbook88 added a commit that referenced this pull request Oct 6, 2026
#494 (v0.19.5 release prep) merged at 2026-10-06 01:01 UTC, before the
rest of the v0.19.5 merge chain. Its CHANGELOG section listed #476–#493
only. This PR adds the PRs that landed on `main` after it, so the
v0.19.5 section matches what will be tagged:

- #495 self-update download hardening (includes #496 and #499, applied
to #495's branch before its squash)
- #497 daemon restart after update; `axis version` shows the running
daemon
- #500 `model stop --live`, failed-unload receipts, MLX refusals
- #501 keep `[N/A]` nvidia-smi rows
- #498 stub-first fixture PATH helper

The intro line is updated too (23 PRs, plus #494 itself). Docs-only
change: `internal/buildinfo/version.go` stays `0.19.5`, and the section
date `2026-10-05` is left as #494 set it.

**Local checks:** `hack/verify-repo-truth.sh` OK;
`hack/verify-doc-facts.sh` OK; `hack/validate-release-version.sh
--source` → v0.19.5, and `validate-release-version.sh v0.19.5` → exit 0.
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