Skip to content

Claude/presigned links large events hbk mx#61

Draft
elffjs wants to merge 2 commits intomainfrom
claude/presigned-links-large-events-HbkMX
Draft

Claude/presigned links large events hbk mx#61
elffjs wants to merge 2 commits intomainfrom
claude/presigned-links-large-events-HbkMX

Conversation

@elffjs
Copy link
Member

@elffjs elffjs commented Mar 13, 2026

No description provided.

claude added 2 commits March 13, 2026 12:07
When a cloud event's index key matches the new "single-<uuid>.json"
format (introduced in DIS for events too large to batch into Parquet),
skip the inline download and instead return a short-lived pre-signed
S3 GET URL via the new `presignedUrl` GraphQL field.

Changes:
- `IsSingleEventRef(key)` detects keys with `single-` filename prefix
- `ObjectGetter` interface gains `HeadObject` for bucket discovery
- `Service.HeadObject` exposes bucket-scoped head checks
- `Resolver` gains `Presigner` (*s3.PresignClient) and `PresignExpiry`
- `presignSingleEvent` finds the correct bucket via HeadObject, then
  generates a presigned URL for the configured expiry (default 15m)
- `LatestCloudEvent` and `CloudEvents` resolvers detect single refs and
  return header + presignedUrl with data/dataBase64 null
- `PRESIGNED_URL_EXPIRY` setting controls URL lifetime (e.g. "15m")
- GraphQL schema adds `presignedUrl: String` to CloudEvent type
- generated.go updated to reflect new schema field

https://claude.ai/code/session_01NBNBB4CaeL8t97oyiey4dJ
- TestIsSingleEventRef (12 cases): table-driven coverage of IsSingleEventRef
  for positive keys (date-prefixed, bare, deep path, UUID-style), parquet
  batch refs, legacy DID keys, wrong extensions, wrong basename prefixes,
  and edge cases (empty key, bare slash)

- TestPresignedUrlResolver (3 cases): field resolver returns nil for nil
  wrapper, nil for empty URL, and a pointer to the URL string when set

- TestHeaderResolverWithPresignedWrapper: confirms that Header, Data, and
  DataBase64 field resolvers behave correctly when a wrapper carries a
  presigned URL (header returns index header, data/dataBase64 are nil)

- TestPresignSingleEvent (6 cases): exercises presignSingleEvent with a
  stubObjectGetter (no real S3 or network) and a fake-credentialed
  PresignClient (presigning is pure HMAC — no network calls):
    - first bucket hit → presigned URL contains bucket name and key
    - first bucket miss, second hit → falls back correctly
    - both buckets miss → error contains the key
    - non-NoSuchKey error on first bucket → still skips to second
    - configured expiry embedded in X-Amz-Expires query param
    - no buckets configured → error

https://claude.ai/code/session_01NBNBB4CaeL8t97oyiey4dJ
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