chore(server-test): dogfood @constructive-io/upload-client in upload integration test#1120
Merged
Merged
Conversation
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces the inline
sha256()andputToPresignedUrl()helpers ingraphql/server-test/__tests__/upload.integration.test.tswith imports from@constructive-io/upload-client, eliminating duplicated code. This is the same dogfooding pattern applied in constructive-db PR #1099.Changes:
import crypto from 'crypto'and the two inline helper functions (~19 lines)import { hashContent, putToPresignedUrl } from '@constructive-io/upload-client'@constructive-io/upload-clientas aworkspace:*dependency ingraphql/server-test/package.jsonsha256(...)call sites withawait hashContent(...)contentHashdeclarations intobeforeAllblocks (sincehashContentis async, unlike the old synchronoussha256)Review & Testing Checklist for Human
putToPresignedUrlsignature compatibility: The old inline helper explicitly setContent-LengthviaBuffer.byteLength(content).toString(). Verify the upload-client export handles this internally and accepts the same arguments(url, content, contentType) → Promise<Response>.hashContentoutput equivalence: The oldsha256()usedcrypto.createHash('sha256').update(content).digest('hex'). ConfirmhashContentproduces an identical hex digest — a mismatch would cause uploads to succeed but deduplication and content verification to break silently.cd graphql/server-test && pnpm test -- --testPathPattern=upload.integrationto confirm all tests pass end-to-end against MinIO. These tests require a running MinIO instance (CI provides this).Notes
entity-storage-security.integration.test.ts.Link to Devin session: https://app.devin.ai/sessions/7903d2a3e7a34c6daa605e12d6b80d9e
Requested by: @pyramation