Skip to content

Add curl|sh install script with e2e tests#1

Merged
willisrocks merged 9 commits intomainfrom
add-install-script
Mar 9, 2026
Merged

Add curl|sh install script with e2e tests#1
willisrocks merged 9 commits intomainfrom
add-install-script

Conversation

@willisrocks
Copy link
Copy Markdown
Contributor

Summary

Created a POSIX shell install script (install.sh) and comprehensive test suite (tests/test_install.sh) for downloading pre-built devproxy binaries from GitHub Releases. The install script detects OS/arch, constructs the correct download URL, supports curl/wget fallback, and allows configuration via DEVPROXY_VERSION, DEVPROXY_INSTALL_DIR, and DEVPROXY_INSTALL_BASE_URL environment variables. Updated justfile with a test-install recipe and README.md with install instructions.

Test Plan

  • sh -n install.sh -- no syntax errors
  • just test-install -- 16/16 tests passed (6 platform detection, 2 unsupported OS/arch errors, 3 URL construction, 3 full e2e with mock server, 1 download 404 handling, 1 missing downloader)
  • just check -- 23 unit tests passed, 6 e2e tests passed, clippy clean

Residual Issues

  • No checksum/signature verification of downloaded binary (standard for simple install scripts, can be added later)
  • Tiny race window between cp and chmod in install flow (cosmetic)

🤖 Generated with Claude Code

chris-4d and others added 9 commits March 8, 2026 21:57
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Use a dedicated run_detection_with_stderr helper that does not
suppress stderr (no 2>/dev/null), so the "unsupported" error
messages from detect_platform can be captured and asserted.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Extract case statement for mock binary OS detection into a separate
  variable to avoid POSIX sh syntax ambiguity with unparenthesized
  case patterns inside command substitution.
- Replace curl -fsSL -w '%{http_code}' || true pattern with a simple
  if ! curl -fsSL; then error; fi — the old pattern discarded curl's
  exit code and relied on empty-file detection, which could miss
  servers returning HTML error bodies with 200 status.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add install.sh for downloading pre-built devproxy binaries from GitHub
Releases, with OS/arch detection, curl/wget fallback, and configurable
install directory. Include comprehensive shell-based test suite covering
platform detection, URL construction, e2e install, error handling, and
missing downloader scenarios.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix run_detection_with_stderr exit code handling: use `|| _rc=$?`
  pattern instead of bare `$?` after command, which was unreachable
  under set -eu (findings 1, 5)
- Replace fragile `sed 's/^main$//'` with sentinel marker
  `# __DEVPROXY_INSTALL_MAIN__` and guard assertion (finding 2)
- Replace flaky `sleep 1` for mock server startup with a retry loop
  that polls the server with curl (finding 3)
- Add user-friendly error message to create_install_dir when mkdir
  fails, suggesting sudo or DEVPROXY_INSTALL_DIR (finding 4)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Use `install -m 755` instead of mv + chmod to atomically place the
  binary with correct permissions, eliminating the window where an
  interrupt could leave a non-executable binary (finding 1)
- Add writability check for existing install directories so users get
  a clear error instead of a cryptic mv failure (finding 2)
- Remove `2>/dev/null` from wget so TLS/DNS errors are visible to
  users; `-q` already suppresses the progress bar (finding 3)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Replace `install -m 755` with `cp` + `chmod 755` for portability on
  minimal Linux systems like Alpine (finding 1)
- Add explicit error handling for cp and chmod failures with clear
  messages instead of falling through to verify_installation (finding 2)
- Add test cases for amd64 and arm64 architecture aliases on Linux,
  covering the alternate uname -m values (finding 3)
- Add fallback case for _mock_os on unsupported host platforms so e2e
  tests skip gracefully instead of using an unset variable (finding 4)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@willisrocks willisrocks merged commit cfbc212 into main Mar 9, 2026
@willisrocks willisrocks deleted the add-install-script branch March 9, 2026 05:30
willisrocks added a commit that referenced this pull request Mar 10, 2026
- Update docs/spec.md and skills/setup/SKILL.md to reference login
  keychain instead of system keychain (finding #1)
- Use distinct CN "devproxy Test CA" in roundtrip test to avoid
  colliding with real devproxy CAs in the login keychain (finding #3)
- Update e2e test to accept trust success (no longer requires sudo
  fallback output since login keychain trust succeeds without sudo)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.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