Repository navigation
fix(setup): report the failed Hopper request URL and HTTP status - #8526
Conversation
Hopper download callers collapsed every transport failure into a bare `ok: false`, so HTTP 404 and 503 from the macOS feed and DMG, the Linux publisher feed, the public key and the launch-time package download produced identical generic advice without the failed URL. The shared downloader now returns a typed failure (url plus http_status, timeout, network, response_too_large or url_refused) and keeps caller cancellation as a rejection. Installers attribute it to the request (release_feed, package or public_key); HopperReleaseError carries it, and setup projects it once into `download` and a remediation naming the URL, outcome and next step. Replaces the Linux-only "Package download returned HTTP" special case. Fixes #8503 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 67314ba5f1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
[Medium impact] The PR appears safe to merge; all previous findings are addressed and no new actionable issue was found. SummaryHopper download failures now keep the failed request, URL, and observed outcome through setup and publisher checks.
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Hopper request] --> B[Shared downloader]
B --> C[Typed failure]
C --> D[Installer or publisher]
D --> E[Setup download field and advice]
D --> F[Doctor or launch message]
Reviews (2) · Last reviewed commit: "fix(setup): refuse credentialed Hopper U..." · Reviewed by Greptile |
Native Fetch rejects a URL with userinfo using a TypeError that echoes the whole URL, so a credentialed redirect reached `download.detail`, setup remediation and publisher messages as a network failure. The downloader now refuses request and redirect URLs carrying credentials as `url_refused: credentials` before requesting them, and reports the caller URL through the shared userinfo-removing `sanitizeBrowserUrl`. Releasing an unadmitted body no longer replaces the outcome it was released for: an errored (truncated) body after HTTP 503, or a failed cancel at the size limit, keeps `http_status` or `response_too_large`. Tests compare delivered remediation with the owning formatters and assert request, URL, status and recovery class independently. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…luto#8526) * fix(setup): report the failed Hopper request URL and HTTP status Hopper download callers collapsed every transport failure into a bare `ok: false`, so HTTP 404 and 503 from the macOS feed and DMG, the Linux publisher feed, the public key and the launch-time package download produced identical generic advice without the failed URL. The shared downloader now returns a typed failure (url plus http_status, timeout, network, response_too_large or url_refused) and keeps caller cancellation as a rejection. Installers attribute it to the request (release_feed, package or public_key); HopperReleaseError carries it, and setup projects it once into `download` and a remediation naming the URL, outcome and next step. Replaces the Linux-only "Package download returned HTTP" special case. Fixes morluto#8503 Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(setup): refuse credentialed Hopper URLs and keep known HTTP outcomes Native Fetch rejects a URL with userinfo using a TypeError that echoes the whole URL, so a credentialed redirect reached `download.detail`, setup remediation and publisher messages as a network failure. The downloader now refuses request and redirect URLs carrying credentials as `url_refused: credentials` before requesting them, and reports the caller URL through the shared userinfo-removing `sanitizeBrowserUrl`. Releasing an unadmitted body no longer replaces the outcome it was released for: an errored (truncated) body after HTTP 503, or a failed cancel at the size limit, keeps `http_status` or `response_too_large`. Tests compare delivered remediation with the owning formatters and assert request, URL, status and recovery class independently. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
What broke: Every Hopper download caller (macOS feed and DMG, Linux publisher feed, public key, and launch-time package download) threw away the HTTP status and URL the transport had already observed. HTTP 404 and 503 produced the same generic setup advice.
Fix: The shared downloader now returns a typed failure (
urlplushttp_status/timeout/network/response_too_large/url_refused). Each caller tags it with its request (release_feed,package,public_key), and setup turns it into a structureddownloadfield and a remediation that names the URL, outcome and next step.Risk: Low to moderate.
downloadHopperPackagechanges from{ok, bytes, httpStatus?}toResult(internal to the application layer). REA's own timeout is now returned as data, while caller cancellation still rejects. Setup codes are unchanged.Summary
Fixes #8503.
Hopper setup could not tell a missing release apart from a temporary vendor outage, and it never named the request that failed. This PR keeps the transport's observed facts in one failure shape. That shape flows from
HopperDownload.tsthrough both installers and the Linux publisher into the setup result, doctor and Linux launch messages.Problem and expected behavior
systemSetupHost(darwinDoctor).installHopper(false)with the feed returning 200 and the DMG returning 404 or 503 →{code: "download_failed", remediation: "REA could not download or unpack the official Hopper package. Check network and filesystem access, then retry setup."}for both statuses. The macOS feed, Linux feed (The official Hopper release feed is unavailable.), public key (The official Hopper public key is unavailable.) and launch-time package download (LinuxHopperPublisher.ts:535) dropped the status in the same way.{ "status": "failed", "code": "download_failed", "remediation": "The official Hopper package request to https://www.hopperapp.com:443/downloader/public/Hopper-6.6.1-demo.dmg returned HTTP 503. The vendor service reported a temporary failure; wait, then retry.", "download": { "request": "package", "url": "https://www.hopperapp.com:443/downloader/public/Hopper-6.6.1-demo.dmg", "kind": "http_status", "httpStatus": 503 } }Change and scope
HopperDownload.tsowns the facts. It returnsResult<Uint8Array, HopperDownloadFailure>. The failure kinds arehttp_status(withhttpStatus, left out when the response status is not a valid 300–599 integer, which keeps the existing rule),timeout(REA's own deadline),network(FetchTypeError, with the underlying cause message),response_too_large, andurl_refused(invalid_url,non_https,credentials,redirect_without_location,redirect_limit). Caller cancellation still rejects with the caller's reason, so installer and publisher cancellation handling is unchanged. The same module owns the single description and the recovery text.url_refused: credentials). Native Fetch would reject them anyway, and its error message echoes the whole URL.urlis the caller's requested URL with userinfo removed by the existing sharedsanitizeBrowserUrl, and redirect targets are never reported.http_statusorresponse_too_largewithnetwork.HopperReleaseError.fromDownloadmakes the publisher's feed, key and launch-time package errors carrydownload, with the owned description as their message. That message is what doctordetails.messageand Linux launchuserMessagealready show.download.setupInstallFailure(reason, {packageFailure, platform, download})is the one projection: it replaces the stage's generic advice and addsdownload.runSetupkeepsdownloadonSetupResult, including when a later client or skill failure takes overcode.operationFailure: "Package download returned HTTP n.", which this PR supersedes.publisher_verification_failed). Doctordetailsgains no new structured field; its message carries the facts. The Hopper macOS minimum-version planning ([Bug] Hopper macOS setup accepts hosts below the signed app minimum version #8502) is untouched. It will probably editMacHopper.tsandHopperReleaseFeed.tsas well, but in different functions.Contribution scope: ordinary fix within existing setup boundaries; maintainer scope decision not applicable.
Contract and boundary impact
src/application/HopperDownload.ts(transport). Consumers:MacHopper.ts,LinuxHopper.ts,LinuxHopperPublisher.ts,HopperReleaseFeed.ts(HopperReleaseError),SetupInstallFailure.ts,SetupHost.ts,Setup.ts/SetupTypes.ts. The superseded Linux HTTP-status text path is removed.rea setup --format jsonresults gain an optionaldownloadfield. Remediation text is more specific. No MCP tool or catalog change. Doctor and launch messages for publisher download failures now name the URL and status.docs/installation.mddocuments thedownloadfield. No generated files.Expected effects:
Evidence and regression coverage
tests/process-global/hopperDownloadHttpFailure.test.ts: publicsystemSetupHost(...).installHopper(false)with injectedfetchfor HTTP 404 and 503 on the macOS feed, macOS DMG, Linux publisher feed, Linux public key (checked before any package manager runs; request order asserted), and Linux package. Also covers a macOS networkTypeError, the launch-timeLinuxHopperPublisher.inspectLauncherpackage download, invalid failed-response statuses (status left out rather than misreported), and an unchanged success. Remediation is compared with the owning formatters, while the request, URL, status and recovery class are asserted separately.url_refused: credentialsand check thatJSON.stringify(result)contains no fixture credentials. Also: a credentialed caller URL is refused without fetch and reported without userinfo, HTTP 503 with an errored body keepshttp_status, and a failing cancel at the size limit keepsresponse_too_large. These five cases fail on the previous PR head, where the secret appeared indetailandremediation.tests/process-global/hopperDownloadRedirect.test.ts: HTTPS-downgrade, redirect-limit and initial non-HTTPS refusals now reporturl_refusedwith their reason.tests/boundary/setup/linuxHopperPublisherVerification.test.ts: REA's deadline returnstimeoutwhile caller cancellation still rejects with the caller's reason. An oversized chunked body returnsresponse_too_large.MacHopper.test.ts/LinuxHopper.test.ts: feed and package failures are tied to their stage before any mount, package-manager run or cleanup.Setup.configuration.test.ts:runSetupkeepsdownloadon the final result and after a later skill failure, and leaves it out when no request facts exist.hopperDownloadHttpFailure.test.tsfails 22/22 on base. For example, the macOS DMG 503 case returns the genericdownload_failedremediation with nodownload.Boundary regressions covered: transport-to-result projection for each caller (feed, package, key, launch verification), malformed status input, cancellation versus deadline, and body release on failure. Lifecycle: no lifecycle stage changed. Failures still happen before temporary directory creation, mount or package-manager steps, and existing cleanup suites pass.
Validation performed
Local host: macOS arm64, Node 26 (CI uses the pinned Node 24.22.1).
npx vitest runonhopperDownloadHttpFailure,hopperDownloadRedirect,MacHopper,LinuxHopper,LinuxHopper.cleanup,HopperReleaseFeed,SetupInstallFailure,Setup.configuration,Setup.recovery,linuxHopperPublisherVerificationandDoctor(after the review follow-up): 325 passed, 20 skipped (Linux-only).LinuxHopper.cleanup,LinuxHopperPackageRuntime,HopperReleaseFeed,Setup.recovery/planning/initialSnapshot,Doctor): passed. Three other suites in that run (src/setupEnvironment.test.ts,tests/boundary/filesystem/setupLinuxCleanupOwnership.test.ts,tests/boundary/cli/doctorHopperDiscovery.test.ts) failed, but they need a compileddist/runtime. Two of them were re-run on unmodified base and fail the same way there;doctorHopperDiscoveryreported "REA's compiled runtime is missing" and was not re-run on base. CI covers all three.npm run check:fast: passed.npm run format:check: passed.tests/conformance/readmeConsistency.test.ts: passed.documentationFacts.test.tsneeds the generateddocs/public/product-catalog.json, which cannot be generated under local Node 26, so it andnpm run docs:checkwere left to CI.Compatibility, safety, and release
downloadfield is optional and setup codes are unchanged. Internally,downloadHopperPackageand theMacHopperInstallHost.download/LinuxHopperInstallHost.downloadports now returnResult, andsetupInstallFailuretakes a context object. All in-repo implementations and tests are updated.fetchresponses on macOS; no Linux package manager or Hopper app ran.sanitizeBrowserUrl. Redirect locations are never reported, and no credentials reachdetail, remediation or messages (regression-tested).Author readiness
Human owner: @kaoru0822-kitauji
Before merge
type(scope): outcome.🤖 Generated with Claude Code