Skip to content

Conversation

@unnoq
Copy link
Member

@unnoq unnoq commented Dec 1, 2025

Summary by CodeRabbit

  • Chores
    • Renamed the inactive cleanup option to a clearer name and increased the default cleanup scheduling interval from 6 hours to 12 hours.
  • Tests
    • Updated tests to reflect the renamed option and the revised scheduling expectations.

✏️ Tip: You can customize this high-level summary in your review settings.

@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Dec 1, 2025
@coderabbitai
Copy link

coderabbitai bot commented Dec 1, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

Renames the resume cleanup configuration from inactiveDataRetentionTime to cleanupIntervalSeconds, raises its default from 6 to 12 hours, and updates alarm scheduling to use cleanupIntervalSeconds directly; documentation and tests updated to match the new name and timing.

Changes

Cohort / File(s) Summary
Docs
apps/content/docs/helpers/publisher.md
Added cleanupIntervalSeconds to the PublisherDO resume configuration example (shown as 12 hours).
Core implementation
packages/publisher-durable-object/src/resume-storage.ts
Replaced inactiveDataRetentionTime with cleanupIntervalSeconds in ResumeStorageOptions and ResumeStorage; changed default from 6h to 12h; alarm scheduling now uses cleanupIntervalSeconds directly.
Tests
packages/publisher-durable-object/src/resume-storage.test.ts
Updated test to use cleanupIntervalSeconds and adjusted expected alarm scheduling/calculation to match the renamed option and new interval.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Verify no remaining references to inactiveDataRetentionTime across the repo.
  • Confirm the default change (6h → 12h) is intended and consistent with operational expectations.
  • Review alarm scheduling logic and related timing calculations in resume-storage.ts and tests for off-by-one/edge cases.
  • Ensure documentation example matches production defaults and types.

Poem

🐇 I nibbled names in code tonight,

cleanupInterval now feels right.
Twelve hours hum, the alarms will sweep,
Tests and docs awake from sleep.
A tidy hop — the resumes keep. 🥕

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: renaming the inactivity-based cleanup configuration for the Cloudflare Durable Object publisher from inactiveDataRetentionTime to cleanupIntervalSeconds.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/publisher/cloudflare-durable-object-cleanup-changed

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between edf4768 and 92d047a.

