Skip to content

IMAGES-1405: Add streaming support to Images binding#1

Closed
ns476 wants to merge 2736 commits intomainfrom
streaming-draw
Closed

IMAGES-1405: Add streaming support to Images binding#1
ns476 wants to merge 2736 commits intomainfrom
streaming-draw

Conversation

@ns476
Copy link
Copy Markdown
Owner

@ns476 ns476 commented Dec 3, 2024

No description provided.

danlapid and others added 29 commits December 9, 2024 14:59
This is already covered through the getClient() call below.
…le Object alarm() method

The runtime passes in this parameter when invoking alarm(); the `retryCount`
property gives a count of the number of previous times the runtime has tried to
run this specific alarm event.

The runtime has been passing this parameter to alarm() calls since it was
originally introduced earlier in the year, in PR#1673, but the parameter
declaration has not yet been added to the worker-types TypeScript declarations.
This commit just updates the TypeScript declarations to include this parameter.
…span

Drop duplicate "connect" user tracing span
heap-allocated to reduce WritableStream's memory footprint when no
abort is pending.
- Update rules_ts
- Remove TODO to enable Bazel worker protocol for transpiling. This is no longer
  supported with TS 5.x.
- Elide npm_package for server tests, this should only be used for actual NPM
  packages. One instance (for type-related tests) remains, but that's more
  difficult to remove cleanly.
…am-type

Add optional AlarmInvocationInfo parameter to Durable Object alarm() method
Currently, `ServiceDesignator` can only resolve to one of a fixed set of objects that already exist, but we want to make it a little bit more dynamic in later commits.
This will allow us to extend it to support connection metadata, which might be different for each binding pointing to the same entrypoint.
This adds `ctx.props` to the `ctx` object given to `WorkerEntrypoint`s. The property receives metadata about the particular service binding over which the entrypoint was invoked.

```
class MyEntrypoint extends WorkerEntrypoint {
  foo() {
    console.log("called by: " + this.ctx.props.caller);
  }
}
```

Service binding declarations in the workerd config may specify what metadata to pass:

