fix(file-search): type binary install failures - #222
Conversation
agnitum2009
left a comment
There was a problem hiding this comment.
Second review — independent verification against ab2b3c2; all claims confirmed.
Local verification (fetched the branch and ran the stated test plan):
bun run check-> exit 0, the 12 Effect diagnostics inbinaries.tsare gone, no new diagnosticsbun run test-> 934 Node tests + 31 Vitest tests pass
Behavioral verification of the Layer composition (adversarial tests with local servers):
- The
Layer.provide(Layer.succeed(FetchHttpClient.RequestInit)({ redirect: "manual" }))binding works:layerMergedContextcaptures the build-time context and merges it into the request context, so the fetch client still seesredirect: "manual". Verified with a redirect matrix (old vs new composition both return the 302 verbatim instead of following) and an end-to-end live-install test where an https->http downgrade redirect is correctly refused withrefusing non-HTTPS download URLand nothing is materialized on disk. - Tampered payloads still fail with SHA-256 mismatch, so the integrity contract holds.
All #170 acceptance criteria hold.
Non-blocking hardening suggestions:
- The repo has no redirect-behavior regression test, and the manual binding now depends on the subtle build-time-capture semantics of
layerMergedContext— a future refactor that movesLayer.succeed(RequestInit)out ofLayer.provide(or swaps layerFetch for a layer not built vialayerMergedContext) would silently lose the manual-redirect policy with no test catching it. A client-level assertion (302 returned verbatim, not followed) would pin this cheaply. - Cosmetic: unify
Effect.fail(new BinaryInstallError(...))vsyield* new BinaryInstallError(...)to one style. - A one-line comment at
installLayernoting RequestInit is bound at build time would help.
|
Closing as superseded by #230, which merged the same Issue #170 fix into |
Problem
The file-search binary installer represented expected download, validation, and extraction failures with global
Errorvalues. This erased the Effect failure-channel discriminant, while the live installer also chained multipleEffect.providecalls that could separate Layer lifecycle ownership.Closes #170.
Value
The installer now keeps expected failures type-safe internally and preserves deterministic Layer construction without changing the public installation error contract. This removes the 11
globalErrorInEffectFailurediagnostics and themultipleEffectProvidediagnostic reported by the Effect Language Service.Approach
BinaryInstallErrorfor expected download, redirect, checksum, and extraction failures;InstallErroras the publicBinaryEnv.installfailure and retain the typed internal error as its cause;Validation
bun run check— passed with the 12 reported Effect diagnostics removedbun run test— passed: 934 Node tests and 31 Vitest testsgit diff --check— passedImpact
InstallErrorcontract and conservative failure behavior are unchanged.