Skip to content

[PUB-1702] Use server-provided GC grace period for tombstone removal#2053

Merged
VeskeR merged 3 commits into
mainfrom
PUB-1702/objects-server-gc
Jul 23, 2025
Merged

[PUB-1702] Use server-provided GC grace period for tombstone removal#2053
VeskeR merged 3 commits into
mainfrom
PUB-1702/objects-server-gc

Conversation

@VeskeR

@VeskeR VeskeR commented Jul 1, 2025

Copy link
Copy Markdown
Contributor

gcGracePeriod is now set from connectionDetails received on CONNECTED event. Added to realtime in https://ably.atlassian.net/browse/PUB-1127

Resolves PUB-1702

Summary by CodeRabbit

  • New Features

    • The grace period for object garbage collection is now configurable per connection and updates dynamically based on server-provided details.
  • Bug Fixes

    • Improved handling of the garbage collection grace period to ensure it reflects the latest connection information.
  • Tests

    • Added and updated tests to verify correct initialization and dynamic updating of the garbage collection grace period per connection.

@coderabbitai

coderabbitai Bot commented Jul 1, 2025

Copy link
Copy Markdown

"""

Walkthrough

The changes implement dynamic configuration of the garbage collection grace period (gcGracePeriod) for objects, allowing it to be set by the server via connection details and updated on reconnect. The logic for using this value is refactored throughout relevant classes, and tests are updated to verify correct initialization and updating of gcGracePeriod from server-supplied values.

Changes

File(s) Change Summary
src/plugins/objects/defaults.ts Added comments clarifying fallback logic for gcGracePeriod default usage.
src/plugins/objects/livemap.ts, src/plugins/objects/objectspool.ts Updated to use instance-specific gcGracePeriod (this._objects.gcGracePeriod) instead of static default.
src/plugins/objects/objects.ts Added public gcGracePeriod property; logic to initialize and update it from server connection details.
test/common/modules/private_api_recorder.js Updated private API identifiers to refer to Objects.gcGracePeriod directly.
test/realtime/objects.test.js Added/updated tests to verify correct initialization and updating of gcGracePeriod from connection details.

Sequence Diagram(s)

sequenceDiagram
    participant Server
    participant Client
    participant Objects
    participant ConnectionManager

    Server->>Client: CONNECTED (with gcGracePeriod in connectionDetails)
    Client->>ConnectionManager: Receives connectionDetails
    ConnectionManager->>Objects: Emits connectiondetails event
    Objects->>Objects: Set gcGracePeriod from connectionDetails (or fallback to default)
    Note over Objects: On subsequent CONNECTED events, update gcGracePeriod as needed
Loading

Estimated code review effort

2 (~20 minutes)

Suggested reviewers

  • mschristensen

Poem

A rabbit hops with code so neat,
Grace periods now server-sweet!
No longer static, they adapt and flow,
From connection details, values grow.
Tombstones vanish right on cue—
Dynamic GC, the way that's new!
🐇✨
"""

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ast-grep (0.38.6)
test/realtime/objects.test.js
🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

npm warn EBADENGINE Unsupported engine {
npm warn EBADENGINE package: '@es-joy/jsdoccomment@0.37.1',
npm warn EBADENGINE required: { node: '^14 || ^16 || ^17 || ^18 || ^19 || ^20' },
npm warn EBADENGINE current: { node: 'v24.3.0', npm: '11.4.2' }
npm warn EBADENGINE }
npm warn EBADENGINE Unsupported engine {
npm warn EBADENGINE package: 'eslint-plugin-jsdoc@40.3.0',
npm warn EBADENGINE required: { node: '^14 || ^16 || ^17 || ^18 || ^19' },
npm warn EBADENGINE current: { node: 'v24.3.0', npm: '11.4.2' }
npm warn EBADENGINE }
npm error Exit handler never called!
npm error This is an error with npm itself. Please report this error at:
npm error https://github.com/npm/cli/issues
npm error A complete log of this run can be found in: /.npm/_logs/2025-07-22T16_33_58_783Z-debug-0.log