📒 Files selected for processing (1)
  • apps/content/docs/helpers/publisher.md (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/content/docs/helpers/publisher.md
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: publish-commit
  • GitHub Check: lint
  • GitHub Check: test
  • GitHub Check: Cloudflare Pages

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 and usage tips.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @unnoq, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refactors the cleanup mechanism for Cloudflare Durable Objects by renaming a key configuration parameter and simplifying the alarm scheduling logic. The change aims to make the cleanup process more predictable and easier to understand, ensuring that inactive Durable Objects are properly purged at a defined interval, which has also been adjusted to 12 hours by default.

Highlights

  • Renamed Configuration: The inactiveDataRetentionTime option has been renamed to cleanupIntervalSeconds for improved clarity and accuracy regarding its purpose.
  • Simplified Alarm Scheduling: The Cloudflare Durable Object cleanup alarm is now scheduled directly using the cleanupIntervalSeconds value, removing its previous dependency on retentionSeconds.
  • Updated Default Interval: The default cleanup interval for Durable Objects has been increased from 6 hours to 12 hours, affecting how regularly inactivity checks are performed.
  • Documentation and Test Updates: JSDoc comments and test cases have been updated to reflect the new cleanupIntervalSeconds parameter and its revised behavior.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the cleanup mechanism for Cloudflare Durable Objects by replacing the inactiveDataRetentionTime option with cleanupIntervalSeconds. This change simplifies the alarm scheduling logic, making it a periodic check for inactivity, which is a clearer and more robust approach. The changes are consistently applied across the implementation, tests, and documentation. My only suggestion is to improve the clarity of an inline comment in the documentation to better explain the new cleanup behavior to users.

@codecov
Copy link

codecov bot commented Dec 1, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
packages/publisher-durable-object/src/resume-storage.test.ts (1)

296-314: Time-window assertion could be made more robust

The test correctly asserts that the alarm delay matches cleanupIntervalSeconds, but using Date.now() at assertion time with a tight ±1s window introduces a small flakiness risk if the test environment is slow.

Consider either:

  • Using fake timers (vi.useFakeTimers() / vi.setSystemTime) so both setAlarm and the expectations share a controlled clock, or
  • Capturing a single const now = Date.now() before constructing ResumeStorage and reusing now in both the implementation expectation and bounds, to decouple from test runtime variance.
packages/publisher-durable-object/src/resume-storage.ts (1)

20-30: New cleanupIntervalSeconds option and scheduling look consistent; consider validating the value

The introduction of cleanupIntervalSeconds with a 12 * 60 * 60 default, wiring it through the constructor, and using it directly in scheduleAlarm() all look consistent with the intended “how often to check for cleanup” semantics and with the updated tests/docs.

One improvement to consider: guard against invalid values for cleanupIntervalSeconds (e.g., <= 0, NaN, Infinity) before using it in Date.now() + this.cleanupIntervalSeconds * 1000. Today, a misconfigured value could result in an immediate or effectively never-scheduled alarm, or even a NaN timestamp.

A simple pattern could be:

const rawInterval = options.cleanupIntervalSeconds
if (!Number.isFinite(rawInterval) || rawInterval! <= 0) {
  this.cleanupIntervalSeconds = 12 * 60 * 60
} else {
  this.cleanupIntervalSeconds = rawInterval
}

This keeps the public surface the same while making the runtime more resilient to configuration mistakes.

Also applies to: 42-42, 58-58, 234-235

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f724c58 and edf4768.

📒 Files selected for processing (3)
  • apps/content/docs/helpers/publisher.md (1 hunks)
  • packages/publisher-durable-object/src/resume-storage.test.ts (1 hunks)
  • packages/publisher-durable-object/src/resume-storage.ts (4 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: publish-commit
  • GitHub Check: lint
  • GitHub Check: test
🔇 Additional comments (1)
apps/content/docs/helpers/publisher.md (1)

236-239: Docs example aligned with implementation default

The added cleanupIntervalSeconds: 12 * 60 * 60 and the “default: 12 hours” comment are consistent with the new ResumeStorage default and naming, so the Cloudflare Durable Object example stays in sync with the runtime behavior.

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Dec 1, 2025

Deploying orpc with  Cloudflare Pages  Cloudflare Pages

Latest commit: 92d047a
Status: ✅  Deploy successful!
Preview URL: https://446443a4.orpc-1qh.pages.dev
Branch Preview URL: https://feat-publisher-cloudflare-du.orpc-1qh.pages.dev

View logs

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@pkg-pr-new
Copy link

pkg-pr-new bot commented Dec 1, 2025

More templates

@orpc/ai-sdk

npm i https://pkg.pr.new/@orpc/ai-sdk@1266

@orpc/arktype

npm i https://pkg.pr.new/@orpc/arktype@1266

@orpc/client

npm i https://pkg.pr.new/@orpc/client@1266

@orpc/contract

npm i https://pkg.pr.new/@orpc/contract@1266

@orpc/experimental-durable-iterator

npm i https://pkg.pr.new/@orpc/experimental-durable-iterator@1266

@orpc/hey-api

npm i https://pkg.pr.new/@orpc/hey-api@1266

@orpc/interop

npm i https://pkg.pr.new/@orpc/interop@1266

@orpc/json-schema

npm i https://pkg.pr.new/@orpc/json-schema@1266

@orpc/nest

npm i https://pkg.pr.new/@orpc/nest@1266

@orpc/openapi

npm i https://pkg.pr.new/@orpc/openapi@1266

@orpc/openapi-client

npm i https://pkg.pr.new/@orpc/openapi-client@1266

@orpc/otel

npm i https://pkg.pr.new/@orpc/otel@1266

@orpc/experimental-pino

npm i https://pkg.pr.new/@orpc/experimental-pino@1266

@orpc/experimental-publisher

npm i https://pkg.pr.new/@orpc/experimental-publisher@1266

@orpc/experimental-publisher-durable-object

npm i https://pkg.pr.new/@orpc/experimental-publisher-durable-object@1266

@orpc/experimental-ratelimit

npm i https://pkg.pr.new/@orpc/experimental-ratelimit@1266

@orpc/react

npm i https://pkg.pr.new/@orpc/react@1266

@orpc/react-query

npm i https://pkg.pr.new/@orpc/react-query@1266

@orpc/experimental-react-swr

npm i https://pkg.pr.new/@orpc/experimental-react-swr@1266

@orpc/server

npm i https://pkg.pr.new/@orpc/server@1266

@orpc/shared

npm i https://pkg.pr.new/@orpc/shared@1266

@orpc/solid-query

npm i https://pkg.pr.new/@orpc/solid-query@1266

@orpc/standard-server

npm i https://pkg.pr.new/@orpc/standard-server@1266

@orpc/standard-server-aws-lambda

npm i https://pkg.pr.new/@orpc/standard-server-aws-lambda@1266

@orpc/standard-server-fastify

npm i https://pkg.pr.new/@orpc/standard-server-fastify@1266

@orpc/standard-server-fetch

npm i https://pkg.pr.new/@orpc/standard-server-fetch@1266

@orpc/standard-server-node

npm i https://pkg.pr.new/@orpc/standard-server-node@1266

@orpc/standard-server-peer

npm i https://pkg.pr.new/@orpc/standard-server-peer@1266

@orpc/svelte-query

npm i https://pkg.pr.new/@orpc/svelte-query@1266

@orpc/tanstack-query

npm i https://pkg.pr.new/@orpc/tanstack-query@1266

@orpc/trpc

npm i https://pkg.pr.new/@orpc/trpc@1266

@orpc/valibot

npm i https://pkg.pr.new/@orpc/valibot@1266

@orpc/vue-colada

npm i https://pkg.pr.new/@orpc/vue-colada@1266

@orpc/vue-query

npm i https://pkg.pr.new/@orpc/vue-query@1266

@orpc/zod

npm i https://pkg.pr.new/@orpc/zod@1266

commit: 92d047a

@unnoq unnoq merged commit 7844b89 into main Dec 1, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants