Skip to content

fix(driver-utils): address PR #26151 review comments#26204

Merged
anthony-murphy merged 4 commits intomicrosoft:mainfrom
anthony-murphy-agent:fix/prefetch-review-followup
Jan 14, 2026
Merged

fix(driver-utils): address PR #26151 review comments#26204
anthony-murphy merged 4 commits intomicrosoft:mainfrom
anthony-murphy-agent:fix/prefetch-review-followup

Conversation

@anthony-murphy-agent
Copy link
Contributor

Summary

  • Replace any with proper error types in tests using GenericNetworkError and NonRetryableError
  • Add test for non-retryable errors to verify cache behavior
  • Skip prefetch calls if blobId is already cached to avoid unnecessary async overhead

This is a follow-up PR to address review comments from #26151:

  • @jason-ha: Avoid any and as any - errors should use proper types
  • @jason-ha: Add test for non-retryable errors
  • @markfields: Skip readBlob call if blobId is already in prefetchCache

Test plan

  • New unit test for non-retryable error caching behavior
  • All existing prefetch tests pass (6 total)
  • Lint passes

🤖 Generated with Claude Code

Co-Authored-By: anthony-murphy anthony.murphy@microsoft.com

- Replace `any` with proper error types in tests using GenericNetworkError
  and NonRetryableError from network.ts
- Add test for non-retryable errors to verify cache behavior (errors without
  canRetry=true should remain cached, not cleared)
- Skip prefetch calls if blobId is already cached to avoid unnecessary
  async overhead

Co-Authored-By: anthony-murphy <anthony.murphy@microsoft.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@anthony-murphy
Copy link
Contributor

/azp run Build - api-markdown-documenter, Build - benchmark-tool, Build - build-common, Build - build-tools, Build - client packages, Build - common-utils, Build - eslint-config-fluid, Build - eslint-plugin-fluid, Build - protocol-definitions, Build - test-tools

@anthony-murphy
Copy link
Contributor

/azp run repo-policy-check, server-gitrest, server-gitssh, server-historian, server-routerlicious

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

1 similar comment
@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Contributor

@jason-ha jason-ha left a comment

Choose a reason for hiding this comment

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

#26151 (comment) (use of any) appears addressed :)

…ntity

Address review feedback: use non-retryable error in the fire-and-forget
prefetch failure test so we can verify the cached error instance identity
rather than just checking the message.

Co-Authored-By: anthony-murphy <anthony.murphy@microsoft.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@anthony-murphy
Copy link
Contributor

/azp run Build - api-markdown-documenter, Build - benchmark-tool, Build - build-common, Build - build-tools, Build - client packages, Build - common-utils, Build - eslint-config-fluid, Build - eslint-plugin-fluid, Build - protocol-definitions, Build - test-tools

@anthony-murphy
Copy link
Contributor

/azp run repo-policy-check, server-gitrest, server-gitssh, server-historian, server-routerlicious

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

1 similar comment
@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Add explicit unhandled rejection tracking to the fire-and-forget prefetch
failure tests. This actively verifies no unhandled rejections occur rather
than relying on implicit behavior.

Co-Authored-By: anthony-murphy <anthony.murphy@microsoft.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Change the first assert.rejects in the non-retryable error test to validate
via error instance identity rather than message comparison, for consistency
with other tests.

Co-Authored-By: anthony-murphy <anthony.murphy@microsoft.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@anthony-murphy-agent
Copy link
Contributor Author

Azure Pipelines commands (copy and post separately, limit of 10 at a time):

/azp run Build - api-markdown-documenter, Build - benchmark-tool, Build - build-common, Build - build-tools, Build - client packages, Build - common-utils, Build - eslint-config-fluid, Build - eslint-plugin-fluid, Build - protocol-definitions, Build - test-tools
/azp run repo-policy-check, server-gitrest, server-gitssh, server-historian, server-routerlicious

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses review feedback from #26151 by improving type safety in tests, adding test coverage for non-retryable errors, and optimizing prefetch performance.

Changes:

  • Replace any type usage with proper error types (GenericNetworkError and NonRetryableError)
  • Add comprehensive test for non-retryable error caching behavior
  • Optimize prefetch performance by skipping cache lookups for already-cached blobs

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
packages/loader/driver-utils/src/test/prefetchDocumentStorageService.spec.ts Added typed error helper functions, new non-retryable error test, and improved unhandled rejection tracking in existing tests
packages/loader/driver-utils/src/prefetchDocumentStorageService.ts Added cache checks before prefetch calls to avoid unnecessary async overhead when blobs are already cached

Copy link
Contributor

@jason-ha jason-ha left a comment

Choose a reason for hiding this comment

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

My test concerns were addressed.
For the implementation, would PromiseCache be better to use? Could be for a different follow-up.

@anthony-murphy
Copy link
Contributor

/azp run Build - api-markdown-documenter, Build - benchmark-tool, Build - build-common, Build - build-tools, Build - client packages, Build - common-utils, Build - eslint-config-fluid, Build - eslint-plugin-fluid, Build - protocol-definitions, Build - test-tools

@anthony-murphy
Copy link
Contributor

/azp run repo-policy-check, server-gitrest, server-gitssh, server-historian, server-routerlicious

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

1 similar comment
@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@anthony-murphy anthony-murphy enabled auto-merge (squash) January 13, 2026 23:55
@anthony-murphy anthony-murphy merged commit 63c47eb into microsoft:main Jan 14, 2026
28 checks passed
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.

4 participants