```
bindings = [
  ( name = "FOO",
    service = (
      name = "my-service",
      entrypoint = "MyEntrypoint",
      props = (
        json = `{"caller": "my-calling-service"}
      )
    )
  )
]
```

Note that "caller" is just an example. The props can contain anything. Use cases include:
* Authentication of the caller's identity.
* Authorization / permissions (independent of caller identity).
* Specifying a particular resource. For example, if the `WorkerEntrypoint` represents a chat room, `props.roomId` could be the ID of the specific chat room to access.

This allows service bindings to implement a deeper capability-based security model, where bindings point to specific resources with specific permissions, instead of general APIs.

On Cloudflare, only users who have permission to modify your worker will have permission to create a binding containing arbitrary metadata. Meanwhile we will be creating a mechanism by which you can grant a service binding to your worker to someone, but where you specify the metadata. Thus, you can use the metadata to authenticate requests, without the need for any cryptography.
…-stream-memory-opt-2

Moar WritableStream memory optimization
This will be used to better export user tracing spans in a follow-up PR.
…tracing-otel-p0

[nfc] Refactor and add trace span RPC code
…sion

R2-2604: Improve R2 Binding Test Coverage
- Update perfetto, this requires listing an (unused) expat dependency in the
  config file.
- Drop obsolete perfetto patch
- Unconditionally enable optimization on perfetto-tracing.c++, this reduces
  debug binary sizes significantly as perfetto code can be optimized out at
  link time.
…ltiple_typewrappers

Add a test for multiple typewrappers
* Implement tracing::TailStreamWriter
* Add the streaming-tail-workers autogate
* Implement the tail stream rpc interface
* Update type snapshot
Say you have a module-syntax Worker that has no `export default`. You then refer to that worker from elsewhere in the workerd config, but you do not specify an entrypoint. What should happen?

In the midst of other changes, PR cloudflare#3193 turned this into an error, becaues it seemed like obviously it should be. This turns out to have broken Miniflare tests, which often use an empty string as a placeholder Worker that is referenced but never invoked.

So, this PR restores the old behavior.

It turns out, incidentally, that the old behavior is crazier than you'd imagine. See the comments in the test case for details.
…ng-default-entrypoint

Undo tightening of rules around default entrypoints in cloudflare#3193.
fhanau and others added 12 commits January 28, 2025 21:39
…sing a PR

- GitHub warns about an outdated dependency (idna Rust crate) being vulnerable.
  This is only used as a transitive dependency in a sample however – update
  Rust deps for the sample to fix this.
- The CLA check CI job ran when closing a PR so far, leading to a confusing
  comment when closing a PR that would not pass the CLA job even though the
  point of CLA passing is now moot. Accordingly, we should only run the CLA when
  opening or synchronizing a PR.
Historically, this did not cause a config-time error, only a runtime error. Probably nobody depends on this bug, but I'd prefer not to have to roll back this change if I'm wrong, so I'll maintain the behavior for now.
…mpl promise

@kenton suggested adding this line to fix the issues we were finding
with the containers integration.
This interface evolved from early beginnings where we didn't really know where we were going, and as a result was quite warty in the way that it reported entrypoints:
* It would report each _method_ of stateless entrypoints with a separate call, rather than reporting the whole entrypoint at once. All of the implementations had to group these back into entrypoints using HashMaps.
* It reported a Durable Object class as if it were an entrypoint with a single method called "class". This sort of made sense back when there was a fixed list of handler names, but the introduction of RPC made this very weird.

Evidence of why this was a bad interface can be seen in the previous commit, which introduces tests for three different bugs that I discovered just while refactoring this interface.

In any case, this changes the interface to just make sense.
kentonv and others added 12 commits January 30, 2025 12:13
Containers: wait for up/down streams to finish resolving the connectImpl promise
The Bazel 8 update is currently blocked on a TypeScript build issue, so let's
update to the latest maintenance release instead. This includes a few remote
cache bug fixes, so we enable Build Without The Bytes for Windows again
(disabling effectively only applied to release CI runs, for tests this gets
overwritten by the ci-test configuration).
Also update the development documentation since we're here – the section on code
formatting was outdated and suggested setup steps that are no longer needed.
To detect the main worker having a self loop, we need to compare the current
WorkerService with the WorkerService corresponding to the tail worker. If
service refers to an EntrypointService, that means we have to compare to the
underlying worker instead.
…lidation

Refactor: Make ValidationErrorReporter interface better.
* Roll V8 to 13.3

* Try to get highway bindings right

* Update abseil, zlib and icu to match V8 13.3.

* Improve compatibility with V8 13.3 (cloudflare#3440)

- Adjust isolate group creation to allow building with and without shared
  pointer cage
- Update V8 defines in compile_flags.txt based on bazel aquery output –
  we currently build V8 without perfetto support. Ideally we'd have an
  external, auto-generated file with the set of definitions that matter for
  embedders, but for now this needs to be maintained manually.
- Fix some of the deprecation warnings from V8 13.3.
- Change comment on updating Chromium zlib, this is more of a chore than a
  necessity.

* Fix V8 macOS build

---------

Co-authored-by: Felix Hanau <felix@cloudflare.com>
Fixes "promise will never complete" when exceeding memory.
To help debug the problem where queue consumer isolates can time out
unexpectedly.
Adds `@cf/deepseek-ai/deepseek-r1-distill-qwen-32b` and `@cf/unum/uform-gen2-qwen-500m` to types.
@ns476 ns476 changed the base branch from ns476/draw to main February 4, 2025 13:50
@ns476 ns476 closed this Feb 4, 2025
@ns476 ns476 deleted the streaming-draw branch February 4, 2025 13:51
@ns476 ns476 restored the streaming-draw branch February 4, 2025 13:51
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.