Skip to content

Create primaryStub and deprecate 'primary' field.#6605

Merged
jtolio merged 1 commit into
jolio/move-config-read-replicationfrom
jolio/add-primaryStub
Apr 23, 2026
Merged

Create primaryStub and deprecate 'primary' field.#6605
jtolio merged 1 commit into
jolio/move-config-read-replicationfrom
jolio/add-primaryStub

Conversation

@jtolio

@jtolio jtolio commented Apr 17, 2026

Copy link
Copy Markdown
Member

No description provided.

@jtolio jtolio requested review from a team as code owners April 17, 2026 19:02
@jtolio jtolio requested a review from justin-mp April 17, 2026 19:02

@ask-bonk ask-bonk Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm Bonk, and I've done a quick review of your PR.

This PR adds primaryStub as an alias for the existing primary property on DurableObjectStorage, both backed by getPrimary(), and marks primary as deprecated via a C++ comment.

Issues

  1. Missing @deprecated JSDoc on primary in TypeScript types (medium) — The deprecation is only expressed as a C++ comment. TypeScript users will see both primaryStub and primary in their IDE with no indication that primary is deprecated. Consider adding a @deprecated JSDoc annotation so IDEs surface the deprecation with a strikethrough. This could be done via JSG_TS_OVERRIDE in the DurableObjectStorage block, or by adding a comment annotation that the type generator picks up.

  2. No test for the new property (low) — Since primaryStub maps to the same getter as primary, the risk is very low. Still, a quick assertion in an existing test that ctx.storage.primaryStub is accessible would provide coverage.

Comment thread src/workerd/api/actor-state.h
@ask-bonk

ask-bonk Bot commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

I've posted my review on PR #6605. Here's a summary:

PR adds primaryStub as an alias for the existing primary property on DurableObjectStorage, both backed by the same getPrimary() getter, and marks primary as deprecated with a C++ comment.

Two issues flagged:

  1. Missing @deprecated JSDoc on primary in TypeScript types (medium) — The deprecation is only a C++ comment. TypeScript/IDE users won't see any deprecation signal. Suggested adding a @deprecated annotation via JSG_TS_OVERRIDE so IDEs show a strikethrough on primary.

  2. No test for the new property (low) — Since it's the same getter, risk is minimal, but noted for completeness.

github run

@jtolio jtolio requested a review from a team as a code owner April 17, 2026 19:36
@jtolio jtolio requested a review from emily-shen April 17, 2026 19:36
@jtolio jtolio force-pushed the jolio/add-primaryStub branch from ab0c23c to 6eef891 Compare April 17, 2026 19:38
@jtolio jtolio enabled auto-merge (rebase) April 17, 2026 19:39
@jtolio jtolio changed the title Create primaryStub and deprecate the confusingly named primary field. Create primaryStub and deprecate 'primary' field. Apr 21, 2026

@justin-mp justin-mp left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

As matter of onboarding you our usual approach to commits, let's do this one by the book.

  • The doc updates for ensureReplicas and disableReplicas should be separate commits. Why? Because commits should have exactly one idea in them. (They should really be a separate PR, but we do just-passing-through cleanups like this sometimes because stacking PRs is such a pain.)
  • Rebase on top of master rather than merge. Why? We prefer to edit history in PRs.

@jtolio

jtolio commented Apr 22, 2026

Copy link
Copy Markdown
Member Author

The doc updates for ensureReplicas and disableReplicas should be separate commits. Why? Because commits should have exactly one idea in them. (They should really be a separate PR, but we do just-passing-through cleanups like this sometimes because stacking PRs is such a pain.)

Will split!

Rebase on top of master rather than merge. Why? We prefer to edit history in PRs.

This PR is in auto-merge rebase mode, which means Github will cherry pick the lone commit in this branch onto main. The merge commit that exists was generated from Github's UI when I clicked "update branch", but I don't believe it will show up in the history if Github applies this commit in rebase mode.

But okay, I'll avoid the button going forward even so!

@codspeed-hq

codspeed-hq Bot commented Apr 22, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 12.94%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

❌ 1 regressed benchmark
✅ 71 untouched benchmarks
⏩ 129 skipped benchmarks1

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Benchmark BASE HEAD Efficiency
Encode_ASCII_32[TextEncoder][0/0/32] 2.7 ms 3.1 ms -12.94%

Comparing jolio/add-primaryStub (2289287) with main (4028835)2

Open in CodSpeed

Footnotes

  1. 129 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

  2. No successful run was found on jolio/move-config-read-replication (8af12c7) during the generation of this report, so main (4028835) was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@jtolio jtolio force-pushed the jolio/add-primaryStub branch 2 times, most recently from 1d15aff to da3c505 Compare April 22, 2026 18:42
@kentonv

kentonv commented Apr 23, 2026

Copy link
Copy Markdown
Member

(drive-by comment, feel free to ignore)

Arguably this also belongs on ctx (DurableObjectState), not on ctx.storage? The stub isn't really storage...

@justin-mp

Copy link
Copy Markdown
Contributor

(drive-by comment, feel free to ignore)

Arguably this also belongs on ctx (DurableObjectState), not on ctx.storage? The stub isn't really storage...

That's a good point. We put it on ctx.storage because that's where everything replication-related went. If we were to move primaryStub to ctx, should we also move configureReadReplication there too? Read replication is much more closely related to storage though.

X-BranchTarget: jolio/add-primaryStub
@jtolio jtolio force-pushed the jolio/add-primaryStub branch from da3c505 to 2289287 Compare April 23, 2026 21:56
@jtolio jtolio changed the base branch from main to jolio/move-config-read-replication April 23, 2026 21:56
@jtolio jtolio merged commit b90a31e into jolio/move-config-read-replication Apr 23, 2026
16 of 18 checks passed
@jtolio jtolio deleted the jolio/add-primaryStub branch April 23, 2026 21:56
@jtolio jtolio restored the jolio/add-primaryStub branch April 23, 2026 21:57
@jtolio

jtolio commented Apr 23, 2026

Copy link
Copy Markdown
Member Author

ugh! unmerge!

@jtolio jtolio deleted the jolio/add-primaryStub branch April 23, 2026 21:58
@jtolio

jtolio commented Apr 23, 2026

Copy link
Copy Markdown
Member Author

lol, this is what I get for setting auto merge mode on and then changing the target branch to one with less protections. okay

@jtolio

jtolio commented Apr 23, 2026

Copy link
Copy Markdown
Member Author

Okay, sorry, this PR is reopened at #6652

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 6 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (jolio/move-config-read-replication@f86c757). Learn more about missing BASE report.

Files with missing lines Patch % Lines
src/workerd/api/actor-state.c++ 0.00% 6 Missing ⚠️
Additional details and impacted files
@@                          Coverage Diff                          @@
##             jolio/move-config-read-replication    #6605   +/-   ##
=====================================================================
  Coverage                                      ?   66.42%           
=====================================================================
  Files                                         ?      405           
  Lines                                         ?   116112           
  Branches                                      ?    19434           
=====================================================================
  Hits                                          ?    77131           
  Misses                                        ?    27401           
  Partials                                      ?    11580           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

4 participants