Skip to content

chore(server-test): dogfood @constructive-io/upload-client in upload integration test#1120

Merged
pyramation merged 2 commits into
mainfrom
feat/dogfood-upload-client-server-test
May 11, 2026
Merged

chore(server-test): dogfood @constructive-io/upload-client in upload integration test#1120
pyramation merged 2 commits into
mainfrom
feat/dogfood-upload-client-server-test

Conversation

@pyramation
Copy link
Copy Markdown
Contributor

@pyramation pyramation commented May 11, 2026

Summary

Replaces the inline sha256() and putToPresignedUrl() helpers in graphql/server-test/__tests__/upload.integration.test.ts with imports from @constructive-io/upload-client, eliminating duplicated code. This is the same dogfooding pattern applied in constructive-db PR #1099.

Changes:

  • Removed import crypto from 'crypto' and the two inline helper functions (~19 lines)
  • Added import { hashContent, putToPresignedUrl } from '@constructive-io/upload-client'
  • Added @constructive-io/upload-client as a workspace:* dependency in graphql/server-test/package.json
  • Replaced 4 sha256(...) call sites with await hashContent(...)
  • Moved 2 describe-level contentHash declarations into beforeAll blocks (since hashContent is async, unlike the old synchronous sha256)

Review & Testing Checklist for Human

  • putToPresignedUrl signature compatibility: The old inline helper explicitly set Content-Length via Buffer.byteLength(content).toString(). Verify the upload-client export handles this internally and accepts the same arguments (url, content, contentType) → Promise<Response>.
  • hashContent output equivalence: The old sha256() used crypto.createHash('sha256').update(content).digest('hex'). Confirm hashContent produces an identical hex digest — a mismatch would cause uploads to succeed but deduplication and content verification to break silently.
  • Run the upload integration tests: cd graphql/server-test && pnpm test -- --testPathPattern=upload.integration to confirm all tests pass end-to-end against MinIO. These tests require a running MinIO instance (CI provides this).

Notes

  • The lockfile diff is large but substantively just adds the workspace dependency; the rest is pnpm formatting changes.
  • Related: constructive-db PR chore: update schemas from constructive-db #1093 applied the same dogfooding to entity-storage-security.integration.test.ts.

Link to Devin session: https://app.devin.ai/sessions/7903d2a3e7a34c6daa605e12d6b80d9e
Requested by: @pyramation

@devin-ai-integration
Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@pyramation pyramation merged commit e0c6e4d into main May 11, 2026
5 checks passed
@pyramation pyramation deleted the feat/dogfood-upload-client-server-test branch May 11, 2026 04:23
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.

1 participant