Skip to content

Comments

Loopback service stubs accept a dynamic version (cohort) parameter#6111

Open
sohpeach wants to merge 1 commit intomainfrom
swallace/loopback-service-binding-cohorts
Open

Loopback service stubs accept a dynamic version (cohort) parameter#6111
sohpeach wants to merge 1 commit intomainfrom
swallace/loopback-service-binding-cohorts

Conversation

@sohpeach
Copy link
Member

@sohpeach sohpeach commented Feb 19, 2026

Similar to props, this allows a worker to call the service stub as a function, passing along the given version information (currently only a cohort string) to the runtime.

workerd's server implementation currently ignores this information, so the test included in this commit is very minimal. We could come up with a better test once we've decided how this information will be exposed to the worker, assuming it also makes sense in the workerd runtime. The internal codebase tests this feature in more depth.

The feature is behind the experimental enable_version_api flag. Usage looks like:
let service = ctx.exports.default({ version: { cohort: "blah" } });

@sohpeach sohpeach requested a review from jp4a50 February 19, 2026 12:54
@sohpeach sohpeach requested review from a team as code owners February 19, 2026 12:54
@sohpeach sohpeach force-pushed the swallace/loopback-service-binding-cohorts branch from 47269b7 to 5e97e28 Compare February 20, 2026 13:35
@github-actions
Copy link

github-actions bot commented Feb 20, 2026

The generated output of @cloudflare/workers-types matches the snapshot in types/generated-snapshot 🎉

@sohpeach sohpeach force-pushed the swallace/loopback-service-binding-cohorts branch from 5e97e28 to 117d265 Compare February 20, 2026 14:27
@codspeed-hq
Copy link

codspeed-hq bot commented Feb 20, 2026

Merging this PR will improve performance by 19.42%

⚡ 1 improved benchmark
✅ 69 untouched benchmarks
⏩ 129 skipped benchmarks1

Performance Changes

Benchmark BASE HEAD Efficiency
jsonResponse[Response] 47.5 µs 39.8 µs +19.42%

Comparing swallace/loopback-service-binding-cohorts (4fa1ce8) with main (8719dcd)

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.

@sohpeach sohpeach force-pushed the swallace/loopback-service-binding-cohorts branch from 117d265 to d5a70e0 Compare February 24, 2026 15:21
@ask-bonk
Copy link
Contributor

ask-bonk bot commented Feb 24, 2026

@sohpeach Bonk workflow was cancelled.

View workflow run · To retry, trigger Bonk again.

Similar to `props`, this allows a worker to call the service stub as a
function, passing along the given version information (currently only a
cohort string) to the runtime.

workerd's server implementation currently ignores this information, so
the test included in this commit is very minimal. We could come up with
a better test once we've decided how this information will be exposed to
the worker, assuming it also makes sense in the workerd runtime. The
internal codebase tests this feature in more depth.

The feature is behind the experimental `enable_version_api` flag. Usage
looks like:
`let service = ctx.exports.default({ version: { cohort: "blah" } });`
@sohpeach sohpeach force-pushed the swallace/loopback-service-binding-cohorts branch from d5a70e0 to 4fa1ce8 Compare February 24, 2026 18:30
@sohpeach
Copy link
Member Author

/bonk review

@ask-bonk
Copy link
Contributor

ask-bonk bot commented Feb 24, 2026

Review posted. Here's a summary of the findings:

Review Summary

I reviewed PR #6152 which adds a dynamic version (cohort) parameter to loopback service stubs.

Findings posted:

  1. [LOW] Unused include -- #include <workerd/io/features.h> in export-loopback.c++ is not used. Likely left over from an earlier iteration.

  2. [LOW] versionRequest silently ignored in server.c++ -- The new parameter is accepted but never read. A // TODO comment would help future readers understand this is intentional (the PR description explains it, but code outlives PR descriptions).

  3. [LOW] Test coverage is minimal -- The test confirms the new API shape doesn't crash, but doesn't verify version propagation. jp4a50's earlier feedback about also passing props and testing undefined appears unaddressed.

Non-issues confirmed:

  • jsg::Optional<kj::Maybe<kj::String>> cohort correctly models the JS undefined | null | string semantics
  • The two-method approach (call vs callWithVersion gated on compat flag) preserves backward compat
  • VersionRequest::clone() is correctly implemented
  • EW_EXPORT_LOOPBACK_ISOLATE_TYPES correctly includes the new struct types
  • TypeScript snapshots match the C++ definitions

Note: I was unable to post inline comments because the remote PR head appears to have been overwritten with a different commit. The overall review comment was posted successfully.


Time for a pun! I tried to review a cohort parameter, but it just kept versioning away from me.

github run

@jasnell
Copy link
Collaborator

jasnell commented Feb 24, 2026

Time for a pun! I tried to review a cohort parameter, but it just kept versioning away from me.

Ha!! Bonk picked up on the dad-jokes skill I added. Love it.

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.

3 participants