Repository navigation
Add WorkerTracer::hasTailStreamWriter() - #8263
Conversation
There was a problem hiding this comment.
Superseded by the review of
9dc7fae8.
This review, of 47d2109a
✅ Approved — Trivial const accessor over an existing member; no issues found.
The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.
✅ All checks passed
📋 Code Quality: ✅ LGTM
WorkerTracer::hasTailStreamWriter() is a const accessor over maybeTailStreamWriter and is placed in the public section. No issues.
Reviewed commit: 47d2109a
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8263 +/- ##
=======================================
Coverage 65.28% 65.28%
=======================================
Files 758 758
Lines 191103 191103
Branches 30169 30169
=======================================
+ Hits 124760 124762 +2
Misses 48809 48809
+ Partials 17534 17532 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
47d2109 to
9dc7fae
Compare
There was a problem hiding this comment.
Superseded by the review of
e92a0d18.
This review, of 9dc7fae8
✅ Approved — Trivial const accessor over an existing member; no issues found.
The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.
✅ All checks passed
📋 Code Quality: ✅ LGTM
WorkerTracer::hasTailStreamWriter() is a const accessor over maybeTailStreamWriter and is placed in the public section. No issues.
Reviewed commit: 9dc7fae8 — same changes as 47d2109a, so this is that commit's review (no new review was run; line numbers are as of 47d2109a)
9dc7fae to
e92a0d1
Compare
There was a problem hiding this comment.
Superseded by the review of
735c9a08.
This review, of e92a0d18
💬 Approved with comments — The code changes look correct and are covered by tests. The one remaining point is a developer reference doc that no longer matches the new deferred-linking and cycle-rejection behaviour in the legacy module registry.
Findings: 1 warning
The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.
🔧 Fix with your agent
Paste the following into your coding agent to investigate and fix these issues.
Fix the following code review issues found in pull request #8263.
Before making changes, review each issue and present a brief summary table:
- For each finding, state whether you agree, disagree, or need clarification
- If you disagree (e.g., the fix would require disproportionate changes
for minimal ROI, or the finding is factually incorrect), explain why
- If you need to clarify something before deciding, ask those questions
- Then share your plan for which issues to tackle and in what order
## WARNING (1)
### [Documentation] The legacy module registry reference still says the resolver always returns the module and that a dynamic import always instantiates inline and returns the namespace right away. It does not mention the new `kEvaluating` rejection or the deferred linking.
- **File:** docs/reference/detail/legacy-module-registry.md:295
📝 Documentation: ⚠️ 1 warning
The legacy module registry reference doc no longer matches the new resolve and dynamic-import behaviour.
Recommendation: 📝 Minor Comments
- [WARNING] The legacy module registry reference still says the resolver always returns the module and that a dynamic import always instantiates inline and returns the namespace right away. It does not mention the new
kEvaluatingrejection or the deferred linking. (docs/reference/detail/legacy-module-registry.md:295)
View full review
docs/reference/detail/legacy-module-registry.md still describes the old flow:
- The resolve callback (around line 214) always returns the resolved module's handle.
- The dynamic import path (around lines 291-295) calls
instantiateModuleand returnsmodule->GetModuleNamespace()right away.
With this change, the resolver rejects a module that is still kEvaluating, and a nested dynamic import can defer linking to a microtask and read the namespace only after that work settles. Updating the resolve-callback, dynamic-import and instantiateModule sections would keep the reference accurate.
✅ All other checks passed
🔒 Security: ✅ LGTM
The StdioFile::write fix closes a use-after-free: user code running inside console.log could detach, transfer or shrink the ArrayBuffer being written. The module-linking change replaces a process abort with a JS error. Neither change opens a new trust-boundary or memory-safety problem.
📖 AGENTS.md: ✅ LGTM
No AGENTS.md updates are needed for this change.
📋 Code Quality: ✅ LGTM
Module linking (jsg/modules.c++):
- The new
kEvaluatingguard inresolveModuleCallbackonly fires when a graph is linked while one of its modules is still evaluating. Ordinary static cycles are not affected. - Deferral only happens for a nested import that allows a pending result.
require()and the main module still link synchronously and throw on failure. - The retried link in the microtask rejects the import with the module's own error.
Namespace read (jsg/modules.h): The namespace is read only once the pending promise settles, which is required because an unlinked module has no namespace yet.
Stdio write (worker-fs.c++): StdioFile::write copies the caller's buffer before re-entering JS. The final buffer.size() only reads the view's size field, not the bytes it points to.
Tests: The new tests cover each new path.
⚡ Performance: ✅ LGTM
- The per-write copy in
StdioFile::writeis linear in the write size and small next to theconsole.logcall it guards. - The status check in
resolveModuleCallbackis O(1). - The deferred link path is rare and costs one microtask.
Reviewed commit: e92a0d18
9dc7fae to
735c9a0
Compare
There was a problem hiding this comment.
Superseded by the review of
8fd0a277.
This review, of 735c9a08
✅ Approved — Small, correct const accessor with no issues found.
The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.
✅ All checks passed
📋 Code Quality: ✅ LGTM
hasTailStreamWriter() is a const accessor that compares the kj::Maybe writer member against kj::none. It matches the existing comparison in tracer.c++.
Reviewed commit: 735c9a08
Lets the embedder tell whether an invocation's events are streamed to tail workers, e.g. to start continuous profiling only on invocations that produce a Workers trace.
735c9a0 to
8fd0a27
Compare
There was a problem hiding this comment.
✅ Approved — Small, correct const accessor with no findings.
The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.
✅ All checks passed
📋 Code Quality: ✅ LGTM
hasTailStreamWriter() is a const accessor over the kj::Maybe tail stream writer member. The comparison against kj::none is valid and has no side effects.
Reviewed commit: 8fd0a277
Lets the embedder tell whether an invocation's events are streamed to tail workers, e.g. to start continuous profiling only on invocations that produce a Workers trace.