Skip to content

Add e2e tests for update binary checksum verification - #434

Merged
skyrpex merged 2 commits into
mainfrom
devx-1035-add-e2e-tests-for-lstk-update-checksum-verification
Aug 5, 2026
Merged

Add e2e tests for update binary checksum verification#434
skyrpex merged 2 commits into
mainfrom
devx-1035-add-e2e-tests-for-lstk-update-checksum-verification

Conversation

@skyrpex

@skyrpex skyrpex commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Issue

lstk update's direct-binary path now hard-depends on SHA-256 verification against the release's checksums.txt (fail-closed). That gate had unit coverage only — nothing exercised the full download-and-verify flow through the real binary, so a regression could break every binary-install user's update path unnoticed.

Solution

Add three hermetic e2e tests that run a real built binary against a mock GitHub server (no network, all side effects in temp dirs):

  • Happy path — correct manifest: binary downloaded, verified, replaced in place; replaced binary prints the new version.
  • Checksum mismatch — update aborts with exit 1, "checksum mismatch" reported, installed binary untouched, no temp leftovers.
  • Missing checksums.txt — fail-closed refusal ("refusing to install an unverifiable binary"), nothing installed.

To make the real binary reach the mock, two undocumented test-only env vars redirect the updater's GitHub hosts: LSTK_UPDATE_GITHUB_API_ENDPOINT (release metadata, default api.github.com) and LSTK_UPDATE_GITHUB_DOWNLOAD_ENDPOINT (assets, default github.com) — same pattern as LSTK_API_ENDPOINT / LSTK_ANALYTICS_ENDPOINT. Unset means production defaults; behavior is otherwise unchanged.

Also hardened the existing real-GitHub tests: TestUpdateBinaryInPlace/...JSON now run with an isolated temp $HOME (they previously leaked config/logs into the developer's real one) and assert the replaced binary prints the exact version the update reported.

Docs

No user-facing changes. The two new env vars are deliberately undocumented test-only knobs (redirecting the update download source is not a supported user workflow — enterprise/offline setups are served by the existing custom image config instead). Nothing for technical writers to pick up.

Review

Human review advised — small, test-focused change, but it adds env-var redirection hooks into the security-sensitive update download path; worth confirming the test-only override approach there.

Closes DEVX-1035

Co-Authored-By: Claude noreply@anthropic.com

Co-Authored-By: Claude <noreply@anthropic.com>
@skyrpex skyrpex added semver: patch docs: skip Pull request does not require documentation changes labels Aug 5, 2026
Co-Authored-By: Claude <noreply@anthropic.com>
@skyrpex
skyrpex marked this pull request as ready for review August 5, 2026 13:18
@skyrpex
skyrpex requested a review from a team as a code owner August 5, 2026 13:18
@skyrpex
skyrpex merged commit e05657c into main Aug 5, 2026
19 checks passed
@skyrpex
skyrpex deleted the devx-1035-add-e2e-tests-for-lstk-update-checksum-verification branch August 5, 2026 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs: skip Pull request does not require documentation changes semver: patch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant