Skip to content

feat(relay): Lambda relay, normalizers and CloudFormation template - #4

Merged
jonathanong merged 6 commits into
mainfrom
feat/relay
Nov 10, 2026
Merged

jonathanong merged 6 commits into
mainfrom
feat/relay

Conversation

@jonathanong

Copy link
Copy Markdown
Owner

Adds @hook-harness/relay.

  • POST /webhook: HMAC over raw bytes (base64-decoded), timingSafeEqual, static allowlist, signals-only normalizers, conditional PutItem (redeliveries are a success), 1-day TTL in expiresAt.
  • GET /events?owner=&repos=&after=&limit=: bearer token (SHA-256 looked up as token#<hash>), revoked/expiry check, one Query on the owner partition with SK > max(after-60s, now-1d), pagination up to the limit, gap flag.
  • template.yaml: table (provisioned 25/25 default or on-demand), role, 1-day log group, arm64 nodejs24.x function with placeholder code, public function URL and both permissions.
  • esbuild bundle to packages/relay/dist/index.mjs (AWS SDK v3 bundled). pnpm check passes with 100% coverage.

Contract: owner-partitioned events

Per coordinator request, events are partitioned by owner so one poll covers an org:

  • Event item: PK=owner#<lower-cased owner>, SK=<receivedAt ms, 15 digits>#<delivery id>, top-level repo, envelope, expiresAt.
  • GET /events: owner required (400); repos=a/b,c/d optional. Events are filtered in code after the Query (the cursor advances past filtered-out items, and fills up to limit of kept events). 403 when the token allows nothing in the owner.
  • Token repos entries: owner/name, owner/* or * (case-insensitive).
  • @hook-harness/relay/keys exports: DAY_SECONDS, DAY_MS, OVERLAP_MS, padMs, eventPk, eventSk, eventExpiresAt, tokenHash, tokenPk, tokenKey, tokenAllowsRepo, tokenAllowsOwner.

Note: pnpm added minimumReleaseAgeExclude entries for the AWS SDK packages in pnpm-workspace.yaml.

🤖 Generated with Claude Code

https://claude.ai/code/session_01MaU9o1s775q1DoiNSPtC4b

jonathanong and others added 3 commits November 9, 2026 21:43
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-10T05:44:15.549769Z
We couldn’t complete this review. Comment @codex review to try again.
9d14cb8 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

Next included review available in 47 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Free
  • Run ID: e48e656e-c8e8-4df5-a28f-ccdd8b922915
Commits

Reviewing files that changed from the base of the PR and between df94f44 and dfffa0c.

Files ignored due to path filters: 1

  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
Files selected for processing: 37

  • packages/relay/package.json
  • packages/relay/src/auth.ts
  • packages/relay/src/client.ts
  • packages/relay/src/events.test.ts
  • packages/relay/src/events.ts
  • packages/relay/src/fixtures/check_suite.completed.json
  • packages/relay/src/fixtures/issue_comment.created.json
  • packages/relay/src/fixtures/merge_group.destroyed.json
  • packages/relay/src/fixtures/pull_request.dequeued.json
  • packages/relay/src/fixtures/pull_request_review.submitted.json
  • packages/relay/src/fixtures/pull_request_review_comment.created.json
  • packages/relay/src/fixtures/pull_request_review_thread.resolved.json
  • packages/relay/src/fixtures/push.json
  • packages/relay/src/fixtures/status.json
  • packages/relay/src/fixtures/workflow_run.completed.json
  • packages/relay/src/handler.ts
  • packages/relay/src/index.ts
  • packages/relay/src/keys.ts
  • packages/relay/src/misc.test.ts
  • packages/relay/src/normalize/branch.ts
  • packages/relay/src/normalize/checks.ts
  • packages/relay/src/normalize/comment.ts
  • packages/relay/src/normalize/common.ts
  • packages/relay/src/normalize/index.ts
  • packages/relay/src/normalize/other.test.ts
  • packages/relay/src/normalize/pull-request.test.ts
  • packages/relay/src/normalize/pull-request.ts
  • packages/relay/src/respond.ts
  • packages/relay/src/signature.ts
  • packages/relay/src/template.test.ts
  • packages/relay/src/test-helpers/deps.ts
  • packages/relay/src/test-helpers/fixture.ts
  • packages/relay/src/types.ts
  • packages/relay/src/webhook.test.ts
  • packages/relay/src/webhook.ts
  • packages/relay/template.yaml
  • pnpm-workspace.yaml
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Note

Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Essentials by visiting https://app.coderabbit.ai/settings/billing.

jonathanong and others added 3 commits November 9, 2026 21:48
The conditional put could never dedupe because the sort key includes the
receive time. GitHub does not retry on its own, so a manual redelivery is
an intentional replay.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MaU9o1s775q1DoiNSPtC4b
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MaU9o1s775q1DoiNSPtC4b
@jonathanong
jonathanong merged commit 79cdde9 into main Nov 10, 2026
4 checks passed
@jonathanong
jonathanong deleted the feat/relay branch November 10, 2026 05:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant