Skip to content

One scheduler tier for cancellation, push notifications, and background work #444

Description

@Firehed

What is missing

The server handles one message at a time and only ever replies. Three behaviours need more than that:

The one extension point

Built one at a time, these become three scheduling paths and three ways to write to the client. That is feature × mechanism, the M×N shape this project forbids.

There is one scheduler, in the transport and dispatch tier, and it is the only place that:

  • runs a unit of work and can cancel it (every unit carries a cancellation token);
  • decides when a server-initiated message is sent (debounce, ordering);
  • writes to the client, through the existing ClientConnection and OutgoingMessage channel.

A feature adds a job kind or a notification value. It never adds a loop, a timer, a fork, or a write to the transport. A change that does is rejected in review.

Constraints (RFC 1 §6)

  • The resolution interior stays synchronous and correct without the scheduler.
  • pcntl and ext-parallel are feature-detected with a synchronous fallback; Fibers and FFI may be relied on.
  • Background results re-enter symbol state through SymbolSink only.
  • When the rule freeze lifts (build manifest, last step), a deny entry confines TransportInterface::write() to the Client tier so a second output path cannot appear. The tier and its rule land together.

Acceptance

  • A superseded request is abandoned and answered with RequestCancelled.
  • A debounced notification reaches the client through ClientConnection; no other class writes to the transport.
  • A background job cannot starve an interactive request, and can be cancelled.

When

After the last step of docs/architecture/build-manifest.md lands, and only when the first push feature (#266) is scheduled.


This issue body was written by AI and has not been reviewed line by line by a human.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions