Skip to content

[codex] Fix Devvit bridge raw request handling - #18

Merged
imjlk merged 1 commit into
mainfrom
codex/devvit-bridge-fixes
Jul 6, 2026
Merged

imjlk merged 1 commit into
mainfrom
codex/devvit-bridge-fixes

Conversation

@imjlk

@imjlk imjlk commented Jul 6, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Preserve raw Uint8Array request bodies when translating Express requests into Fetch requests for Devvit oRPC bridge handling.
  • Align Devvit leaderboard lock expiration with the millisecond TTL constant in both the reference target and generated Phaser template.
  • Add a patch Sampo changeset for @mpgd/cli.

Validation

  • pnpm format
  • pnpm --dir apps/target-devvit check
  • pnpm validate:starter-workflow
  • pnpm check
  • ocr llm test
  • ocr review --audience agent --background "Fix Devvit target bridge raw request handling and leaderboard lock TTL in mpgd-kit reference target and generated Phaser template." --from origin/main --to HEAD — no comments generated

Notes

  • Scope intentionally excludes README install guidance and helper package promotion.

Summary by CodeRabbit

  • Bug Fixes
    • Preserves raw request body headers when forwarding Devvit target requests, improving handling of binary or non-JSON payloads.
    • Avoids incorrectly adding a JSON content type to raw byte requests.
    • Aligns leaderboard lock expiration timing with the intended millisecond-based timeout, reducing timing mismatches.

@coderabbitai

coderabbitai Bot commented Jul 6, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7f99edd0-ff59-495f-9710-9b4710c9be5d

📥 Commits

Reviewing files that changed from the base of the PR and between bb96043 and c5f0672.

📒 Files selected for processing (3)
  • .sampo/changesets/devvit-bridge-fixes.md
  • apps/target-devvit/src/server/index.ts
  • packages/cli/templates/phaser-game/apps/target-devvit/src/server/index.ts

📝 Walkthrough

Walkthrough

This PR fixes two bugs in the Devvit target server's expressRequestToFetchRequest and leaderboardLockExpirationDate functions, applied identically to both apps/target-devvit and the CLI's phaser-game template, plus an accompanying changeset entry.

Changes

Devvit Bridge Fixes

Layer / File(s) Summary
Leaderboard lock TTL calculation
apps/target-devvit/src/server/index.ts, packages/cli/templates/phaser-game/apps/target-devvit/src/server/index.ts
leaderboardLockExpirationDate() now uses leaderboardLockTtlMs directly instead of multiplying leaderboardLockTtlSeconds by 1000.
Request body/content-type handling
apps/target-devvit/src/server/index.ts, packages/cli/templates/phaser-game/apps/target-devvit/src/server/index.ts
expressRequestToFetchRequest() assigns init.body before header logic and only defaults content-type to application/json when missing and the body is not a Uint8Array.
Changeset documentation
.sampo/changesets/devvit-bridge-fixes.md
Adds a patch changeset for npm/@mpgd/cli documenting both fixes.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • imjlk/mpgd-kit#2: Introduces the Devvit target/bridge implementation, including leaderboardLockExpirationDate() and expressRequestToFetchRequest(), that this PR fixes.
  • imjlk/mpgd-kit#6: Also modifies expressRequestToFetchRequest's body/content-type handling while wiring the bridge to the oRPC endpoint.
  • imjlk/mpgd-kit#9: Also touches the same leaderboardLockExpirationDate and expressRequestToFetchRequest functions in both file locations.

Poem

A rabbit hopped through TTL and byte,
Fixed the lock so timing's right,
No more JSON forced on raw data's back,
Uint8Array bodies now stay on track,
Two files, one fix, one changeset song —
Thump thump, the bridge is strong! 🐇✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: fixing Devvit bridge raw request handling.
Description check ✅ Passed The description matches the template with Summary, Validation, and Notes sections and includes the key implementation details.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/devvit-bridge-fixes

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

imjlk commented Jul 6, 2026

Copy link
Copy Markdown
Owner Author

Codex follow-up: I rechecked the final PR state after CI completed and found no further issues. Local validation and Open Code Review both passed, and all GitHub checks are green.

@imjlk
imjlk merged commit acfa5f0 into main Jul 6, 2026
6 checks passed
@imjlk
imjlk deleted the codex/devvit-bridge-fixes branch July 6, 2026 18:30
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