📜 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 20f7b69 and d910262.

📒 Files selected for processing (2)
  • test/common/modules/private_api_recorder.js (2 hunks)
  • test/realtime/objects.test.js (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • test/common/modules/private_api_recorder.js
  • test/realtime/objects.test.js
⏰ 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). (7)
  • GitHub Check: test-browser (firefox)
  • GitHub Check: test-browser (webkit)
  • GitHub Check: test-browser (chromium)
  • GitHub Check: test-node (20.x)
  • GitHub Check: test-node (16.x)
  • GitHub Check: test-npm-package
  • GitHub Check: test-node (18.x)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch PUB-1702/objects-server-gc

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@VeskeR VeskeR requested a review from mschristensen July 1, 2025 08:24
@github-actions github-actions Bot temporarily deployed to staging/pull/2053/bundle-report July 1, 2025 08:24 Inactive
@github-actions github-actions Bot temporarily deployed to staging/pull/2053/features July 1, 2025 08:24 Inactive
@github-actions github-actions Bot temporarily deployed to staging/pull/2053/typedoc July 1, 2025 08:25 Inactive
@VeskeR VeskeR removed the request for review from lawrence-forooghian July 18, 2025 10:18
@github-actions github-actions Bot temporarily deployed to staging/pull/2053/features July 22, 2025 08:10 Inactive
@github-actions github-actions Bot temporarily deployed to staging/pull/2053/bundle-report July 22, 2025 08:10 Inactive
@github-actions github-actions Bot temporarily deployed to staging/pull/2053/typedoc July 22, 2025 08:10 Inactive
@VeskeR VeskeR force-pushed the PUB-1702/objects-server-gc branch from 49ae8c8 to 79c3f75 Compare July 22, 2025 08:11
@VeskeR VeskeR changed the base branch from PUB-1667/map-set-objects to main July 22, 2025 08:11
@VeskeR VeskeR force-pushed the PUB-1702/objects-server-gc branch from 79c3f75 to ab9d982 Compare July 22, 2025 08:37
@github-actions github-actions Bot temporarily deployed to staging/pull/2053/features July 22, 2025 08:38 Inactive
@github-actions github-actions Bot temporarily deployed to staging/pull/2053/bundle-report July 22, 2025 08:38 Inactive
@github-actions github-actions Bot temporarily deployed to staging/pull/2053/typedoc July 22, 2025 08:38 Inactive
@VeskeR VeskeR force-pushed the PUB-1702/objects-server-gc branch from ab9d982 to 5dea3dc Compare July 22, 2025 08:53
@github-actions github-actions Bot temporarily deployed to staging/pull/2053/features July 22, 2025 08:54 Inactive
@github-actions github-actions Bot temporarily deployed to staging/pull/2053/bundle-report July 22, 2025 08:54 Inactive
@github-actions github-actions Bot temporarily deployed to staging/pull/2053/typedoc July 22, 2025 08:54 Inactive
VeskeR added 2 commits July 22, 2025 10:07
`gcGracePeriod` is now set from connectionDetails received on CONNECTED
event. Added to realtime in [1]

Resolves PUB-1702

[1] https://ably.atlassian.net/browse/PUB-1127
The field was renamed server-side to better reflect that this is
specifically for LiveObjects
@VeskeR VeskeR force-pushed the PUB-1702/objects-server-gc branch from 5dea3dc to 20f7b69 Compare July 22, 2025 09:07
@github-actions github-actions Bot temporarily deployed to staging/pull/2053/bundle-report July 22, 2025 09:08 Inactive
@github-actions github-actions Bot temporarily deployed to staging/pull/2053/features July 22, 2025 09:08 Inactive
@github-actions github-actions Bot temporarily deployed to staging/pull/2053/typedoc July 22, 2025 09:08 Inactive
@VeskeR VeskeR merged commit 8dfda2e into main Jul 23, 2025
15 of 20 checks passed
@VeskeR VeskeR deleted the PUB-1702/objects-server-gc branch July 23, 2025 03:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants