Skip to content

fix(winbindex): fall back to MinIO on a pre-send SHA-1 mismatch - #73

Merged
Wenzel merged 1 commit into
masterfrom
fix/winbindex-zero-byte-fallback
Sep 9, 2026
Merged

Wenzel merged 1 commit into
masterfrom
fix/winbindex-zero-byte-fallback

Conversation

@Wenzel

@Wenzel Wenzel commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

What

Follow-up to #72. Copilot's last review pass (which landed as #72 was being merged) found a real edge in streamFromSymbolServer:

On a SHA-1 mismatch it destroyed the response and returned failed_after_send — blocking the MinIO fallback — even when zero bytes had been written to the client. That happens if the symbol server returns 200 with an empty body for a hash that isn't the empty-file hash. In that case the response is still pristine, so the request should just fall through to MinIO.

Change

One line: the digest-mismatch branch now checks wrote and returns not_available when nothing was sent, mirroring what the stream-error branch already does.

Tests

tests/winbindex.test.ts: added a case (empty 200 body + non-empty expected hash → not_available, response untouched). 38/38 in the winbindex suite; full suite 90 passing (the one tests/git-log failure is the pre-existing unrelated TS1378).

🤖 Generated with Claude Code

https://claude.ai/code/session_01NmATMvFbdupfLRq7Ldwabv

The digest-mismatch branch in streamFromSymbolServer destroyed the
response and returned failed_after_send even when zero bytes had
reached the client (a symbol server 200 with an empty body for a hash
that is not the empty-file hash). The response is still pristine in
that case, so it now mirrors the stream-error branch and returns
not_available, letting the request fall through to MinIO.

Found by Copilot on #72 after merge. winbindex.test.ts 38/38.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NmATMvFbdupfLRq7Ldwabv

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The change is narrowly scoped, preserves the existing “fail after send” behavior when bytes were written, and includes a targeted regression test for the reported edge case.

Pull request overview

Fixes an edge case in the Winbindex → Microsoft symbol server streaming path where a SHA-1 mismatch could incorrectly “fail after send” and block the MinIO fallback even when the client received zero bytes (e.g., symbol server returns 200 with an empty body).

Changes:

  • In streamFromSymbolServer, treat a post-stream digest mismatch as not_available (MinIO fallback) when no bytes were written to the response.
  • Add a regression test covering the empty-200-body + non-empty-expected-hash scenario to ensure the response remains untouched and fallback is allowed.
File summaries
File Description
src/winbindex.ts Allows MinIO fallback on SHA-1 mismatch when wrote === false (no bytes sent).
tests/winbindex.test.ts Adds an empty-body symbol-server case asserting not_available and pristine response state.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Lite

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

@Wenzel
Wenzel merged commit e8807e4 into master Sep 9, 2026
3 checks passed
@Wenzel
Wenzel deleted the fix/winbindex-zero-byte-fallback branch September 9, 2026 12:29
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